summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/Makefile.am36
-rw-r--r--mysql-test/README7
-rwxr-xr-xmysql-test/create-test-result5
-rw-r--r--mysql-test/include/ctype_common.inc58
-rw-r--r--mysql-test/include/endspace.inc7
-rw-r--r--mysql-test/include/have_archive.inc4
-rw-r--r--mysql-test/include/have_big5.inc4
-rw-r--r--mysql-test/include/have_compress.inc4
-rw-r--r--mysql-test/include/have_csv.inc4
-rw-r--r--mysql-test/include/have_debug.inc4
-rw-r--r--mysql-test/include/have_exampledb.inc4
-rw-r--r--mysql-test/include/have_geometry.inc4
-rw-r--r--mysql-test/include/have_ndb.inc7
-rw-r--r--mysql-test/include/have_query_cache.inc3
-rw-r--r--mysql-test/include/have_sjis.inc4
-rw-r--r--mysql-test/include/have_tis620.inc4
-rw-r--r--mysql-test/include/have_ucs2.inc4
-rw-r--r--mysql-test/include/have_ujis.inc4
-rw-r--r--mysql-test/include/master-slave.inc13
-rw-r--r--mysql-test/include/not_embedded.inc2
-rw-r--r--mysql-test/include/ps_conv.inc1204
-rw-r--r--mysql-test/include/ps_create.inc43
-rw-r--r--mysql-test/include/ps_modify.inc360
-rw-r--r--mysql-test/include/ps_modify1.inc105
-rw-r--r--mysql-test/include/ps_query.inc773
-rw-r--r--mysql-test/include/ps_renew.inc35
-rw-r--r--mysql-test/init_db.sql58
-rw-r--r--mysql-test/install_test_db.sh222
-rw-r--r--mysql-test/misc/kill_master.sh4
-rw-r--r--mysql-test/my_create_tables.c646
-rw-r--r--mysql-test/my_manage.c876
-rw-r--r--mysql-test/my_manage.h137
-rw-r--r--mysql-test/mysql-test-run.sh566
-rw-r--r--mysql-test/mysql_test_run_new.c1779
-rw-r--r--mysql-test/ndb/Makefile.am25
-rw-r--r--mysql-test/ndb/basic.result69
-rw-r--r--mysql-test/ndb/basic.test17
-rw-r--r--mysql-test/ndb/basic_log.result (renamed from mysql-test/t/README)0
-rw-r--r--mysql-test/ndb/ndb_config_2_node.ini30
-rw-r--r--mysql-test/ndb/ndb_range_bounds.pl138
-rw-r--r--mysql-test/ndb/ndbcluster.sh342
-rw-r--r--mysql-test/ndb/restart.result16
-rw-r--r--mysql-test/ndb/restart.test12
-rw-r--r--mysql-test/ndb/restart_log.result20
-rw-r--r--mysql-test/r/alias.result2
-rw-r--r--mysql-test/r/alter_table.result135
-rw-r--r--mysql-test/r/alter_table.result.es483
-rw-r--r--mysql-test/r/analyse.result102
-rw-r--r--mysql-test/r/ansi.result11
-rw-r--r--mysql-test/r/archive.result2604
-rw-r--r--mysql-test/r/auto_increment.result214
-rw-r--r--mysql-test/r/backup.result1
-rw-r--r--mysql-test/r/bdb-alter-table-1.result2
-rw-r--r--mysql-test/r/bdb-crash.result2
-rw-r--r--mysql-test/r/bdb-deadlock.result6
-rw-r--r--mysql-test/r/bdb.result224
-rw-r--r--mysql-test/r/bdb_cache.result11
-rw-r--r--mysql-test/r/bench_count_distinct.result5
-rw-r--r--mysql-test/r/bigint.result12
-rw-r--r--mysql-test/r/binary.result89
-rw-r--r--mysql-test/r/bool.result14
-rw-r--r--mysql-test/r/case.result83
-rw-r--r--mysql-test/r/cast.result149
-rw-r--r--mysql-test/r/comments.result2
-rw-r--r--mysql-test/r/compare.result28
-rw-r--r--mysql-test/r/connect.result67
-rw-r--r--mysql-test/r/consistent_snapshot.result15
-rw-r--r--mysql-test/r/constraints.result13
-rw-r--r--mysql-test/r/convert.result17
-rw-r--r--mysql-test/r/count_distinct3.result8
-rw-r--r--mysql-test/r/create.result434
-rw-r--r--mysql-test/r/create_select_tmp.result24
-rw-r--r--mysql-test/r/csv.result4931
-rw-r--r--mysql-test/r/ctype_big5.result58
-rw-r--r--mysql-test/r/ctype_collate.result584
-rw-r--r--mysql-test/r/ctype_cp1251.result32
-rw-r--r--mysql-test/r/ctype_create.result74
-rw-r--r--mysql-test/r/ctype_latin1.result307
-rw-r--r--mysql-test/r/ctype_latin1_de.result47
-rw-r--r--mysql-test/r/ctype_many.result1685
-rw-r--r--mysql-test/r/ctype_mb.result57
-rw-r--r--mysql-test/r/ctype_recoding.result242
-rw-r--r--mysql-test/r/ctype_sjis.result73
-rw-r--r--mysql-test/r/ctype_tis620.result2923
-rw-r--r--mysql-test/r/ctype_uca.result2388
-rw-r--r--mysql-test/r/ctype_ucs.result594
-rw-r--r--mysql-test/r/ctype_ujis.result2203
-rw-r--r--mysql-test/r/ctype_utf8.result819
-rw-r--r--mysql-test/r/date_formats.result458
-rw-r--r--mysql-test/r/delayed.result8
-rw-r--r--mysql-test/r/delete.result114
-rw-r--r--mysql-test/r/derived.result332
-rw-r--r--mysql-test/r/distinct.result112
-rw-r--r--mysql-test/r/drop.result19
-rw-r--r--mysql-test/r/drop_temp_table.result10
-rw-r--r--mysql-test/r/drop_temp_table.result.es12
-rw-r--r--mysql-test/r/endspace.result217
-rw-r--r--mysql-test/r/errors.result20
-rw-r--r--mysql-test/r/exampledb.result6
-rw-r--r--mysql-test/r/explain.result49
-rw-r--r--mysql-test/r/flush.result5
-rw-r--r--mysql-test/r/flush_block_commit.result10
-rw-r--r--mysql-test/r/flush_table.result10
-rw-r--r--mysql-test/r/fulltext.result158
-rw-r--r--mysql-test/r/fulltext2.result217
-rw-r--r--mysql-test/r/fulltext_cache.result36
-rw-r--r--mysql-test/r/fulltext_distinct.result4
-rw-r--r--mysql-test/r/fulltext_left_join.result16
-rw-r--r--mysql-test/r/fulltext_multi.result30
-rw-r--r--mysql-test/r/fulltext_order_by.result54
-rw-r--r--mysql-test/r/fulltext_var.result35
-rw-r--r--mysql-test/r/func_compress.result74
-rw-r--r--mysql-test/r/func_concat.result42
-rw-r--r--mysql-test/r/func_crypt.result91
-rw-r--r--mysql-test/r/func_date_add.result22
-rw-r--r--mysql-test/r/func_default.result18
-rw-r--r--mysql-test/r/func_encrypt.result5
-rw-r--r--mysql-test/r/func_equal.result2
-rw-r--r--mysql-test/r/func_gconcat.result459
-rw-r--r--mysql-test/r/func_group.result542
-rw-r--r--mysql-test/r/func_if.result21
-rw-r--r--mysql-test/r/func_in.result161
-rw-r--r--mysql-test/r/func_like.result120
-rw-r--r--mysql-test/r/func_math.result67
-rw-r--r--mysql-test/r/func_misc.result18
-rw-r--r--mysql-test/r/func_op.result10
-rw-r--r--mysql-test/r/func_regexp.result46
-rw-r--r--mysql-test/r/func_sapdb.result221
-rw-r--r--mysql-test/r/func_set.result30
-rw-r--r--mysql-test/r/func_str.result424
-rw-r--r--mysql-test/r/func_system.result70
-rw-r--r--mysql-test/r/func_test.result117
-rw-r--r--mysql-test/r/func_time.result138
-rw-r--r--mysql-test/r/gcc296.result16
-rw-r--r--mysql-test/r/gis-rtree.result806
-rw-r--r--mysql-test/r/gis.result657
-rw-r--r--mysql-test/r/grant.result211
-rw-r--r--mysql-test/r/grant2.result54
-rw-r--r--mysql-test/r/grant_cache.result30
-rw-r--r--mysql-test/r/group_by.result88
-rw-r--r--mysql-test/r/handler.result86
-rw-r--r--mysql-test/r/have_archive.require2
-rw-r--r--mysql-test/r/have_big5.require2
-rw-r--r--mysql-test/r/have_compress.require2
-rw-r--r--mysql-test/r/have_csv.require2
-rw-r--r--mysql-test/r/have_debug.require2
-rw-r--r--mysql-test/r/have_exampledb.require2
-rw-r--r--mysql-test/r/have_geometry.require2
-rw-r--r--mysql-test/r/have_ndb.require2
-rw-r--r--mysql-test/r/have_openssl_1.require2
-rw-r--r--mysql-test/r/have_sjis.require2
-rw-r--r--mysql-test/r/have_tis620.require2
-rw-r--r--mysql-test/r/have_ucs2.require2
-rw-r--r--mysql-test/r/have_ujis.require2
-rw-r--r--mysql-test/r/having.result16
-rw-r--r--mysql-test/r/heap.result93
-rw-r--r--mysql-test/r/heap_auto_increment.result41
-rw-r--r--mysql-test/r/heap_btree.result248
-rw-r--r--mysql-test/r/heap_hash.result357
-rw-r--r--mysql-test/r/help.result243
-rw-r--r--mysql-test/r/init_connect.result24
-rw-r--r--mysql-test/r/innodb-deadlock.result80
-rw-r--r--mysql-test/r/innodb.result583
-rw-r--r--mysql-test/r/innodb.result.es1653
-rw-r--r--mysql-test/r/innodb_cache.result28
-rw-r--r--mysql-test/r/innodb_handler.result16
-rw-r--r--mysql-test/r/insert.result243
-rw-r--r--mysql-test/r/insert_select.result28
-rw-r--r--mysql-test/r/insert_select.result.es635
-rw-r--r--mysql-test/r/insert_update.result169
-rw-r--r--mysql-test/r/isam.result38
-rw-r--r--mysql-test/r/join.result36
-rw-r--r--mysql-test/r/join_crash.result8
-rw-r--r--mysql-test/r/join_outer.result216
-rw-r--r--mysql-test/r/key.result160
-rw-r--r--mysql-test/r/key_cache.result289
-rw-r--r--mysql-test/r/key_diff.result6
-rw-r--r--mysql-test/r/key_primary.result8
-rw-r--r--mysql-test/r/keywords.result2
-rw-r--r--mysql-test/r/loaddata.result22
-rw-r--r--mysql-test/r/lock.result12
-rw-r--r--mysql-test/r/lock_multi.result2
-rw-r--r--mysql-test/r/lock_tables_lost_commit.result2
-rw-r--r--mysql-test/r/lowercase_table.result31
-rw-r--r--mysql-test/r/lowercase_table2.result4
-rw-r--r--mysql-test/r/lowercase_table3.result4
-rw-r--r--mysql-test/r/lowercase_table_qcache.result24
-rw-r--r--mysql-test/r/merge.result177
-rw-r--r--mysql-test/r/metadata.result62
-rw-r--r--mysql-test/r/mix_innodb_myisam_binlog.result111
-rw-r--r--mysql-test/r/multi_statement.result33
-rw-r--r--mysql-test/r/multi_update.result124
-rw-r--r--mysql-test/r/myisam-blob.result17
-rw-r--r--mysql-test/r/myisam-blob.result.es59
-rw-r--r--mysql-test/r/myisam.result199
-rw-r--r--mysql-test/r/mysql_protocols.result9
-rw-r--r--mysql-test/r/mysqlbinlog.result11
-rw-r--r--mysql-test/r/mysqlbinlog2.result446
-rw-r--r--mysql-test/r/mysqldump.result475
-rw-r--r--mysql-test/r/mysqltest.result144
-rw-r--r--mysql-test/r/ndb_alter_table.result172
-rw-r--r--mysql-test/r/ndb_autodiscover.result370
-rw-r--r--mysql-test/r/ndb_autodiscover2.result13
-rw-r--r--mysql-test/r/ndb_basic.result575
-rw-r--r--mysql-test/r/ndb_blob.result487
-rw-r--r--mysql-test/r/ndb_cache.result43
-rw-r--r--mysql-test/r/ndb_charset.result201
-rw-r--r--mysql-test/r/ndb_grant.result416
-rw-r--r--mysql-test/r/ndb_index.result154
-rw-r--r--mysql-test/r/ndb_index_ordered.result312
-rw-r--r--mysql-test/r/ndb_index_unique.result614
-rw-r--r--mysql-test/r/ndb_insert.result607
-rw-r--r--mysql-test/r/ndb_limit.result72
-rw-r--r--mysql-test/r/ndb_lock.result65
-rw-r--r--mysql-test/r/ndb_minmax.result120
-rw-r--r--mysql-test/r/ndb_replace.result21
-rw-r--r--mysql-test/r/ndb_subquery.result42
-rw-r--r--mysql-test/r/ndb_transaction.result257
-rw-r--r--mysql-test/r/ndb_truncate.result14
-rw-r--r--mysql-test/r/ndb_types.result36
-rw-r--r--mysql-test/r/ndb_update.result13
-rw-r--r--mysql-test/r/negation_elimination.result391
-rw-r--r--mysql-test/r/null.result201
-rw-r--r--mysql-test/r/null_key.result225
-rw-r--r--mysql-test/r/odbc.result6
-rw-r--r--mysql-test/r/olap.result336
-rw-r--r--mysql-test/r/openssl_1.result14
-rw-r--r--mysql-test/r/openssl_2.result25
-rw-r--r--mysql-test/r/order_by.result315
-rw-r--r--mysql-test/r/outfile.result10
-rw-r--r--mysql-test/r/packet.result4
-rw-r--r--mysql-test/r/packet.result.es26
-rw-r--r--mysql-test/r/preload.result167
-rw-r--r--mysql-test/r/ps.result484
-rw-r--r--mysql-test/r/ps_10nestset.result76
-rw-r--r--mysql-test/r/ps_11bugs.result118
-rw-r--r--mysql-test/r/ps_1general.result886
-rw-r--r--mysql-test/r/ps_2myisam.result3133
-rw-r--r--mysql-test/r/ps_3innodb.result3116
-rw-r--r--mysql-test/r/ps_4heap.result3117
-rw-r--r--mysql-test/r/ps_5merge.result6064
-rw-r--r--mysql-test/r/ps_6bdb.result3116
-rw-r--r--mysql-test/r/ps_7ndb.result3116
-rw-r--r--mysql-test/r/query_cache.result225
-rw-r--r--mysql-test/r/query_cache.result.es925
-rw-r--r--mysql-test/r/raid.result22
-rw-r--r--mysql-test/r/range.result342
-rw-r--r--mysql-test/r/rename.result17
-rw-r--r--mysql-test/r/repair.result30
-rw-r--r--mysql-test/r/repair_part2.result8
-rw-r--r--mysql-test/r/replace.result16
-rw-r--r--mysql-test/r/rollback.result21
-rw-r--r--mysql-test/r/row.result172
-rw-r--r--mysql-test/r/rpl000001.result35
-rw-r--r--mysql-test/r/rpl000002.result28
-rw-r--r--mysql-test/r/rpl000003.result17
-rw-r--r--mysql-test/r/rpl000004.result9
-rw-r--r--mysql-test/r/rpl000005.result5
-rw-r--r--mysql-test/r/rpl000006.result8
-rw-r--r--mysql-test/r/rpl000008.result32
-rw-r--r--mysql-test/r/rpl000009.result173
-rw-r--r--mysql-test/r/rpl000010.result6
-rw-r--r--mysql-test/r/rpl000011.result9
-rw-r--r--mysql-test/r/rpl000012.result14
-rw-r--r--mysql-test/r/rpl000013.result7
-rw-r--r--mysql-test/r/rpl000015.result20
-rw-r--r--mysql-test/r/rpl000017.result2
-rw-r--r--mysql-test/r/rpl000018.result8
-rw-r--r--mysql-test/r/rpl_EE_error.result10
-rw-r--r--mysql-test/r/rpl_alter.result26
-rw-r--r--mysql-test/r/rpl_change_master.result12
-rw-r--r--mysql-test/r/rpl_charset.result209
-rw-r--r--mysql-test/r/rpl_commit_after_flush.result6
-rw-r--r--mysql-test/r/rpl_create_database.result83
-rw-r--r--mysql-test/r/rpl_delete_all.result31
-rw-r--r--mysql-test/r/rpl_do_grant.result20
-rw-r--r--mysql-test/r/rpl_drop.result6
-rw-r--r--mysql-test/r/rpl_empty_master_crash.result11
-rw-r--r--mysql-test/r/rpl_error_ignored_table.result29
-rw-r--r--mysql-test/r/rpl_failed_optimize.result15
-rw-r--r--mysql-test/r/rpl_failsafe.result8
-rw-r--r--mysql-test/r/rpl_flush_log_loop.result14
-rw-r--r--mysql-test/r/rpl_flush_tables.result40
-rw-r--r--mysql-test/r/rpl_free_items.result4
-rw-r--r--mysql-test/r/rpl_get_lock.result15
-rw-r--r--mysql-test/r/rpl_ignore_grant.result30
-rw-r--r--mysql-test/r/rpl_init_slave.result24
-rw-r--r--mysql-test/r/rpl_insert_id.result9
-rw-r--r--mysql-test/r/rpl_insert_ignore.result70
-rw-r--r--mysql-test/r/rpl_loaddata.result26
-rw-r--r--mysql-test/r/rpl_loaddata_rule_m.result15
-rw-r--r--mysql-test/r/rpl_loaddata_rule_s.result4
-rw-r--r--mysql-test/r/rpl_loaddatalocal.result4
-rw-r--r--mysql-test/r/rpl_log.result124
-rw-r--r--mysql-test/r/rpl_log_pos.result44
-rw-r--r--mysql-test/r/rpl_master_pos_wait.result9
-rw-r--r--mysql-test/r/rpl_max_relay_size.result32
-rw-r--r--mysql-test/r/rpl_misc_functions.result21
-rw-r--r--mysql-test/r/rpl_multi_delete.result4
-rw-r--r--mysql-test/r/rpl_multi_delete2.result8
-rw-r--r--mysql-test/r/rpl_multi_update.result9
-rw-r--r--mysql-test/r/rpl_mystery22.result10
-rw-r--r--mysql-test/r/rpl_openssl.result30
-rw-r--r--mysql-test/r/rpl_optimize.result4
-rw-r--r--mysql-test/r/rpl_ps.result28
-rw-r--r--mysql-test/r/rpl_redirect.result7
-rw-r--r--mysql-test/r/rpl_relayrotate.result19
-rw-r--r--mysql-test/r/rpl_relayspace.result4
-rw-r--r--mysql-test/r/rpl_replicate_do.result11
-rw-r--r--mysql-test/r/rpl_reset_slave.result20
-rw-r--r--mysql-test/r/rpl_rewrite_db.result92
-rw-r--r--mysql-test/r/rpl_rotate_logs.result58
-rw-r--r--mysql-test/r/rpl_server_id1.result14
-rw-r--r--mysql-test/r/rpl_server_id2.result8
-rw-r--r--mysql-test/r/rpl_set_charset.result7
-rw-r--r--mysql-test/r/rpl_skip_error.result5
-rw-r--r--mysql-test/r/rpl_sporadic_master.result8
-rw-r--r--mysql-test/r/rpl_start_stop_slave.result4
-rw-r--r--mysql-test/r/rpl_temporary.result91
-rw-r--r--mysql-test/r/rpl_timezone.result77
-rw-r--r--mysql-test/r/rpl_trunc_binlog.result8
-rw-r--r--mysql-test/r/rpl_until.result72
-rw-r--r--mysql-test/r/rpl_user_variables.result109
-rw-r--r--mysql-test/r/sel000001.result21
-rw-r--r--mysql-test/r/sel000002.result9
-rw-r--r--mysql-test/r/sel000003.result8
-rw-r--r--mysql-test/r/sel000031.result12
-rw-r--r--mysql-test/r/sel000032.result12
-rw-r--r--mysql-test/r/sel000033.result14
-rw-r--r--mysql-test/r/sel000100.result38
-rw-r--r--mysql-test/r/select.result259
-rw-r--r--mysql-test/r/select.result.es2389
-rw-r--r--mysql-test/r/select_found.result29
-rw-r--r--mysql-test/r/select_safe.result32
-rw-r--r--mysql-test/r/show_check.result208
-rw-r--r--mysql-test/r/sql_mode.result140
-rw-r--r--mysql-test/r/status.result2
-rw-r--r--mysql-test/r/subselect.result2127
-rw-r--r--mysql-test/r/subselect2.result131
-rw-r--r--mysql-test/r/subselect_gis.result8
-rw-r--r--mysql-test/r/subselect_innodb.result142
-rw-r--r--mysql-test/r/symlink.result12
-rw-r--r--mysql-test/r/synchronization.result162
-rw-r--r--mysql-test/r/system_mysql_db.result167
-rw-r--r--mysql-test/r/temp_table.result14
-rw-r--r--mysql-test/r/timezone.result11
-rw-r--r--mysql-test/r/timezone2.result305
-rw-r--r--mysql-test/r/timezone3.result4
-rw-r--r--mysql-test/r/truncate.result4
-rw-r--r--mysql-test/r/type_blob.result113
-rw-r--r--mysql-test/r/type_blob.result.es692
-rw-r--r--mysql-test/r/type_date.result4
-rw-r--r--mysql-test/r/type_datetime.result75
-rw-r--r--mysql-test/r/type_decimal.result89
-rw-r--r--mysql-test/r/type_enum.result103
-rw-r--r--mysql-test/r/type_float.result67
-rw-r--r--mysql-test/r/type_float.result.es145
-rw-r--r--mysql-test/r/type_nchar.result50
-rw-r--r--mysql-test/r/type_ranges.result213
-rw-r--r--mysql-test/r/type_ranges.result.es320
-rw-r--r--mysql-test/r/type_set.result39
-rw-r--r--mysql-test/r/type_time.result6
-rw-r--r--mysql-test/r/type_timestamp.result429
-rw-r--r--mysql-test/r/type_uint.result5
-rw-r--r--mysql-test/r/type_year.result2
-rw-r--r--mysql-test/r/union.result775
-rw-r--r--mysql-test/r/update.result19
-rw-r--r--mysql-test/r/user_var.result92
-rw-r--r--mysql-test/r/varbinary.result14
-rw-r--r--mysql-test/r/variables.result191
-rw-r--r--mysql-test/r/warnings.result127
-rw-r--r--mysql-test/std_data/init_file.dat2
-rw-r--r--mysql-test/std_data/master-bin.000001 (renamed from mysql-test/std_data/master-bin.001)bin98 -> 98 bytes
-rw-r--r--mysql-test/std_data/trunc_binlog.000001 (renamed from mysql-test/std_data/trunc_binlog.001)bin119 -> 119 bytes
-rw-r--r--mysql-test/std_data/warnings_loaddata.dat8
-rw-r--r--mysql-test/t/alias.test5
-rw-r--r--mysql-test/t/alter_table.test100
-rw-r--r--mysql-test/t/analyse.test27
-rw-r--r--mysql-test/t/ansi-master.opt1
-rw-r--r--mysql-test/t/ansi.test9
-rw-r--r--mysql-test/t/archive.test1302
-rw-r--r--mysql-test/t/auto_increment.test123
-rw-r--r--mysql-test/t/backup.test3
-rw-r--r--mysql-test/t/bdb-alter-table-1.test5
-rw-r--r--mysql-test/t/bdb-crash.test7
-rw-r--r--mysql-test/t/bdb-deadlock.test17
-rw-r--r--mysql-test/t/bdb-deadlock.tminus57
-rw-r--r--mysql-test/t/bdb.test181
-rw-r--r--mysql-test/t/bdb_cache.test15
-rw-r--r--mysql-test/t/bench_count_distinct.test7
-rw-r--r--mysql-test/t/bigint.test12
-rw-r--r--mysql-test/t/binary.test43
-rw-r--r--mysql-test/t/bool.test15
-rw-r--r--mysql-test/t/bulk_replace.test5
-rw-r--r--mysql-test/t/case.test68
-rw-r--r--mysql-test/t/cast.test88
-rw-r--r--mysql-test/t/check.test5
-rw-r--r--mysql-test/t/client_test.test2
-rw-r--r--mysql-test/t/comments.test3
-rw-r--r--mysql-test/t/compare.test20
-rw-r--r--mysql-test/t/connect.test75
-rw-r--r--mysql-test/t/consistent_snapshot.test41
-rw-r--r--mysql-test/t/constraints.test8
-rw-r--r--mysql-test/t/convert.test11
-rw-r--r--mysql-test/t/count_distinct.test3
-rw-r--r--mysql-test/t/count_distinct2.test2
-rw-r--r--mysql-test/t/count_distinct3.test58
-rw-r--r--mysql-test/t/create.test294
-rw-r--r--mysql-test/t/create_select_tmp.test10
-rw-r--r--mysql-test/t/csv.test1315
-rw-r--r--mysql-test/t/ctype_big5.test12
-rw-r--r--mysql-test/t/ctype_collate.test196
-rw-r--r--mysql-test/t/ctype_cp1251.test17
-rw-r--r--mysql-test/t/ctype_create.test100
-rw-r--r--mysql-test/t/ctype_latin1.test62
-rw-r--r--mysql-test/t/ctype_latin1_de-master.opt3
-rw-r--r--mysql-test/t/ctype_latin1_de.test40
-rw-r--r--mysql-test/t/ctype_many.test211
-rw-r--r--mysql-test/t/ctype_mb.test26
-rw-r--r--mysql-test/t/ctype_recoding.test181
-rw-r--r--mysql-test/t/ctype_sjis.test64
-rw-r--r--mysql-test/t/ctype_tis620-master.opt1
-rw-r--r--mysql-test/t/ctype_tis620.test132
-rw-r--r--mysql-test/t/ctype_uca.test454
-rw-r--r--mysql-test/t/ctype_ucs.test386
-rw-r--r--mysql-test/t/ctype_ujis-master.opt1
-rw-r--r--mysql-test/t/ctype_ujis.test1132
-rw-r--r--mysql-test/t/ctype_utf8.test668
-rw-r--r--mysql-test/t/date_formats-master.opt1
-rw-r--r--mysql-test/t/date_formats.test261
-rw-r--r--mysql-test/t/delayed.test4
-rw-r--r--mysql-test/t/delete.test84
-rw-r--r--mysql-test/t/derived.test216
-rw-r--r--mysql-test/t/dirty_close.test4
-rw-r--r--mysql-test/t/distinct.test62
-rw-r--r--mysql-test/t/drop.test18
-rw-r--r--mysql-test/t/empty_table.test3
-rw-r--r--mysql-test/t/endspace.test96
-rw-r--r--mysql-test/t/errors.test7
-rw-r--r--mysql-test/t/exampledb.test16
-rw-r--r--mysql-test/t/explain.test13
-rw-r--r--mysql-test/t/flush.test6
-rw-r--r--mysql-test/t/flush_block_commit.test13
-rw-r--r--mysql-test/t/flush_table.test8
-rw-r--r--mysql-test/t/foreign_key.test3
-rw-r--r--mysql-test/t/fulltext.test87
-rw-r--r--mysql-test/t/fulltext2.test184
-rw-r--r--mysql-test/t/fulltext_cache.test7
-rw-r--r--mysql-test/t/fulltext_distinct.test7
-rw-r--r--mysql-test/t/fulltext_left_join.test9
-rw-r--r--mysql-test/t/fulltext_multi.test10
-rw-r--r--mysql-test/t/fulltext_order_by.test15
-rw-r--r--mysql-test/t/fulltext_update.test2
-rw-r--r--mysql-test/t/fulltext_var.test22
-rw-r--r--mysql-test/t/func_compress.test47
-rw-r--r--mysql-test/t/func_concat.test28
-rw-r--r--mysql-test/t/func_crypt.test43
-rw-r--r--mysql-test/t/func_date_add.test5
-rw-r--r--mysql-test/t/func_default.test19
-rw-r--r--mysql-test/t/func_encrypt.test5
-rw-r--r--mysql-test/t/func_equal.test6
-rw-r--r--mysql-test/t/func_gconcat.test279
-rw-r--r--mysql-test/t/func_group.test326
-rw-r--r--mysql-test/t/func_if.test11
-rw-r--r--mysql-test/t/func_in.test80
-rw-r--r--mysql-test/t/func_isnull.test3
-rw-r--r--mysql-test/t/func_like.test69
-rw-r--r--mysql-test/t/func_math.test21
-rw-r--r--mysql-test/t/func_misc.test8
-rw-r--r--mysql-test/t/func_op.test2
-rw-r--r--mysql-test/t/func_regexp.test31
-rw-r--r--mysql-test/t/func_sapdb.test121
-rw-r--r--mysql-test/t/func_set.test28
-rw-r--r--mysql-test/t/func_str.test270
-rw-r--r--mysql-test/t/func_system.test28
-rw-r--r--mysql-test/t/func_test.test75
-rw-r--r--mysql-test/t/func_time.test73
-rw-r--r--mysql-test/t/func_timestamp.test3
-rw-r--r--mysql-test/t/gcc296.test19
-rw-r--r--mysql-test/t/gis-rtree.test174
-rw-r--r--mysql-test/t/gis.test361
-rw-r--r--mysql-test/t/grant.test178
-rw-r--r--mysql-test/t/grant2.test71
-rw-r--r--mysql-test/t/grant_cache.test27
-rw-r--r--mysql-test/t/group_by.test32
-rw-r--r--mysql-test/t/handler.test41
-rw-r--r--mysql-test/t/having.test16
-rw-r--r--mysql-test/t/heap.test65
-rw-r--r--mysql-test/t/heap_auto_increment.test33
-rw-r--r--mysql-test/t/heap_btree.test165
-rw-r--r--mysql-test/t/heap_hash.test253
-rw-r--r--mysql-test/t/help.test115
-rw-r--r--mysql-test/t/init_connect-master.opt1
-rw-r--r--mysql-test/t/init_connect.test34
-rw-r--r--mysql-test/t/innodb-deadlock.test79
-rw-r--r--mysql-test/t/innodb-master.opt1
-rw-r--r--mysql-test/t/innodb.test432
-rw-r--r--mysql-test/t/innodb_cache.test24
-rw-r--r--mysql-test/t/innodb_handler.test11
-rw-r--r--mysql-test/t/insert.test70
-rw-r--r--mysql-test/t/insert_select.test12
-rw-r--r--mysql-test/t/insert_update.test81
-rw-r--r--mysql-test/t/isam.test22
-rw-r--r--mysql-test/t/join.test27
-rw-r--r--mysql-test/t/join_crash.test11
-rw-r--r--mysql-test/t/join_outer.test148
-rw-r--r--mysql-test/t/key.test142
-rw-r--r--mysql-test/t/key_cache-master.opt1
-rw-r--r--mysql-test/t/key_cache.test169
-rw-r--r--mysql-test/t/key_diff.test3
-rw-r--r--mysql-test/t/key_primary.test3
-rw-r--r--mysql-test/t/keywords.test3
-rw-r--r--mysql-test/t/kill.test3
-rw-r--r--mysql-test/t/limit.test3
-rw-r--r--mysql-test/t/loaddata.test2
-rw-r--r--mysql-test/t/lock.test8
-rw-r--r--mysql-test/t/lock_multi.test4
-rw-r--r--mysql-test/t/lock_tables_lost_commit.test4
-rw-r--r--mysql-test/t/lowercase_table.test38
-rw-r--r--mysql-test/t/lowercase_table2.test2
-rw-r--r--mysql-test/t/lowercase_table3.test6
-rw-r--r--mysql-test/t/lowercase_table_qcache-master.opt1
-rw-r--r--mysql-test/t/lowercase_table_qcache.test29
-rw-r--r--mysql-test/t/merge.test111
-rw-r--r--mysql-test/t/metadata.test37
-rw-r--r--mysql-test/t/mix_innodb_myisam_binlog.test11
-rw-r--r--mysql-test/t/multi_statement.test16
-rw-r--r--mysql-test/t/multi_update.test148
-rw-r--r--mysql-test/t/myisam-blob.test11
-rw-r--r--mysql-test/t/myisam.test92
-rw-r--r--mysql-test/t/mysql_protocols.test10
-rw-r--r--mysql-test/t/mysqlbinlog.test26
-rw-r--r--mysql-test/t/mysqlbinlog2.test156
-rw-r--r--mysql-test/t/mysqldump.test129
-rw-r--r--mysql-test/t/mysqltest.test288
-rw-r--r--mysql-test/t/ndb_alter_table.test157
-rw-r--r--mysql-test/t/ndb_autodiscover.test482
-rw-r--r--mysql-test/t/ndb_autodiscover2-master.opt1
-rw-r--r--mysql-test/t/ndb_autodiscover2.test19
-rw-r--r--mysql-test/t/ndb_basic.test541
-rw-r--r--mysql-test/t/ndb_blob.test405
-rw-r--r--mysql-test/t/ndb_cache.test31
-rw-r--r--mysql-test/t/ndb_charset.test169
-rw-r--r--mysql-test/t/ndb_grant.later374
-rw-r--r--mysql-test/t/ndb_index.test129
-rw-r--r--mysql-test/t/ndb_index_ordered.test174
-rw-r--r--mysql-test/t/ndb_index_unique.test288
-rw-r--r--mysql-test/t/ndb_insert.test614
-rw-r--r--mysql-test/t/ndb_limit.test82
-rw-r--r--mysql-test/t/ndb_lock.test70
-rw-r--r--mysql-test/t/ndb_minmax.test66
-rw-r--r--mysql-test/t/ndb_replace.test27
-rw-r--r--mysql-test/t/ndb_subquery.test38
-rw-r--r--mysql-test/t/ndb_transaction.test297
-rw-r--r--mysql-test/t/ndb_truncate.test33
-rw-r--r--mysql-test/t/ndb_types.test47
-rw-r--r--mysql-test/t/ndb_update.test22
-rw-r--r--mysql-test/t/negation_elimination.test72
-rw-r--r--mysql-test/t/null.test124
-rw-r--r--mysql-test/t/null_key.test51
-rw-r--r--mysql-test/t/odbc.test6
-rw-r--r--mysql-test/t/olap.test148
-rw-r--r--mysql-test/t/openssl_1.test8
-rw-r--r--mysql-test/t/order_by.test162
-rw-r--r--mysql-test/t/order_fill_sortbuf.test3
-rw-r--r--mysql-test/t/outfile.test22
-rw-r--r--mysql-test/t/overflow.test2
-rw-r--r--mysql-test/t/preload.test100
-rw-r--r--mysql-test/t/ps.test487
-rw-r--r--mysql-test/t/ps_10nestset.test71
-rw-r--r--mysql-test/t/ps_11bugs.test131
-rw-r--r--mysql-test/t/ps_1general.test1051
-rw-r--r--mysql-test/t/ps_2myisam.test42
-rw-r--r--mysql-test/t/ps_3innodb.test24
-rw-r--r--mysql-test/t/ps_4heap.test49
-rw-r--r--mysql-test/t/ps_5merge.test84
-rw-r--r--mysql-test/t/ps_6bdb.test23
-rw-r--r--mysql-test/t/ps_7ndb.test23
-rw-r--r--mysql-test/t/query_cache.test157
-rw-r--r--mysql-test/t/query_cache_merge.test2
-rw-r--r--mysql-test/t/raid.test32
-rw-r--r--mysql-test/t/range.test194
-rw-r--r--mysql-test/t/rename.test31
-rw-r--r--mysql-test/t/repair.test28
-rw-r--r--mysql-test/t/repair_part2-master.sh1
-rw-r--r--mysql-test/t/repair_part2.test7
-rw-r--r--mysql-test/t/replace.test13
-rw-r--r--mysql-test/t/rollback.test15
-rw-r--r--mysql-test/t/row.test84
-rw-r--r--mysql-test/t/rpl000001-slave.opt1
-rw-r--r--mysql-test/t/rpl000001.test22
-rw-r--r--mysql-test/t/rpl000002.test34
-rw-r--r--mysql-test/t/rpl000003.test14
-rw-r--r--mysql-test/t/rpl000004.test6
-rw-r--r--mysql-test/t/rpl000005.test2
-rw-r--r--mysql-test/t/rpl000006.test4
-rw-r--r--mysql-test/t/rpl000008-slave.opt2
-rw-r--r--mysql-test/t/rpl000008.test41
-rw-r--r--mysql-test/t/rpl000009-slave.opt2
-rw-r--r--mysql-test/t/rpl000009.test168
-rw-r--r--mysql-test/t/rpl000010.test10
-rw-r--r--mysql-test/t/rpl000011.test18
-rw-r--r--mysql-test/t/rpl000012.test8
-rw-r--r--mysql-test/t/rpl000013.test6
-rw-r--r--mysql-test/t/rpl000015.test18
-rw-r--r--mysql-test/t/rpl000016-slave.opt1
-rwxr-xr-xmysql-test/t/rpl000017-slave.sh4
-rw-r--r--mysql-test/t/rpl000017.test12
-rw-r--r--mysql-test/t/rpl000018.test14
-rw-r--r--mysql-test/t/rpl_EE_error.test4
-rw-r--r--mysql-test/t/rpl_alter.test25
-rw-r--r--mysql-test/t/rpl_change_master.test2
-rw-r--r--mysql-test/t/rpl_charset.test171
-rw-r--r--mysql-test/t/rpl_commit_after_flush.test2
-rw-r--r--mysql-test/t/rpl_create_database-master.opt1
-rw-r--r--mysql-test/t/rpl_create_database-slave.opt1
-rw-r--r--mysql-test/t/rpl_create_database.test70
-rw-r--r--mysql-test/t/rpl_delete_all.test41
-rw-r--r--mysql-test/t/rpl_do_grant.test14
-rw-r--r--mysql-test/t/rpl_drop.test2
-rw-r--r--mysql-test/t/rpl_empty_master_crash.test4
-rw-r--r--mysql-test/t/rpl_error_ignored_table.test3
-rw-r--r--mysql-test/t/rpl_failed_optimize-master.opt1
-rw-r--r--mysql-test/t/rpl_failed_optimize.test18
-rw-r--r--mysql-test/t/rpl_failsafe.test8
-rw-r--r--mysql-test/t/rpl_flush_log_loop.test7
-rw-r--r--mysql-test/t/rpl_flush_tables.test35
-rw-r--r--mysql-test/t/rpl_get_lock.test4
-rw-r--r--mysql-test/t/rpl_ignore_grant.test22
-rw-r--r--mysql-test/t/rpl_init_slave-slave.opt1
-rw-r--r--mysql-test/t/rpl_init_slave.test26
-rw-r--r--mysql-test/t/rpl_insert_id-slave.opt1
-rw-r--r--mysql-test/t/rpl_insert_id.test5
-rw-r--r--mysql-test/t/rpl_insert_ignore-slave.opt1
-rw-r--r--mysql-test/t/rpl_insert_ignore.test71
-rw-r--r--mysql-test/t/rpl_loaddata.test8
-rw-r--r--mysql-test/t/rpl_loaddata_rule_m.test13
-rw-r--r--mysql-test/t/rpl_log.test43
-rw-r--r--mysql-test/t/rpl_log_pos.test28
-rw-r--r--mysql-test/t/rpl_master_pos_wait.test1
-rw-r--r--mysql-test/t/rpl_max_relay_size.test9
-rwxr-xr-xmysql-test/t/rpl_misc_functions-slave.sh1
-rw-r--r--mysql-test/t/rpl_misc_functions.test30
-rw-r--r--mysql-test/t/rpl_multi_update.test5
-rw-r--r--mysql-test/t/rpl_mystery22.test14
-rw-r--r--mysql-test/t/rpl_openssl.test62
-rw-r--r--mysql-test/t/rpl_ps.test43
-rw-r--r--mysql-test/t/rpl_redirect.test4
-rw-r--r--mysql-test/t/rpl_relayrotate-slave.opt4
-rw-r--r--mysql-test/t/rpl_relayrotate.test75
-rw-r--r--mysql-test/t/rpl_relayspace-slave.opt2
-rw-r--r--mysql-test/t/rpl_replicate_do.test10
-rw-r--r--mysql-test/t/rpl_reset_slave.test4
-rw-r--r--mysql-test/t/rpl_rewrite_db-slave.opt1
-rw-r--r--mysql-test/t/rpl_rewrite_db.test77
-rw-r--r--mysql-test/t/rpl_rotate_logs.test64
-rw-r--r--mysql-test/t/rpl_server_id1.test9
-rw-r--r--mysql-test/t/rpl_set_charset.test7
-rw-r--r--mysql-test/t/rpl_skip_error.test1
-rw-r--r--mysql-test/t/rpl_sporadic_master.test16
-rw-r--r--mysql-test/t/rpl_temporary.test131
-rw-r--r--mysql-test/t/rpl_timezone-master.opt1
-rw-r--r--mysql-test/t/rpl_timezone-slave.opt1
-rw-r--r--mysql-test/t/rpl_timezone.test84
-rw-r--r--mysql-test/t/rpl_trunc_binlog.test14
-rw-r--r--mysql-test/t/rpl_until.test82
-rw-r--r--mysql-test/t/rpl_user_variables.test55
-rw-r--r--mysql-test/t/sel000001.test31
-rw-r--r--mysql-test/t/sel000002.test17
-rw-r--r--mysql-test/t/sel000003.test18
-rw-r--r--mysql-test/t/sel000031.test20
-rw-r--r--mysql-test/t/sel000032.test20
-rw-r--r--mysql-test/t/sel000033.test18
-rw-r--r--mysql-test/t/sel000100.test46
-rw-r--r--mysql-test/t/select.test51
-rw-r--r--mysql-test/t/select_found.test30
-rw-r--r--mysql-test/t/select_safe.test3
-rw-r--r--mysql-test/t/show_check.test200
-rw-r--r--mysql-test/t/sql_mode.test82
-rw-r--r--mysql-test/t/status.test9
-rw-r--r--mysql-test/t/subselect.test1388
-rw-r--r--mysql-test/t/subselect2.test149
-rw-r--r--mysql-test/t/subselect_gis.test15
-rw-r--r--mysql-test/t/subselect_innodb.test147
-rw-r--r--mysql-test/t/symlink.test17
-rw-r--r--mysql-test/t/synchronization.test33
-rw-r--r--mysql-test/t/system_mysql_db.test5
-rw-r--r--mysql-test/t/system_mysql_db_fix.test16
-rw-r--r--mysql-test/t/system_mysql_db_refs.test12
-rw-r--r--mysql-test/t/tablelock.test3
-rw-r--r--mysql-test/t/temp_table.test18
-rw-r--r--mysql-test/t/timezone.test15
-rw-r--r--mysql-test/t/timezone2.test268
-rw-r--r--mysql-test/t/truncate.test3
-rw-r--r--mysql-test/t/type_blob.test69
-rw-r--r--mysql-test/t/type_date.test10
-rw-r--r--mysql-test/t/type_datetime.test29
-rw-r--r--mysql-test/t/type_decimal.test13
-rw-r--r--mysql-test/t/type_enum.test96
-rw-r--r--mysql-test/t/type_float.test30
-rw-r--r--mysql-test/t/type_nchar.test35
-rw-r--r--mysql-test/t/type_ranges.test8
-rw-r--r--mysql-test/t/type_set.test26
-rw-r--r--mysql-test/t/type_time.test4
-rw-r--r--mysql-test/t/type_timestamp.test240
-rw-r--r--mysql-test/t/type_uint.test4
-rw-r--r--mysql-test/t/type_year.test3
-rw-r--r--mysql-test/t/union-master.opt1
-rw-r--r--mysql-test/t/union.test429
-rw-r--r--mysql-test/t/update.test16
-rw-r--r--mysql-test/t/user_var.test63
-rw-r--r--mysql-test/t/varbinary.test8
-rw-r--r--mysql-test/t/variables-master.opt2
-rw-r--r--mysql-test/t/variables.test122
-rw-r--r--mysql-test/t/warnings-master.opt1
-rw-r--r--mysql-test/t/warnings.test98
716 files changed, 109363 insertions, 4462 deletions
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index 8b0c096120a..d718935cca8 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -17,12 +17,30 @@
## Process this file with automake to create Makefile.in
+if HAVE_NDBCLUSTER_DB
+SUBDIRS = ndb
+DIST_SUBDIRS=ndb
+else
+# If one uses automake conditionals, automake will automatically
+# include all possible branches to DIST_SUBDIRS goal.
+# Reset DIST_SUBDIRS if we don't use NDB
+SUBDIRS=
+DIST_SUBDIRS=
+endif
+
benchdir_root= $(prefix)
testdir = $(benchdir_root)/mysql-test
EXTRA_SCRIPTS = mysql-test-run.sh install_test_db.sh
EXTRA_DIST = $(EXTRA_SCRIPTS)
-test_SCRIPTS = mysql-test-run install_test_db
-CLEANFILES = $(test_SCRIPTS)
+test_SCRIPTS = mysql-test-run install_test_db
+test_DATA = std_data/client-key.pem std_data/client-cert.pem std_data/cacert.pem
+CLEANFILES = $(test_SCRIPTS) $(test_DATA)
+
+INCLUDES = -I$(srcdir)/../include -I../include -I..
+EXTRA_PROGRAMS = mysql_test_run_new
+noinst_HEADERS = my_manage.h
+mysql_test_run_new_SOURCES= mysql_test_run_new.c my_manage.c my_create_tables.c
+
dist-hook:
mkdir -p $(distdir)/t $(distdir)/r $(distdir)/include \
@@ -30,9 +48,11 @@ dist-hook:
$(INSTALL_DATA) $(srcdir)/t/*.test $(srcdir)/t/*.opt $(srcdir)/t/*.sh $(srcdir)/t/*.slave-mi $(distdir)/t
$(INSTALL_DATA) $(srcdir)/include/*.inc $(distdir)/include
$(INSTALL_DATA) $(srcdir)/r/*.result $(srcdir)/r/*.require $(distdir)/r
- $(INSTALL_DATA) $(srcdir)/std_data/*.dat $(srcdir)/std_data/*.001 $(distdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(distdir)/std_data
+ $(INSTALL_DATA) $(srcdir)/std_data/*.dat $(srcdir)/std_data/*.000001 $(distdir)/std_data
+ $(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(distdir)/std_data
+ $(INSTALL_DATA) $(srcdir)/std_data/*.pem $(distdir)/std_data
+
install-data-local:
$(mkinstalldirs) \
@@ -52,6 +72,11 @@ install-data-local:
$(INSTALL_DATA) $(srcdir)/std_data/*.*001 $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(DESTDIR)$(testdir)/std_data
+ $(INSTALL_DATA) $(srcdir)/std_data/*.pem $(DESTDIR)$(testdir)/std_data
+
+std_data/%.pem:
+ @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
+
SUFFIXES = .sh
@@ -67,7 +92,10 @@ SUFFIXES = .sh
-e 's!@''libexecdir''@!$(libexecdir)!g' \
-e 's!@''PERL''@!@PERL@!' \
-e 's!@''VERSION''@!@VERSION@!' \
+ -e 's!@''MYSQL_TCP_PORT''@!@MYSQL_TCP_PORT@!' \
-e 's!@''MYSQL_BASE_VERSION''@!@MYSQL_BASE_VERSION@!' \
+ -e 's!@''MYSQL_UNIX_ADDR''@!@MYSQL_UNIX_ADDR@!' \
+ -e 's!@''MYSQL_TCP_PORT''@!@MYSQL_TCP_PORT@!' \
-e 's!@''MYSQL_NO_DASH_VERSION''@!@MYSQL_NO_DASH_VERSION@!' \
-e 's!@''MYSQL_SERVER_SUFFIX''@!@MYSQL_SERVER_SUFFIX@!' \
$< > $@-t
diff --git a/mysql-test/README b/mysql-test/README
index 6ad97adbd2b..bccb05c555c 100644
--- a/mysql-test/README
+++ b/mysql-test/README
@@ -1,6 +1,10 @@
This directory contains a test suite for mysql daemon. To run
the currently existing test cases, simply execute ./mysql-test-run in
this directory. It will fire up the newly built mysqld and test it.
+
+If you want to run the test with a running MySQL server use the --external
+option to mysql-test-run.
+
Note that you do not have to have to do make install, and you could
actually have a co-existing MySQL installation - the tests will not
conflict with it.
@@ -13,8 +17,7 @@ http://dev.mysql.com/doc/mysql/en/MySQL_test_suite.html
You can create your own test cases. To create a test case:
- cd t
- vi test_case_name.test
+ xeamacs t/test_case_name.test
in the file, put a set of SQL commands that will create some tables,
load test data, run some queries to manipulate it.
diff --git a/mysql-test/create-test-result b/mysql-test/create-test-result
index bfd64f32fc5..b9be2300976 100755
--- a/mysql-test/create-test-result
+++ b/mysql-test/create-test-result
@@ -27,14 +27,13 @@ test_name=$1
[ -z $test_name ] && usage
result_file=$RESULT_DIR/$test_name.result
+reject_file=$RESULT_DIR/$test_name.reject
[ -f $result_file ] && die "result file $result_file has already been created"
touch $result_file
echo "Running the test case against empty file, will fail, but don't worry"
-./mysql-test-run --do-test=$test_name
-
-reject_file=$result_file.reject
+./mysql-test-run --local $test_name
if [ -f $reject_file ] ; then
echo "Below are the contents of the reject file:"
diff --git a/mysql-test/include/ctype_common.inc b/mysql-test/include/ctype_common.inc
new file mode 100644
index 00000000000..202c508a9c9
--- /dev/null
+++ b/mysql-test/include/ctype_common.inc
@@ -0,0 +1,58 @@
+#
+# Common tests for all character sets and collations.
+# Include this file from a test with @test_characrer_set
+# and @test_collation set to desired values.
+#
+# Please don't use SHOW CREATE TABLE in this file,
+# we want it to be HANDLER independent. You can
+# use SHOW FULL COLUMNS instead.
+#
+# Please surround all CREATE TABLE with --disable_warnings
+# and --enable_warnings to be able to set storage_engine
+# without having to check if the hanlder exists.
+
+SET @safe_character_set_server= @@character_set_server;
+SET @safe_collation_server= @@collation_server;
+SET character_set_server= @test_character_set;
+SET collation_server= @test_collation;
+CREATE DATABASE d1;
+USE d1;
+
+#
+# Bug 1883: LIKE did not work in some cases with a key.
+#
+--disable_warnings
+CREATE TABLE t1 (c CHAR(10), KEY(c));
+--enable_warnings
+# check the column was created with the expected charset/collation
+--replace_result select,insert,update,references ""
+SHOW FULL COLUMNS FROM t1;
+INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
+SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
+DROP TABLE t1;
+
+#
+# Bug 6643 incorrect response with partial utf8 index
+#
+--disable_warnings
+CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
+--enable_warnings
+# check the column was created with the expected charset/collation
+--replace_result select,insert,update,references ""
+SHOW FULL COLUMNS FROM t1;
+INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
+SELECT c1 as want3results from t1 where c1 like 'l%';
+SELECT c1 as want3results from t1 where c1 like 'lo%';
+SELECT c1 as want1result from t1 where c1 like 'loc%';
+SELECT c1 as want1result from t1 where c1 like 'loca%';
+SELECT c1 as want1result from t1 where c1 like 'locat%';
+SELECT c1 as want1result from t1 where c1 like 'locati%';
+SELECT c1 as want1result from t1 where c1 like 'locatio%';
+SELECT c1 as want1result from t1 where c1 like 'location%';
+DROP TABLE t1;
+
+DROP DATABASE d1;
+# Restore settings
+USE test;
+SET character_set_server= @safe_character_set_server;
+SET collation_server= @safe_collation_server;
diff --git a/mysql-test/include/endspace.inc b/mysql-test/include/endspace.inc
new file mode 100644
index 00000000000..1692a258bde
--- /dev/null
+++ b/mysql-test/include/endspace.inc
@@ -0,0 +1,7 @@
+select 'a' = 'a', 'a' = 'a ', 'a ' = 'a';
+select 'a\0' = 'a', 'a\0' < 'a', 'a\0' > 'a';
+select 'a' = 'a\0', 'a' < 'a\0', 'a' > 'a\0';
+select 'a\0' = 'a ', 'a\0' < 'a ', 'a\0' > 'a ';
+select 'a ' = 'a\0', 'a ' < 'a\0', 'a ' > 'a\0';
+select 'a a' > 'a', 'a \0' < 'a';
+select binary 'a a' > 'a', binary 'a \0' > 'a', binary 'a\0' > 'a';
diff --git a/mysql-test/include/have_archive.inc b/mysql-test/include/have_archive.inc
new file mode 100644
index 00000000000..f7fb942e83e
--- /dev/null
+++ b/mysql-test/include/have_archive.inc
@@ -0,0 +1,4 @@
+-- require r/have_archive.require
+disable_query_log;
+show variables like "have_archive";
+enable_query_log;
diff --git a/mysql-test/include/have_big5.inc b/mysql-test/include/have_big5.inc
new file mode 100644
index 00000000000..790e8085e1a
--- /dev/null
+++ b/mysql-test/include/have_big5.inc
@@ -0,0 +1,4 @@
+-- require r/have_big5.require
+disable_query_log;
+show collation like "big5_chinese_ci";
+enable_query_log;
diff --git a/mysql-test/include/have_compress.inc b/mysql-test/include/have_compress.inc
new file mode 100644
index 00000000000..c042cd7452a
--- /dev/null
+++ b/mysql-test/include/have_compress.inc
@@ -0,0 +1,4 @@
+-- require r/have_compress.require
+disable_query_log;
+show variables like "have_compress";
+enable_query_log;
diff --git a/mysql-test/include/have_csv.inc b/mysql-test/include/have_csv.inc
new file mode 100644
index 00000000000..d28199831b8
--- /dev/null
+++ b/mysql-test/include/have_csv.inc
@@ -0,0 +1,4 @@
+-- require r/have_csv.require
+disable_query_log;
+show variables like "have_csv";
+enable_query_log;
diff --git a/mysql-test/include/have_debug.inc b/mysql-test/include/have_debug.inc
new file mode 100644
index 00000000000..ff59037b6eb
--- /dev/null
+++ b/mysql-test/include/have_debug.inc
@@ -0,0 +1,4 @@
+-- require r/have_debug.require
+disable_query_log;
+select (version() like "%debug%") as debug;
+enable_query_log;
diff --git a/mysql-test/include/have_exampledb.inc b/mysql-test/include/have_exampledb.inc
new file mode 100644
index 00000000000..7ddd15c48b3
--- /dev/null
+++ b/mysql-test/include/have_exampledb.inc
@@ -0,0 +1,4 @@
+-- require r/have_exampledb.require
+disable_query_log;
+show variables like "have_example_engine";
+enable_query_log;
diff --git a/mysql-test/include/have_geometry.inc b/mysql-test/include/have_geometry.inc
new file mode 100644
index 00000000000..169c3a41ee7
--- /dev/null
+++ b/mysql-test/include/have_geometry.inc
@@ -0,0 +1,4 @@
+-- require r/have_geometry.require
+disable_query_log;
+show variables like "have_geometry";
+enable_query_log;
diff --git a/mysql-test/include/have_ndb.inc b/mysql-test/include/have_ndb.inc
new file mode 100644
index 00000000000..84e60657876
--- /dev/null
+++ b/mysql-test/include/have_ndb.inc
@@ -0,0 +1,7 @@
+-- require r/have_ndb.require
+disable_query_log;
+show variables like "have_ndbcluster";
+enable_query_log;
+#connect (server1,127.0.0.1,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
+#connect (server2,127.0.0.1,root,,test,$MASTER_MYPORT1,$MASTER_MYSOCK1);
+#connection server1;
diff --git a/mysql-test/include/have_query_cache.inc b/mysql-test/include/have_query_cache.inc
index e5e6052c9a7..39549157849 100644
--- a/mysql-test/include/have_query_cache.inc
+++ b/mysql-test/include/have_query_cache.inc
@@ -1,4 +1,7 @@
-- require r/have_query_cache.require
+# As PS are not cached we disable them to ensure the we get the right number
+# of query cache hits
+-- disable_ps_protocol
disable_query_log;
show variables like "have_query_cache";
enable_query_log;
diff --git a/mysql-test/include/have_sjis.inc b/mysql-test/include/have_sjis.inc
new file mode 100644
index 00000000000..0d580a3a232
--- /dev/null
+++ b/mysql-test/include/have_sjis.inc
@@ -0,0 +1,4 @@
+-- require r/have_sjis.require
+disable_query_log;
+show collation like "sjis_japanese_ci";
+enable_query_log;
diff --git a/mysql-test/include/have_tis620.inc b/mysql-test/include/have_tis620.inc
new file mode 100644
index 00000000000..c1e775681b0
--- /dev/null
+++ b/mysql-test/include/have_tis620.inc
@@ -0,0 +1,4 @@
+-- require r/have_tis620.require
+disable_query_log;
+show collation like "tis620_thai_ci";
+enable_query_log;
diff --git a/mysql-test/include/have_ucs2.inc b/mysql-test/include/have_ucs2.inc
new file mode 100644
index 00000000000..92ec9b5fb44
--- /dev/null
+++ b/mysql-test/include/have_ucs2.inc
@@ -0,0 +1,4 @@
+-- require r/have_ucs2.require
+disable_query_log;
+show collation like "ucs2_general_ci";
+enable_query_log;
diff --git a/mysql-test/include/have_ujis.inc b/mysql-test/include/have_ujis.inc
new file mode 100644
index 00000000000..ecceb7a8408
--- /dev/null
+++ b/mysql-test/include/have_ujis.inc
@@ -0,0 +1,4 @@
+-- require r/have_ujis.require
+disable_query_log;
+show collation like "ujis_japanese_ci";
+enable_query_log;
diff --git a/mysql-test/include/master-slave.inc b/mysql-test/include/master-slave.inc
index 474b1357e9e..5ec4b4379f8 100644
--- a/mysql-test/include/master-slave.inc
+++ b/mysql-test/include/master-slave.inc
@@ -3,17 +3,24 @@ connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,);
connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT,);
connection slave;
---error 0,1199
-!slave stop;
+#we expect STOP SLAVE to produce a warning as the slave is stopped
+#(the server was started with skip-slave-start)
+--disable_warnings
+stop slave;
+--enable_warnings
@r/slave-stopped.result show status like 'Slave_running';
connection master;
+--disable_warnings
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+--enable_warnings
reset master;
connection slave;
reset slave;
# Clean up old test tables
+--disable_warnings
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+--enable_warnings
+start slave;
@r/slave-running.result show status like 'Slave_running';
# Set the default connection to 'master'
diff --git a/mysql-test/include/not_embedded.inc b/mysql-test/include/not_embedded.inc
index 52ae026ece3..fcc1756caab 100644
--- a/mysql-test/include/not_embedded.inc
+++ b/mysql-test/include/not_embedded.inc
@@ -1,5 +1,5 @@
-- require r/not_embedded.require
disable_query_log;
-select version() like "%embedded%" as "have_embedded";
+select version() like N'%embedded%' as 'have_embedded';
enable_query_log;
diff --git a/mysql-test/include/ps_conv.inc b/mysql-test/include/ps_conv.inc
new file mode 100644
index 00000000000..0a5bec26fe7
--- /dev/null
+++ b/mysql-test/include/ps_conv.inc
@@ -0,0 +1,1204 @@
+############################ ps_conv.inc ##############################
+# #
+# Tests for prepared statements: conversion of parameters #
+# #
+# Please don't #
+# - try to execute this script in ANSI mode, because many statements #
+# will fail due to the strict type checking #
+# - reuse such ugly assignments like timestamp column = float value . #
+# I included them only for controlling purposes. #
+########################################################################
+
+#
+# NOTE: PLEASE SEE ps_1general.test (bottom)
+# BEFORE ADDING NEW TEST CASES HERE !!!
+
+#
+# Please be aware, that this file will be sourced by several test case files
+# stored within the subdirectory 't'. So every change here will affect
+# several test cases.
+
+
+# The MySQL User Variables do not support the simulation of all
+# C-API field types.
+#
+# - There is no method to make an explicit assignment of a type to a variable.
+# - The type of the variable can be only influenced by the writing style
+# of the value.
+#
+# The next tests should give an example for these properties.
+--disable_warnings
+drop table if exists t5 ;
+--enable_warnings
+set @arg01= 8;
+set @arg02= 8.0;
+set @arg03= 80.00000000000e-1;
+set @arg04= 'abc' ;
+set @arg05= CAST('abc' as binary) ;
+set @arg06= '1991-08-05' ;
+set @arg07= CAST('1991-08-05' as date);
+set @arg08= '1991-08-05 01:01:01' ;
+set @arg09= CAST('1991-08-05 01:01:01' as datetime) ;
+set @arg10= unix_timestamp('1991-01-01 01:01:01');
+set @arg11= YEAR('1991-01-01 01:01:01');
+# This first assignment to @arg<n> fixes the type of the variable
+# The second assignment sets the value to NULL, but it does not change
+# the numeric types.
+set @arg12= 8 ;
+set @arg12= NULL ;
+set @arg13= 8.0 ;
+set @arg13= NULL ;
+set @arg14= 'abc';
+set @arg14= NULL ;
+set @arg15= CAST('abc' as binary) ;
+set @arg15= NULL ;
+create table t5 as select
+ 8 as const01, @arg01 as param01,
+ 8.0 as const02, @arg02 as param02,
+ 80.00000000000e-1 as const03, @arg03 as param03,
+ 'abc' as const04, @arg04 as param04,
+ CAST('abc' as binary) as const05, @arg05 as param05,
+ '1991-08-05' as const06, @arg06 as param06,
+ CAST('1991-08-05' as date) as const07, @arg07 as param07,
+ '1991-08-05 01:01:01' as const08, @arg08 as param08,
+ CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09,
+ unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10,
+ YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11,
+ NULL as const12, @arg12 as param12,
+ @arg13 as param13,
+ @arg14 as param14,
+ @arg15 as param15;
+
+# Bug#4788 show create table provides incorrect statement
+show create table t5 ;
+--vertical_results
+--enable_metadata
+--disable_ps_protocol
+select * from t5 ;
+--enable_ps_protocol
+--disable_metadata
+--horizontal_results
+drop table t5 ;
+
+# But there seems to be also an implicit conversion of C-API
+# data types to a smaller number of base data types.
+#
+# Example: C-API for prepared statements
+# CREATE TABLE abc as SELECT ? as a, ? as b, ...
+#
+# MYSQL_TYPE of parameter column type
+# MYSQL_TYPE_TINY bigint(4)
+# MYSQL_TYPE_SHORT bigint(6)
+# MYSQL_TYPE_FLOAT double
+# ...
+#
+# So we can hope that the functionality of mysqltest + user variables
+# sufficient to simulate much of the behaviour of the C-API
+# vis-a-vis the server.
+
+# The main test object is the table t9, defined as follows:
+#
+# eval create table t9
+# (
+# c1 tinyint, c2 smallint, c3 mediumint, c4 int,
+# c5 integer, c6 bigint, c7 float, c8 double,
+# c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
+# c13 date, c14 datetime, c15 timestamp(14), c16 time,
+# c17 year, c18 bit, c19 bool, c20 char,
+# c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
+# c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
+# c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
+# c32 set('monday', 'tuesday', 'wednesday'),
+# primary key(c1)
+# ) engine = $type ;
+# We test each statement in non-prepared mode and in prepared mode
+# for comparison purposes.
+#
+# We test the following conversions:
+# BIGINT -> the rest of numeric columns
+# CHAR, LONGTEXT, LONGBLOB, NULL, FLOAT, REAL, DOUBLE -> numeric columns
+# FLOAT, REAL, CHAR, LONGTEXT, BINARY, BIGINT -> string
+# DATETIME, TIME -> text, and back
+
+
+--disable_query_log
+select '------ data type conversion tests ------' as test_sequence ;
+--enable_query_log
+--source include/ps_renew.inc
+
+# insert a record with many NULLs
+insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ;
+select * from t9 order by c1 ;
+
+############ select @parm:= .. / select .. into @parm tests ############
+--disable_query_log
+select '------ select @parameter:= column ------' as test_sequence ;
+--enable_query_log
+# PS query to retrieve the content of the @variables
+prepare full_info from "select @arg01, @arg02, @arg03, @arg04,
+ @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12,
+ @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20,
+ @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28,
+ @arg29, @arg30, @arg31, @arg32" ;
+
+# non PS statement for comparison purposes
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+ @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+ @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+ @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+ @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+ @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+ @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+ @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 1 ;
+# get as much informations about the parameters as possible
+--enable_metadata
+execute full_info ;
+--disable_metadata
+# now the same procedure with the record containing so many NULLs
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+ @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+ @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+ @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+ @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+ @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+ @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+ @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 0 ;
+# get as much informations about the parameters as possible
+--enable_metadata
+execute full_info ;
+--disable_metadata
+
+prepare stmt1 from "select
+ @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+ @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+ @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+ @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+ @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+ @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+ @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+ @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+# get as much informations about the parameters as possible
+--enable_metadata
+execute full_info ;
+--disable_metadata
+# now the same procedure with the record containing so many NULLs
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+# get as much informations about the parameters as possible
+--enable_metadata
+execute full_info ;
+--disable_metadata
+
+# the next statement must fail
+--error 1064
+prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
+
+--disable_query_log
+select '------ select column, .. into @parm,.. ------' as test_sequence ;
+--enable_query_log
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+ c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+ c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 1 ;
+# get as much informations about the parameters as possible
+--enable_metadata
+execute full_info ;
+--disable_metadata
+# now the same procedure with the record containing so many NULLs
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+ c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+ c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 0 ;
+# get as much informations about the parameters as possible
+--enable_metadata
+execute full_info ;
+--disable_metadata
+
+prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+ c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+ c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+# get as much informations about the parameters as possible
+--enable_metadata
+execute full_info ;
+--disable_metadata
+# now the same procedure with the record containing so many NULLs
+# Bug#5034: prepared "select 1 into @arg15", second execute crashes server
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+# get as much informations about the parameters as possible
+--enable_metadata
+execute full_info ;
+--disable_metadata
+
+# the next statement must fail
+--error 1064
+prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
+
+
+
+######################### test of numeric types ##########################
+# #
+# c1 tinyint, c2 smallint, c3 mediumint, c4 int, #
+# c5 integer, c6 bigint, c7 float, c8 double, #
+# c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4), #
+# #
+##########################################################################
+--disable_query_log
+select '-- insert into numeric columns --' as test_sequence ;
+--enable_query_log
+
+######## INSERT into .. numeric columns values(BIGINT(n),BIGINT) ########
+insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ;
+set @arg00= 21 ;
+insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ;
+execute stmt1 ;
+set @arg00= 23;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. numeric columns values(DOUBLE(m,n),DOUBLE) ########
+insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
+ 30.0, 30.0, 30.0 ) ;
+set @arg00= 31.0 ;
+insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0,
+ 32.0, 32.0, 32.0 )" ;
+execute stmt1 ;
+set @arg00= 33.0;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. numeric columns values(CHAR(n),LONGTEXT) #########
+insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( '40', '40', '40', '40', '40', '40', '40', '40',
+ '40', '40', '40' ) ;
+set @arg00= '41' ;
+insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( '42', '42', '42', '42', '42', '42', '42', '42',
+ '42', '42', '42' )" ;
+execute stmt1 ;
+set @arg00= '43';
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. numeric columns values(BINARY(n),LONGBLOB) ########
+insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( CAST('50' as binary), CAST('50' as binary),
+ CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+ CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+ CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ;
+set @arg00= CAST('51' as binary) ;
+insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ;
+execute stmt1 ;
+set @arg00= CAST('53' as binary) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. numeric columns values(BIGINT,NULL) ########
+# we first assign number to arg00 to set it's datatype to numeric.
+set @arg00= 2 ;
+set @arg00= NULL ;
+insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL ) ;
+insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 61, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL )" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. numeric columns values(DOUBLE,NULL) ########
+set @arg00= 8.0 ;
+set @arg00= NULL ;
+insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 71, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. numeric columns values(LONGBLOB,NULL) ########
+set @arg00= 'abc' ;
+set @arg00= NULL ;
+insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 81, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+
+######## SELECT of all inserted records ########
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c1 >= 20
+order by c1 ;
+
+
+--disable_query_log
+select '-- select .. where numeric column = .. --' as test_sequence ;
+--enable_query_log
+######## SELECT .. WHERE column(numeric)=value(BIGINT(n)/BIGINT) ########
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+ and c8= 20 and c9= 20 and c10= 20 and c12= 20;
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+ and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+ and c12= @arg00;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+ and c8= 20 and c9= 20 and c10= 20 and c12= 20 ";
+execute stmt1 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## SELECT .. WHERE column(numeric)=value(DOUBLE(m,n)/DOUBLE) ########
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+ and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0;
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+ and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+ and c12= @arg00;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+ and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 ";
+execute stmt1 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## SELECT .. WHERE column(numeric)=value(CHAR(n)/LONGTEXT) ########
+select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20';
+prepare stmt1 from "select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' ";
+execute stmt1 ;
+set @arg00= '20';
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+ and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+ and c12= @arg00;
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## SELECT .. WHERE column(numeric)=value(BINARY(n)/LONGBLOB) ########
+select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+ c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+ c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+ c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+ c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+ c12= CAST('20' as binary);
+prepare stmt1 from "select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+ c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+ c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+ c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+ c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+ c12= CAST('20' as binary) ";
+execute stmt1 ;
+set @arg00= CAST('20' as binary) ;
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+ and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+ and c12= @arg00;
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+delete from t9 ;
+
+#################### Some overflow experiments ################################
+# #
+# MySQL Manual (July 2004) #
+# - Setting a numeric column to a value that lies outside the column's range. #
+# The value is clipped to the closest endpoint of the range. #
+# ... #
+# - For example, inserting the string '1999.0e-2' into an INT, FLOAT, #
+# DECIMAL(10,6), or YEAR column results in the values 1999, 19.9921, #
+# 19.992100, and 1999. #
+# That means there is an anomaly if a float value is assigned via string to #
+# a column of type bigint. The string will be cut from the right side to #
+# a "usable" integer value. #
+# #
+###############################################################################
+--disable_query_log
+select '-- some numeric overflow experiments --' as test_sequence ;
+--enable_query_log
+prepare my_insert from "insert into t9
+ ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c21 = 'O' ";
+prepare my_delete from "delete from t9 where c21 = 'O' ";
+
+# Numeric overflow of columns(c1, c2, c3, c4, c5, c12) with type not in
+# (BIGINT,FLOAT,REAL,DOUBLE) during insert
+#
+# Use the maximum BIGINT from the manual
+set @arg00= 9223372036854775807 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ;
+--vertical_results
+execute my_select ;
+--horizontal_results
+execute my_delete ;
+set @arg00= '9223372036854775807' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ;
+--vertical_results
+execute my_select ;
+--horizontal_results
+execute my_delete ;
+# Use the minimum BIGINT from the manual
+#
+set @arg00= -9223372036854775808 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ;
+--vertical_results
+execute my_select ;
+--horizontal_results
+execute my_delete ;
+set @arg00= '-9223372036854775808' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ;
+--vertical_results
+execute my_select ;
+--horizontal_results
+execute my_delete ;
+
+# Numeric overflow of columns(c1, c2, c3, c4, c5, c12) with type not in
+# (FLOAT,REAL,DOUBLE) during insert
+#
+set @arg00= 1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ;
+--vertical_results
+execute my_select ;
+--horizontal_results
+execute my_delete ;
+# Attention: The columns(c1,c2,c3,c4,c5,c6) do not get the overflow,
+# because the string is treated as written integer and
+# '.11111111111111111111e+50' is cut away.
+set @arg00= '1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ;
+--vertical_results
+execute my_select ;
+--horizontal_results
+execute my_delete ;
+set @arg00= -1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ;
+--vertical_results
+execute my_select ;
+--horizontal_results
+execute my_delete ;
+# Attention: The columns(c1,c2,c3,c4,c5,c6) do not get the overflow,
+# because the string is treated as written integer and
+# '.11111111111111111111e+50' is cut away.
+set @arg00= '-1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ;
+--vertical_results
+execute my_select ;
+--horizontal_results
+execute my_delete ;
+
+########################## test of string types ##########################
+# #
+# c20 char, c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext, #
+# c25 blob, c26 text, c27 mediumblob, c28 mediumtext, c29 longblob, #
+# c30 longtext, c31 enum('one', 'two', 'three') #
+# #
+##########################################################################
+--disable_query_log
+select '-- insert into string columns --' as test_sequence ;
+--enable_query_log
+
+######## INSERT into .. string columns values(CHAR(n),LONGTEXT) ########
+--disable_query_log
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 20, '20', '20', '20', '20', '20', '20', '20', '20', '20', '20', '20' ) ;
+set @arg00= '21' ;
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 21, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 22, '22', '22', '22', '22', '22', '22', '22', '22', '22', '22', '22' )" ;
+execute stmt1 ;
+set @arg00= '23';
+prepare stmt2 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 23, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. string columns values(BINARY(n),LONGBLOB) ########
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 30, CAST('30' as binary), CAST('30' as binary), CAST('30' as binary),
+ CAST('30' as binary), CAST('30' as binary), CAST('30' as binary),
+ CAST('30' as binary), CAST('30' as binary), CAST('30' as binary),
+ CAST('30' as binary), CAST('30' as binary) ) ;
+set @arg00= '31' ;
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 31, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 32, CAST('32' as binary), CAST('32' as binary), CAST('32' as binary),
+ CAST('32' as binary), CAST('32' as binary), CAST('32' as binary),
+ CAST('32' as binary), CAST('32' as binary), CAST('32' as binary),
+ CAST('32' as binary), CAST('32' as binary) )" ;
+execute stmt1 ;
+set @arg00= CAST('33' as binary);
+prepare stmt2 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 33, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. string columns values(BIGINT(n),BIGINT) ########
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40 ) ;
+set @arg00= 41 ;
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 41, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42 )" ;
+execute stmt1 ;
+set @arg00= 43;
+prepare stmt2 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 43, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. string columns values(DOUBLE(m,n),DOUBLE) ########
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 50, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0 ) ;
+set @arg00= 51.0 ;
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 51, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 52, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0 )" ;
+execute stmt1 ;
+set @arg00= 53.0;
+prepare stmt2 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 53, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. string columns values(DOUBLE(m,n),DOUBLE) ########
+# typical float writing style
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 54, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1,
+ 5.4e+1, 5.4e+1, 5.4e+1 ) ;
+set @arg00= 5.5e+1 ;
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 55, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 56, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1,
+ 5.6e+1, 5.6e+1, 5.6e+1 )" ;
+execute stmt1 ;
+set @arg00= 5.7e+1;
+prepare stmt2 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 57, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. string columns values(LONGBLOB,NULL) ########
+set @arg00= 'abc' ;
+set @arg00= NULL ;
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ;
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 61, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+######## INSERT into .. string columns values(BIGINT,NULL) ########
+set @arg00= 2 ;
+set @arg00= NULL ;
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 71, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+######## INSERT into .. string columns values(DOUBLE,NULL) ########
+set @arg00= 8 ;
+set @arg00= NULL ;
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 81, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+--enable_query_log
+
+######## SELECT of all inserted records ########
+select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30
+from t9 where c1 >= 20
+order by c1 ;
+
+
+--disable_query_log
+select '-- select .. where string column = .. --' as test_sequence ;
+--enable_query_log
+######## SELECT .. WHERE column(string)=value(CHAR(n)/LONGTEXT) ########
+set @arg00= '20';
+# c20 (char) must be extended for the comparison
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+ c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+ c27= '20' and c28= '20' and c29= '20' and c30= '20' ;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+ c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+ c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+ c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+ c27= '20' and c28= '20' and c29= '20' and c30= '20'" ;
+execute stmt1 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## SELECT .. WHERE column(string)=value(BINARY(n)/LONGBLOB) ########
+set @arg00= CAST('20' as binary);
+# c20 (char) must be extended for the comparison
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+ = CAST('20' as binary) and c21= CAST('20' as binary)
+ and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+ c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+ c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+ c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+ c30= CAST('20' as binary) ;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and
+ c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+ c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and
+ c30= @arg00;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+ = CAST('20' as binary) and c21= CAST('20' as binary)
+ and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+ c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+ c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+ c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+ c30= CAST('20' as binary)" ;
+execute stmt1 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and
+ c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and
+ c29= ? and c30= ?";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## SELECT .. WHERE column(string)=value(BIGINT(m,n),BIGINT) ########
+set @arg00= 20;
+# c20 (char) must be extended for the comparison
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+ c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+ c27= 20 and c28= 20 and c29= 20 and c30= 20 ;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+ c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+ c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+ c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+ c27= 20 and c28= 20 and c29= 20 and c30= 20" ;
+execute stmt1 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## SELECT .. WHERE column(string)=value(DOUBLE(m,n),DOUBLE) ########
+set @arg00= 20.0;
+# c20 (char) must be extended for the comparison
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+ c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+ c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+ c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+ c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+ c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+ c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ;
+execute stmt1 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ;
+
+delete from t9 ;
+
+
+######################### test of date/time columns ########################
+# #
+# c13 date, c14 datetime, c15 timestamp(14), c16 time, c17 year #
+# #
+############################################################################
+--disable_query_log
+select '-- insert into date/time columns --' as test_sequence ;
+--enable_query_log
+######## INSERT into .. date/time columns values(VARCHAR(19),LONGTEXT) ########
+--disable_query_log
+set @arg00= '1991-01-01 01:01:01' ;
+insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 20, '1991-01-01 01:01:01', '1991-01-01 01:01:01', '1991-01-01 01:01:01',
+ '1991-01-01 01:01:01', '1991-01-01 01:01:01') ;
+insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 21, @arg00, @arg00, @arg00, @arg00, @arg00) ;
+prepare stmt1 from "insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 22, '1991-01-01 01:01:01', '1991-01-01 01:01:01', '1991-01-01 01:01:01',
+ '1991-01-01 01:01:01', '1991-01-01 01:01:01')" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 23, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. date/time columns values(DATETIME,LONGBLOB) ########
+set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
+insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 30, CAST('1991-01-01 01:01:01' as datetime),
+ CAST('1991-01-01 01:01:01' as datetime),
+ CAST('1991-01-01 01:01:01' as datetime),
+ CAST('1991-01-01 01:01:01' as datetime),
+ CAST('1991-01-01 01:01:01' as datetime)) ;
+insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 31, @arg00, @arg00, @arg00, @arg00, @arg00) ;
+prepare stmt1 from "insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 32, CAST('1991-01-01 01:01:01' as datetime),
+ CAST('1991-01-01 01:01:01' as datetime),
+ CAST('1991-01-01 01:01:01' as datetime),
+ CAST('1991-01-01 01:01:01' as datetime),
+ CAST('1991-01-01 01:01:01' as datetime))" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 33, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. date/time columns values(BIGINT(n),BIGINT) ########
+set @arg00= 2000000000 ;
+insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 40, 2000000000, 2000000000, 2000000000, 2000000000, 2000000000 ) ;
+insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 41, @arg00, @arg00, @arg00, @arg00, @arg00) ;
+prepare stmt1 from "insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 42, 2000000000, 2000000000, 2000000000, 2000000000, 2000000000 )" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 43, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. date/time columns values(DOUBLE(m,n),DOUBLE) ########
+set @arg00= 1.0e+10 ;
+insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 50, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 ) ;
+insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 51, @arg00, @arg00, @arg00, @arg00, @arg00) ;
+prepare stmt1 from "insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 52, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 )" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 53, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. date/time columns values(LONGBLOB,NULL) ########
+# Attention: c15 is timestamp and the manual says:
+# The first TIMESTAMP column in table row automatically is updated
+# to the current timestamp when the value of any other column in the
+# row is changed, unless the TIMESTAMP column explicitly is assigned
+# a value other than NULL.
+# That's why a fixed NOT NULL value is inserted.
+set @arg00= 'abc' ;
+set @arg00= NULL ;
+insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 60, NULL, NULL, '1991-01-01 01:01:01',
+ NULL, NULL) ;
+insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 61, @arg00, @arg00, '1991-01-01 01:01:01', @arg00, @arg00) ;
+prepare stmt1 from "insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 62, NULL, NULL, '1991-01-01 01:01:01',
+ NULL, NULL)" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 63, ?, ?, '1991-01-01 01:01:01', ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. date/time columns values(BIGINT,NULL) ########
+set @arg00= 8 ;
+set @arg00= NULL ;
+insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 71, @arg00, @arg00, '1991-01-01 01:01:01', @arg00, @arg00) ;
+prepare stmt2 from "insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 73, ?, ?, '1991-01-01 01:01:01', ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. date/time columns values(DOUBLE,NULL) ########
+set @arg00= 8.0 ;
+set @arg00= NULL ;
+insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 81, @arg00, @arg00, '1991-01-01 01:01:01', @arg00, @arg00) ;
+prepare stmt2 from "insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 83, ?, ?, '1991-01-01 01:01:01', ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00 ;
+
+--enable_query_log
+
+######## SELECT of all inserted records ########
+select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
+
+
+--disable_query_log
+select '-- select .. where date/time column = .. --' as test_sequence ;
+--enable_query_log
+######## SELECT .. WHERE column(date/time/..)=value(CHAR(n)/LONGTEXT) ########
+set @arg00= '1991-01-01 01:01:01' ;
+select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+ c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+ c17= '1991-01-01 01:01:01' ;
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+ and c17= @arg00 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+ c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+ c17= '1991-01-01 01:01:01'" ;
+execute stmt1 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## SELECT .. WHERE column(date/time/..)=value(DATETIME/LONGBLOB) ########
+set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
+select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+ c14= CAST('1991-01-01 01:01:01' as datetime) and
+ c15= CAST('1991-01-01 01:01:01' as datetime) and
+ c16= CAST('1991-01-01 01:01:01' as datetime) and
+ c17= CAST('1991-01-01 01:01:01' as datetime) ;
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+ and c17= @arg00 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+ c14= CAST('1991-01-01 01:01:01' as datetime) and
+ c15= CAST('1991-01-01 01:01:01' as datetime) and
+ c16= CAST('1991-01-01 01:01:01' as datetime) and
+ c17= CAST('1991-01-01 01:01:01' as datetime)" ;
+execute stmt1 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## SELECT .. WHERE column(year)=value(INT(10)/BIGINT) ########
+set @arg00= 1991 ;
+select 'true' as found from t9
+where c1= 20 and c17= 1991 ;
+select 'true' as found from t9
+where c1= 20 and c17= @arg00 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= 1991" ;
+execute stmt1 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= ?" ;
+execute stmt1 using @arg00 ;
+
+
+######## SELECT .. WHERE column(year)=value(DOUBLE(m,n)/DOUBLE) ########
+set @arg00= 1.991e+3 ;
+select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;
+select 'true' as found from t9
+where c1= 20 and abs(c17 - @arg00) < 0.01 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;
+execute stmt1 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - ?) < 0.01" ;
+execute stmt1 using @arg00 ;
+
diff --git a/mysql-test/include/ps_create.inc b/mysql-test/include/ps_create.inc
new file mode 100644
index 00000000000..dfc9c494b46
--- /dev/null
+++ b/mysql-test/include/ps_create.inc
@@ -0,0 +1,43 @@
+############### include/ps_create.inc ##################
+# #
+# drop + create the tables used in most PS test cases #
+# t/ps_*.test #
+# #
+########################################################
+
+#
+# NOTE: PLEASE SEE ps_1general.test (bottom)
+# BEFORE ADDING NEW TABLES HERE !!!
+#
+# Please be aware, that this file will be sourced by several
+# test case files stored within the subdirectory 't'.
+# So every change here will affect several test cases.
+
+#----------- Please insert your table definitions here ----------#
+
+
+#---- Please do not alter the following table definitions -------#
+
+--disable_warnings
+drop table if exists t1, t9 ;
+--enable_warnings
+
+eval create table t1
+(
+ a int, b varchar(30),
+ primary key(a)
+) engine = $type ;
+
+eval create table t9
+(
+ c1 tinyint, c2 smallint, c3 mediumint, c4 int,
+ c5 integer, c6 bigint, c7 float, c8 double,
+ c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
+ c13 date, c14 datetime, c15 timestamp(14), c16 time,
+ c17 year, c18 bit, c19 bool, c20 char,
+ c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
+ c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
+ c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
+ c32 set('monday', 'tuesday', 'wednesday'),
+ primary key(c1)
+) engine = $type ;
diff --git a/mysql-test/include/ps_modify.inc b/mysql-test/include/ps_modify.inc
new file mode 100644
index 00000000000..eb6820934f3
--- /dev/null
+++ b/mysql-test/include/ps_modify.inc
@@ -0,0 +1,360 @@
+###################### ps_modify.inc #########################
+# #
+# Tests for prepared statements: INSERT/DELETE/UPDATE... #
+# #
+##############################################################
+
+#
+# NOTE: PLEASE SEE ps_1general.test (bottom)
+# BEFORE ADDING NEW TEST CASES HERE !!!
+
+#
+# Please be aware, that this file will be sourced by several test case files
+# stored within the subdirectory 't'. So every change here will affect
+# several test cases.
+#
+# Please do not modify the structure (DROP/ALTER..) of the tables
+# 't1' and 't9'.
+#
+# But you are encouraged to use these two tables within your statements
+# (DELETE/UPDATE/...) whenever possible.
+# t1 - very simple table
+# t9 - table with nearly all available column types
+#
+# The structure and the content of these tables can be found in
+# include/ps_create.inc CREATE TABLE ...
+# include/ps_renew.inc DELETE all rows and INSERT some rows
+#
+# Both tables are managed by the same storage engine.
+# The type of the storage engine is stored in the variable '$type' .
+
+
+
+#------------------- Please insert your test cases here -------------------#
+
+
+
+#-------- Please be very carefull when editing behind this line ----------#
+
+--disable_query_log
+select '------ delete tests ------' as test_sequence ;
+--enable_query_log
+--source include/ps_renew.inc
+
+## delete without parameter
+prepare stmt1 from 'delete from t1 where a=2' ;
+execute stmt1;
+select a,b from t1 where a=2;
+# delete with row not found
+execute stmt1;
+
+## delete with one parameter in the where clause
+insert into t1 values(0,NULL);
+set @arg00=NULL;
+prepare stmt1 from 'delete from t1 where b=?' ;
+execute stmt1 using @arg00;
+select a,b from t1 where b is NULL ;
+set @arg00='one';
+execute stmt1 using @arg00;
+select a,b from t1 where b=@arg00;
+
+## truncate a table
+--error 1295
+prepare stmt1 from 'truncate table t1' ;
+
+
+--disable_query_log
+select '------ update tests ------' as test_sequence ;
+--enable_query_log
+--source include/ps_renew.inc
+
+## update without parameter
+prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ;
+execute stmt1;
+select a,b from t1 where a=2;
+# dummy update
+execute stmt1;
+select a,b from t1 where a=2;
+
+## update with one parameter in the set clause
+set @arg00=NULL;
+prepare stmt1 from 'update t1 set b=? where a=2' ;
+execute stmt1 using @arg00;
+select a,b from t1 where a=2;
+set @arg00='two';
+execute stmt1 using @arg00;
+select a,b from t1 where a=2;
+
+## update with one parameter in the where cause
+set @arg00=2;
+prepare stmt1 from 'update t1 set b=NULL where a=?' ;
+execute stmt1 using @arg00;
+select a,b from t1 where a=@arg00;
+update t1 set b='two' where a=@arg00;
+# row not found in update
+set @arg00=2000;
+execute stmt1 using @arg00;
+select a,b from t1 where a=@arg00;
+
+## update on primary key column (two parameters)
+set @arg00=2;
+set @arg01=22;
+prepare stmt1 from 'update t1 set a=? where a=?' ;
+# dummy update
+execute stmt1 using @arg00, @arg00;
+select a,b from t1 where a=@arg00;
+execute stmt1 using @arg01, @arg00;
+select a,b from t1 where a=@arg01;
+execute stmt1 using @arg00, @arg01;
+select a,b from t1 where a=@arg00;
+set @arg00=NULL;
+set @arg01=2;
+execute stmt1 using @arg00, @arg01;
+select a,b from t1 order by a;
+set @arg00=0;
+execute stmt1 using @arg01, @arg00;
+select a,b from t1 order by a;
+
+## update with subquery and several parameters
+set @arg00=23;
+set @arg01='two';
+set @arg02=2;
+set @arg03='two';
+set @arg04=2;
+--disable_warnings
+drop table if exists t2;
+--enable_warnings
+# t2 will be of table type 'MYISAM'
+create table t2 as select a,b from t1 ;
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a in (select ? from t2
+ where b = ? or a = ?)';
+--enable_info
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
+--disable_info
+select a,b from t1 where a = @arg00 ;
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a not in (select ? from t2
+ where b = ? or a = ?)';
+--enable_info
+execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
+--disable_info
+select a,b from t1 order by a ;
+drop table t2 ;
+# t2 is now of table type '$type'
+# The test battery for table type 'MERGE' gets here only a 'MYISAM' table
+#
+# Test UPDATE with SUBQUERY in prepared mode
+#
+eval create table t2
+(
+ a int, b varchar(30),
+ primary key(a)
+) engine = $type ;
+insert into t2(a,b) select a, b from t1 ;
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a in (select ? from t2
+ where b = ? or a = ?)';
+--enable_info
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
+--disable_info
+select a,b from t1 where a = @arg00 ;
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a not in (select ? from t2
+ where b = ? or a = ?)';
+--enable_info
+execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
+--disable_info
+select a,b from t1 order by a ;
+drop table t2 ;
+
+## update with parameters in limit
+set @arg00=1;
+prepare stmt1 from 'update t1 set b=''bla''
+where a=2
+limit 1';
+execute stmt1 ;
+select a,b from t1 where b = 'bla' ;
+# currently (May 2004, Version 4.1) it is impossible
+-- error 1064
+prepare stmt1 from 'update t1 set b=''bla''
+where a=2
+limit ?';
+
+--disable_query_log
+select '------ insert tests ------' as test_sequence ;
+--enable_query_log
+--source include/ps_renew.inc
+
+## insert without parameter
+prepare stmt1 from 'insert into t1 values(5, ''five'' )';
+execute stmt1;
+select a,b from t1 where a = 5;
+
+## insert with one parameter in values part
+set @arg00='six' ;
+prepare stmt1 from 'insert into t1 values(6, ? )';
+execute stmt1 using @arg00;
+select a,b from t1 where b = @arg00;
+# the second insert fails, because the first column is primary key
+--error 1062
+execute stmt1 using @arg00;
+set @arg00=NULL ;
+prepare stmt1 from 'insert into t1 values(0, ? )';
+execute stmt1 using @arg00;
+select a,b from t1 where b is NULL;
+
+## insert with two parameter in values part
+set @arg00=8 ;
+set @arg01='eight' ;
+prepare stmt1 from 'insert into t1 values(?, ? )';
+execute stmt1 using @arg00, @arg01 ;
+select a,b from t1 where b = @arg01;
+# cases derived from client_test.c: test_null()
+set @NULL= null ;
+set @arg00= 'abc' ;
+# execute must fail, because first column is primary key (-> not null)
+--error 1048
+execute stmt1 using @NULL, @NULL ;
+--error 1048
+execute stmt1 using @NULL, @NULL ;
+--error 1048
+execute stmt1 using @NULL, @arg00 ;
+--error 1048
+execute stmt1 using @NULL, @arg00 ;
+let $1 = 2;
+while ($1)
+{
+ eval set @arg01= 10000 + $1 ;
+ execute stmt1 using @arg01, @arg00 ;
+ dec $1;
+}
+select * from t1 where a > 10000 order by a ;
+delete from t1 where a > 10000 ;
+let $1 = 2;
+while ($1)
+{
+ eval set @arg01= 10000 + $1 ;
+ execute stmt1 using @arg01, @NULL ;
+ dec $1;
+}
+select * from t1 where a > 10000 order by a ;
+delete from t1 where a > 10000 ;
+let $1 = 10;
+while ($1)
+{
+ eval set @arg01= 10000 + $1 ;
+ execute stmt1 using @arg01, @arg01 ;
+ dec $1;
+}
+select * from t1 where a > 10000 order by a ;
+delete from t1 where a > 10000 ;
+
+
+## insert with two rows in values part
+set @arg00=81 ;
+set @arg01='8-1' ;
+set @arg02=82 ;
+set @arg03='8-2' ;
+prepare stmt1 from 'insert into t1 values(?,?),(?,?)';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
+select a,b from t1 where a in (@arg00,@arg02) ;
+
+## insert with two parameter in the set part
+set @arg00=9 ;
+set @arg01='nine' ;
+prepare stmt1 from 'insert into t1 set a=?, b=? ';
+execute stmt1 using @arg00, @arg01 ;
+select a,b from t1 where a = @arg00 ;
+
+## insert with parameters in the ON DUPLICATE KEY part
+set @arg00=6 ;
+set @arg01=1 ;
+prepare stmt1 from 'insert into t1 set a=?, b=''sechs''
+ on duplicate key update a=a + ?, b=concat(b,''modified'') ';
+execute stmt1 using @arg00, @arg01;
+select * from t1 order by a;
+set @arg00=81 ;
+set @arg01=1 ;
+--error 1062
+execute stmt1 using @arg00, @arg01;
+
+## insert, autoincrement column and ' SELECT LAST_INSERT_ID() '
+# cases derived from client_test.c: test_bug3117()
+--disable_warnings
+drop table if exists t2 ;
+--enable_warnings
+# The test battery for table type 'MERGE' gets here only a 'MYISAM' table
+eval create table t2 (id int auto_increment primary key)
+ENGINE= $type ;
+prepare stmt1 from ' select last_insert_id() ' ;
+insert into t2 values (NULL) ;
+execute stmt1 ;
+insert into t2 values (NULL) ;
+# bug#3117
+execute stmt1 ;
+drop table t2 ;
+
+## many parameters
+set @1000=1000 ;
+set @x1000_2="x1000_2" ;
+set @x1000_3="x1000_3" ;
+
+set @x1000="x1000" ;
+set @1100=1100 ;
+set @x1100="x1100" ;
+set @100=100 ;
+set @updated="updated" ;
+insert into t1 values(1000,'x1000_1') ;
+insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3)
+ on duplicate key update a = a + @100, b = concat(b,@updated) ;
+select a,b from t1 where a >= 1000 order by a ;
+delete from t1 where a >= 1000 ;
+insert into t1 values(1000,'x1000_1') ;
+prepare stmt1 from ' insert into t1 values(?,?),(?,?)
+ on duplicate key update a = a + ?, b = concat(b,?) ';
+execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ;
+select a,b from t1 where a >= 1000 order by a ;
+delete from t1 where a >= 1000 ;
+insert into t1 values(1000,'x1000_1') ;
+execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ;
+select a,b from t1 where a >= 1000 order by a ;
+delete from t1 where a >= 1000 ;
+
+## replace
+prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
+execute stmt1;
+execute stmt1;
+execute stmt1;
+
+
+
+## multi table statements
+--disable_query_log
+select '------ multi table tests ------' as test_sequence ;
+--enable_query_log
+# cases derived from client_test.c: test_multi
+delete from t1 ;
+delete from t9 ;
+insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
+insert into t9 (c1,c21)
+ values (1, 'one'), (2, 'two'), (3, 'three') ;
+prepare stmt_delete from " delete t1, t9
+ from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
+prepare stmt_update from " update t1, t9
+ set t1.b='updated', t9.c21='updated'
+ where t1.a=t9.c1 and t1.a=? ";
+prepare stmt_select1 from " select a, b from t1 order by a" ;
+prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
+set @arg00= 1 ;
+let $1= 3 ;
+while ($1)
+{
+ execute stmt_update using @arg00 ;
+ execute stmt_delete ;
+ execute stmt_select1 ;
+ execute stmt_select2 ;
+ set @arg00= @arg00 + 1 ;
+ dec $1 ;
+}
+
diff --git a/mysql-test/include/ps_modify1.inc b/mysql-test/include/ps_modify1.inc
new file mode 100644
index 00000000000..345654b2d66
--- /dev/null
+++ b/mysql-test/include/ps_modify1.inc
@@ -0,0 +1,105 @@
+###################### ps_modify1.inc ########################
+# #
+# Tests for prepared statements: big INSERT .. SELECTs #
+# #
+##############################################################
+
+#
+# NOTE: THESE TESTS CANNOT BE APPLIED TO TABLES OF TYPE MERGE.
+# Test which can be applied to MERGE tables should be stored in
+# include/ps_modify.inc .
+#
+
+#
+# NOTE: PLEASE SEE ps_1general.test (bottom)
+# BEFORE ADDING NEW TEST CASES HERE !!!
+
+#
+# Please be aware, that this file will be sourced by several test case files
+# stored within the subdirectory 't'. So every change here will affect
+# several test cases.
+#
+# Please do not modify the structure (DROP/ALTER..) of the tables
+# 't1' and 't9'.
+#
+# But you are encouraged to use these two tables within your statements
+# (DELETE/UPDATE/...) whenever possible.
+# t1 - very simple table
+# t9 - table with nearly all available column types
+#
+# The structure and the content of these tables can be found in
+# include/ps_create.inc CREATE TABLE ...
+# include/ps_renew.inc DELETE all rows and INSERT some rows
+#
+# Both tables are managed by the same storage engine.
+# The type of the storage engine is stored in the variable '$type' .
+
+
+
+#------------------- Please insert your test cases here -------------------#
+
+
+#-------- Please be very carefull when editing behind this line ----------#
+
+--source include/ps_renew.inc
+#
+# add a NULL row to t1: this row is used only in this test
+insert into t1 values(0,NULL) ;
+
+## big insert select statements
+set @duplicate='duplicate ' ;
+set @1000=1000 ;
+set @5=5 ;
+select a,b from t1 where a < 5 order by a ;
+--enable_info
+insert into t1 select a + @1000, concat(@duplicate,b) from t1
+where a < @5 ;
+--disable_info
+select a,b from t1 where a >= 1000 order by a ;
+delete from t1 where a >= 1000 ;
+prepare stmt1 from ' insert into t1 select a + ?, concat(?,b) from t1
+where a < ? ' ;
+--enable_info
+execute stmt1 using @1000, @duplicate, @5;
+--disable_info
+select a,b from t1 where a >= 1000 order by a ;
+delete from t1 where a >= 1000 ;
+
+set @1=1 ;
+set @2=2 ;
+set @100=100 ;
+set @float=1.00;
+set @five='five' ;
+--disable_warnings
+drop table if exists t2;
+--enable_warnings
+create table t2 like t1 ;
+--enable_info
+insert into t2 (b,a)
+select @duplicate, sum(first.a) from t1 first, t1 second
+ where first.a <> @5 and second.b = first.b
+ and second.b <> @five
+ group by second.b
+ having sum(second.a) > @2
+union
+select b, a + @100 from t1
+ where (a,b) in ( select sqrt(a+@1)+CAST(@float AS signed),b
+ from t1);
+--disable_info
+select a,b from t2 order by a ;
+delete from t2 ;
+prepare stmt1 from ' insert into t2 (b,a)
+select ?, sum(first.a)
+ from t1 first, t1 second
+ where first.a <> ? and second.b = first.b and second.b <> ?
+ group by second.b
+ having sum(second.a) > ?
+union
+select b, a + ? from t1
+ where (a,b) in ( select sqrt(a+?)+CAST(? AS signed),b
+ from t1 ) ' ;
+--enable_info
+execute stmt1 using @duplicate, @5, @five, @2, @100, @1, @float ;
+--disable_info
+select a,b from t2 order by a ;
+drop table t2;
diff --git a/mysql-test/include/ps_query.inc b/mysql-test/include/ps_query.inc
new file mode 100644
index 00000000000..e6f19c67138
--- /dev/null
+++ b/mysql-test/include/ps_query.inc
@@ -0,0 +1,773 @@
+####################### ps_query.inc #########################
+# #
+# Tests for prepared statements: SELECTs #
+# #
+##############################################################
+
+#
+# NOTE: PLEASE SEE ps_1general.test (bottom)
+# BEFORE ADDING NEW TEST CASES HERE !!!
+
+#
+# Please be aware, that this file will be sourced by several test case files
+# stored within the subdirectory 't'. So every change here will affect
+# several test cases.
+#
+# Please do not modify (INSERT/UPDATE/DELETE) the content or the
+# structure (DROP/ALTER..) of the tables
+# 't1' and 't9'.
+# Such tests should be done in include/ps_modify.inc .
+#
+# But you are encouraged to use these two tables within your SELECT statements
+# whenever possible.
+# t1 - very simple table
+# t9 - table with nearly all available column types
+#
+# The structure and the content of these tables can be found in
+# include/ps_create.inc CREATE TABLE ...
+# include/ps_renew.inc DELETE all rows and INSERT some rows
+#
+# Both tables are managed by the same storage engine.
+# The type of the storage engine is stored in the variable '$type' .
+
+
+
+#------------------- Please insert your test cases here -------------------#
+
+
+
+#-------- Please be very carefull when editing behind this line ----------#
+
+################ simple select tests ################
+--disable_query_log
+select '------ simple select tests ------' as test_sequence ;
+--enable_query_log
+
+##### many column types, but no parameter
+# heavy modified case derived from client_test.c: test_func_fields()
+prepare stmt1 from ' select * from t9 order by c1 ' ;
+--enable_metadata
+execute stmt1;
+--disable_metadata
+
+##### parameter used for keyword like SELECT (must fail)
+set @arg00='SELECT' ;
+# mysqltest gives no output for the next statement, Why ??
+--error 1064
+@arg00 a from t1 where a=1;
+--error 1064
+prepare stmt1 from ' ? a from t1 where a=1 ';
+
+##### parameter in select column list
+## parameter is not NULL
+set @arg00=1 ;
+select @arg00, b from t1 where a=1 ;
+prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+set @arg00='lion' ;
+select @arg00, b from t1 where a=1 ;
+prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+## parameter is NULL
+set @arg00=NULL ;
+select @arg00, b from t1 where a=1 ;
+prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+## parameter within an expression
+set @arg00=1 ;
+select b, a - @arg00 from t1 where a=1 ;
+prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+# case derived from client_test.c: test_ps_null_param()
+set @arg00=null ;
+select @arg00 as my_col ;
+prepare stmt1 from ' select ? as my_col';
+execute stmt1 using @arg00 ;
+select @arg00 + 1 as my_col ;
+prepare stmt1 from ' select ? + 1 as my_col';
+execute stmt1 using @arg00 ;
+select 1 + @arg00 as my_col ;
+prepare stmt1 from ' select 1 + ? as my_col';
+execute stmt1 using @arg00 ;
+## parameter is within a function
+# variations on 'substr'
+set @arg00='MySQL' ;
+select substr(@arg00,1,2) from t1 where a=1 ;
+prepare stmt1 from ' select substr(?,1,2) from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+set @arg00=3 ;
+select substr('MySQL',@arg00,5) from t1 where a=1 ;
+prepare stmt1 from ' select substr(''MySQL'',?,5) from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+select substr('MySQL',1,@arg00) from t1 where a=1 ;
+prepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+# variations on 'concat'
+set @arg00='MySQL' ;
+select a , concat(@arg00,b) from t1 order by a;
+# BUG#3796 Prepared statement, select concat(<parameter>,<column>),wrong result
+prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ;
+execute stmt1 using @arg00;
+#
+select a , concat(b,@arg00) from t1 order by a ;
+prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ;
+execute stmt1 using @arg00;
+
+# variations on 'group_concat'
+set @arg00='MySQL' ;
+select group_concat(@arg00,b order by a) from t1
+group by 'a' ;
+prepare stmt1 from ' select group_concat(?,b order by a) from t1
+group by ''a'' ' ;
+execute stmt1 using @arg00;
+#
+select group_concat(b,@arg00 order by a) from t1
+group by 'a' ;
+prepare stmt1 from ' select group_concat(b,? order by a) from t1
+group by ''a'' ' ;
+execute stmt1 using @arg00;
+
+## two parameters
+set @arg00='first' ;
+set @arg01='second' ;
+set @arg02=NULL;
+select @arg00, @arg01 from t1 where a=1 ;
+prepare stmt1 from ' select ?, ? from t1 where a=1 ' ;
+execute stmt1 using @arg00, @arg01 ;
+# NULL as first and/or last parameter
+execute stmt1 using @arg02, @arg01 ;
+execute stmt1 using @arg00, @arg02 ;
+execute stmt1 using @arg02, @arg02 ;
+# case derived from client_test.c: test_ps_conj_select()
+# for BUG#3420: select returned all rows of the table
+--disable_warnings
+drop table if exists t5 ;
+--enable_warnings
+create table t5 (id1 int(11) not null default '0',
+ value2 varchar(100), value1 varchar(100)) ;
+insert into t5 values (1,'hh','hh'),(2,'hh','hh'),
+ (1,'ii','ii'),(2,'ii','ii') ;
+prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ;
+set @arg00=1 ;
+set @arg01='hh' ;
+execute stmt1 using @arg00, @arg01 ;
+drop table t5 ;
+# case derived from client_test.c: test_bug1180()
+# for BUG#1180 optimized away part of WHERE clause
+--disable_warnings
+drop table if exists t5 ;
+--enable_warnings
+create table t5(session_id char(9) not null) ;
+insert into t5 values ('abc') ;
+prepare stmt1 from ' select * from t5
+where ?=''1111'' and session_id = ''abc'' ' ;
+set @arg00='abc' ;
+execute stmt1 using @arg00 ;
+set @arg00='1111' ;
+execute stmt1 using @arg00 ;
+set @arg00='abc' ;
+execute stmt1 using @arg00 ;
+drop table t5 ;
+
+
+##### parameter used for keyword FROM (must fail)
+set @arg00='FROM' ;
+--error 1064
+select a @arg00 t1 where a=1 ;
+--error 1064
+prepare stmt1 from ' select a ? t1 where a=1 ' ;
+##### parameter used for tablename (must fail)
+set @arg00='t1' ;
+--error 1064
+select a from @arg00 where a=1 ;
+--error 1064
+prepare stmt1 from ' select a from ? where a=1 ' ;
+##### parameter used for keyword WHERE tablename (must fail)
+set @arg00='WHERE' ;
+--error 1064
+select a from t1 @arg00 a=1 ;
+--error 1064
+prepare stmt1 from ' select a from t1 ? a=1 ' ;
+
+##### parameter used in where clause
+# parameter is not NULL
+set @arg00=1 ;
+select a FROM t1 where a=@arg00 ;
+prepare stmt1 from ' select a FROM t1 where a=? ' ;
+execute stmt1 using @arg00 ;
+set @arg00=1000 ;
+# row not found
+execute stmt1 using @arg00 ;
+# parameter is NULL
+set @arg00=NULL ;
+select a FROM t1 where a=@arg00 ;
+prepare stmt1 from ' select a FROM t1 where a=? ' ;
+execute stmt1 using @arg00 ;
+# parameter is not NULL within a function
+set @arg00=4 ;
+select a FROM t1 where a=sqrt(@arg00) ;
+prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
+execute stmt1 using @arg00 ;
+# parameter is NULL within a function
+set @arg00=NULL ;
+select a FROM t1 where a=sqrt(@arg00) ;
+prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
+execute stmt1 using @arg00 ;
+# parameter in IN
+set @arg00=2 ;
+set @arg01=3 ;
+select a FROM t1 where a in (@arg00,@arg01) order by a;
+prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a ';
+execute stmt1 using @arg00, @arg01;
+# case derived from client_test.c: test_bug1500()
+set @arg00= 'one' ;
+set @arg01= 'two' ;
+set @arg02= 'five' ;
+prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ;
+execute stmt1 using @arg00, @arg01, @arg02 ;
+# parameter in LIKE
+prepare stmt1 from ' select b FROM t1 where b like ? ';
+set @arg00='two' ;
+execute stmt1 using @arg00 ;
+set @arg00='tw%' ;
+execute stmt1 using @arg00 ;
+set @arg00='%wo' ;
+execute stmt1 using @arg00 ;
+# case derived from client_test.c: test_ps_null_param():
+# second part, comparisions with NULL placeholders in prepared
+# mode
+set @arg00=null ;
+insert into t9 set c1= 0, c5 = NULL ;
+select c5 from t9 where c5 > NULL ;
+prepare stmt1 from ' select c5 from t9 where c5 > ? ';
+execute stmt1 using @arg00 ;
+select c5 from t9 where c5 < NULL ;
+prepare stmt1 from ' select c5 from t9 where c5 < ? ';
+execute stmt1 using @arg00 ;
+select c5 from t9 where c5 = NULL ;
+prepare stmt1 from ' select c5 from t9 where c5 = ? ';
+execute stmt1 using @arg00 ;
+select c5 from t9 where c5 <=> NULL ;
+prepare stmt1 from ' select c5 from t9 where c5 <=> ? ';
+execute stmt1 using @arg00 ;
+delete from t9 where c1= 0 ;
+
+##### parameter used for operator in WHERE clause (must fail)
+set @arg00='>' ;
+--error 1064
+select a FROM t1 where a @arg00 1 ;
+--error 1064
+prepare stmt1 from ' select a FROM t1 where a ? 1 ' ;
+
+##### parameter used in group by clause
+set @arg00=1 ;
+select a,b FROM t1 where a is not NULL
+AND b is not NULL group by a - @arg00 ;
+prepare stmt1 from ' select a,b FROM t1 where a is not NULL
+AND b is not NULL group by a - ? ' ;
+execute stmt1 using @arg00 ;
+
+##### parameter used in having clause
+set @arg00='two' ;
+select a,b FROM t1 where a is not NULL
+AND b is not NULL having b <> @arg00 order by a ;
+prepare stmt1 from ' select a,b FROM t1 where a is not NULL
+AND b is not NULL having b <> ? order by a ' ;
+execute stmt1 using @arg00 ;
+
+##### parameter used in order clause
+set @arg00=1 ;
+select a,b FROM t1 where a is not NULL
+AND b is not NULL order by a - @arg00 ;
+prepare stmt1 from ' select a,b FROM t1 where a is not NULL
+AND b is not NULL order by a - ? ' ;
+execute stmt1 using @arg00 ;
+## What is the semantic of a single parameter (integer >0)
+# after order by? column number or constant
+set @arg00=2 ;
+select a,b from t1 order by 2 ;
+prepare stmt1 from ' select a,b from t1
+order by ? ';
+execute stmt1 using @arg00;
+set @arg00=1 ;
+execute stmt1 using @arg00;
+set @arg00=0 ;
+--error 1054
+execute stmt1 using @arg00;
+
+##### parameter used in limit clause
+set @arg00=1;
+prepare stmt1 from ' select a,b from t1 order by a
+limit 1 ';
+execute stmt1 ;
+# currently (May 2004, Version 4.1) it is impossible
+-- error 1064
+prepare stmt1 from ' select a,b from t1
+limit ? ';
+
+##### parameter used in many places
+set @arg00='b' ;
+set @arg01=0 ;
+set @arg02=2 ;
+set @arg03=2 ;
+select sum(a), @arg00 from t1 where a > @arg01
+and b is not null group by substr(b,@arg02)
+having sum(a) <> @arg03 ;
+prepare stmt1 from ' select sum(a), ? from t1 where a > ?
+and b is not null group by substr(b,?)
+having sum(a) <> ? ';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03;
+
+
+################ join tests ################
+--disable_query_log
+select '------ join tests ------' as test_sequence ;
+--enable_query_log
+
+# no parameter
+select first.a as a1, second.a as a2
+from t1 first, t1 second
+where first.a = second.a order by a1 ;
+prepare stmt1 from ' select first.a as a1, second.a as a2
+ from t1 first, t1 second
+ where first.a = second.a order by a1 ';
+execute stmt1 ;
+
+# some parameters
+set @arg00='ABC';
+set @arg01='two';
+set @arg02='one';
+select first.a, @arg00, second.a FROM t1 first, t1 second
+where @arg01 = first.b or first.a = second.a or second.b = @arg02
+order by second.a, first.a;
+prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
+ where ? = first.b or first.a = second.a or second.b = ?
+ order by second.a, first.a';
+execute stmt1 using @arg00, @arg01, @arg02;
+
+# test case derived from client_test.c: test_join()
+--disable_warnings
+drop table if exists t2 ;
+--enable_warnings
+create table t2 as select * from t1 ;
+set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
+set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
+set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
+set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
+set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
+set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
+set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
+let $1= 9 ;
+while ($1)
+{
+ --disable_query_log
+ eval select @query$1 as 'the join statement is:' ;
+ --enable_query_log
+ eval prepare stmt1 from @query$1 ;
+ let $2= 3 ;
+ while ($2)
+ {
+ execute stmt1 ;
+ dec $2 ;
+ }
+ dec $1 ;
+}
+drop table t2 ;
+
+
+################ subquery tests ################
+--disable_query_log
+select '------ subquery tests ------' as test_sequence ;
+--enable_query_log
+
+# no parameter
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = ''two'') ';
+execute stmt1 ;
+
+###### parameter in the outer part
+set @arg00='two' ;
+select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = 'two' ) and b=@arg00 ;
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = ''two'') and b=? ';
+execute stmt1 using @arg00;
+###### parameter in the inner part
+set @arg00='two' ;
+# Bug#4000 (only BDB tables)
+select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = @arg00 ) and b='two' ;
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = ? ) and b=''two'' ' ;
+execute stmt1 using @arg00;
+set @arg00=3 ;
+set @arg01='three' ;
+select a,b FROM t1 where (a,b) in (select 3, 'three');
+select a FROM t1 where (a,b) in (select @arg00,@arg01);
+prepare stmt1 from ' select a FROM t1 where (a,b) in (select ?, ?) ';
+execute stmt1 using @arg00, @arg01;
+
+###### parameters in the both parts
+set @arg00=1 ;
+set @arg01='two' ;
+set @arg02=2 ;
+set @arg03='two' ;
+# Bug#4000 (only BDB tables)
+select a, @arg00, b FROM t1 outer_table where
+ b=@arg01 and a = (select @arg02 from t1 where b = @arg03 ) ;
+prepare stmt1 from ' select a, ?, b FROM t1 outer_table where
+ b=? and a = (select ? from t1 where b = ? ) ' ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
+
+######## correlated subquery
+# no parameter
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = outer_table.b ) order by a ';
+# also Bug#4000 (only BDB tables)
+# Bug#4106 : ndb table, query with correlated subquery, wrong result
+execute stmt1 ;
+# test case derived from client_test.c: test_subqueries_ref
+let $1= 3 ;
+while ($1)
+{
+ prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+ execute stmt1 ;
+ deallocate prepare stmt1 ;
+ dec $1 ;
+}
+
+
+###### parameter in the outer part
+set @arg00='two' ;
+# Bug#4000 (only BDB tables)
+select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = outer_table.b ) and b=@arg00 ;
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = outer_table.b) and b=? ';
+# also Bug#4000 (only BDB tables)
+execute stmt1 using @arg00;
+
+###### parameter in the inner part
+set @arg00=2 ;
+select a, b FROM t1 outer_table where
+ a = (select a from t1 where a = @arg00 and b = outer_table.b) and b='two' ;
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where a = ? and b = outer_table.b) and b=''two'' ' ;
+execute stmt1 using @arg00;
+
+set @arg00=2 ;
+select a, b FROM t1 outer_table where
+ a = (select a from t1 where outer_table.a = @arg00 and a=2) and b='two' ;
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where outer_table.a = ? and a=2) and b=''two'' ' ;
+execute stmt1 using @arg00;
+
+###### parameters in the both parts
+set @arg00=1 ;
+set @arg01='two' ;
+set @arg02=2 ;
+set @arg03='two' ;
+# Bug#4000 (only BDB tables)
+select a, @arg00, b FROM t1 outer_table where
+ b=@arg01 and a = (select @arg02 from t1 where outer_table.b = @arg03
+ and outer_table.a=a ) ;
+prepare stmt1 from ' select a, ?, b FROM t1 outer_table where
+ b=? and a = (select ? from t1 where outer_table.b = ?
+ and outer_table.a=a ) ' ;
+# also Bug#4000 (only BDB tables)
+execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
+
+###### subquery after from
+set @arg00=1 ;
+set @arg01=0 ;
+select a, @arg00
+from ( select a - @arg00 as a from t1 where a=@arg00 ) as t2
+where a=@arg01;
+prepare stmt1 from ' select a, ?
+ from ( select a - ? as a from t1 where a=? ) as t2
+ where a=? ';
+execute stmt1 using @arg00, @arg00, @arg00, @arg01 ;
+
+###### subquery in select list
+# test case derived from client_test.c: test_create_drop
+--disable_warnings
+drop table if exists t2 ;
+--enable_warnings
+create table t2 as select * from t1;
+prepare stmt1 from ' select a in (select a from t2) from t1 ' ;
+execute stmt1 ;
+# test case derived from client_test.c: test_selecttmp()
+--disable_warnings
+drop table if exists t5, t6, t7 ;
+--enable_warnings
+create table t5 (a int , b int) ;
+create table t6 like t5 ;
+create table t7 like t5 ;
+insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
+ (2, -1), (3, 10) ;
+insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ;
+insert into t7 values (3, 3), (2, 2), (1, 1) ;
+prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1) from t7 ' ;
+let $1= 3 ;
+while ($1)
+{
+ execute stmt1 ;
+ dec $1 ;
+}
+drop table t5, t6, t7 ;
+
+
+###### heavy modified case derived from client_test.c: test_distinct()
+--disable_warnings
+drop table if exists t2 ;
+--enable_warnings
+create table t2 as select * from t9;
+## unusual and complex SELECT without parameters
+set @stmt= ' SELECT
+ (SELECT SUM(c1 + c12 + 0.0) FROM t2
+ where (t9.c2 - 0e-3) = t2.c2
+ GROUP BY t9.c15 LIMIT 1) as scalar_s,
+ exists (select 1.0e+0 from t2
+ where t2.c3 * 9.0000000000 = t9.c4) as exists_s,
+ c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s,
+ (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s
+FROM t9,
+(select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
+--enable_metadata
+prepare stmt1 from @stmt ;
+#
+# Result log was disabled upon test case failure in the optimized build.
+#
+--disable_result_log
+execute stmt1 ;
+--disable_metadata
+execute stmt1 ;
+## now expand the terrible SELECT to EXPLAIN SELECT
+set @stmt= concat('explain ',@stmt);
+--enable_metadata
+prepare stmt1 from @stmt ;
+execute stmt1 ;
+--disable_metadata
+# Bug#4271 prepared explain complex select, second executes crashes the server
+execute stmt1 ;
+## many parameters
+## replace the constants of the complex SELECT with parameters
+set @stmt= ' SELECT
+ (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
+ GROUP BY t9.c15 LIMIT 1) as scalar_s,
+ exists (select ? from t2
+ where t2.c3*?=t9.c4) as exists_s,
+ c5*? in (select c6+? from t2) as in_s,
+ (c7-?, c8-?) in (select c9+?, c10+? from t2) as in_row_s
+FROM t9,
+(select c25 x, c32 y from t2) tt WHERE x =c25 ' ;
+set @arg00= 0.0 ;
+set @arg01= 0e-3 ;
+set @arg02= 1.0e+0 ;
+set @arg03= 9.0000000000 ;
+set @arg04= 4 ;
+set @arg05= 0.3e+1 ;
+set @arg06= 4 ;
+set @arg07= 4 ;
+set @arg08= 4.0 ;
+set @arg09= 40e-1 ;
+--enable_metadata
+prepare stmt1 from @stmt ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+ @arg07, @arg08, @arg09 ;
+--disable_metadata
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+ @arg07, @arg08, @arg09 ;
+## now expand the terrible SELECT to EXPLAIN SELECT
+set @stmt= concat('explain ',@stmt);
+--enable_metadata
+prepare stmt1 from @stmt ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+ @arg07, @arg08, @arg09 ;
+--disable_metadata
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+ @arg07, @arg08, @arg09 ;
+--enable_result_log
+drop table t2 ;
+
+
+##### test case derived from client_test.c: test_bug4079()
+--error 1242
+select 1 < (select a from t1) ;
+prepare stmt1 from ' select 1 < (select a from t1) ' ;
+--error 1242
+execute stmt1 ;
+# Bug#5066 embedded server, select after failed subquery provides wrong result
+# (two additional records, all column values NULL)
+select 1 as my_col ;
+
+################ union tests ################
+--disable_query_log
+select '------ union tests ------' as test_sequence ;
+--enable_query_log
+
+# no parameter
+prepare stmt1 from ' select a FROM t1 where a=1
+ union distinct
+ select a FROM t1 where a=1 ';
+execute stmt1 ;
+# Bug#3577: the second execute crashes mysqld
+execute stmt1 ;
+prepare stmt1 from ' select a FROM t1 where a=1
+ union all
+ select a FROM t1 where a=1 ';
+execute stmt1 ;
+# test case derived from client_test.c: test_bad_union()
+--error 1222
+prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ;
+--error 1222
+prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ;
+--error 1222
+prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ;
+--error 1222
+prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ;
+
+
+##### everything in the first table
+# one parameter as constant in the first table
+set @arg00=1 ;
+select @arg00 FROM t1 where a=1
+union distinct
+select 1 FROM t1 where a=1;
+prepare stmt1 from ' select ? FROM t1 where a=1
+ union distinct
+ select 1 FROM t1 where a=1 ' ;
+execute stmt1 using @arg00;
+
+##### everything in the second table
+# one parameter as constant
+set @arg00=1 ;
+select 1 FROM t1 where a=1
+union distinct
+select @arg00 FROM t1 where a=1;
+prepare stmt1 from ' select 1 FROM t1 where a=1
+ union distinct
+ select ? FROM t1 where a=1 ' ;
+execute stmt1 using @arg00;
+
+# one parameter in every table
+set @arg00='a' ;
+select @arg00 FROM t1 where a=1
+union distinct
+select @arg00 FROM t1 where a=1;
+prepare stmt1 from ' select ? FROM t1 where a=1
+ union distinct
+ select ? FROM t1 where a=1 ';
+# BUG#3811 wrong result, prepared statement, union,
+# parameter in result column list
+execute stmt1 using @arg00, @arg00;
+prepare stmt1 from ' select ?
+ union distinct
+ select ? ';
+execute stmt1 using @arg00, @arg00;
+
+# many parameters
+set @arg00='a' ;
+set @arg01=1 ;
+set @arg02='a' ;
+set @arg03=2 ;
+select @arg00 FROM t1 where a=@arg01
+union distinct
+select @arg02 FROM t1 where a=@arg03;
+prepare stmt1 from ' select ? FROM t1 where a=?
+ union distinct
+ select ? FROM t1 where a=? ' ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03;
+
+## increased complexity
+
+set @arg00=1 ;
+# Bug#3686 the wrong server response was 1140 Mixing of GROUP columns ..
+prepare stmt1 from ' select sum(a) + 200, ? from t1
+union distinct
+select sum(a) + 200, 1 from t1
+group by b ' ;
+execute stmt1 using @arg00;
+
+set @Oporto='Oporto' ;
+set @Lisboa='Lisboa' ;
+set @0=0 ;
+set @1=1 ;
+set @2=2 ;
+set @3=3 ;
+set @4=4 ;
+select @Oporto,@Lisboa,@0,@1,@2,@3,@4 ;
+
+## union + group by
+select sum(a) + 200 as the_sum, @Oporto as the_town from t1
+group by b
+union distinct
+select sum(a) + 200, @Lisboa from t1
+group by b ;
+
+prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
+ group by b
+ union distinct
+ select sum(a) + 200, ? from t1
+ group by b ' ;
+execute stmt1 using @Oporto, @Lisboa;
+
+
+## union + where + group by
+select sum(a) + 200 as the_sum, @Oporto as the_town from t1
+where a > @1
+group by b
+union distinct
+select sum(a) + 200, @Lisboa from t1
+where a > @2
+group by b ;
+
+prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
+ where a > ?
+ group by b
+ union distinct
+ select sum(a) + 200, ? from t1
+ where a > ?
+ group by b ' ;
+execute stmt1 using @Oporto, @1, @Lisboa, @2;
+
+## union + where + group by + having
+select sum(a) + 200 as the_sum, @Oporto as the_town from t1
+where a > @1
+group by b
+having avg(a) > @2
+union distinct
+select sum(a) + 200, @Lisboa from t1
+where a > @2
+group by b
+having avg(a) > @3;
+
+prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
+ where a > ?
+ group by b
+ having avg(a) > ?
+ union distinct
+ select sum(a) + 200, ? from t1
+ where a > ?
+ group by b
+ having avg(a) > ? ';
+execute stmt1 using @Oporto, @1, @2, @Lisboa, @2, @3;
+
+
+################ explain select tests ################
+--disable_query_log
+select '------ explain select tests ------' as test_sequence ;
+--enable_query_log
+--disable_metadata
+# table with many column types
+prepare stmt1 from ' explain select * from t9 ' ;
+--enable_metadata
+execute stmt1;
+--disable_metadata
+
+
diff --git a/mysql-test/include/ps_renew.inc b/mysql-test/include/ps_renew.inc
new file mode 100644
index 00000000000..f50b5d58485
--- /dev/null
+++ b/mysql-test/include/ps_renew.inc
@@ -0,0 +1,35 @@
+################ include/ps_renew.inc #################
+# #
+# renew the content of t1 and t9 #
+# #
+#######################################################
+
+# truncate could not be used, because it is not supported
+# in tables of type MERGE
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+ c10= 1, c11= 1, c12 = 1,
+ c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+ c16= '11:11:11', c17= '2004',
+ c18= 1, c19=true, c20= 'a', c21= '123456789a',
+ c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+ c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+ c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+ c10= 9, c11= 9, c12 = 9,
+ c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+ c16= '11:11:11', c17= '2004',
+ c18= 1, c19=false, c20= 'a', c21= '123456789a',
+ c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+ c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+ c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
diff --git a/mysql-test/init_db.sql b/mysql-test/init_db.sql
new file mode 100644
index 00000000000..63483af00d6
--- /dev/null
+++ b/mysql-test/init_db.sql
@@ -0,0 +1,58 @@
+CREATE DATABASE mysql;
+CREATE DATABASE test;
+
+USE mysql;
+
+
+CREATE TABLE db (Host char(60) binary DEFAULT '' NOT NULL,Db char(64) binary DEFAULT '' NOT NULL,User char(16) binary DEFAULT '' NOT NULL,Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,References_priv enum('N','Y') DEFAULT 'N' NOT NULL,Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,PRIMARY KEY Host (Host,Db,User),KEY User (User)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';
+
+INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
+INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
+
+
+CREATE TABLE host (Host char(60) binary DEFAULT '' NOT NULL,Db char(64) binary DEFAULT '' NOT NULL,Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,References_priv enum('N','Y') DEFAULT 'N' NOT NULL,Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,PRIMARY KEY Host (Host,Db)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges';
+
+CREATE TABLE user (Host char(60) binary DEFAULT '' NOT NULL,User char(16) binary DEFAULT '' NOT NULL,Password char(41) binary DEFAULT '' NOT NULL,Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL,Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL,Process_priv enum('N','Y') DEFAULT 'N' NOT NULL,File_priv enum('N','Y') DEFAULT 'N' NOT NULL,Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,References_priv enum('N','Y') DEFAULT 'N' NOT NULL,Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL,Super_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL,Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL,Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL,ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL,ssl_cipher BLOB NOT NULL,x509_issuer BLOB NOT NULL,x509_subject BLOB NOT NULL,max_questions int(11) unsigned DEFAULT 0 NOT NULL,max_updates int(11) unsigned DEFAULT 0 NOT NULL,max_connections int(11) unsigned DEFAULT 0 NOT NULL,PRIMARY KEY Host (Host,User)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
+
+INSERT INTO user VALUES ('%','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
+INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
+INSERT INTO user VALUES ('%','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0);
+
+CREATE TABLE func (name char(64) binary DEFAULT '' NOT NULL,ret tinyint(1) DEFAULT '0' NOT NULL,dl char(128) DEFAULT '' NOT NULL,type enum ('function','aggregate') NOT NULL,PRIMARY KEY (name)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions';
+
+CREATE TABLE tables_priv (Host char(60) binary DEFAULT '' NOT NULL,Db char(64) binary DEFAULT '' NOT NULL,User char(16) binary DEFAULT '' NOT NULL,Table_name char(64) binary DEFAULT '' NOT NULL,Grantor char(77) DEFAULT '' NOT NULL,Timestamp timestamp(14),Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL,Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,PRIMARY KEY (Host,Db,User,Table_name),KEY Grantor (Grantor)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges';
+
+CREATE TABLE columns_priv (Host char(60) binary DEFAULT '' NOT NULL,Db char(64) binary DEFAULT '' NOT NULL,User char(16) binary DEFAULT '' NOT NULL,Table_name char(64) binary DEFAULT '' NOT NULL,Column_name char(64) binary DEFAULT '' NOT NULL,Timestamp timestamp(14),Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,PRIMARY KEY (Host,Db,User,Table_name,Column_name)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges';
+
+CREATE TABLE help_topic (help_topic_id int unsigned not null,name varchar(64) not null,help_category_id smallint unsigned not null,description text not null,example text not null,url varchar(128) not null,primary key (help_topic_id),unique index (name)) engine=MyISAM CHARACTER SET utf8 comment='help topics';
+
+CREATE TABLE help_category (help_category_id smallint unsigned not null,name varchar(64) not null,parent_category_id smallint unsigned null,url varchar(128) not null,primary key (help_category_id),unique index (name)) engine=MyISAM CHARACTER SET utf8 comment='help categories';
+
+CREATE TABLE help_keyword (help_keyword_id int unsigned not null,name varchar(64) not null,primary key (help_keyword_id),unique index (name)) engine=MyISAM CHARACTER SET utf8 comment='help keywords';
+
+CREATE TABLE help_relation (help_topic_id int unsigned not null references help_topic,help_keyword_id int unsigned not null references help_keyword,primary key (help_keyword_id, help_topic_id)) engine=MyISAM CHARACTER SET utf8 comment='keyword-topic relation';
+
+CREATE TABLE time_zone_name (Name char(64) NOT NULL,Time_zone_id int unsigned NOT NULL,PRIMARY KEY Name (Name)) engine=MyISAM CHARACTER SET utf8 comment='Time zone names';
+
+INSERT INTO time_zone_name (Name, Time_Zone_id) VALUES ('MET', 1), ('UTC', 2), ('Universal', 2), ('Europe/Moscow',3), ('leap/Europe/Moscow',4), ('Japan', 5);
+
+
+CREATE TABLE time_zone (Time_zone_id int unsigned NOT NULL auto_increment,Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL,PRIMARY KEY TzId (Time_zone_id)) engine=MyISAM CHARACTER SET utf8 comment='Time zones';
+
+INSERT INTO time_zone (Time_zone_id, Use_leap_seconds) VALUES (1,'N'), (2,'N'), (3,'N'), (4,'Y'), (5,'N');
+
+
+CREATE TABLE time_zone_transition (Time_zone_id int unsigned NOT NULL,Transition_time bigint signed NOT NULL,Transition_type_id int unsigned NOT NULL,PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time)) engine=MyISAM CHARACTER SET utf8 comment='Time zone transitions';
+
+INSERT INTO time_zone_transition (Time_zone_id, Transition_time, Transition_type_id) VALUES (1, -1693706400, 0) ,(1, -1680483600, 1),(1, -1663455600, 2) ,(1, -1650150000, 3),(1, -1632006000, 2) ,(1, -1618700400, 3),(1, -938905200, 2) ,(1, -857257200, 3),(1, -844556400, 2) ,(1, -828226800, 3),(1, -812502000, 2) ,(1, -796777200, 3),(1, 228877200, 2) ,(1, 243997200, 3),(1, 260326800, 2) ,(1, 276051600, 3),(1, 291776400, 2) ,(1, 307501200, 3),(1, 323830800, 2) ,(1, 338950800, 3),(1, 354675600, 2) ,(1, 370400400, 3),(1, 386125200, 2) ,(1, 401850000, 3),(1, 417574800, 2) ,(1, 433299600, 3),(1, 449024400, 2) ,(1, 465354000, 3),(1, 481078800, 2) ,(1, 496803600, 3),(1, 512528400, 2) ,(1, 528253200, 3),(1, 543978000, 2) ,(1, 559702800, 3),(1, 575427600, 2) ,(1, 591152400, 3),(1, 606877200, 2) ,(1, 622602000, 3),(1, 638326800, 2) ,(1, 654656400, 3),(1, 670381200, 2) ,(1, 686106000, 3),(1, 701830800, 2) ,(1, 717555600, 3),(1, 733280400, 2) ,(1, 749005200, 3),(1, 764730000, 2) ,(1, 780454800, 3),(1, 796179600, 2) ,(1, 811904400, 3),(1, 828234000, 2) ,(1, 846378000, 3),(1, 859683600, 2) ,(1, 877827600, 3),(1, 891133200, 2) ,(1, 909277200, 3),(1, 922582800, 2) ,(1, 941331600, 3),(1, 954032400, 2) ,(1, 972781200, 3),(1, 985482000, 2) ,(1, 1004230800, 3),(1, 1017536400, 2) ,(1, 1035680400, 3),(1, 1048986000, 2) ,(1, 1067130000, 3),(1, 1080435600, 2) ,(1, 1099184400, 3),(1, 1111885200, 2) ,(1, 1130634000, 3),(1, 1143334800, 2) ,(1, 1162083600, 3),(1, 1174784400, 2) ,(1, 1193533200, 3),(1, 1206838800, 2) ,(1, 1224982800, 3),(1, 1238288400, 2) ,(1, 1256432400, 3),(1, 1269738000, 2) ,(1, 1288486800, 3),(1, 1301187600, 2) ,(1, 1319936400, 3),(1, 1332637200, 2) ,(1, 1351386000, 3),(1, 1364691600, 2) ,(1, 1382835600, 3),(1, 1396141200, 2) ,(1, 1414285200, 3),(1, 1427590800, 2) ,(1, 1445734800, 3),(1, 1459040400, 2) ,(1, 1477789200, 3),(1, 1490490000, 2) ,(1, 1509238800, 3),(1, 1521939600, 2) ,(1, 1540688400, 3),(1, 1553994000, 2) ,(1, 1572138000, 3),(1, 1585443600, 2) ,(1, 1603587600, 3),(1, 1616893200, 2) ,(1, 1635642000, 3),(1, 1648342800, 2) ,(1, 1667091600, 3),(1, 1679792400, 2) ,(1, 1698541200, 3),(1, 1711846800, 2) ,(1, 1729990800, 3),(1, 1743296400, 2) ,(1, 1761440400, 3),(1, 1774746000, 2) ,(1, 1792890000, 3),(1, 1806195600, 2) ,(1, 1824944400, 3),(1, 1837645200, 2) ,(1, 1856394000, 3),(1, 1869094800, 2) ,(1, 1887843600, 3),(1, 1901149200, 2) ,(1, 1919293200, 3),(1, 1932598800, 2) ,(1, 1950742800, 3),(1, 1964048400, 2) ,(1, 1982797200, 3),(1, 1995498000, 2) ,(1, 2014246800, 3),(1, 2026947600, 2) ,(1, 2045696400, 3),(1, 2058397200, 2) ,(1, 2077146000, 3),(1, 2090451600, 2) ,(1, 2108595600, 3),(1, 2121901200, 2) ,(1, 2140045200, 3),(3, -1688265000, 2) ,(3, -1656819048, 1),(3, -1641353448, 2) ,(3, -1627965048, 3),(3, -1618716648, 1) ,(3, -1596429048, 3),(3, -1593829848, 5) ,(3, -1589860800, 4),(3, -1542427200, 5) ,(3, -1539493200, 6),(3, -1525323600, 5) ,(3, -1522728000, 4),(3, -1491188400, 7) ,(3, -1247536800, 4),(3, 354920400, 5) ,(3, 370728000, 4),(3, 386456400, 5) ,(3, 402264000, 4),(3, 417992400, 5) ,(3, 433800000, 4),(3, 449614800, 5) ,(3, 465346800, 8),(3, 481071600, 9) ,(3, 496796400, 8),(3, 512521200, 9) ,(3, 528246000, 8),(3, 543970800, 9) ,(3, 559695600, 8),(3, 575420400, 9) ,(3, 591145200, 8),(3, 606870000, 9) ,(3, 622594800, 8),(3, 638319600, 9) ,(3, 654649200, 8),(3, 670374000, 10) ,(3, 686102400, 11),(3, 695779200, 8) ,(3, 701812800, 5),(3, 717534000, 4) ,(3, 733273200, 9),(3, 748998000, 8) ,(3, 764722800, 9),(3, 780447600, 8) ,(3, 796172400, 9),(3, 811897200, 8) ,(3, 828226800, 9),(3, 846370800, 8) ,(3, 859676400, 9),(3, 877820400, 8) ,(3, 891126000, 9),(3, 909270000, 8) ,(3, 922575600, 9),(3, 941324400, 8) ,(3, 954025200, 9),(3, 972774000, 8) ,(3, 985474800, 9),(3, 1004223600, 8) ,(3, 1017529200, 9),(3, 1035673200, 8) ,(3, 1048978800, 9),(3, 1067122800, 8) ,(3, 1080428400, 9),(3, 1099177200, 8) ,(3, 1111878000, 9),(3, 1130626800, 8) ,(3, 1143327600, 9),(3, 1162076400, 8) ,(3, 1174777200, 9),(3, 1193526000, 8) ,(3, 1206831600, 9),(3, 1224975600, 8) ,(3, 1238281200, 9),(3, 1256425200, 8) ,(3, 1269730800, 9),(3, 1288479600, 8) ,(3, 1301180400, 9),(3, 1319929200, 8) ,(3, 1332630000, 9),(3, 1351378800, 8) ,(3, 1364684400, 9),(3, 1382828400, 8) ,(3, 1396134000, 9),(3, 1414278000, 8) ,(3, 1427583600, 9),(3, 1445727600, 8) ,(3, 1459033200, 9),(3, 1477782000, 8) ,(3, 1490482800, 9),(3, 1509231600, 8) ,(3, 1521932400, 9),(3, 1540681200, 8) ,(3, 1553986800, 9),(3, 1572130800, 8) ,(3, 1585436400, 9),(3, 1603580400, 8) ,(3, 1616886000, 9),(3, 1635634800, 8) ,(3, 1648335600, 9),(3, 1667084400, 8) ,(3, 1679785200, 9),(3, 1698534000, 8) ,(3, 1711839600, 9),(3, 1729983600, 8) ,(3, 1743289200, 9),(3, 1761433200, 8) ,(3, 1774738800, 9),(3, 1792882800, 8) ,(3, 1806188400, 9),(3, 1824937200, 8) ,(3, 1837638000, 9),(3, 1856386800, 8) ,(3, 1869087600, 9),(3, 1887836400, 8) ,(3, 1901142000, 9),(3, 1919286000, 8) ,(3, 1932591600, 9),(3, 1950735600, 8) ,(3, 1964041200, 9),(3, 1982790000, 8) ,(3, 1995490800, 9),(3, 2014239600, 8) ,(3, 2026940400, 9),(3, 2045689200, 8) ,(3, 2058390000, 9),(3, 2077138800, 8) ,(3, 2090444400, 9),(3, 2108588400, 8) ,(3, 2121894000, 9),(3, 2140038000, 8),(4, -1688265000, 2) ,(4, -1656819048, 1),(4, -1641353448, 2) ,(4, -1627965048, 3),(4, -1618716648, 1) ,(4, -1596429048, 3),(4, -1593829848, 5) ,(4, -1589860800, 4),(4, -1542427200, 5) ,(4, -1539493200, 6),(4, -1525323600, 5) ,(4, -1522728000, 4),(4, -1491188400, 7) ,(4, -1247536800, 4),(4, 354920409, 5) ,(4, 370728010, 4),(4, 386456410, 5) ,(4, 402264011, 4),(4, 417992411, 5) ,(4, 433800012, 4),(4, 449614812, 5) ,(4, 465346812, 8),(4, 481071612, 9) ,(4, 496796413, 8),(4, 512521213, 9) ,(4, 528246013, 8),(4, 543970813, 9) ,(4, 559695613, 8),(4, 575420414, 9) ,(4, 591145214, 8),(4, 606870014, 9) ,(4, 622594814, 8),(4, 638319615, 9) ,(4, 654649215, 8),(4, 670374016, 10) ,(4, 686102416, 11),(4, 695779216, 8) ,(4, 701812816, 5),(4, 717534017, 4) ,(4, 733273217, 9),(4, 748998018, 8) ,(4, 764722818, 9),(4, 780447619, 8) ,(4, 796172419, 9),(4, 811897219, 8) ,(4, 828226820, 9),(4, 846370820, 8) ,(4, 859676420, 9),(4, 877820421, 8) ,(4, 891126021, 9),(4, 909270021, 8) ,(4, 922575622, 9),(4, 941324422, 8) ,(4, 954025222, 9),(4, 972774022, 8) ,(4, 985474822, 9),(4, 1004223622, 8) ,(4, 1017529222, 9),(4, 1035673222, 8) ,(4, 1048978822, 9),(4, 1067122822, 8) ,(4, 1080428422, 9),(4, 1099177222, 8) ,(4, 1111878022, 9),(4, 1130626822, 8) ,(4, 1143327622, 9),(4, 1162076422, 8) ,(4, 1174777222, 9),(4, 1193526022, 8) ,(4, 1206831622, 9),(4, 1224975622, 8) ,(4, 1238281222, 9),(4, 1256425222, 8) ,(4, 1269730822, 9),(4, 1288479622, 8) ,(4, 1301180422, 9),(4, 1319929222, 8) ,(4, 1332630022, 9),(4, 1351378822, 8) ,(4, 1364684422, 9),(4, 1382828422, 8) ,(4, 1396134022, 9),(4, 1414278022, 8) ,(4, 1427583622, 9),(4, 1445727622, 8) ,(4, 1459033222, 9),(4, 1477782022, 8) ,(4, 1490482822, 9),(4, 1509231622, 8) ,(4, 1521932422, 9),(4, 1540681222, 8) ,(4, 1553986822, 9),(4, 1572130822, 8) ,(4, 1585436422, 9),(4, 1603580422, 8) ,(4, 1616886022, 9),(4, 1635634822, 8) ,(4, 1648335622, 9),(4, 1667084422, 8) ,(4, 1679785222, 9),(4, 1698534022, 8) ,(4, 1711839622, 9),(4, 1729983622, 8) ,(4, 1743289222, 9),(4, 1761433222, 8) ,(4, 1774738822, 9),(4, 1792882822, 8) ,(4, 1806188422, 9),(4, 1824937222, 8) ,(4, 1837638022, 9),(4, 1856386822, 8) ,(4, 1869087622, 9),(4, 1887836422, 8) ,(4, 1901142022, 9),(4, 1919286022, 8) ,(4, 1932591622, 9),(4, 1950735622, 8) ,(4, 1964041222, 9),(4, 1982790022, 8) ,(4, 1995490822, 9),(4, 2014239622, 8) ,(4, 2026940422, 9),(4, 2045689222, 8) ,(4, 2058390022, 9),(4, 2077138822, 8) ,(4, 2090444422, 9),(4, 2108588422, 8) ,(4, 2121894022, 9),(4, 2140038022, 8);
+
+
+CREATE TABLE time_zone_transition_type (Time_zone_id int unsigned NOT NULL,Transition_type_id int unsigned NOT NULL,Offset int signed DEFAULT 0 NOT NULL,Is_DST tinyint unsigned DEFAULT 0 NOT NULL,Abbreviation char(8) DEFAULT '' NOT NULL,PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id)) engine=MyISAM CHARACTER SET utf8 comment='Time zone transition types';
+
+INSERT INTO time_zone_transition_type (Time_zone_id,Transition_type_id, Offset, Is_DST, Abbreviation) VALUES (1, 0, 7200, 1, 'MEST') ,(1, 1, 3600, 0, 'MET') ,(1, 2, 7200, 1, 'MEST') ,(1, 3, 3600, 0, 'MET') ,(2, 0, 0, 0, 'UTC') ,(3, 0, 9000, 0, 'MMT') ,(3, 1, 12648, 1, 'MST') ,(3, 2, 9048, 0, 'MMT') ,(3, 3, 16248, 1, 'MDST') ,(3, 4, 10800, 0, 'MSK') ,(3, 5, 14400, 1, 'MSD') ,(3, 6, 18000, 1, 'MSD') ,(3, 7, 7200, 0, 'EET') ,(3, 8, 10800, 0, 'MSK') ,(3, 9, 14400, 1, 'MSD') ,(3, 10, 10800, 1, 'EEST') ,(3, 11, 7200, 0, 'EET') ,(4, 0, 9000, 0, 'MMT') ,(4, 1, 12648, 1, 'MST') ,(4, 2, 9048, 0, 'MMT') ,(4, 3, 16248, 1, 'MDST') ,(4, 4, 10800, 0, 'MSK') ,(4, 5, 14400, 1, 'MSD') ,(4, 6, 18000, 1, 'MSD') ,(4, 7, 7200, 0, 'EET') ,(4, 8, 10800, 0, 'MSK') ,(4, 9, 14400, 1, 'MSD') ,(4, 10, 10800, 1, 'EEST') ,(4, 11, 7200, 0, 'EET') ,(5, 0, 32400, 0, 'CJT') ,(5, 1, 32400, 0, 'JST');
+
+CREATE TABLE time_zone_leap_second (Transition_time bigint signed NOT NULL,Correction int signed NOT NULL,PRIMARY KEY TranTime (Transition_time)) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones';
+
+INSERT INTO time_zone_leap_second (Transition_time, Correction) VALUES (78796800, 1) ,(94694401, 2) ,(126230402, 3) ,(157766403, 4) ,(189302404, 5) ,(220924805, 6) ,(252460806, 7) ,(283996807, 8) ,(315532808, 9) ,(362793609, 10) ,(394329610, 11) ,(425865611, 12) ,(489024012, 13) ,(567993613, 14) ,(631152014, 15) ,(662688015, 16) ,(709948816, 17) ,(741484817, 18) ,(773020818, 19) ,(820454419, 20) ,(867715220, 21) ,(915148821, 22);
+
+
diff --git a/mysql-test/install_test_db.sh b/mysql-test/install_test_db.sh
index 0b95809037f..4554b92857e 100644
--- a/mysql-test/install_test_db.sh
+++ b/mysql-test/install_test_db.sh
@@ -6,22 +6,26 @@
# columns_priv in the mysql database, as well as the func table.
if [ x$1 = x"--bin" ]; then
- shift 1
-
-# Check if it's a binary distribution or a 'make install'
-if test -x ../libexec/mysqld
- then
- execdir=../libexec
- else
- execdir=../bin
-fi
- bindir=../bin
- BINARY_DIST=1
- fix_bin=mysql-test
+ shift 1
+
+ # Check if it's a binary distribution or a 'make install'
+ if test -x ../libexec/mysqld
+ then
+ execdir=../libexec
+ else
+ execdir=../bin
+ fi
+ bindir=../bin
+ BINARY_DIST=1
+ fix_bin=mysql-test
+ scriptdir=../bin
+ libexecdir=../libexec
else
- execdir=../sql
- bindir=../client
- fix_bin=.
+ execdir=../sql
+ bindir=../client
+ fix_bin=.
+ scriptdir=../scripts
+ libexecdir=../libexec
fi
vardir=var
@@ -32,8 +36,13 @@ then
data=var/slave-data
ldata=$fix_bin/var/slave-data
else
- data=var/master-data
- ldata=$fix_bin/var/master-data
+ if [ x$1 = x"-1" ]
+ then
+ data=var/master-data1
+ else
+ data=var/master-data
+ fi
+ ldata=$fix_bin/$data
fi
mdata=$data/mysql
@@ -41,8 +50,13 @@ EXTRA_ARG=""
if test ! -x $execdir/mysqld
then
- echo "mysqld is missing - looked in $execdir"
- exit 1
+ if test ! -x $libexecdir/mysqld
+ then
+ echo "mysqld is missing - looked in $execdir and in $libexecdir"
+ exit 1
+ else
+ execdir=$libexecdir
+ fi
fi
# On IRIX hostname is in /usr/bsd so add this to the path
@@ -64,177 +78,15 @@ if [ x$BINARY_DIST = x1 ] ; then
basedir=..
else
basedir=.
-EXTRA_ARG="--language=../sql/share/english/"
-fi
-
-# Initialize variables
-c_d="" i_d=""
-c_h="" i_h=""
-c_u="" i_u=""
-c_f="" i_f=""
-c_t="" c_c=""
-
-# Check for old tables
-if test ! -f $mdata/db.frm
-then
- # mysqld --bootstrap wants one command/line
- c_d="$c_d CREATE TABLE db ("
- c_d="$c_d Host char(60) binary DEFAULT '' NOT NULL,"
- c_d="$c_d Db char(64) binary DEFAULT '' NOT NULL,"
- c_d="$c_d User char(16) binary DEFAULT '' NOT NULL,"
- c_d="$c_d Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_d="$c_d Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_d="$c_d Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_d="$c_d Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_d="$c_d Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_d="$c_d Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_d="$c_d Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_d="$c_d References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_d="$c_d Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_d="$c_d Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_d="$c_d Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_d="$c_d Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_d="$c_d PRIMARY KEY Host (Host,Db,User),"
- c_d="$c_d KEY User (User)"
- c_d="$c_d )"
- c_d="$c_d comment='Database privileges';"
-
- i_d="INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
- INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');"
-fi
-
-if test ! -f $mdata/host.frm
-then
- c_h="$c_h CREATE TABLE host ("
- c_h="$c_h Host char(60) binary DEFAULT '' NOT NULL,"
- c_h="$c_h Db char(64) binary DEFAULT '' NOT NULL,"
- c_h="$c_h Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_h="$c_h Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_h="$c_h Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_h="$c_h Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_h="$c_h Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_h="$c_h Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_h="$c_h Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_h="$c_h References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_h="$c_h Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_h="$c_h Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_h="$c_h Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_h="$c_h Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_h="$c_h PRIMARY KEY Host (Host,Db)"
- c_h="$c_h )"
- c_h="$c_h comment='Host privileges; Merged with database privileges';"
-fi
-
-if test ! -f $mdata/user.frm
-then
- c_u="$c_u CREATE TABLE user ("
- c_u="$c_u Host char(60) binary DEFAULT '' NOT NULL,"
- c_u="$c_u User char(16) binary DEFAULT '' NOT NULL,"
- c_u="$c_u Password char(16) binary DEFAULT '' NOT NULL,"
- c_u="$c_u Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Process_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u File_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Super_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
- c_u="$c_u ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL,"
- c_u="$c_u ssl_cipher BLOB NOT NULL,"
- c_u="$c_u x509_issuer BLOB NOT NULL,"
- c_u="$c_u x509_subject BLOB NOT NULL,"
- c_u="$c_u max_questions int(11) unsigned DEFAULT 0 NOT NULL,"
- c_u="$c_u max_updates int(11) unsigned DEFAULT 0 NOT NULL,"
- c_u="$c_u max_connections int(11) unsigned DEFAULT 0 NOT NULL,"
- c_u="$c_u PRIMARY KEY Host (Host,User)"
- c_u="$c_u )"
- c_u="$c_u comment='Users and global privileges';"
-
- i_u="INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
- INSERT INTO user VALUES ('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
- REPLACE INTO user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
- INSERT INTO user (host,user) values ('localhost','');
- INSERT INTO user (host,user) values ('$hostname','');"
-fi
-
-if test ! -f $mdata/func.frm
-then
- c_f="$c_f CREATE TABLE func ("
- c_f="$c_f name char(64) binary DEFAULT '' NOT NULL,"
- c_f="$c_f ret tinyint(1) DEFAULT '0' NOT NULL,"
- c_f="$c_f dl char(128) DEFAULT '' NOT NULL,"
- c_f="$c_f type enum ('function','aggregate') NOT NULL,"
- c_f="$c_f PRIMARY KEY (name)"
- c_f="$c_f )"
- c_f="$c_f comment='User defined functions';"
-fi
-
-if test ! -f $mdata/tables_priv.frm
-then
- c_t="$c_t CREATE TABLE tables_priv ("
- c_t="$c_t Host char(60) binary DEFAULT '' NOT NULL,"
- c_t="$c_t Db char(64) binary DEFAULT '' NOT NULL,"
- c_t="$c_t User char(16) binary DEFAULT '' NOT NULL,"
- c_t="$c_t Table_name char(64) binary DEFAULT '' NOT NULL,"
- c_t="$c_t Grantor char(77) DEFAULT '' NOT NULL,"
- c_t="$c_t Timestamp timestamp(14),"
- c_t="$c_t Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL,"
- c_t="$c_t Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,"
- c_t="$c_t PRIMARY KEY (Host,Db,User,Table_name),"
- c_t="$c_t KEY Grantor (Grantor)"
- c_t="$c_t )"
- c_t="$c_t comment='Table privileges';"
-fi
-
-if test ! -f $mdata/columns_priv.frm
-then
- c_c="$c_c CREATE TABLE columns_priv ("
- c_c="$c_c Host char(60) binary DEFAULT '' NOT NULL,"
- c_c="$c_c Db char(64) binary DEFAULT '' NOT NULL,"
- c_c="$c_c User char(16) binary DEFAULT '' NOT NULL,"
- c_c="$c_c Table_name char(64) binary DEFAULT '' NOT NULL,"
- c_c="$c_c Column_name char(64) binary DEFAULT '' NOT NULL,"
- c_c="$c_c Timestamp timestamp(14),"
- c_c="$c_c Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,"
- c_c="$c_c PRIMARY KEY (Host,Db,User,Table_name,Column_name)"
- c_c="$c_c )"
- c_c="$c_c comment='Column privileges';"
+EXTRA_ARG="--language=../sql/share/english/ --character-sets-dir=../sql/share/charsets/"
fi
mysqld_boot=" $execdir/mysqld --no-defaults --bootstrap --skip-grant-tables \
- --basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb --skip-warnings $EXTRA_ARG"
+ --basedir=$basedir --datadir=$ldata --skip-innodb --skip-ndbcluster --skip-bdb \
+ $EXTRA_ARG"
echo "running $mysqld_boot"
-if $mysqld_boot << END_OF_DATA
-use mysql;
-$c_d
-$i_d
-
-$c_h
-$i_h
-
-$c_u
-$i_u
-
-$c_f
-$i_f
-
-$c_t
-$c_c
-END_OF_DATA
+if $scriptdir/mysql_create_system_tables test $mdata $hostname | $mysqld_boot
then
exit 0
else
diff --git a/mysql-test/misc/kill_master.sh b/mysql-test/misc/kill_master.sh
new file mode 100644
index 00000000000..7938c9d3ac2
--- /dev/null
+++ b/mysql-test/misc/kill_master.sh
@@ -0,0 +1,4 @@
+kill -9 `cat var/run/master.pid`
+# The kill may fail if process has already gone away,
+# so don't use the exit code of the kill. Use 0.
+exit 0
diff --git a/mysql-test/my_create_tables.c b/mysql-test/my_create_tables.c
new file mode 100644
index 00000000000..405f66dc8df
--- /dev/null
+++ b/mysql-test/my_create_tables.c
@@ -0,0 +1,646 @@
+#include <stdio.h>
+#include <errno.h>
+#ifndef __WIN__
+#include <dirent.h>
+#endif
+#include <string.h>
+#ifdef __NETWARE__
+#include <screen.h>
+#include <proc.h>
+#else
+#include <sys/types.h>
+#ifndef __WIN__
+#include <sys/wait.h>
+#include <unistd.h>
+#else
+#include <direct.h>
+#include <stdlib.h>
+#include <stdio.h>
+#endif
+#endif
+#include <ctype.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <assert.h>
+#include "my_manage.h"
+
+/*
+ Synopsis:
+ This function testes a exist file
+
+Arguments:
+ mdata: path to data
+ file_name: name of file
+Output:
+ A zero value indicates that file is exist.
+*/
+bool test_sys_file(const char *mdata,const char *file_name)
+{
+ struct stat file;
+ char path_file_name[PATH_MAX];
+ snprintf(path_file_name, PATH_MAX, "%s/%s", mdata, file_name);
+ return(stat(path_file_name,&file));
+}
+
+/*
+ Synopsis:
+ This function creates a file with sql requstes for creating
+ system data files.
+
+Arguments:
+ mdata: path to data
+ output_file: file name for output file
+ test: to create system files with test data
+Output:
+ A zero value indicates a success.
+*/
+bool create_system_files(const char *mdata,const char *output_file, bool test)
+{
+ FILE *out;
+
+ out = fopen(output_file, "w+");
+
+ if (!out)
+ return 1;
+
+ if (test_sys_file(mdata,"mysql"))
+ {
+ fprintf(out,"CREATE DATABASE mysql;\n");
+ }
+
+ if (test && test_sys_file(mdata,"test"))
+ {
+ fprintf(out,"CREATE DATABASE test;\n");
+ }
+
+ fprintf(out,"USE mysql;\n");
+
+ if (test_sys_file(mdata,"mysql/db.frm"))
+ {
+ fprintf(out,
+ "CREATE TABLE db ("
+ "Host char(60) binary DEFAULT '' NOT NULL,"
+ "Db char(64) binary DEFAULT '' NOT NULL,"
+ "User char(16) binary DEFAULT '' NOT NULL,"
+ "Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "PRIMARY KEY Host (Host,Db,User),"
+ "KEY User (User))"
+ "comment='Database privileges';\n");
+
+ if (test)
+ {
+ fprintf(out,"INSERT INTO db VALUES ('%%','test','','Y','Y','Y','Y'"
+ ",'Y','Y','N','Y','Y','Y','Y','Y');\n");
+ fprintf(out,"INSERT INTO db VALUES ('%%','test\\_%%','','Y','Y','Y'"
+ ",'Y','Y','Y','N','Y','Y','Y','Y','Y');\n");
+ }
+ }
+
+ if (test_sys_file(mdata,"mysql/host.frm"))
+ {
+ fprintf(out,
+ "CREATE TABLE host ("
+ "Host char(60) binary DEFAULT '' NOT NULL,"
+ "Db char(64) binary DEFAULT '' NOT NULL,"
+ "Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "PRIMARY KEY Host (Host,Db))"
+ "comment='Host privileges;"
+ " Merged with database privileges';\n");
+ }
+
+ if (test_sys_file(mdata,"mysql/user.frm"))
+ {
+#ifdef __WIN__
+ WSADATA wsa_data;
+#endif
+ char hostname[FN_REFLEN];
+
+#ifdef __WIN__
+ if (WSAStartup(MAKEWORD( 2, 2 ),&wsa_data))
+ return 1;
+#endif
+ if (gethostname(hostname, FN_REFLEN))
+ return 1;
+#ifdef __WIN__
+ WSACleanup( );
+#endif
+
+ if (strchr(hostname, '.') == NULL)
+ strcat(hostname, "%");
+
+ fprintf(out,
+ "CREATE TABLE user ("
+ "Host char(60) binary DEFAULT '' NOT NULL,"
+ "User char(16) binary DEFAULT '' NOT NULL,"
+ "Password char(41) binary DEFAULT '' NOT NULL,"
+ "Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Process_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "File_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Super_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
+ "ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL,"
+ "ssl_cipher BLOB NOT NULL,"
+ "x509_issuer BLOB NOT NULL,"
+ "x509_subject BLOB NOT NULL,"
+ "max_questions int(11) unsigned DEFAULT 0 NOT NULL,"
+ "max_updates int(11) unsigned DEFAULT 0 NOT NULL,"
+ "max_connections int(11) unsigned DEFAULT 0 NOT NULL,"
+ "PRIMARY KEY Host (Host,User)"
+ ") comment='Users and global privileges';\n");
+
+ if (test)
+ {
+ fprintf(out,
+ "INSERT INTO user VALUES ('localhost','root',''"
+ ",'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'"
+ ",'Y','Y','Y','Y','Y','','','','',0,0,0);\n");
+ fprintf(out,
+ "INSERT INTO user VALUES ('%s','root','','Y','Y',"
+ "'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y',"
+ "'Y','Y','Y','Y','','','','',0,0,0);\n",hostname);
+ fprintf(out,
+ "REPLACE INTO user VALUES ('127.0.0.1','root','',"
+ "'Y','Y','Y','Y','Y','Y',"
+ "'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'"
+ ",'Y','','','','',0,0,0);\n");
+ fprintf(out,"INSERT INTO user (host,user) values ('localhost','');\n");
+ fprintf(out,"INSERT INTO user (host,user) values ('%s','');\n",hostname);
+ }
+ else
+ {
+ fprintf(out,
+ "INSERT INTO user VALUES ('localhost','root','',"
+ "'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y',"
+ "'Y','Y','Y','Y','','','','',0,0,0);\n");
+#ifndef __WIN__
+ fprintf(out,
+ "INSERT INTO user VALUES ('%s','root','','Y','Y',"
+ "'Y','Y','Y','Y','Y','Y'"
+ "'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','',''"
+ ",'','',0,0,0);\n",hostname);
+ fprintf(out,"INSERT INTO user (host,user) values ('%s','');\n",hostname);
+ fprintf(out,"INSERT INTO user (host,user) values ('localhost','');\n");
+#else
+ fprintf(out,
+ "INSERT INTO user VALUES ('localhost','','','Y','Y','Y'"
+ ",'Y','Y','Y','Y','Y','Y'"
+ ",'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','',"
+ "'','',0,0,0);\n");
+#endif
+ }
+ }
+
+
+ if (test_sys_file(mdata,"mysql/func.frm"))
+ {
+ fprintf(out,
+ "CREATE TABLE func ("
+ "name char(64) binary DEFAULT '' NOT NULL,"
+ "ret tinyint(1) DEFAULT '0' NOT NULL,"
+ "dl char(128) DEFAULT '' NOT NULL,"
+ "type enum ('function','aggregate') NOT NULL,"
+ "PRIMARY KEY (name)"
+ ") comment='User defined functions';\n");
+ }
+
+ if (test_sys_file(mdata,"mysql/tables_priv.frm"))
+ {
+ fprintf(out,
+ "CREATE TABLE tables_priv ("
+ "Host char(60) binary DEFAULT '' NOT NULL,"
+ "Db char(64) binary DEFAULT '' NOT NULL,"
+ "User char(16) binary DEFAULT '' NOT NULL,"
+ "Table_name char(64) binary DEFAULT '' NOT NULL,"
+ "Grantor char(77) DEFAULT '' NOT NULL,"
+ "Timestamp timestamp(14),"
+ "Table_priv set('Select','Insert','Update','Delete',"
+ "'Create','Drop','Grant','References','Index','Alter')"
+ " DEFAULT '' NOT NULL,"
+ "Column_priv set('Select','Insert','Update','References')"
+ " DEFAULT '' NOT NULL,"
+ "PRIMARY KEY (Host,Db,User,Table_name),"
+ "KEY Grantor (Grantor)"
+ ") comment='Table privileges';\n");
+ }
+
+ if (test_sys_file(mdata,"mysql/columns_priv.frm"))
+ {
+ fprintf(out,
+ "CREATE TABLE columns_priv ("
+ "Host char(60) binary DEFAULT '' NOT NULL,"
+ "Db char(64) binary DEFAULT '' NOT NULL,"
+ "User char(16) binary DEFAULT '' NOT NULL,"
+ "Table_name char(64) binary DEFAULT '' NOT NULL,"
+ "Column_name char(64) binary DEFAULT '' NOT NULL,"
+ "Timestamp timestamp(14),"
+ "Column_priv set('Select','Insert','Update','References')"
+ " DEFAULT '' NOT NULL,"
+ "PRIMARY KEY (Host,Db,User,Table_name,Column_name)"
+ ") comment='Column privileges';\n");
+ }
+
+ if (test_sys_file(mdata,"mysql/help_topic.frm"))
+ {
+ fprintf(out,
+ "CREATE TABLE help_topic ("
+ "help_topic_id int unsigned not null,"
+ "name varchar(64) not null,"
+ "help_category_id smallint unsigned not null,"
+ "description text not null,"
+ "example text not null,"
+ "url varchar(128) not null,"
+ "primary key (help_topic_id),"
+ "unique index (name)"
+ ") comment='help topics';\n");
+ }
+
+ if (test_sys_file(mdata,"mysql/help_category.frm"))
+ {
+ fprintf(out,
+ "CREATE TABLE help_category ("
+ "help_category_id smallint unsigned not null,"
+ "name varchar(64) not null,"
+ "parent_category_id smallint unsigned null,"
+ "url varchar(128) not null,"
+ "primary key (help_category_id),"
+ "unique index (name)"
+ ") comment='help categories';\n");
+ }
+
+ if (test_sys_file(mdata,"mysql/help_keyword.frm"))
+ {
+ fprintf(out,
+ "CREATE TABLE help_keyword ("
+ "help_keyword_id int unsigned not null,"
+ "name varchar(64) not null,"
+ "primary key (help_keyword_id),"
+ "unique index (name)"
+ ") comment='help keywords';\n");
+ }
+
+ if (test_sys_file(mdata,"mysql/help_relation.frm"))
+ {
+ fprintf(out,
+ "CREATE TABLE help_relation ("
+ "help_topic_id int unsigned not null references help_topic,"
+ "help_keyword_id int unsigned not null references help_keyword,"
+ "primary key (help_keyword_id, help_topic_id)"
+ ") comment='keyword-topic relation';\n");
+ }
+
+ if (test_sys_file(mdata,"mysql/time_zone_name.frm"))
+ {
+ fprintf(out,
+ "CREATE TABLE time_zone_name ("
+ "Name char(64) NOT NULL,"
+ "Time_zone_id int unsigned NOT NULL,"
+ "PRIMARY KEY Name (Name)"
+ ") DEFAULT CHARACTER SET latin1 "
+ "comment='Time zone names';\n");
+
+ if (test)
+ {
+ fprintf(out,
+ "INSERT INTO time_zone_name (Name, Time_Zone_id) VALUES"
+ "('MET', 1), ('UTC', 2), ('Universal', 2), "
+ "('Europe/Moscow',3), ('leap/Europe/Moscow',4);\n");
+ }
+ }
+
+
+ if (test_sys_file(mdata,"mysql/time_zone.frm"))
+ {
+ fprintf(out,
+ "CREATE TABLE time_zone ("
+ "Time_zone_id int unsigned NOT NULL auto_increment,"
+ "Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL,"
+ "PRIMARY KEY TzId (Time_zone_id)"
+ ") DEFAULT CHARACTER SET latin1 "
+ "comment='Time zones';\n");
+
+ if (test)
+ {
+ fprintf(out,"INSERT INTO time_zone (Time_zone_id, Use_leap_seconds)"
+ "VALUES (1,'N'), (2,'N'), (3,'N'), (4,'Y');\n");
+ }
+ }
+
+ if (test_sys_file(mdata,"mysql/time_zone_transition.frm"))
+ {
+ fprintf(out,
+ "CREATE TABLE time_zone_transition ("
+ "Time_zone_id int unsigned NOT NULL,"
+ "Transition_time bigint signed NOT NULL,"
+ "Transition_type_id int unsigned NOT NULL,"
+ "PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time)"
+ ") DEFAULT CHARACTER SET latin1 "
+ "comment='Time zone transitions';\n");
+
+ if (test)
+ {
+ fprintf(out,
+ "INSERT INTO time_zone_transition"
+ "(Time_zone_id, Transition_time, Transition_type_id)"
+ "VALUES"
+ " (1, -1693706400, 0) ,(1, -1680483600, 1)"
+ ",(1, -1663455600, 2) ,(1, -1650150000, 3)"
+ ",(1, -1632006000, 2) ,(1, -1618700400, 3)"
+ ",(1, -938905200, 2) ,(1, -857257200, 3)"
+ ",(1, -844556400, 2) ,(1, -828226800, 3)"
+ ",(1, -812502000, 2) ,(1, -796777200, 3)"
+ ",(1, 228877200, 2) ,(1, 243997200, 3)"
+ ",(1, 260326800, 2) ,(1, 276051600, 3)"
+ ",(1, 291776400, 2) ,(1, 307501200, 3)"
+ ",(1, 323830800, 2) ,(1, 338950800, 3)"
+ ",(1, 354675600, 2) ,(1, 370400400, 3)"
+ ",(1, 386125200, 2) ,(1, 401850000, 3)"
+ ",(1, 417574800, 2) ,(1, 433299600, 3)"
+ ",(1, 449024400, 2) ,(1, 465354000, 3)"
+ ",(1, 481078800, 2) ,(1, 496803600, 3)"
+ ",(1, 512528400, 2) ,(1, 528253200, 3)"
+ ",(1, 543978000, 2) ,(1, 559702800, 3)"
+ ",(1, 575427600, 2) ,(1, 591152400, 3)"
+ ",(1, 606877200, 2) ,(1, 622602000, 3)"
+ ",(1, 638326800, 2) ,(1, 654656400, 3)"
+ ",(1, 670381200, 2) ,(1, 686106000, 3)"
+ ",(1, 701830800, 2) ,(1, 717555600, 3)"
+ ",(1, 733280400, 2) ,(1, 749005200, 3)"
+ ",(1, 764730000, 2) ,(1, 780454800, 3)"
+ ",(1, 796179600, 2) ,(1, 811904400, 3)"
+ ",(1, 828234000, 2) ,(1, 846378000, 3)"
+ ",(1, 859683600, 2) ,(1, 877827600, 3)"
+ ",(1, 891133200, 2) ,(1, 909277200, 3)"
+ ",(1, 922582800, 2) ,(1, 941331600, 3)"
+ ",(1, 954032400, 2) ,(1, 972781200, 3)"
+ ",(1, 985482000, 2) ,(1, 1004230800, 3)"
+ ",(1, 1017536400, 2) ,(1, 1035680400, 3)"
+ ",(1, 1048986000, 2) ,(1, 1067130000, 3)"
+ ",(1, 1080435600, 2) ,(1, 1099184400, 3)"
+ ",(1, 1111885200, 2) ,(1, 1130634000, 3)"
+ ",(1, 1143334800, 2) ,(1, 1162083600, 3)"
+ ",(1, 1174784400, 2) ,(1, 1193533200, 3)"
+ ",(1, 1206838800, 2) ,(1, 1224982800, 3)"
+ ",(1, 1238288400, 2) ,(1, 1256432400, 3)"
+ ",(1, 1269738000, 2) ,(1, 1288486800, 3)"
+ ",(1, 1301187600, 2) ,(1, 1319936400, 3)"
+ ",(1, 1332637200, 2) ,(1, 1351386000, 3)"
+ ",(1, 1364691600, 2) ,(1, 1382835600, 3)"
+ ",(1, 1396141200, 2) ,(1, 1414285200, 3)"
+ ",(1, 1427590800, 2) ,(1, 1445734800, 3)"
+ ",(1, 1459040400, 2) ,(1, 1477789200, 3)"
+ ",(1, 1490490000, 2) ,(1, 1509238800, 3)"
+ ",(1, 1521939600, 2) ,(1, 1540688400, 3)"
+ ",(1, 1553994000, 2) ,(1, 1572138000, 3)"
+ ",(1, 1585443600, 2) ,(1, 1603587600, 3)"
+ ",(1, 1616893200, 2) ,(1, 1635642000, 3)"
+ ",(1, 1648342800, 2) ,(1, 1667091600, 3)"
+ ",(1, 1679792400, 2) ,(1, 1698541200, 3)"
+ ",(1, 1711846800, 2) ,(1, 1729990800, 3)"
+ ",(1, 1743296400, 2) ,(1, 1761440400, 3)"
+ ",(1, 1774746000, 2) ,(1, 1792890000, 3)"
+ ",(1, 1806195600, 2) ,(1, 1824944400, 3)"
+ ",(1, 1837645200, 2) ,(1, 1856394000, 3)"
+ ",(1, 1869094800, 2) ,(1, 1887843600, 3)"
+ ",(1, 1901149200, 2) ,(1, 1919293200, 3)"
+ ",(1, 1932598800, 2) ,(1, 1950742800, 3)"
+ ",(1, 1964048400, 2) ,(1, 1982797200, 3)"
+ ",(1, 1995498000, 2) ,(1, 2014246800, 3)"
+ ",(1, 2026947600, 2) ,(1, 2045696400, 3)"
+ ",(1, 2058397200, 2) ,(1, 2077146000, 3)"
+ ",(1, 2090451600, 2) ,(1, 2108595600, 3)"
+ ",(1, 2121901200, 2) ,(1, 2140045200, 3)"
+ ",(3, -1688265000, 2) ,(3, -1656819048, 1)"
+ ",(3, -1641353448, 2) ,(3, -1627965048, 3)"
+ ",(3, -1618716648, 1) ,(3, -1596429048, 3)"
+ ",(3, -1593829848, 5) ,(3, -1589860800, 4)"
+ ",(3, -1542427200, 5) ,(3, -1539493200, 6)"
+ ",(3, -1525323600, 5) ,(3, -1522728000, 4)"
+ ",(3, -1491188400, 7) ,(3, -1247536800, 4)"
+ ",(3, 354920400, 5) ,(3, 370728000, 4)"
+ ",(3, 386456400, 5) ,(3, 402264000, 4)"
+ ",(3, 417992400, 5) ,(3, 433800000, 4)"
+ ",(3, 449614800, 5) ,(3, 465346800, 8)"
+ ",(3, 481071600, 9) ,(3, 496796400, 8)"
+ ",(3, 512521200, 9) ,(3, 528246000, 8)"
+ ",(3, 543970800, 9) ,(3, 559695600, 8)"
+ ",(3, 575420400, 9) ,(3, 591145200, 8)"
+ ",(3, 606870000, 9) ,(3, 622594800, 8)"
+ ",(3, 638319600, 9) ,(3, 654649200, 8)"
+ ",(3, 670374000, 10) ,(3, 686102400, 11)"
+ ",(3, 695779200, 8) ,(3, 701812800, 5)"
+ ",(3, 717534000, 4) ,(3, 733273200, 9)"
+ ",(3, 748998000, 8) ,(3, 764722800, 9)"
+ ",(3, 780447600, 8) ,(3, 796172400, 9)"
+ ",(3, 811897200, 8) ,(3, 828226800, 9)"
+ ",(3, 846370800, 8) ,(3, 859676400, 9)"
+ ",(3, 877820400, 8) ,(3, 891126000, 9)"
+ ",(3, 909270000, 8) ,(3, 922575600, 9)"
+ ",(3, 941324400, 8) ,(3, 954025200, 9)"
+ ",(3, 972774000, 8) ,(3, 985474800, 9)"
+ ",(3, 1004223600, 8) ,(3, 1017529200, 9)"
+ ",(3, 1035673200, 8) ,(3, 1048978800, 9)"
+ ",(3, 1067122800, 8) ,(3, 1080428400, 9)"
+ ",(3, 1099177200, 8) ,(3, 1111878000, 9)"
+ ",(3, 1130626800, 8) ,(3, 1143327600, 9)"
+ ",(3, 1162076400, 8) ,(3, 1174777200, 9)"
+ ",(3, 1193526000, 8) ,(3, 1206831600, 9)"
+ ",(3, 1224975600, 8) ,(3, 1238281200, 9)"
+ ",(3, 1256425200, 8) ,(3, 1269730800, 9)"
+ ",(3, 1288479600, 8) ,(3, 1301180400, 9)"
+ ",(3, 1319929200, 8) ,(3, 1332630000, 9)"
+ ",(3, 1351378800, 8) ,(3, 1364684400, 9)"
+ ",(3, 1382828400, 8) ,(3, 1396134000, 9)"
+ ",(3, 1414278000, 8) ,(3, 1427583600, 9)"
+ ",(3, 1445727600, 8) ,(3, 1459033200, 9)"
+ ",(3, 1477782000, 8) ,(3, 1490482800, 9)"
+ ",(3, 1509231600, 8) ,(3, 1521932400, 9)"
+ ",(3, 1540681200, 8) ,(3, 1553986800, 9)"
+ ",(3, 1572130800, 8) ,(3, 1585436400, 9)"
+ ",(3, 1603580400, 8) ,(3, 1616886000, 9)"
+ ",(3, 1635634800, 8) ,(3, 1648335600, 9)"
+ ",(3, 1667084400, 8) ,(3, 1679785200, 9)"
+ ",(3, 1698534000, 8) ,(3, 1711839600, 9)"
+ ",(3, 1729983600, 8) ,(3, 1743289200, 9)"
+ ",(3, 1761433200, 8) ,(3, 1774738800, 9)"
+ ",(3, 1792882800, 8) ,(3, 1806188400, 9)"
+ ",(3, 1824937200, 8) ,(3, 1837638000, 9)"
+ ",(3, 1856386800, 8) ,(3, 1869087600, 9)"
+ ",(3, 1887836400, 8) ,(3, 1901142000, 9)"
+ ",(3, 1919286000, 8) ,(3, 1932591600, 9)"
+ ",(3, 1950735600, 8) ,(3, 1964041200, 9)"
+ ",(3, 1982790000, 8) ,(3, 1995490800, 9)"
+ ",(3, 2014239600, 8) ,(3, 2026940400, 9)"
+ ",(3, 2045689200, 8) ,(3, 2058390000, 9)"
+ ",(3, 2077138800, 8) ,(3, 2090444400, 9)"
+ ",(3, 2108588400, 8) ,(3, 2121894000, 9)"
+ ",(3, 2140038000, 8)"
+ ",(4, -1688265000, 2) ,(4, -1656819048, 1)"
+ ",(4, -1641353448, 2) ,(4, -1627965048, 3)"
+ ",(4, -1618716648, 1) ,(4, -1596429048, 3)"
+ ",(4, -1593829848, 5) ,(4, -1589860800, 4)"
+ ",(4, -1542427200, 5) ,(4, -1539493200, 6)"
+ ",(4, -1525323600, 5) ,(4, -1522728000, 4)"
+ ",(4, -1491188400, 7) ,(4, -1247536800, 4)"
+ ",(4, 354920409, 5) ,(4, 370728010, 4)"
+ ",(4, 386456410, 5) ,(4, 402264011, 4)"
+ ",(4, 417992411, 5) ,(4, 433800012, 4)"
+ ",(4, 449614812, 5) ,(4, 465346812, 8)"
+ ",(4, 481071612, 9) ,(4, 496796413, 8)"
+ ",(4, 512521213, 9) ,(4, 528246013, 8)"
+ ",(4, 543970813, 9) ,(4, 559695613, 8)"
+ ",(4, 575420414, 9) ,(4, 591145214, 8)"
+ ",(4, 606870014, 9) ,(4, 622594814, 8)"
+ ",(4, 638319615, 9) ,(4, 654649215, 8)"
+ ",(4, 670374016, 10) ,(4, 686102416, 11)"
+ ",(4, 695779216, 8) ,(4, 701812816, 5)"
+ ",(4, 717534017, 4) ,(4, 733273217, 9)"
+ ",(4, 748998018, 8) ,(4, 764722818, 9)"
+ ",(4, 780447619, 8) ,(4, 796172419, 9)"
+ ",(4, 811897219, 8) ,(4, 828226820, 9)"
+ ",(4, 846370820, 8) ,(4, 859676420, 9)"
+ ",(4, 877820421, 8) ,(4, 891126021, 9)"
+ ",(4, 909270021, 8) ,(4, 922575622, 9)"
+ ",(4, 941324422, 8) ,(4, 954025222, 9)"
+ ",(4, 972774022, 8) ,(4, 985474822, 9)"
+ ",(4, 1004223622, 8) ,(4, 1017529222, 9)"
+ ",(4, 1035673222, 8) ,(4, 1048978822, 9)"
+ ",(4, 1067122822, 8) ,(4, 1080428422, 9)"
+ ",(4, 1099177222, 8) ,(4, 1111878022, 9)"
+ ",(4, 1130626822, 8) ,(4, 1143327622, 9)"
+ ",(4, 1162076422, 8) ,(4, 1174777222, 9)"
+ ",(4, 1193526022, 8) ,(4, 1206831622, 9)"
+ ",(4, 1224975622, 8) ,(4, 1238281222, 9)"
+ ",(4, 1256425222, 8) ,(4, 1269730822, 9)"
+ ",(4, 1288479622, 8) ,(4, 1301180422, 9)"
+ ",(4, 1319929222, 8) ,(4, 1332630022, 9)"
+ ",(4, 1351378822, 8) ,(4, 1364684422, 9)"
+ ",(4, 1382828422, 8) ,(4, 1396134022, 9)"
+ ",(4, 1414278022, 8) ,(4, 1427583622, 9)"
+ ",(4, 1445727622, 8) ,(4, 1459033222, 9)"
+ ",(4, 1477782022, 8) ,(4, 1490482822, 9)"
+ ",(4, 1509231622, 8) ,(4, 1521932422, 9)"
+ ",(4, 1540681222, 8) ,(4, 1553986822, 9)"
+ ",(4, 1572130822, 8) ,(4, 1585436422, 9)"
+ ",(4, 1603580422, 8) ,(4, 1616886022, 9)"
+ ",(4, 1635634822, 8) ,(4, 1648335622, 9)"
+ ",(4, 1667084422, 8) ,(4, 1679785222, 9)"
+ ",(4, 1698534022, 8) ,(4, 1711839622, 9)"
+ ",(4, 1729983622, 8) ,(4, 1743289222, 9)"
+ ",(4, 1761433222, 8) ,(4, 1774738822, 9)"
+ ",(4, 1792882822, 8) ,(4, 1806188422, 9)"
+ ",(4, 1824937222, 8) ,(4, 1837638022, 9)"
+ ",(4, 1856386822, 8) ,(4, 1869087622, 9)"
+ ",(4, 1887836422, 8) ,(4, 1901142022, 9)"
+ ",(4, 1919286022, 8) ,(4, 1932591622, 9)"
+ ",(4, 1950735622, 8) ,(4, 1964041222, 9)"
+ ",(4, 1982790022, 8) ,(4, 1995490822, 9)"
+ ",(4, 2014239622, 8) ,(4, 2026940422, 9)"
+ ",(4, 2045689222, 8) ,(4, 2058390022, 9)"
+ ",(4, 2077138822, 8) ,(4, 2090444422, 9)"
+ ",(4, 2108588422, 8) ,(4, 2121894022, 9)"
+ ",(4, 2140038022, 8);\n");
+ }
+ }
+
+ if (test_sys_file(mdata,"mysql/time_zone_transition_type.frm"))
+ {
+ fprintf(out,
+ "CREATE TABLE time_zone_transition_type ("
+ "Time_zone_id int unsigned NOT NULL,"
+ "Transition_type_id int unsigned NOT NULL,"
+ "Offset int signed DEFAULT 0 NOT NULL,"
+ "Is_DST tinyint unsigned DEFAULT 0 NOT NULL,"
+ "Abbreviation char(8) DEFAULT '' NOT NULL,"
+ "PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id)"
+ ") DEFAULT CHARACTER SET latin1 "
+ "comment='Time zone transition types';\n");
+
+ if (test)
+ {
+ fprintf(out,
+ "INSERT INTO time_zone_transition_type (Time_zone_id,"
+ "Transition_type_id, Offset, Is_DST, Abbreviation) VALUES"
+ "(1, 0, 7200, 1, 'MEST') ,(1, 1, 3600, 0, 'MET')"
+ ",(1, 2, 7200, 1, 'MEST') ,(1, 3, 3600, 0, 'MET')"
+ ",(2, 0, 0, 0, 'UTC')"
+ ",(3, 0, 9000, 0, 'MMT') ,(3, 1, 12648, 1, 'MST')"
+ ",(3, 2, 9048, 0, 'MMT') ,(3, 3, 16248, 1, 'MDST')"
+ ",(3, 4, 10800, 0, 'MSK') ,(3, 5, 14400, 1, 'MSD')"
+ ",(3, 6, 18000, 1, 'MSD') ,(3, 7, 7200, 0, 'EET')"
+ ",(3, 8, 10800, 0, 'MSK') ,(3, 9, 14400, 1, 'MSD')"
+ ",(3, 10, 10800, 1, 'EEST') ,(3, 11, 7200, 0, 'EET')"
+ ",(4, 0, 9000, 0, 'MMT') ,(4, 1, 12648, 1, 'MST')"
+ ",(4, 2, 9048, 0, 'MMT') ,(4, 3, 16248, 1, 'MDST')"
+ ",(4, 4, 10800, 0, 'MSK') ,(4, 5, 14400, 1, 'MSD')"
+ ",(4, 6, 18000, 1, 'MSD') ,(4, 7, 7200, 0, 'EET')"
+ ",(4, 8, 10800, 0, 'MSK') ,(4, 9, 14400, 1, 'MSD')"
+ ",(4, 10, 10800, 1, 'EEST') ,(4, 11, 7200, 0, 'EET');\n");
+ }
+ }
+
+ if (test_sys_file(mdata,"mysql/time_zone_leap_second.frm"))
+ {
+ fprintf(out,
+ "CREATE TABLE time_zone_leap_second ("
+ "Transition_time bigint signed NOT NULL,"
+ "Correction int signed NOT NULL,"
+ "PRIMARY KEY TranTime (Transition_time)"
+ ") DEFAULT CHARACTER SET latin1 "
+ "comment='Leap seconds information for time zones';\n");
+
+ if (test)
+ {
+ fprintf(out,
+ "INSERT INTO time_zone_leap_second "
+ "(Transition_time, Correction) VALUES "
+ "(78796800, 1) ,(94694401, 2) ,(126230402, 3)"
+ ",(157766403, 4) ,(189302404, 5) ,(220924805, 6)"
+ ",(252460806, 7) ,(283996807, 8) ,(315532808, 9)"
+ ",(362793609, 10) ,(394329610, 11) ,(425865611, 12)"
+ ",(489024012, 13) ,(567993613, 14) ,(631152014, 15)"
+ ",(662688015, 16) ,(709948816, 17) ,(741484817, 18)"
+ ",(773020818, 19) ,(820454419, 20) ,(867715220, 21)"
+ ",(915148821, 22);\n");
+ }
+ }
+
+ return fclose(out);
+}
diff --git a/mysql-test/my_manage.c b/mysql-test/my_manage.c
new file mode 100644
index 00000000000..472b0d32683
--- /dev/null
+++ b/mysql-test/my_manage.c
@@ -0,0 +1,876 @@
+/*
+ Copyright (c) 2003 Novell, Inc. All Rights Reserved.
+
+ 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; either version 2 of the License, or
+ (at your option) any later version.
+
+ 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 <stdio.h>
+#include <errno.h>
+#ifndef __WIN__
+#include <dirent.h>
+#endif
+#include <string.h>
+#ifdef __NETWARE__
+#include <screen.h>
+#include <proc.h>
+#else
+#include <sys/types.h>
+#ifndef __WIN__
+#include <sys/wait.h>
+#include <unistd.h>
+#include <signal.h>
+#include <fnmatch.h> /* FIXME HAVE_FNMATCH_H or something */
+#else
+#include <direct.h>
+#include <stdlib.h>
+#include <stdio.h>
+#endif
+#endif
+#include <ctype.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <assert.h>
+
+#include "my_manage.h"
+
+#ifndef __NETWARE__
+#define ASSERT assert
+extern char **environ;
+#endif
+
+
+
+/******************************************************************************
+
+ macros
+
+******************************************************************************/
+
+/******************************************************************************
+
+ global variables
+
+******************************************************************************/
+
+/******************************************************************************
+
+ functions
+
+******************************************************************************/
+
+/******************************************************************************
+
+ init_args()
+
+ Init an argument list.
+
+******************************************************************************/
+
+void init_args(arg_list_t *al)
+{
+ ASSERT(al != NULL);
+
+ al->argc= 0;
+ al->size= ARG_BUF;
+ al->argv= malloc(al->size * sizeof(char *));
+ ASSERT(al->argv != NULL);
+
+ return;
+}
+
+/******************************************************************************
+
+ add_arg()
+
+ Add an argument to a list.
+
+******************************************************************************/
+
+void add_arg(arg_list_t *al, const char *format, ...)
+{
+ va_list ap;
+ char temp[FN_REFLEN];
+
+ ASSERT(al != NULL);
+
+ /* increase size */
+ if (al->argc >= (int)al->size)
+ {
+ al->size+= ARG_BUF;
+ al->argv= realloc(al->argv, al->size * sizeof(char *));
+ ASSERT(al->argv != NULL);
+ }
+
+ if (format)
+ {
+ va_start(ap, format);
+ vsprintf(temp, format, ap);
+ va_end(ap);
+
+ al->argv[al->argc]= malloc(strlen(temp)+1);
+ ASSERT(al->argv[al->argc] != NULL);
+ strcpy(al->argv[al->argc], temp);
+
+ ++(al->argc);
+ }
+ else
+ {
+ al->argv[al->argc]= NULL;
+ }
+
+ return;
+}
+
+/******************************************************************************
+
+ free_args()
+
+ Free an argument list.
+
+******************************************************************************/
+
+void free_args(arg_list_t *al)
+{
+ int i;
+
+ ASSERT(al != NULL);
+
+ for (i= 0; i < al->argc; i++)
+ {
+ ASSERT(al->argv[i] != NULL);
+ free(al->argv[i]);
+ al->argv[i]= NULL;
+ }
+
+ free(al->argv);
+ al->argc= 0;
+ al->argv= NULL;
+
+ return;
+}
+
+/******************************************************************************
+
+ sleep_until_file_deleted()
+
+ Sleep until the given file is no longer found.
+
+******************************************************************************/
+
+#ifndef __WIN__
+int sleep_until_file_deleted(char *pid_file)
+#else
+int sleep_until_file_deleted(HANDLE pid_file)
+#endif
+{
+ int err= 0; /* Initiate to supress warning */
+#ifndef __WIN__
+ struct stat buf;
+ int i;
+
+ for (i= 0; (i < TRY_MAX) && (err= !stat(pid_file, &buf)); i++) sleep(1);
+
+ if (err != 0) err= errno;
+#else
+ err= (WaitForSingleObject(pid_file, TRY_MAX*1000) == WAIT_TIMEOUT);
+#endif
+ return err;
+}
+
+/******************************************************************************
+
+ sleep_until_file_exists()
+
+ Sleep until the given file exists.
+
+******************************************************************************/
+
+#ifndef __WIN__
+int sleep_until_file_exists(char *pid_file)
+#else
+int sleep_until_file_exists(HANDLE pid_file)
+#endif
+{
+ int err= 0; /* Initiate to supress warning */
+#ifndef __WIN__
+ struct stat buf;
+ int i;
+
+ for (i= 0; (i < TRY_MAX) && (err= stat(pid_file, &buf)); i++) sleep(1);
+
+ if (err != 0) err= errno;
+#else
+ err= (WaitForSingleObject(pid_file, TRY_MAX*1000) == WAIT_TIMEOUT);
+#endif
+ return err;
+}
+
+/******************************************************************************
+
+ wait_for_server_start()
+
+ Wait for the server on the given port to start.
+
+******************************************************************************/
+
+int wait_for_server_start(char *bin_dir __attribute__((unused)),
+ char *mysqladmin_file,
+ char *user, char *password, int port,char *tmp_dir)
+{
+ arg_list_t al;
+ int err= 0, i;
+ char trash[FN_REFLEN];
+
+ /* mysqladmin file */
+ snprintf(trash, FN_REFLEN, "%s/trash.out",tmp_dir);
+
+ /* args */
+ init_args(&al);
+ add_arg(&al, "%s", mysqladmin_file);
+ add_arg(&al, "--no-defaults");
+ add_arg(&al, "--port=%u", port);
+ add_arg(&al, "--user=%s", user);
+ add_arg(&al, "--password=%s", password);
+ add_arg(&al, "--silent");
+
+/* #ifdef NOT_USED */
+#ifndef __NETWARE__
+ add_arg(&al, "-O");
+ add_arg(&al, "connect_timeout=10");
+ add_arg(&al, "-w");
+#endif
+
+ add_arg(&al, "--host=localhost");
+#ifndef __NETWARE__
+ add_arg(&al, "--protocol=tcp");
+#endif
+ add_arg(&al, "ping");
+
+ /*
+ NetWare does not support the connect timeout in the TCP/IP stack
+ -- we will try the ping multiple times
+ */
+#ifndef __WIN__
+ for (i= 0; (i < TRY_MAX)
+ && (err= spawn(mysqladmin_file, &al, TRUE, NULL,
+ trash, NULL, NULL)); i++) sleep(1);
+#else
+ err= spawn(mysqladmin_file, &al, TRUE, NULL,trash, NULL, NULL);
+#endif
+
+ /* free args */
+ free_args(&al);
+
+ return err;
+}
+
+/******************************************************************************
+
+ spawn()
+
+ Spawn the given path with the given arguments.
+
+******************************************************************************/
+
+#ifdef __NETWARE__
+int spawn(char *path, arg_list_t *al, int join, char *input,
+ char *output, char *error, char *pid_file)
+{
+ pid_t pid;
+ int result= 0;
+ wiring_t wiring= { FD_UNUSED, FD_UNUSED, FD_UNUSED };
+ unsigned long flags= PROC_CURRENT_SPACE | PROC_INHERIT_CWD;
+
+ /* open wiring */
+ if (input)
+ wiring.infd= open(input, O_RDONLY);
+
+ if (output)
+ wiring.outfd= open(output, O_WRONLY | O_CREAT | O_TRUNC);
+
+ if (error)
+ wiring.errfd= open(error, O_WRONLY | O_CREAT | O_TRUNC);
+
+ /* procve requires a NULL */
+ add_arg(al, NULL);
+
+ /* go */
+ pid= procve(path, flags, NULL, &wiring, NULL, NULL, 0,
+ NULL, (const char **)al->argv);
+
+ /* close wiring */
+ if (wiring.infd != -1)
+ close(wiring.infd);
+
+ if (wiring.outfd != -1)
+ close(wiring.outfd);
+
+ if (wiring.errfd != -1)
+ close(wiring.errfd);
+
+ return result;
+}
+#elif __WIN__
+
+int spawn(char *path, arg_list_t *al, int join, char *input,
+ char *output, char *error, HANDLE *pid)
+{
+ intptr_t result;
+ int i;
+ STARTUPINFO startup_info;
+ PROCESS_INFORMATION process_information;
+ DWORD exit_code;
+ char win_args[1024]= "";
+
+ /* Skip the first parameter */
+ for (i= 1; i < al->argc; i++)
+ {
+ ASSERT(al->argv[i] != NULL);
+ strcat(win_args,al->argv[i]);
+ strcat(win_args," ");
+ }
+
+ memset(&startup_info,0,sizeof(STARTUPINFO));
+ startup_info.cb= sizeof(STARTUPINFO);
+
+ if (input)
+ freopen(input, "rb", stdin);
+
+ if (output)
+ freopen(output, "wb", stdout);
+
+ if (error)
+ freopen(error, "wb", stderr);
+
+ result= CreateProcess(
+ path,
+ (LPSTR)&win_args,
+ NULL,
+ NULL,
+ TRUE,
+ 0,
+ NULL,
+ NULL,
+ &startup_info,
+ &process_information
+ );
+
+ if (result && process_information.hProcess)
+ {
+ if (join)
+ {
+ if (WaitForSingleObject(process_information.hProcess, mysqld_timeout)
+ == WAIT_TIMEOUT)
+ {
+ exit_code= -1;
+ }
+ else
+ {
+ GetExitCodeProcess(process_information.hProcess, &exit_code);
+ }
+ CloseHandle(process_information.hProcess);
+ }
+ else
+ {
+ exit_code= 0;
+ }
+ if (pid != NULL)
+ *pid= process_information.hProcess;
+ }
+ else
+ {
+ exit_code= -1;
+ }
+ if (input)
+ freopen("CONIN$","rb",stdin);
+ if (output)
+ freopen("CONOUT$","wb",stdout);
+ if (error)
+ freopen("CONOUT$","wb",stderr);
+
+ return exit_code;
+}
+#else
+int spawn(char *path, arg_list_t *al, int join, char *input,
+ char *output, char *error, char *pid_file __attribute__((unused)))
+{
+ pid_t pid;
+ int res_exec= 0;
+ int result= 0;
+
+ pid= fork();
+
+ if (pid == -1)
+ {
+ fprintf(stderr, "fork was't created\n");
+ /* We can't create the fork...exit with error */
+ return EXIT_FAILURE;
+ }
+
+ if (pid > 0)
+ {
+ /* The parent process is waiting for child process if join is not zero */
+ if (join)
+ {
+ waitpid(pid, &result, 0);
+ if (WIFEXITED(result) != 0)
+ {
+ result= WEXITSTATUS(result);
+ }
+ else
+ {
+ result= EXIT_FAILURE;
+ }
+ }
+ }
+ else
+ {
+
+ /* Child process */
+ add_arg(al, NULL);
+
+ /* Reassign streams */
+ if (input)
+ freopen(input, "r", stdin);
+
+ if (output)
+ freopen(output, "w", stdout);
+
+ if (error)
+ freopen(error, "w", stderr);
+
+ /* Spawn the process */
+ if ((res_exec= execve(path, al->argv, environ)) < 0)
+ exit(EXIT_FAILURE);
+
+ /* Restore streams */
+ if (input)
+ freopen("/dev/tty", "r", stdin);
+
+ if (output)
+ freopen("/dev/tty", "w", stdout);
+
+ if (error)
+ freopen("/dev/tty", "w", stderr);
+
+ exit(0);
+ }
+
+ return result;
+}
+#endif
+/******************************************************************************
+
+ stop_server()
+
+ Stop the server with the given port and pid file.
+
+******************************************************************************/
+
+int stop_server(char *bin_dir __attribute__((unused)), char *mysqladmin_file,
+ char *user, char *password, int port,
+#ifndef __WIN__
+ char *pid_file,
+#else
+ HANDLE pid_file,
+#endif
+ char *tmp_dir)
+{
+ arg_list_t al;
+ int err= 0;
+ char trash[FN_REFLEN];
+
+ snprintf(trash, FN_REFLEN, "%s/trash.out",tmp_dir);
+
+ /* args */
+ init_args(&al);
+ add_arg(&al, "%s", mysqladmin_file);
+ add_arg(&al, "--no-defaults");
+ add_arg(&al, "--port=%u", port);
+ add_arg(&al, "--user=%s", user);
+ add_arg(&al, "--password=%s", password);
+ add_arg(&al, "-O");
+ add_arg(&al, "shutdown_timeout=20");
+#ifndef __NETWARE__
+ add_arg(&al, "--protocol=tcp");
+#endif
+ add_arg(&al, "shutdown");
+
+ /* spawn */
+ if ((err= spawn(mysqladmin_file, &al, TRUE, NULL,
+ trash, NULL, NULL)) == 0)
+ {
+ sleep_until_file_deleted(pid_file);
+ }
+ else
+ {
+#ifndef __WIN__
+ pid_t pid= get_server_pid(pid_file);
+
+ /* shutdown failed - kill server */
+ kill_server(pid);
+
+ sleep(TRY_MAX);
+
+ /* remove pid file if possible */
+ err= remove(pid_file);
+#else
+ TerminateProcess(pid_file,err);
+#endif
+ }
+
+ /* free args */
+ free_args(&al);
+
+ return err;
+}
+
+/******************************************************************************
+
+ get_server_pid()
+
+ Get the VM id with the given pid file.
+
+******************************************************************************/
+
+#ifndef __WIN__
+pid_t get_server_pid(char *pid_file)
+{
+ char buf[FN_REFLEN];
+ int fd, err;
+ char *p;
+ pid_t id= 0;
+
+ /* discover id */
+ fd= open(pid_file, O_RDONLY);
+
+ err= read(fd, buf, FN_REFLEN);
+
+ close(fd);
+
+ if (err > 0)
+ {
+ /* terminate string */
+ if ((p= strchr(buf, '\n')) != NULL)
+ {
+ *p= '\0';
+
+ /* check for a '\r' */
+ if ((p= strchr(buf, '\r')) != NULL)
+ {
+ *p= '\0';
+ }
+ }
+ else
+ {
+ buf[err]= '\0';
+ }
+
+ id= strtol(buf, NULL, 0);
+ }
+
+ return id;
+}
+
+/******************************************************************************
+
+ kill_server()
+
+ Force a kill of the server with the given pid.
+
+******************************************************************************/
+
+void kill_server(pid_t pid)
+{
+ if (pid > 0)
+ {
+#if !defined(__NETWARE__)
+ /* Send SIGTERM to pid */
+ kill(pid, SIGTERM);
+#else /* __NETWARE__ */
+ /* destroy vm */
+ NXVmDestroy(pid);
+#endif
+ }
+}
+#endif
+/******************************************************************************
+
+ del_tree()
+
+ Delete the directory and subdirectories.
+
+******************************************************************************/
+
+void del_tree(char *dir)
+{
+#ifndef __WIN__
+ DIR *parent= opendir(dir);
+ struct dirent *entry;
+ char temp[FN_REFLEN];
+
+ if (parent == NULL)
+ {
+ return;
+ }
+
+ while ((entry= readdir(parent)) != NULL)
+ {
+ /* create long name */
+ snprintf(temp, FN_REFLEN, "%s/%s", dir, entry->d_name);
+
+ if (entry->d_name[0] == '.')
+ {
+ /* Skip */
+ }
+ else
+ {
+/* FIXME missing test in acinclude.m4 */
+#ifndef STRUCT_DIRENT_HAS_D_TYPE
+ struct stat st;
+
+ if (lstat(entry->d_name, &st) == -1)
+ {
+ /* FIXME error */
+ return;
+ }
+ if (S_ISDIR(st.st_mode))
+#else
+ if (S_ISDIR(entry->d_type))
+#endif
+ {
+ /* delete subdirectory */
+ del_tree(temp);
+ }
+ else
+ {
+ /* remove file */
+ remove(temp);
+ }
+ }
+ }
+ /* remove directory */
+ rmdir(dir);
+#else
+ struct _finddata_t parent;
+ intptr_t handle;
+ char temp[FN_REFLEN];
+ char mask[FN_REFLEN];
+
+ snprintf(mask,FN_REFLEN,"%s/*.*",dir);
+
+ if ((handle=_findfirst(mask,&parent)) == -1L)
+ {
+ return;
+ }
+
+ do
+ {
+ /* create long name */
+ snprintf(temp, FN_REFLEN, "%s/%s", dir, parent.name);
+ if (parent.name[0] == '.')
+ {
+ /* Skip */
+ }
+ else
+ if (parent.attrib & _A_SUBDIR)
+ {
+ /* delete subdirectory */
+ del_tree(temp);
+ }
+ else
+ {
+ /* remove file */
+ remove(temp);
+ }
+ } while (_findnext(handle,&parent) == 0);
+
+ _findclose(handle);
+
+ /* remove directory */
+ _rmdir(dir);
+#endif
+}
+
+/******************************************************************************
+
+ removef()
+
+******************************************************************************/
+
+int removef(const char *format, ...)
+{
+#ifdef __NETWARE__
+ va_list ap;
+ char path[FN_REFLEN];
+
+ va_start(ap, format);
+
+ vsnprintf(path, FN_REFLEN, format, ap);
+
+ va_end(ap);
+ return remove(path);
+
+#elif __WIN__
+ {
+ va_list ap;
+ char path[FN_REFLEN];
+ struct _finddata_t parent;
+ intptr_t handle;
+ char temp[FN_REFLEN];
+ char *p;
+
+ va_start(ap, format);
+
+ vsnprintf(path, FN_REFLEN, format, ap);
+
+ va_end(ap);
+
+ p= path + strlen(path);
+ while (*p != '\\' && *p != '/' && p > path) p--;
+
+ if ((handle=_findfirst(path,&parent)) == -1L)
+ {
+ /* if there is not files....it's ok */
+ return 0;
+ }
+
+ *p= '\0';
+
+ do
+ {
+ if (! (parent.attrib & _A_SUBDIR))
+ {
+ snprintf(temp, FN_REFLEN, "%s/%s", path, parent.name);
+ remove(temp);
+ }
+ }while (_findnext(handle,&parent) == 0);
+
+ _findclose(handle);
+ }
+#else
+ DIR *parent;
+ struct dirent *entry;
+ char temp[FN_REFLEN];
+ va_list ap;
+ char path[FN_REFLEN];
+ char *p;
+ /* Get path with mask */
+ va_start(ap, format);
+
+ vsnprintf(path, FN_REFLEN, format, ap);
+
+ va_end(ap);
+
+ p= path + strlen(path);
+ while (*p != '\\' && *p != '/' && p > path) p--;
+ *p= '\0';
+ p++;
+
+ parent= opendir(path);
+
+ if (parent == NULL)
+ {
+ return 1; /* Error, directory missing */
+ }
+
+ while ((entry= readdir(parent)) != NULL)
+ {
+ /* entry is not directory and entry matches with mask */
+#ifndef STRUCT_DIRENT_HAS_D_TYPE
+ struct stat st;
+
+ if (lstat(entry->d_name, &st) == -1)
+ {
+ return 1;
+ }
+
+ if (!S_ISDIR(st.st_mode) && !fnmatch(p, entry->d_name,0))
+#else
+ if (!S_ISDIR(entry->d_type) && !fnmatch(p, entry->d_name,0))
+#endif
+ {
+ /* create long name */
+ snprintf(temp, FN_REFLEN, "%s/%s", path, entry->d_name);
+ /* Delete only files */
+ remove(temp);
+ }
+ }
+#endif
+ return 0;
+}
+
+/******************************************************************************
+
+ get_basedir()
+
+******************************************************************************/
+
+void get_basedir(char *argv0, char *basedir)
+{
+ char temp[FN_REFLEN];
+ char *p;
+ int position;
+
+ ASSERT(argv0 != NULL);
+ ASSERT(basedir != NULL);
+
+ strcpy(temp, strlwr(argv0));
+ while ((p= strchr(temp, '\\')) != NULL) *p= '/';
+
+ if ((position= strinstr(temp, "/bin/")) != 0)
+ {
+ p= temp + position;
+ *p= '\0';
+ strcpy(basedir, temp);
+ }
+}
+
+uint strinstr(reg1 const char *str,reg4 const char *search)
+{
+ reg2 my_string i,j;
+ my_string start= (my_string) str;
+
+ skipp:
+ while (*str != '\0')
+ {
+ if (*str++ == *search)
+ {
+ i=(my_string) str;
+ j= (my_string) search+1;
+ while (*j)
+ if (*i++ != *j++) goto skipp;
+ return ((uint) (str - start));
+ }
+ }
+ return (0);
+}
+
+/******************************************************************************
+
+ remove_empty_file()
+
+******************************************************************************/
+
+void remove_empty_file(const char *file_name)
+{
+ struct stat file;
+
+ if (!stat(file_name,&file))
+ {
+ if (!file.st_size)
+ remove(file_name);
+ }
+}
diff --git a/mysql-test/my_manage.h b/mysql-test/my_manage.h
new file mode 100644
index 00000000000..5df77b01af8
--- /dev/null
+++ b/mysql-test/my_manage.h
@@ -0,0 +1,137 @@
+/*
+ Copyright (c) 2002 Novell, Inc. All Rights Reserved.
+
+ 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; either version 2 of the License, or
+ (at your option) any later version.
+
+ 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
+*/
+
+#ifndef _MY_MANAGE
+#define _MY_MANAGE
+
+/******************************************************************************
+
+ includes
+
+******************************************************************************/
+
+#include <stdlib.h>
+#ifndef __WIN__
+#include <unistd.h>
+#endif
+#ifndef __NETWARE__
+#include <string.h>
+#include <my_global.h>
+#include <m_string.h>
+
+#ifndef __WIN__
+#define strnicmp strncasecmp
+#define strlwr(STRARG) (STRARG)
+#else
+int my_vsnprintf_(char *to, size_t n, const char* value, ...);
+#endif
+#endif
+
+/******************************************************************************
+
+ macros
+
+******************************************************************************/
+
+#define ARG_BUF 10
+#define TRY_MAX 5
+
+#ifdef __WIN__
+#define PATH_MAX _MAX_PATH
+#define NAME_MAX _MAX_FNAME
+#define kill(A,B) TerminateProcess((HANDLE)A,0)
+#define NOT_NEED_PID 0
+#define MASTER_PID 1
+#define SLAVE_PID 2
+#define mysqld_timeout 60000
+
+int pid_mode;
+bool run_server;
+bool skip_first_param;
+
+#define snprintf _snprintf
+#define vsnprintf _vsnprintf
+#endif
+
+
+/******************************************************************************
+
+ structures
+
+******************************************************************************/
+
+typedef struct
+{
+
+ int argc;
+ char **argv;
+
+ size_t size;
+
+} arg_list_t;
+
+#ifdef __WIN__
+typedef int pid_t;
+#endif
+/******************************************************************************
+
+ global variables
+
+******************************************************************************/
+
+/******************************************************************************
+
+ prototypes
+
+******************************************************************************/
+
+void init_args(arg_list_t *);
+void add_arg(arg_list_t *, const char *, ...);
+void free_args(arg_list_t *);
+
+#ifndef __WIN__
+int sleep_until_file_exists(char *);
+int sleep_until_file_deleted(char *);
+#else
+int sleep_until_file_exists(HANDLE);
+int sleep_until_file_deleted(HANDLE);
+#endif
+int wait_for_server_start(char *, char *, char *, char *, int,char *);
+
+#ifndef __WIN__
+int spawn(char *, arg_list_t *, int, char *, char *, char *, char *);
+#else
+int spawn(char *, arg_list_t *, int , char *, char *, char *, HANDLE *);
+#endif
+
+#ifndef __WIN__
+int stop_server(char *, char *, char *, char *, int, char *,char *);
+pid_t get_server_pid(char *);
+void kill_server(pid_t pid);
+#else
+int stop_server(char *, char *, char *, char *, int, HANDLE,char *);
+#endif
+void del_tree(char *);
+int removef(const char *, ...);
+
+void get_basedir(char *, char *);
+void remove_empty_file(const char *file_name);
+
+bool create_system_files(const char *mdata,const char *output_file, bool test);
+
+#endif /* _MY_MANAGE */
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index b760309bb5b..4c141e75baa 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -1,7 +1,7 @@
-#! /bin/sh
+#!/bin/sh
# mysql-test-run - originally written by Matt Wagner <matt@mysql.com>
# modified by Sasha Pachev <sasha@mysql.com>
-# Sligtly updated by Monty
+# Slightly updated by Monty
# Cleaned up again by Matt
# Fixed by Sergei
# List of failed cases (--force) backported from 4.1 by Joerg
@@ -16,12 +16,17 @@ VERBOSE=""
USE_MANAGER=0
MY_TZ=GMT-3
TZ=$MY_TZ; export TZ # for UNIX_TIMESTAMP tests to work
+LOCAL_SOCKET=@MYSQL_UNIX_ADDR@
+MYSQL_TCP_PORT=@MYSQL_TCP_PORT@
# For query_cache test
case `uname` in
SCO_SV | UnixWare | OpenUNIX )
# do nothing (Causes strange behavior)
;;
+ QNX)
+ # do nothing (avoid error message)
+ ;;
* )
ulimit -n 1024
;;
@@ -194,10 +199,13 @@ DYLD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$DYLD_LIBRARY_PATH"
export LD_LIBRARY_PATH DYLD_LIBRARY_PATH
MASTER_RUNNING=0
+MASTER1_RUNNING=0
MASTER_MYPORT=9306
+MASTER_MYPORT1=9307
SLAVE_RUNNING=0
-SLAVE_MYPORT=9307
+SLAVE_MYPORT=9308 # leave room for 2 masters for cluster tests
MYSQL_MANAGER_PORT=9305 # needs to be out of the way of slaves
+NDBCLUSTER_PORT=9350
MYSQL_MANAGER_PW_FILE=$MYSQL_TEST_DIR/var/tmp/manager.pwd
MYSQL_MANAGER_LOG=$MYSQL_TEST_DIR/var/log/manager.log
MYSQL_MANAGER_USER=root
@@ -207,7 +215,11 @@ FAILED_CASES=
EXTRA_MASTER_OPT=""
EXTRA_MYSQL_TEST_OPT=""
-USE_RUNNING_SERVER=1
+EXTRA_MYSQLDUMP_OPT=""
+EXTRA_MYSQLBINLOG_OPT=""
+USE_RUNNING_SERVER=""
+USE_NDBCLUSTER=""
+USE_RUNNING_NDBCLUSTER=""
DO_GCOV=""
DO_GDB=""
MANUAL_GDB=""
@@ -216,7 +228,7 @@ DO_CLIENT_GDB=""
SLEEP_TIME_AFTER_RESTART=1
SLEEP_TIME_FOR_DELETE=10
SLEEP_TIME_FOR_FIRST_MASTER=400 # Enough time to create innodb tables
-SLEEP_TIME_FOR_SECOND_MASTER=30
+SLEEP_TIME_FOR_SECOND_MASTER=400
SLEEP_TIME_FOR_FIRST_SLAVE=400
SLEEP_TIME_FOR_SECOND_SLAVE=30
CHARACTER_SET=latin1
@@ -224,11 +236,17 @@ DBUSER=""
START_WAIT_TIMEOUT=10
STOP_WAIT_TIMEOUT=10
MYSQL_TEST_SSL_OPTS=""
+USE_TIMER=""
+USE_EMBEDDED_SERVER=""
+RESULT_EXT=""
while test $# -gt 0; do
case "$1" in
+ --embedded-server) USE_EMBEDDED_SERVER=1 ; USE_MANAGER=0 ; NO_SLAVE=1 ; \
+ USE_RUNNING_SERVER="" RESULT_EXT=".es" ;;
--user=*) DBUSER=`$ECHO "$1" | $SED -e "s;--user=;;"` ;;
--force) FORCE=1 ;;
+ --timer) USE_TIMER=1 ;;
--verbose-manager) MANAGER_QUIET_OPT="" ;;
--old-master) MASTER_40_ARGS="";;
--master-binary=*)
@@ -236,7 +254,12 @@ while test $# -gt 0; do
--slave-binary=*)
SLAVE_MYSQLD=`$ECHO "$1" | $SED -e "s;--slave-binary=;;"` ;;
--local) USE_RUNNING_SERVER="" ;;
- --extern) USE_RUNNING_SERVER="1" ;;
+ --extern) USE_RUNNING_SERVER="1" ;;
+ --with-ndbcluster)
+ USE_NDBCLUSTER="--ndbcluster" ;;
+ --ndb-connectstring=*)
+ USE_NDBCLUSTER="--ndbcluster" ;
+ USE_RUNNING_NDBCLUSTER=`$ECHO "$1" | $SED -e "s;--ndb-connectstring=;;"` ;;
--tmpdir=*) MYSQL_TMP_DIR=`$ECHO "$1" | $SED -e "s;--tmpdir=;;"` ;;
--local-master)
MASTER_MYPORT=3306;
@@ -246,6 +269,7 @@ while test $# -gt 0; do
--master_port=*) MASTER_MYPORT=`$ECHO "$1" | $SED -e "s;--master_port=;;"` ;;
--slave_port=*) SLAVE_MYPORT=`$ECHO "$1" | $SED -e "s;--slave_port=;;"` ;;
--manager-port=*) MYSQL_MANAGER_PORT=`$ECHO "$1" | $SED -e "s;--manager_port=;;"` ;;
+ --ndbcluster_port=*) NDBCLUSTER_PORT=`$ECHO "$1" | $SED -e "s;--ndbcluster_port=;;"` ;;
--with-openssl)
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT \
--ssl-ca=$BASEDIR/SSL/cacert.pem \
@@ -266,9 +290,11 @@ while test $# -gt 0; do
--start-and-exit)
START_AND_EXIT=1
;;
+ --socket=*) LOCAL_SOCKET=`$ECHO "$1" | $SED -e "s;--socket=;;"` ;;
--skip-rpl) NO_SLAVE=1 ;;
--skip-test=*) SKIP_TEST=`$ECHO "$1" | $SED -e "s;--skip-test=;;"`;;
--do-test=*) DO_TEST=`$ECHO "$1" | $SED -e "s;--do-test=;;"`;;
+ --start-from=* ) START_FROM=`$ECHO "$1" | $SED -e "s;--start-from=;;"` ;;
--warnings | --log-warnings)
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --log-warnings"
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --log-warnings"
@@ -279,6 +305,11 @@ while test $# -gt 0; do
--record)
RECORD=1;
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;;
+ --small-bench)
+ DO_SMALL_BENCH=1
+ DO_BENCH=1
+ NO_SLAVE=1
+ ;;
--bench)
DO_BENCH=1
NO_SLAVE=1
@@ -291,6 +322,8 @@ while test $# -gt 0; do
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1"
SLEEP_TIME_AFTER_RESTART=`$ECHO "$1" | $SED -e "s;--sleep=;;"`
;;
+ --ps-protocol)
+ EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;;
--user-test=*)
USER_TEST=`$ECHO "$1" | $SED -e "s;--user-test=;;"`
;;
@@ -347,7 +380,7 @@ while test $# -gt 0; do
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --gdb"
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb"
;;
- --valgrind)
+ --valgrind | --valgrind-all)
VALGRIND=`which valgrind` # this will print an error if not found
# Give good warning to the user and stop
if [ -z "$VALGRIND" ] ; then
@@ -360,16 +393,17 @@ while test $# -gt 0; do
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-safemalloc --skip-bdb"
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc --skip-bdb"
SLEEP_TIME_AFTER_RESTART=10
- SLEEP_TIME_FOR_DELETE=120
+ SLEEP_TIME_FOR_DELETE=60
USE_RUNNING_SERVER=""
+ if test "$1" = "--valgrind-all"
+ then
+ VALGRIND="$VALGRIND -v --show-reachable=yes"
+ fi
;;
--valgrind-options=*)
TMP=`$ECHO "$1" | $SED -e "s;--valgrind-options=;;"`
VALGRIND="$VALGRIND $TMP"
;;
- --valgrind-all)
- VALGRIND="$VALGRIND -v --show-reachable=yes"
- ;;
--skip-*)
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT $1"
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT $1"
@@ -384,6 +418,10 @@ while test $# -gt 0; do
--debug=d:t:i:A,$MYSQL_TEST_DIR/var/log/slave.trace"
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT \
--debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqltest.trace"
+ EXTRA_MYSQLDUMP_OPT="$EXTRA_MYSQLDUMP_OPT \
+ --debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqldump.trace"
+ EXTRA_MYSQLBINLOG_OPT="$EXTRA_MYSQLBINLOG_OPT \
+ --debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqlbinlog.trace"
;;
--fast)
FAST_START=1
@@ -404,6 +442,7 @@ MANAGER_PID_FILE="$MYRUN_DIR/manager.pid"
MASTER_MYDDIR="$MYSQL_TEST_DIR/var/master-data"
MASTER_MYSOCK="$MYSQL_TMP_DIR/master.sock"
+MASTER_MYSOCK1=$MYSQL_MYSOCK"1"
MASTER_MYPID="$MYRUN_DIR/master.pid"
MASTER_MYLOG="$MYSQL_TEST_DIR/var/log/master.log"
MASTER_MYERR="$MYSQL_TEST_DIR/var/log/master.err"
@@ -415,10 +454,12 @@ SLAVE_MYLOG="$MYSQL_TEST_DIR/var/log/slave.log"
SLAVE_MYERR="$MYSQL_TEST_DIR/var/log/slave.err"
CURRENT_TEST="$MYSQL_TEST_DIR/var/log/current_test"
-SMALL_SERVER="-O key_buffer_size=1M -O sort_buffer=256K -O max_heap_table_size=1M"
+SMALL_SERVER="--key_buffer_size=1M --sort_buffer=256K --max_heap_table_size=1M"
-export MASTER_MYPORT
-export SLAVE_MYPORT
+export MASTER_MYPORT MASTER_MYPORT1 SLAVE_MYPORT MYSQL_TCP_PORT MASTER_MYSOCK MASTER_MYSOCK1
+
+NDBCLUSTER_BASE_PORT=`expr $NDBCLUSTER_PORT + 2`
+NDBCLUSTER_OPTS="--port=$NDBCLUSTER_PORT --port-base=$NDBCLUSTER_BASE_PORT --data-dir=$MYSQL_TEST_DIR/var"
if [ x$SOURCE_DIST = x1 ] ; then
MY_BASEDIR=$MYSQL_TEST_DIR
@@ -438,18 +479,29 @@ fi
if test ${COLUMNS:-0} -lt 80 ; then COLUMNS=80 ; fi
E=`$EXPR $COLUMNS - 8`
-DASH72=`$ECHO '------------------------------------------'|$CUT -c 1-$E`
+DASH72=`$ECHO '-------------------------------------------------------'|$CUT -c 1-$E`
# on source dist, we pick up freshly build executables
# on binary, use what is installed
if [ x$SOURCE_DIST = x1 ] ; then
- MYSQLD="$VALGRIND $BASEDIR/sql/mysqld"
- if [ -f "$BASEDIR/client/.libs/lt-mysqltest" ] ; then
- MYSQL_TEST="$BASEDIR/client/.libs/lt-mysqltest"
- elif [ -f "$BASEDIR/client/.libs/mysqltest" ] ; then
- MYSQL_TEST="$BASEDIR/client/.libs/mysqltest"
+ if [ "x$USE_EMBEDDED_SERVER" = "x1" ] ; then
+ if [ -f "$BASEDIR/libmysqld/examples/mysqltest" ] ; then
+ MYSQL_TEST="$VALGRIND $BASEDIR/libmysqld/examples/mysqltest"
+ else
+ echo "Fatal error: Cannot find embedded server 'mysqltest'" 1>&2
+ exit 1
+ fi
+ TESTS_BINDIR="$BASEDIR/libmysqld/examples"
else
- MYSQL_TEST="$BASEDIR/client/mysqltest"
+ MYSQLD="$VALGRIND $BASEDIR/sql/mysqld"
+ if [ -f "$BASEDIR/client/.libs/lt-mysqltest" ] ; then
+ MYSQL_TEST="$BASEDIR/client/.libs/lt-mysqltest"
+ elif [ -f "$BASEDIR/client/.libs/mysqltest" ] ; then
+ MYSQL_TEST="$BASEDIR/client/.libs/mysqltest"
+ else
+ MYSQL_TEST="$BASEDIR/client/mysqltest"
+ fi
+ TESTS_BINDIR="$BASEDIR/tests"
fi
if [ -f "$BASEDIR/client/.libs/mysqldump" ] ; then
MYSQL_DUMP="$BASEDIR/client/.libs/mysqldump"
@@ -476,6 +528,7 @@ if [ x$SOURCE_DIST = x1 ] ; then
CHARSETSDIR="$BASEDIR/sql/share/charsets"
INSTALL_DB="./install_test_db"
MYSQL_FIX_SYSTEM_TABLES="$BASEDIR/scripts/mysql_fix_privilege_tables"
+ NDB_TOOLS_DIR="$BASEDIR/ndb/tools"
else
if test -x "$BASEDIR/libexec/mysqld"
then
@@ -484,6 +537,7 @@ else
MYSQLD="$VALGRIND $BASEDIR/bin/mysqld"
fi
CLIENT_BINDIR="$BASEDIR/bin"
+ TESTS_BINDIR="$BASEDIR/tests"
MYSQL_TEST="$CLIENT_BINDIR/mysqltest"
MYSQL_DUMP="$CLIENT_BINDIR/mysqldump"
MYSQL_BINLOG="$CLIENT_BINDIR/mysqlbinlog"
@@ -495,6 +549,7 @@ else
MYSQL="$CLIENT_BINDIR/mysql"
INSTALL_DB="./install_test_db --bin"
MYSQL_FIX_SYSTEM_TABLES="$CLIENT_BINDIR/mysql_fix_privilege_tables"
+ NDB_TOOLS_DIR="$CLIENT_BINDIR"
if test -d "$BASEDIR/share/mysql/english"
then
LANGUAGE="$BASEDIR/share/mysql/english/"
@@ -505,12 +560,6 @@ else
fi
fi
-MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD"
-MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR"
-MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --bindir=$CLIENT_BINDIR"
-MYSQL="$MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD"
-export MYSQL MYSQL_DUMP MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES CLIENT_BINDIR
-
if [ -z "$MASTER_MYSQLD" ]
then
MASTER_MYSQLD=$MYSQLD
@@ -529,7 +578,7 @@ then
fi
if [ -n "$USE_RUNNING_SERVER" ]
then
- MASTER_MYSOCK="/tmp/mysql.sock"
+ MASTER_MYSOCK=$LOCAL_SOCKET;
DBUSER=${DBUSER:-test}
else
DBUSER=${DBUSER:-root} # We want to do FLUSH xxx commands
@@ -543,9 +592,20 @@ then
fi
+MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
+MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR $EXTRA_MYSQLBINLOG_OPT"
+MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose"
+MYSQL="$MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD"
+export MYSQL MYSQL_DUMP MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES
+export CLIENT_BINDIR TESTS_BINDIR CHARSETSDIR
+export NDB_TOOLS_DIR
+
MYSQL_TEST_ARGS="--no-defaults --socket=$MASTER_MYSOCK --database=$DB \
--user=$DBUSER --password=$DBPASSWD --silent -v --skip-safemalloc \
--tmpdir=$MYSQL_TMP_DIR --port=$MASTER_MYPORT $MYSQL_TEST_SSL_OPTS"
+if [ x$USE_TIMER = x1 ] ; then
+ MYSQL_TEST_ARGS="$MYSQL_TEST_ARGS --timer-file=$MY_LOG_DIR/timer"
+fi
MYSQL_TEST_BIN=$MYSQL_TEST
MYSQL_TEST="$MYSQL_TEST $MYSQL_TEST_ARGS"
GDB_CLIENT_INIT=$MYSQL_TMP_DIR/gdbinit.client
@@ -579,6 +639,13 @@ show_failed_diff ()
result_file=r/$1.result
eval_file=r/$1.eval
+ # If we have an special externsion for result files we use it if we are recording
+ # or a result file with that extension exists.
+ if [ -n "$RESULT_EXT" -a \( x$RECORD = x1 -o -f "$result_file$RESULT_EXT" \) ]
+ then
+ result_file="$result_file$RESULT_EXT"
+ fi
+
if [ -f $eval_file ]
then
result_file=$eval_file
@@ -594,7 +661,6 @@ show_failed_diff ()
echo "http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html"
echo "to find the reason to this problem and how to report this."
echo ""
- echo "Test $1 failed!"
fi
}
@@ -615,7 +681,7 @@ error () {
error_is () {
$ECHO "Errors are (from $TIMEFILE) :"
$CAT < $TIMEFILE
- $ECHO "(the last line(s) may be the ones that caused the die() in mysqltest)"
+ $ECHO "(the last lines may be the most important ones)"
}
prefix_to_8() {
@@ -664,7 +730,7 @@ report_stats () {
$ECHO "The log files in $MY_LOG_DIR may give you some hint"
$ECHO "of what when wrong."
$ECHO "If you want to report this error, please read first the documentation at"
- $ECHO "http://www.mysql.com/doc/M/y/MySQL_test_suite.html"
+ $ECHO "http://www.mysql.com/doc/en/MySQL_test_suite.html"
fi
if test -z "$USE_RUNNING_SERVER"
@@ -675,13 +741,15 @@ report_stats () {
$RM -f $MY_LOG_DIR/warnings $MY_LOG_DIR/warnings.tmp
# Remove some non fatal warnings from the log files
$SED -e 's!Warning: Table:.* on delete!!g' -e 's!Warning: Setting lower_case_table_names=2!!g' -e 's!Warning: One can only use the --user.*root!!g' \
- $MY_LOG_DIR/*.err > $MY_LOG_DIR/warnings.tmp
+ $MY_LOG_DIR/*.err \
+ | $SED -e 's!Warning: Table:.* on rename!!g' \
+ > $MY_LOG_DIR/warnings.tmp
found_error=0
# Find errors
for i in "^Warning:" "^Error:" "^==.* at 0x"
do
- if `$GREP "$i" $MY_LOG_DIR/warnings.tmp >> $MY_LOG_DIR/warnings`
+ if $GREP "$i" $MY_LOG_DIR/warnings.tmp >> $MY_LOG_DIR/warnings
then
found_error=1
fi
@@ -697,13 +765,22 @@ report_stats () {
mysql_install_db () {
$ECHO "Removing Stale Files"
- $RM -rf $MASTER_MYDDIR $SLAVE_MYDDIR $MY_LOG_DIR/*
+ $RM -rf $MASTER_MYDDIR $MASTER_MYDDIR"1" $SLAVE_MYDDIR $MY_LOG_DIR/*
$ECHO "Installing Master Databases"
$INSTALL_DB
if [ $? != 0 ]; then
error "Could not install master test DBs"
exit 1
fi
+ if [ ! -z "$USE_NDBCLUSTER" ]
+ then
+ $ECHO "Installing Master Databases 1"
+ $INSTALL_DB -1
+ if [ $? != 0 ]; then
+ error "Could not install master test DBs 1"
+ exit 1
+ fi
+ fi
$ECHO "Installing Slave Databases"
$INSTALL_DB -slave
if [ $? != 0 ]; then
@@ -821,13 +898,13 @@ manager_launch()
ident=$1
shift
if [ $USE_MANAGER = 0 ] ; then
- $@ >> $CUR_MYERR 2>&1 &
+ echo $@ | /bin/sh >> $CUR_MYERR 2>&1 &
sleep 2 #hack
return
fi
$MYSQL_MANAGER_CLIENT $MANAGER_QUIET_OPT --user=$MYSQL_MANAGER_USER \
--password=$MYSQL_MANAGER_PW --port=$MYSQL_MANAGER_PORT <<EOF
-def_exec $ident $@
+def_exec $ident "$@"
set_exec_stdout $ident $CUR_MYERR
set_exec_stderr $ident $CUR_MYERR
set_exec_con $ident root localhost $CUR_MYSOCK
@@ -842,10 +919,10 @@ manager_term()
ident=$2
if [ $USE_MANAGER = 0 ] ; then
# Shutdown time must be high as slave may be in reconnect
- $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock --connect_timeout=5 --shutdown_timeout=70 shutdown >> $MYSQL_MANAGER_LOG 2>&1
+ $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock$3 --connect_timeout=5 --shutdown_timeout=70 shutdown >> $MYSQL_MANAGER_LOG 2>&1
res=$?
# Some systems require an extra connect
- $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock --connect_timeout=1 ping >> $MYSQL_MANAGER_LOG 2>&1
+ $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock$3 --connect_timeout=1 ping >> $MYSQL_MANAGER_LOG 2>&1
if test $res = 0
then
wait_for_pid $pid
@@ -859,18 +936,59 @@ EOF
abort_if_failed "Could not execute manager command"
}
+start_ndbcluster()
+{
+ if [ ! -z "$USE_NDBCLUSTER" ]
+ then
+ if [ -z "$USE_RUNNING_NDBCLUSTER" ]
+ then
+ echo "Starting ndbcluster"
+ if [ "$DO_BENCH" = 1 ]
+ then
+ NDBCLUSTER_EXTRA_OPTS=""
+ else
+ NDBCLUSTER_EXTRA_OPTS="--small"
+ fi
+ ./ndb/ndbcluster $NDBCLUSTER_OPTS $NDBCLUSTER_EXTRA_OPTS --initial || exit 1
+ NDB_CONNECTSTRING="host=localhost:$NDBCLUSTER_PORT"
+ else
+ NDB_CONNECTSTRING="$USE_RUNNING_NDBCLUSTER"
+ echo "Using ndbcluster at $NDB_CONNECTSTRING"
+ fi
+ USE_NDBCLUSTER="$USE_NDBCLUSTER --ndb-connectstring=\"$NDB_CONNECTSTRING\""
+ export NDB_CONNECTSTRING
+ fi
+}
+
+stop_ndbcluster()
+{
+ if [ ! -z "$USE_NDBCLUSTER" ]
+ then
+ if [ -z "$USE_RUNNING_NDBCLUSTER" ]
+ then
+ # Kill any running ndbcluster stuff
+ ./ndb/ndbcluster $NDBCLUSTER_OPTS --stop
+ fi
+ fi
+}
+
+# The embedded server needs the cleanup so we do some of the start work
+# but stop before actually running mysqld or anything.
start_master()
{
- if [ x$MASTER_RUNNING = x1 ] || [ x$LOCAL_MASTER = x1 ] ; then
+ eval "this_master_running=\$MASTER$1_RUNNING"
+ if [ x$this_master_running = x1 ] || [ x$LOCAL_MASTER = x1 ] ; then
return
fi
- # Remove old berkeley db log files that can confuse the server
- $RM -f $MASTER_MYDDIR/log.*
- # Remove stale binary logs
- $RM -f $MYSQL_TEST_DIR/var/log/master-bin.*
+ # Remove stale binary logs except for 2 tests which need them
+ if [ "$tname" != "rpl_crash_binlog_ib_1b" ] && [ "$tname" != "rpl_crash_binlog_ib_2b" ] && [ "$tname" != "rpl_crash_binlog_ib_3b" ]
+ then
+ $RM -f $MYSQL_TEST_DIR/var/log/master-bin$1.*
+ fi
+
# Remove old master.info and relay-log.info files
- $RM -f $MYSQL_TEST_DIR/var/master-data/master.info $MYSQL_TEST_DIR/var/master-data/relay-log.info
+ $RM -f $MYSQL_TEST_DIR/var/master-data$1/master.info $MYSQL_TEST_DIR/var/master-data$1/relay-log.info
#run master initialization shell script if one exists
@@ -879,19 +997,29 @@ start_master()
/bin/sh $master_init_script
fi
cd $BASEDIR # for gcov
+ if [ -n "$1" ] ; then
+ id=`$EXPR $1 + 101`;
+ this_master_myport=`$EXPR $MASTER_MYPORT + $1`
+ NOT_FIRST_MASTER_EXTRA_OPTS="--skip-innodb"
+ else
+ id=1;
+ this_master_myport=$MASTER_MYPORT
+ NOT_FIRST_MASTER_EXTRA_OPTS=""
+ fi
if [ -z "$DO_BENCH" ]
then
- master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin \
- --server-id=1 \
+ master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin$1 \
+ --server-id=$id \
--basedir=$MY_BASEDIR \
- --port=$MASTER_MYPORT \
+ --port=$this_master_myport \
--local-infile \
--exit-info=256 \
--core \
- --datadir=$MASTER_MYDDIR \
- --pid-file=$MASTER_MYPID \
- --socket=$MASTER_MYSOCK \
- --log=$MASTER_MYLOG \
+ $USE_NDBCLUSTER \
+ --datadir=$MASTER_MYDDIR$1 \
+ --pid-file=$MASTER_MYPID$1 \
+ --socket=$MASTER_MYSOCK$1 \
+ --log=$MASTER_MYLOG$1 \
--character-sets-dir=$CHARSETSDIR \
--default-character-set=$CHARACTER_SET \
--tmpdir=$MYSQL_TMP_DIR \
@@ -900,30 +1028,45 @@ start_master()
--open-files-limit=1024 \
$MASTER_40_ARGS \
$SMALL_SERVER \
- $EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT"
+ $EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT \
+ $NOT_FIRST_MASTER_EXTRA_OPTS"
else
- master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin \
- --server-id=1 --rpl-recovery-rank=1 \
+ master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin$1 \
+ --server-id=$id --rpl-recovery-rank=1 \
--basedir=$MY_BASEDIR --init-rpl-role=master \
- --port=$MASTER_MYPORT \
+ --port=$this_master_myport \
--local-infile \
- --datadir=$MASTER_MYDDIR \
- --pid-file=$MASTER_MYPID \
- --socket=$MASTER_MYSOCK \
+ --datadir=$MASTER_MYDDIR$1 \
+ --pid-file=$MASTER_MYPID$1 \
+ --socket=$MASTER_MYSOCK$1 \
--character-sets-dir=$CHARSETSDIR \
--default-character-set=$CHARACTER_SET \
--core \
+ $USE_NDBCLUSTER \
--tmpdir=$MYSQL_TMP_DIR \
--language=$LANGUAGE \
--innodb_data_file_path=ibdata1:50M \
$MASTER_40_ARGS \
$SMALL_SERVER \
- $EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT"
+ $EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT \
+ $NOT_FIRST_MASTER_EXTRA_OPTS"
fi
CUR_MYERR=$MASTER_MYERR
CUR_MYSOCK=$MASTER_MYSOCK
+ # For embedded server we collect the server flags and return
+ if [ "x$USE_EMBEDDED_SERVER" = "x1" ] ; then
+ # Add a -A to each argument to pass it to embedded server
+ EMBEDDED_SERVER_OPTS=""
+ for opt in $master_args
+ do
+ EMBEDDED_SERVER_OPTS="$EMBEDDED_SERVER_OPTS -A $opt"
+ done
+ EXTRA_MYSQL_TEST_OPT="$EMBEDDED_SERVER_OPTS"
+ return
+ fi
+
if [ x$DO_DDD = x1 ]
then
$ECHO "set args $master_args" > $GDB_MASTER_INIT
@@ -954,9 +1097,9 @@ EOF
else
manager_launch master $MASTER_MYSQLD $master_args
fi
- sleep_until_file_created $MASTER_MYPID $wait_for_master
+ sleep_until_file_created $MASTER_MYPID$1 $wait_for_master
wait_for_master=$SLEEP_TIME_FOR_SECOND_MASTER
- MASTER_RUNNING=1
+ eval "MASTER$1_RUNNING=1"
}
start_slave()
@@ -988,8 +1131,12 @@ start_slave()
slave_sock="$SLAVE_MYSOCK"
fi
# Remove stale binary logs and old master.info files
- $RM -f $MYSQL_TEST_DIR/var/log/$slave_ident-*bin.*
- $RM -f $slave_datadir/master.info $slave_datadir/relay-log.info
+ # except for too tests which need them
+ if [ "$tname" != "rpl_crash_binlog_ib_1b" ] && [ "$tname" != "rpl_crash_binlog_ib_2b" ] && [ "$tname" != "rpl_crash_binlog_ib_3b" ]
+ then
+ $RM -f $MYSQL_TEST_DIR/var/log/$slave_ident-*bin.*
+ $RM -f $slave_datadir/master.info $slave_datadir/relay-log.info
+ fi
#run slave initialization shell script if one exists
if [ -f "$slave_init_script" ] ;
@@ -1025,7 +1172,7 @@ start_slave()
--core --init-rpl-role=slave \
--tmpdir=$MYSQL_TMP_DIR \
--language=$LANGUAGE \
- --skip-innodb --skip-slave-start \
+ --skip-innodb --skip-ndbcluster --skip-slave-start \
--slave-load-tmpdir=$SLAVE_LOAD_TMPDIR \
--report-host=127.0.0.1 --report-user=root \
--report-port=$slave_port \
@@ -1080,6 +1227,7 @@ mysql_start ()
# start_master
# start_slave
cd $MYSQL_TEST_DIR
+ start_ndbcluster
return 1
}
@@ -1128,26 +1276,31 @@ stop_slave_threads ()
stop_master ()
{
- if [ x$MASTER_RUNNING = x1 ]
+ eval "this_master_running=\$MASTER$1_RUNNING"
+ if [ x$this_master_running = x1 ]
then
- pid=`$CAT $MASTER_MYPID`
- manager_term $pid master
- if [ $? != 0 ] && [ -f $MASTER_MYPID ]
- then # try harder!
- $ECHO "master not cooperating with mysqladmin, will try manual kill"
- kill $pid
- sleep_until_file_deleted $pid $MASTER_MYPID
- if [ -f $MASTER_MYPID ] ; then
- $ECHO "master refused to die. Sending SIGKILL"
- kill -9 `$CAT $MASTER_MYPID`
- $RM -f $MASTER_MYPID
+ # For embedded server we don't stop anyting but mark that
+ # MASTER_RUNNING=0 to get cleanup when calling start_master().
+ if [ x$USE_EMBEDDED_SERVER != x1 ] ; then
+ pid=`$CAT $MASTER_MYPID$1`
+ manager_term $pid master $1
+ if [ $? != 0 ] && [ -f $MASTER_MYPID$1 ]
+ then # try harder!
+ $ECHO "master not cooperating with mysqladmin, will try manual kill"
+ kill $pid
+ sleep_until_file_deleted $pid $MASTER_MYPID$1
+ if [ -f $MASTER_MYPID$1 ] ; then
+ $ECHO "master refused to die. Sending SIGKILL"
+ kill -9 `$CAT $MASTER_MYPID$1`
+ $RM -f $MASTER_MYPID$1
+ else
+ $ECHO "master responded to SIGTERM "
+ fi
else
- $ECHO "master responded to SIGTERM "
+ sleep $SLEEP_TIME_AFTER_RESTART
fi
- else
- sleep $SLEEP_TIME_AFTER_RESTART
fi
- MASTER_RUNNING=0
+ eval "MASTER$1_RUNNING=0"
fi
}
@@ -1157,12 +1310,13 @@ mysql_stop ()
$ECHO "Shutting-down MySQL daemon"
$ECHO ""
stop_master
+ stop_master 1
$ECHO "Master shutdown finished"
stop_slave
stop_slave 1
stop_slave 2
$ECHO "Slave shutdown finished"
-
+ stop_ndbcluster
return 1
}
@@ -1188,43 +1342,88 @@ run_testcase ()
master_init_script=$TESTDIR/$tname-master.sh
slave_init_script=$TESTDIR/$tname-slave.sh
slave_master_info_file=$TESTDIR/$tname.slave-mi
- result_file=$tname
+ tsrcdir=$TESTDIR/$tname-src
+ result_file="r/$tname.result"
echo $tname > $CURRENT_TEST
SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0`
- if [ $USE_MANAGER = 1 ] ; then
+ if [ -n "$RESULT_EXT" -a \( x$RECORD = x1 -o -f "$result_file$RESULT_EXT" \) ] ; then
+ result_file="$result_file$RESULT_EXT"
+ fi
+ if [ "$USE_MANAGER" = 1 ] ; then
many_slaves=`$EXPR \( \( $tname : rpl_failsafe \) != 0 \) \| \( \( $tname : rpl_chain_temp_table \) != 0 \)`
fi
+ if $EXPR "$tname" '<' "$START_FROM" > /dev/null ; then
+ #skip_test $tname
+ return
+ fi
- if [ -n "$SKIP_TEST" ] ; then
- SKIP_THIS_TEST=`$EXPR \( $tname : "$SKIP_TEST" \) != 0`
- if [ x$SKIP_THIS_TEST = x1 ] ;
- then
- skip_test $tname;
- return;
+ if [ "$SKIP_TEST" ] ; then
+ if $EXPR \( "$tname" : "$SKIP_TEST" \) > /dev/null ; then
+ skip_test $tname
+ return
fi
- fi
+ fi
- if [ -n "$DO_TEST" ] ; then
- DO_THIS_TEST=`$EXPR \( $tname : "$DO_TEST" \) != 0`
- if [ x$DO_THIS_TEST = x0 ] ;
- then
- skip_test $tname;
- return;
+ if [ "$DO_TEST" ] ; then
+ if $EXPR \( "$tname" : "$DO_TEST" \) > /dev/null ; then
+ : #empty command to keep some shells happy
+ else
+ #skip_test $tname
+ return
fi
- fi
-
+ fi
- if [ x${NO_SLAVE}x$SKIP_SLAVE = x1x0 ] ;
- then
- skip_test $tname;
+ if [ x${NO_SLAVE}x$SKIP_SLAVE = x1x0 ] ; then
+ skip_test $tname
return
fi
- # Stop all slave threads, so that we don't have useless reconnection attempts
- # and error messages in case the slave and master servers restart.
- stop_slave_threads
- stop_slave_threads 1
- stop_slave_threads 2
+ if [ "x$USE_EMBEDDED_SERVER" != "x1" ] ; then
+ # Stop all slave threads, so that we don't have useless reconnection
+ # attempts and error messages in case the slave and master servers restart.
+ stop_slave_threads
+ stop_slave_threads 1
+ stop_slave_threads 2
+ fi
+
+ # FIXME temporary solution, we will get a new C version of this
+ # script soon anyway so it is not worth it spending the time
+ if [ "x$USE_EMBEDDED_SERVER" = "x1" -a -z "$DO_TEST" ] ; then
+ for t in \
+ "alter_table" \
+ "bdb-deadlock" \
+ "connect" \
+ "ctype_latin1_de" \
+ "ctype_ucs" \
+ "flush_block_commit" \
+ "grant2" \
+ "grant_cache" \
+ "grant" \
+ "init_connect" \
+ "init_file" \
+ "innodb" \
+ "innodb-deadlock" \
+ "innodb-lock" \
+ "mix_innodb_myisam_binlog" \
+ "mysqlbinlog2" \
+ "mysqlbinlog" \
+ "mysqldump" \
+ "mysql_protocols" \
+ "packet" \
+ "ps_1general" \
+ "rename" \
+ "show_check" \
+ "system_mysql_db_fix" \
+ "timezone2" \
+ "user_var" \
+ "variables"
+ do
+ if [ "$tname" = "$t" ] ; then
+ skip_test $tname
+ return
+ fi
+ done
+ fi
if [ -z "$USE_RUNNING_SERVER" ] ;
then
@@ -1240,67 +1439,86 @@ run_testcase ()
;;
--result-file=*)
result_file=`$ECHO "$EXTRA_MASTER_OPT" | $SED -e "s;--result-file=;;"`
+ result_file="r/$result_file.result"
+ if [ -n "$RESULT_EXT" -a \( x$RECORD = x1 -o -f "$result_file$RESULT_EXT" \) ] ; then
+ result_file="$result_file$RESULT_EXT"
+ fi
# Note that this must be set to space, not "" for test-reset to work
EXTRA_MASTER_OPT=" "
;;
esac
stop_master
+ stop_master 1
echo "CURRENT_TEST: $tname" >> $MASTER_MYERR
start_master
+ if [ -n "$USE_NDBCLUSTER" -a -z "$DO_BENCH" ] ; then
+ start_master 1
+ fi
TZ=$MY_TZ; export TZ
else
- if [ ! -z "$EXTRA_MASTER_OPT" ] || [ x$MASTER_RUNNING != x1 ] || [ -f $master_init_script ]
+ # If we had extra master opts to the previous run
+ # or there is no master running (FIXME strange.....)
+ # or there is a master init script
+ if [ ! -z "$EXTRA_MASTER_OPT" ] || [ x$MASTER_RUNNING != x1 ] || \
+ [ -f $master_init_script ]
then
EXTRA_MASTER_OPT=""
stop_master
+ stop_master 1
echo "CURRENT_TEST: $tname" >> $MASTER_MYERR
start_master
+ if [ -n "$USE_NDBCLUSTER" -a -z "$DO_BENCH" ] ; then
+ start_master 1
+ fi
else
echo "CURRENT_TEST: $tname" >> $MASTER_MYERR
fi
fi
- do_slave_restart=0
- if [ -f $slave_opt_file ] ;
- then
- EXTRA_SLAVE_OPT=`$CAT $slave_opt_file | $SED -e "s;\\$MYSQL_TEST_DIR;$MYSQL_TEST_DIR;"`
- do_slave_restart=1
- else
- if [ ! -z "$EXTRA_SLAVE_OPT" ] || [ x$SLAVE_RUNNING != x1 ] ;
- then
- EXTRA_SLAVE_OPT=""
- do_slave_restart=1
- fi
- fi
-
- if [ -f $slave_master_info_file ] ; then
- SLAVE_MASTER_INFO=`$CAT $slave_master_info_file`
- do_slave_restart=1
- else
- if [ ! -z "$SLAVE_MASTER_INFO" ] || [ x$SLAVE_RUNNING != x1 ] ;
+ # We never start a slave if embedded server is used
+ if [ "x$USE_EMBEDDED_SERVER" != "x1" ] ; then
+ do_slave_restart=0
+ if [ -f $slave_opt_file ] ;
then
- SLAVE_MASTER_INFO=""
+ EXTRA_SLAVE_OPT=`$CAT $slave_opt_file | $SED -e "s;\\$MYSQL_TEST_DIR;$MYSQL_TEST_DIR;"`
do_slave_restart=1
+ else
+ if [ ! -z "$EXTRA_SLAVE_OPT" ] || [ x$SLAVE_RUNNING != x1 ] ;
+ then
+ EXTRA_SLAVE_OPT=""
+ do_slave_restart=1
+ fi
fi
- fi
- if [ x$do_slave_restart = x1 ] ; then
- stop_slave
- echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR
- start_slave
- else
- echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR
- fi
- if [ x$many_slaves = x1 ]; then
- start_slave 1
- start_slave 2
+ if [ -f $slave_master_info_file ] ; then
+ SLAVE_MASTER_INFO=`$CAT $slave_master_info_file`
+ do_slave_restart=1
+ else
+ if [ ! -z "$SLAVE_MASTER_INFO" ] || [ x$SLAVE_RUNNING != x1 ] ;
+ then
+ SLAVE_MASTER_INFO=""
+ do_slave_restart=1
+ fi
+ fi
+
+ if [ x$do_slave_restart = x1 ] ; then
+ stop_slave
+ echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR
+ start_slave
+ else
+ echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR
+ fi
+ if [ x$many_slaves = x1 ]; then
+ start_slave 1
+ start_slave 2
+ fi
fi
fi
cd $MYSQL_TEST_DIR
if [ -f $tf ] ; then
$RM -f r/$tname.*reject
- mysql_test_args="-R r/$result_file.result $EXTRA_MYSQL_TEST_OPT"
+ mysql_test_args="-R $result_file $EXTRA_MYSQL_TEST_OPT"
if [ -z "$DO_CLIENT_GDB" ] ; then
`$MYSQL_TEST $mysql_test_args < $tf 2> $TIMEFILE`;
else
@@ -1320,24 +1538,33 @@ run_testcase ()
if [ $res = 0 ]; then
total_inc
pass_inc
- $ECHO "$RES$RES_SPACE [ pass ]"
+ TIMER=""
+ if [ x$USE_TIMER = x1 -a -f "$MY_LOG_DIR/timer" ]; then
+ TIMER=`cat $MY_LOG_DIR/timer`
+ TIMER=`$PRINTF "%13s" $TIMER`
+ fi
+ $ECHO "$RES$RES_SPACE [ pass ] $TIMER"
else
# why the following ``if'' ? That is why res==1 is special ?
if [ $res = 2 ]; then
skip_inc
$ECHO "$RES$RES_SPACE [ skipped ]"
else
+ if [ $res -gt 2 ]; then
+ $ECHO "mysqltest returned unexpected code $res, it has probably crashed" >> $TIMEFILE
+ fi
total_inc
fail_inc
$ECHO "$RES$RES_SPACE [ fail ]"
$ECHO
error_is
- show_failed_diff $result_file
+ show_failed_diff $tname
$ECHO
if [ x$FORCE != x1 ] ; then
$ECHO "Aborting: $tname failed. To continue, re-run with '--force'."
$ECHO
- if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && [ -z "$DO_DDD" ]
+ if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && \
+ [ -z "$DO_DDD" ] && [ -z "$USE_EMBEDDED_SERVER" ]
then
mysql_stop
stop_manager
@@ -1345,7 +1572,8 @@ run_testcase ()
exit 1
fi
FAILED_CASES="$FAILED_CASES $tname"
- if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && [ -z "$DO_DDD" ]
+ if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && \
+ [ -z "$DO_DDD" ] && [ -z "$USE_EMBEDDED_SERVER" ]
then
mysql_restart
fi
@@ -1371,14 +1599,17 @@ then
then
# Ensure that no old mysqld test servers are running
$MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
+ $MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK1 -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
$MYSQLADMIN --no-defaults --socket=$SLAVE_MYSOCK -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
$MYSQLADMIN --no-defaults --host=$hostname --port=$MASTER_MYPORT -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
+ $MYSQLADMIN --no-defaults --host=$hostname --port=$MASTER_MYPORT1 -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
$MYSQLADMIN --no-defaults --host=$hostname --port=$SLAVE_MYPORT -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
$MYSQLADMIN --no-defaults --host=$hostname --port=`expr $SLAVE_MYPORT + 1` -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
sleep_until_file_deleted 0 $MASTER_MYPID
+ sleep_until_file_deleted 0 $MASTER_MYPID"1"
sleep_until_file_deleted 0 $SLAVE_MYPID
else
- rm $MASTER_MYPID $SLAVE_MYPID
+ rm $MASTER_MYPID $MASTER_MYPID"1" $SLAVE_MYPID
fi
# Kill any running managers
@@ -1393,13 +1624,21 @@ then
fi
fi
+ stop_ndbcluster
+
# Remove files that can cause problems
+ $RM -rf $MYSQL_TEST_DIR/var/ndbcluster
$RM -f $MYSQL_TEST_DIR/var/run/* $MYSQL_TEST_DIR/var/tmp/*
+ # Remove old berkeley db log files that can confuse the server
+ $RM -f $MASTER_MYDDIR/log.*
+ $RM -f $MASTER_MYDDIR"1"/log.*
+
wait_for_master=$SLEEP_TIME_FOR_FIRST_MASTER
wait_for_slave=$SLEEP_TIME_FOR_FIRST_SLAVE
$ECHO "Installing Test Databases"
mysql_install_db
+
start_manager
# Do not automagically start daemons if we are in gdb or running only one test
@@ -1424,16 +1663,28 @@ $ECHO "Starting Tests"
#
if [ "$DO_BENCH" = 1 ]
then
+ start_master
+
+ if [ "$DO_SMALL_BENCH" = 1 ]
+ then
+ EXTRA_BENCH_ARGS="--small-test --small-tables"
+ fi
+
+ if [ ! -z "$USE_NDBCLUSTER" ]
+ then
+ EXTRA_BENCH_ARGS="--create-options=TYPE=ndb $EXTRA_BENCH_ARGS"
+ fi
+
BENCHDIR=$BASEDIR/sql-bench/
savedir=`pwd`
cd $BENCHDIR
if [ -z "$1" ]
then
- ./run-all-tests --socket=$MASTER_MYSOCK --user=root
+ ./run-all-tests --socket=$MASTER_MYSOCK --user=root $EXTRA_BENCH_ARGS --log
else
if [ -x "./$1" ]
then
- ./$1 --socket=$MASTER_MYSOCK --user=root
+ ./$1 --socket=$MASTER_MYSOCK --user=root $EXTRA_BENCH_ARGS
else
echo "benchmark $1 not found"
fi
@@ -1445,20 +1696,24 @@ then
fi
$ECHO
-$ECHO " TEST RESULT"
+if [ x$USE_TIMER = x1 ] ; then
+$ECHO "TEST RESULT TIME (ms)"
+else
+$ECHO "TEST RESULT"
+fi
$ECHO $DASH72
if [ -z "$1" ] ;
then
- if [ x$RECORD = x1 ]; then
- $ECHO "Will not run in record mode without a specific test case."
- else
- for tf in $TESTDIR/*.$TESTSUFFIX
- do
- run_testcase $tf
- done
- $RM -f $TIMEFILE # Remove for full test
- fi
+ if [ x$RECORD = x1 ]; then
+ $ECHO "Will not run in record mode without a specific test case."
+ else
+ for tf in $TESTDIR/*.$TESTSUFFIX
+ do
+ run_testcase $tf
+ done
+ $RM -f $TIMEFILE # Remove for full test
+ fi
else
while [ ! -z "$1" ]; do
tname=`$BASENAME $1 .test`
@@ -1479,7 +1734,6 @@ if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && [ -z "$DO_DDD" ]
then
mysql_stop
fi
-
stop_manager
report_stats
$ECHO
diff --git a/mysql-test/mysql_test_run_new.c b/mysql-test/mysql_test_run_new.c
new file mode 100644
index 00000000000..fe13d71c1c2
--- /dev/null
+++ b/mysql-test/mysql_test_run_new.c
@@ -0,0 +1,1779 @@
+/*
+ Copyright (c) 2002, 2003 Novell, Inc. All Rights Reserved.
+
+ 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; either version 2 of the License, or
+ (at your option) any later version.
+
+ 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 <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#ifndef __WIN__
+#include <dirent.h>
+#endif
+#include <string.h>
+#ifdef __NETWARE__
+#include <screen.h>
+#include <nks/vm.h>
+#endif
+#include <ctype.h>
+#include <sys/stat.h>
+#ifndef __WIN__
+#include <unistd.h>
+#endif
+#include <fcntl.h>
+#ifdef __NETWARE__
+#include <sys/mode.h>
+#endif
+#ifdef __WIN__
+#include <Shlwapi.h>
+#include <direct.h>
+#endif
+
+#include "my_manage.h"
+
+/******************************************************************************
+
+ macros
+
+******************************************************************************/
+
+#define HEADER "TEST RESULT \n"
+#define DASH "-------------------------------------------------------\n"
+
+#define NW_TEST_SUFFIX ".nw-test"
+#define NW_RESULT_SUFFIX ".nw-result"
+#define TEST_SUFFIX ".test"
+#define RESULT_SUFFIX ".result"
+#define REJECT_SUFFIX ".reject"
+#define OUT_SUFFIX ".out"
+#define ERR_SUFFIX ".err"
+
+const char *TEST_PASS= "[ pass ]";
+const char *TEST_SKIP= "[ skip ]";
+const char *TEST_FAIL= "[ fail ]";
+const char *TEST_BAD= "[ bad ]";
+const char *TEST_IGNORE= "[ignore]";
+
+/******************************************************************************
+
+ global variables
+
+******************************************************************************/
+
+#ifdef __NETWARE__
+static char base_dir[FN_REFLEN]= "sys:/mysql";
+#else
+static char base_dir[FN_REFLEN]= "..";
+#endif
+static char db[FN_LEN]= "test";
+static char user[FN_LEN]= "root";
+static char password[FN_LEN]= "";
+
+int master_port= 9306;
+int slave_port= 9307;
+
+#if !defined(__NETWARE__) && !defined(__WIN__)
+static char master_socket[FN_REFLEN]= "./var/tmp/master.sock";
+static char slave_socket[FN_REFLEN]= "./var/tmp/slave.sock";
+#endif
+
+/* comma delimited list of tests to skip or empty string */
+#ifndef __WIN__
+static char skip_test[FN_REFLEN]= " lowercase_table3 , system_mysql_db_fix ";
+#else
+/*
+ The most ignore testes contain the calls of system command
+*/
+#define MAX_COUNT_TESTES 1024
+/*
+ lowercase_table3 is disabled by Gerg
+ system_mysql_db_fix is disabled by Gerg
+ sp contains a command system
+ rpl_EE_error contains a command system
+ rpl_loaddatalocal contains a command system
+ ndb_autodiscover contains a command system
+ rpl_rotate_logs contains a command system
+ repair contains a command system
+ rpl_trunc_binlog contains a command system
+ mysqldump contains a command system
+ rpl000001 makes non-exit loop...temporary skiped
+*/
+static char skip_test[FN_REFLEN]=
+" lowercase_table3 ,"
+" system_mysql_db_fix ,"
+" sp ,"
+" rpl_EE_error ,"
+" rpl_loaddatalocal ,"
+" ndb_autodiscover ,"
+" rpl_rotate_logs ,"
+" repair ,"
+" rpl_trunc_binlog ,"
+" mysqldump ,"
+" rpl000001 ";
+#endif
+static char ignore_test[FN_REFLEN]= "";
+
+static char bin_dir[FN_REFLEN];
+static char mysql_test_dir[FN_REFLEN];
+static char test_dir[FN_REFLEN];
+static char mysql_tmp_dir[FN_REFLEN];
+static char result_dir[FN_REFLEN];
+static char master_dir[FN_REFLEN];
+static char slave_dir[FN_REFLEN];
+static char lang_dir[FN_REFLEN];
+static char char_dir[FN_REFLEN];
+
+static char mysqladmin_file[FN_REFLEN];
+static char mysqld_file[FN_REFLEN];
+static char mysqltest_file[FN_REFLEN];
+#ifndef __WIN__
+static char master_pid[FN_REFLEN];
+static char slave_pid[FN_REFLEN];
+static char sh_file[FN_REFLEN]= "/bin/sh";
+#else
+static HANDLE master_pid;
+static HANDLE slave_pid;
+#endif
+
+static char master_opt[FN_REFLEN]= "";
+static char slave_opt[FN_REFLEN]= "";
+
+static char slave_master_info[FN_REFLEN]= "";
+
+static char master_init_script[FN_REFLEN]= "";
+static char slave_init_script[FN_REFLEN]= "";
+
+/* OpenSSL */
+static char ca_cert[FN_REFLEN];
+static char server_cert[FN_REFLEN];
+static char server_key[FN_REFLEN];
+static char client_cert[FN_REFLEN];
+static char client_key[FN_REFLEN];
+
+int total_skip= 0;
+int total_pass= 0;
+int total_fail= 0;
+int total_test= 0;
+
+int total_ignore= 0;
+
+int use_openssl= FALSE;
+int master_running= FALSE;
+int slave_running= FALSE;
+int skip_slave= TRUE;
+int single_test= TRUE;
+
+int restarts= 0;
+
+FILE *log_fd= NULL;
+
+/******************************************************************************
+
+ functions
+
+******************************************************************************/
+
+/******************************************************************************
+
+ prototypes
+
+******************************************************************************/
+
+void report_stats();
+void install_db(char *);
+void mysql_install_db();
+void start_master();
+void start_slave();
+void mysql_start();
+void stop_slave();
+void stop_master();
+void mysql_stop();
+void mysql_restart();
+int read_option(char *, char *);
+void run_test(char *);
+void setup(char *);
+void vlog(const char *, va_list);
+void mlog(const char *, ...);
+void log_info(const char *, ...);
+void log_error(const char *, ...);
+void log_errno(const char *, ...);
+void die(const char *);
+char *str_tok(char *string, const char *delim);
+#ifndef __WIN__
+void run_init_script(const char *script_name);
+#endif
+/******************************************************************************
+
+ report_stats()
+
+ Report the gathered statistics.
+
+******************************************************************************/
+
+void report_stats()
+{
+ if (total_fail == 0)
+ {
+ mlog("\nAll %d test(s) were successful.\n", total_test);
+ }
+ else
+ {
+ double percent= ((double)total_pass / total_test) * 100;
+
+ mlog("\nFailed %u/%u test(s), %.02f%% successful.\n",
+ total_fail, total_test, percent);
+ mlog("\nThe .out and .err files in %s may give you some\n", result_dir);
+ mlog("hint of what when wrong.\n");
+ mlog("\nIf you want to report this error, please first read "
+ "the documentation\n");
+ mlog("at: http://www.mysql.com/doc/M/y/MySQL_test_suite.html\n");
+ }
+}
+
+/******************************************************************************
+
+ install_db()
+
+ Install the a database.
+
+******************************************************************************/
+
+void install_db(char *datadir)
+{
+ arg_list_t al;
+ int err;
+ char input[FN_REFLEN];
+ char output[FN_REFLEN];
+ char error[FN_REFLEN];
+
+ /* input file */
+#ifdef __NETWARE__
+ snprintf(input, FN_REFLEN, "%s/bin/init_db.sql", base_dir);
+#else
+ snprintf(input, FN_REFLEN, "%s/mysql-test/init_db.sql", base_dir);
+#endif
+ snprintf(output, FN_REFLEN, "%s/install.out", datadir);
+ snprintf(error, FN_REFLEN, "%s/install.err", datadir);
+
+ if (create_system_files(datadir,input, TRUE))
+ die("Unable to create init_db.sql.");
+ /* args */
+ init_args(&al);
+ add_arg(&al, mysqld_file);
+ add_arg(&al, "--no-defaults");
+ add_arg(&al, "--bootstrap");
+ add_arg(&al, "--skip-grant-tables");
+ add_arg(&al, "--basedir=%s", base_dir);
+ add_arg(&al, "--datadir=%s", datadir);
+ add_arg(&al, "--skip-innodb");
+ add_arg(&al, "--skip-bdb");
+#ifndef __NETWARE__
+ add_arg(&al, "--character-sets-dir=%s", char_dir);
+ add_arg(&al, "--language=%s", lang_dir);
+#endif
+
+ /* spawn */
+ if ((err= spawn(mysqld_file, &al, TRUE, input, output, error, NULL)) != 0)
+ {
+ die("Unable to create database.");
+ }
+
+ /* free args */
+ free_args(&al);
+}
+
+/******************************************************************************
+
+ mysql_install_db()
+
+ Install the test databases.
+
+******************************************************************************/
+
+void mysql_install_db()
+{
+ char temp[FN_REFLEN];
+
+ /* var directory */
+ snprintf(temp, FN_REFLEN, "%s/var", mysql_test_dir);
+
+ /* create var directory */
+#ifndef __WIN__
+ mkdir(temp, S_IRWXU);
+ /* create subdirectories */
+ mlog("Creating test-suite folders...\n");
+ snprintf(temp, FN_REFLEN, "%s/var/run", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, FN_REFLEN, "%s/var/tmp", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, FN_REFLEN, "%s/var/master-data", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, FN_REFLEN, "%s/var/master-data/mysql", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, FN_REFLEN, "%s/var/master-data/test", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, FN_REFLEN, "%s/var/slave-data", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, FN_REFLEN, "%s/var/slave-data/mysql", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, FN_REFLEN, "%s/var/slave-data/test", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+#else
+ mkdir(temp);
+ /* create subdirectories */
+ mlog("Creating test-suite folders...\n");
+ snprintf(temp, FN_REFLEN, "%s/var/run", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, FN_REFLEN, "%s/var/tmp", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, FN_REFLEN, "%s/var/master-data", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, FN_REFLEN, "%s/var/master-data/mysql", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, FN_REFLEN, "%s/var/master-data/test", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, FN_REFLEN, "%s/var/slave-data", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, FN_REFLEN, "%s/var/slave-data/mysql", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, FN_REFLEN, "%s/var/slave-data/test", mysql_test_dir);
+ mkdir(temp);
+#endif
+
+ /* install databases */
+ mlog("Creating test databases for master... \n");
+ install_db(master_dir);
+ mlog("Creating test databases for slave... \n");
+ install_db(slave_dir);
+}
+
+/******************************************************************************
+
+ start_master()
+
+ Start the master server.
+
+******************************************************************************/
+
+void start_master()
+{
+ arg_list_t al;
+ int err;
+ char master_out[FN_REFLEN];
+ char master_err[FN_REFLEN];
+/* char temp[FN_REFLEN]; */
+ char temp2[FN_REFLEN];
+
+ /* remove old berkeley db log files that can confuse the server */
+ removef("%s/log.*", master_dir);
+
+ /* remove stale binary logs */
+ removef("%s/var/log/*-bin.*", mysql_test_dir);
+
+ /* remove stale binary logs */
+ removef("%s/var/log/*.index", mysql_test_dir);
+
+ /* remove master.info file */
+ removef("%s/master.info", master_dir);
+
+ /* remove relay files */
+ removef("%s/var/log/*relay*", mysql_test_dir);
+
+ /* remove relay-log.info file */
+ removef("%s/relay-log.info", master_dir);
+
+ /* init script */
+ if (master_init_script[0] != 0)
+ {
+#ifdef __NETWARE__
+ /* TODO: use the scripts */
+ if (strinstr(master_init_script, "repair_part2-master.sh") != 0)
+ {
+ FILE *fp;
+
+ /* create an empty index file */
+ snprintf(temp, FN_REFLEN, "%s/test/t1.MYI", master_dir);
+ fp= fopen(temp, "wb+");
+
+ fputs("1", fp);
+
+ fclose(fp);
+ }
+#elif !defined(__WIN__)
+ run_init_script(master_init_script);
+#endif
+ }
+
+ /* redirection files */
+ snprintf(master_out, FN_REFLEN, "%s/var/run/master%u.out",
+ mysql_test_dir, restarts);
+ snprintf(master_err, FN_REFLEN, "%s/var/run/master%u.err",
+ mysql_test_dir, restarts);
+#ifndef __WIN__
+ snprintf(temp2,FN_REFLEN,"%s/var",mysql_test_dir);
+ mkdir(temp2,S_IRWXU);
+ snprintf(temp2,FN_REFLEN,"%s/var/log",mysql_test_dir);
+ mkdir(temp2,S_IRWXU);
+#else
+ snprintf(temp2,FN_REFLEN,"%s/var",mysql_test_dir);
+ mkdir(temp2);
+ snprintf(temp2,FN_REFLEN,"%s/var/log",mysql_test_dir);
+ mkdir(temp2);
+#endif
+ /* args */
+ init_args(&al);
+ add_arg(&al, "%s", mysqld_file);
+ add_arg(&al, "--no-defaults");
+ add_arg(&al, "--log-bin=%s/var/log/master-bin",mysql_test_dir);
+ add_arg(&al, "--server-id=1");
+ add_arg(&al, "--basedir=%s", base_dir);
+ add_arg(&al, "--port=%u", master_port);
+#if !defined(__NETWARE__) && !defined(__WIN__)
+ add_arg(&al, "--socket=%s",master_socket);
+#endif
+ add_arg(&al, "--local-infile");
+ add_arg(&al, "--core");
+ add_arg(&al, "--datadir=%s", master_dir);
+#ifndef __WIN__
+ add_arg(&al, "--pid-file=%s", master_pid);
+#endif
+ add_arg(&al, "--character-sets-dir=%s", char_dir);
+ add_arg(&al, "--tmpdir=%s", mysql_tmp_dir);
+ add_arg(&al, "--language=%s", lang_dir);
+#ifdef DEBUG /* only for debug builds */
+ add_arg(&al, "--debug");
+#endif
+
+ if (use_openssl)
+ {
+ add_arg(&al, "--ssl-ca=%s", ca_cert);
+ add_arg(&al, "--ssl-cert=%s", server_cert);
+ add_arg(&al, "--ssl-key=%s", server_key);
+ }
+
+ /* $MASTER_40_ARGS */
+ add_arg(&al, "--rpl-recovery-rank=1");
+ add_arg(&al, "--init-rpl-role=master");
+
+ /* $SMALL_SERVER */
+ add_arg(&al, "-O");
+ add_arg(&al, "key_buffer_size=1M");
+ add_arg(&al, "-O");
+ add_arg(&al, "sort_buffer=256K");
+ add_arg(&al, "-O");
+ add_arg(&al, "max_heap_table_size=1M");
+
+ /* $EXTRA_MASTER_OPT */
+ if (master_opt[0] != 0)
+ {
+ char *p;
+
+ p= (char *)str_tok(master_opt, " \t");
+ if (!strstr(master_opt, "timezone"))
+ {
+ while (p)
+ {
+ add_arg(&al, "%s", p);
+ p= (char *)str_tok(NULL, " \t");
+ }
+ }
+ }
+
+ /* remove the pid file if it exists */
+#ifndef __WIN__
+ remove(master_pid);
+#endif
+
+ /* spawn */
+#ifdef __WIN__
+ if ((err= spawn(mysqld_file, &al, FALSE, NULL,
+ master_out, master_err, &master_pid)) == 0)
+#else
+ if ((err= spawn(mysqld_file, &al, FALSE, NULL,
+ master_out, master_err, master_pid)) == 0)
+#endif
+ {
+ sleep_until_file_exists(master_pid);
+
+ if ((err= wait_for_server_start(bin_dir, mysqladmin_file, user, password,
+ master_port, mysql_tmp_dir)) == 0)
+ {
+ master_running= TRUE;
+ }
+ else
+ {
+ log_error("The master server went down early.");
+ }
+ }
+ else
+ {
+ log_error("Unable to start master server.");
+ }
+
+ /* free_args */
+ free_args(&al);
+}
+
+/******************************************************************************
+
+ start_slave()
+
+ Start the slave server.
+
+******************************************************************************/
+
+void start_slave()
+{
+ arg_list_t al;
+ int err;
+ char slave_out[FN_REFLEN];
+ char slave_err[FN_REFLEN];
+
+ /* skip? */
+ if (skip_slave) return;
+
+ /* remove stale binary logs */
+ removef("%s/*-bin.*", slave_dir);
+
+ /* remove stale binary logs */
+ removef("%s/*.index", slave_dir);
+
+ /* remove master.info file */
+ removef("%s/master.info", slave_dir);
+
+ /* remove relay files */
+ removef("%s/var/log/*relay*", mysql_test_dir);
+
+ /* remove relay-log.info file */
+ removef("%s/relay-log.info", slave_dir);
+
+ /* init script */
+ if (slave_init_script[0] != 0)
+ {
+#ifdef __NETWARE__
+ /* TODO: use the scripts */
+ if (strinstr(slave_init_script, "rpl000016-slave.sh") != 0)
+ {
+ /* create empty master.info file */
+ snprintf(temp, FN_REFLEN, "%s/master.info", slave_dir);
+ close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO));
+ }
+ else if (strinstr(slave_init_script, "rpl000017-slave.sh") != 0)
+ {
+ FILE *fp;
+
+ /* create a master.info file */
+ snprintf(temp, FN_REFLEN, "%s/master.info", slave_dir);
+ fp= fopen(temp, "wb+");
+
+ fputs("master-bin.000001\n", fp);
+ fputs("4\n", fp);
+ fputs("127.0.0.1\n", fp);
+ fputs("replicate\n", fp);
+ fputs("aaaaaaaaaaaaaaab\n", fp);
+ fputs("9306\n", fp);
+ fputs("1\n", fp);
+ fputs("0\n", fp);
+
+ fclose(fp);
+ }
+ else if (strinstr(slave_init_script, "rpl_rotate_logs-slave.sh") != 0)
+ {
+ /* create empty master.info file */
+ snprintf(temp, FN_REFLEN, "%s/master.info", slave_dir);
+ close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO));
+ }
+#elif !defined(__WIN__)
+ run_init_script(slave_init_script);
+#endif
+ }
+
+ /* redirection files */
+ snprintf(slave_out, FN_REFLEN, "%s/var/run/slave%u.out",
+ mysql_test_dir, restarts);
+ snprintf(slave_err, FN_REFLEN, "%s/var/run/slave%u.err",
+ mysql_test_dir, restarts);
+
+ /* args */
+ init_args(&al);
+ add_arg(&al, "%s", mysqld_file);
+ add_arg(&al, "--no-defaults");
+ add_arg(&al, "--log-bin=slave-bin");
+ add_arg(&al, "--relay_log=slave-relay-bin");
+ add_arg(&al, "--basedir=%s", base_dir);
+ add_arg(&al, "--port=%u", slave_port);
+#if !defined(__NETWARE__) && !defined(__WIN__)
+ add_arg(&al, "--socket=%s",slave_socket);
+#endif
+ add_arg(&al, "--datadir=%s", slave_dir);
+#ifndef __WIN__
+ add_arg(&al, "--pid-file=%s", slave_pid);
+#endif
+ add_arg(&al, "--character-sets-dir=%s", char_dir);
+ add_arg(&al, "--core");
+ add_arg(&al, "--tmpdir=%s", mysql_tmp_dir);
+ add_arg(&al, "--language=%s", lang_dir);
+
+ add_arg(&al, "--exit-info=256");
+ add_arg(&al, "--log-slave-updates");
+ add_arg(&al, "--init-rpl-role=slave");
+ add_arg(&al, "--skip-innodb");
+ add_arg(&al, "--skip-slave-start");
+ add_arg(&al, "--slave-load-tmpdir=../../var/tmp");
+
+ add_arg(&al, "--report-user=%s", user);
+ add_arg(&al, "--report-host=127.0.0.1");
+ add_arg(&al, "--report-port=%u", slave_port);
+
+ add_arg(&al, "--master-retry-count=10");
+ add_arg(&al, "-O");
+ add_arg(&al, "slave_net_timeout=10");
+#ifdef DEBUG /* only for debug builds */
+ add_arg(&al, "--debug");
+#endif
+
+ if (use_openssl)
+ {
+ add_arg(&al, "--ssl-ca=%s", ca_cert);
+ add_arg(&al, "--ssl-cert=%s", server_cert);
+ add_arg(&al, "--ssl-key=%s", server_key);
+ }
+
+ /* slave master info */
+ if (slave_master_info[0] != 0)
+ {
+ char *p;
+
+ p= (char *)str_tok(slave_master_info, " \t");
+
+ while (p)
+ {
+ add_arg(&al, "%s", p);
+ p= (char *)str_tok(NULL, " \t");
+ }
+ }
+ else
+ {
+ add_arg(&al, "--master-user=%s", user);
+ add_arg(&al, "--master-password=%s", password);
+ add_arg(&al, "--master-host=127.0.0.1");
+ add_arg(&al, "--master-port=%u", master_port);
+ add_arg(&al, "--master-connect-retry=1");
+ add_arg(&al, "--server-id=2");
+ add_arg(&al, "--rpl-recovery-rank=2");
+ }
+
+ /* small server */
+ add_arg(&al, "-O");
+ add_arg(&al, "key_buffer_size=1M");
+ add_arg(&al, "-O");
+ add_arg(&al, "sort_buffer=256K");
+ add_arg(&al, "-O");
+ add_arg(&al, "max_heap_table_size=1M");
+
+
+ /* opt args */
+ if (slave_opt[0] != 0)
+ {
+ char *p;
+
+ p= (char *)str_tok(slave_opt, " \t");
+
+ while (p)
+ {
+ add_arg(&al, "%s", p);
+ p= (char *)str_tok(NULL, " \t");
+ }
+ }
+
+ /* remove the pid file if it exists */
+#ifndef __WIN__
+ remove(slave_pid);
+#endif
+ /* spawn */
+#ifdef __WIN__
+ if ((err= spawn(mysqld_file, &al, FALSE, NULL,
+ slave_out, slave_err, &slave_pid)) == 0)
+#else
+ if ((err= spawn(mysqld_file, &al, FALSE, NULL,
+ slave_out, slave_err, slave_pid)) == 0)
+#endif
+ {
+ sleep_until_file_exists(slave_pid);
+
+ if ((err= wait_for_server_start(bin_dir, mysqladmin_file, user, password,
+ slave_port, mysql_tmp_dir)) == 0)
+ {
+ slave_running= TRUE;
+ }
+ else
+ {
+ log_error("The slave server went down early.");
+ }
+ }
+ else
+ {
+ log_error("Unable to start slave server.");
+ }
+
+ /* free args */
+ free_args(&al);
+}
+
+/******************************************************************************
+
+ mysql_start()
+
+ Start the mysql servers.
+
+******************************************************************************/
+
+void mysql_start()
+{
+/* log_info("Starting the MySQL server(s): %u", ++restarts); */
+ start_master();
+
+ start_slave();
+
+ /* activate the test screen */
+#ifdef __NETWARE__
+ ActivateScreen(getscreenhandle());
+#endif
+}
+
+/******************************************************************************
+
+ stop_slave()
+
+ Stop the slave server.
+
+******************************************************************************/
+
+void stop_slave()
+{
+ int err;
+
+ /* running? */
+ if (!slave_running) return;
+
+ /* stop */
+ if ((err= stop_server(bin_dir, mysqladmin_file, user, password,
+ slave_port, slave_pid, mysql_tmp_dir)) == 0)
+ {
+ slave_running= FALSE;
+ }
+ else
+ {
+ log_error("Unable to stop slave server.");
+ }
+}
+
+/******************************************************************************
+
+ stop_master()
+
+ Stop the master server.
+
+******************************************************************************/
+
+void stop_master()
+{
+ int err;
+
+ /* running? */
+ if (!master_running) return;
+
+ if ((err= stop_server(bin_dir, mysqladmin_file, user, password,
+ master_port, master_pid, mysql_tmp_dir)) == 0)
+ {
+ master_running= FALSE;
+ }
+ else
+ {
+ log_error("Unable to stop master server.");
+ }
+}
+
+/******************************************************************************
+
+ mysql_stop()
+
+ Stop the mysql servers.
+
+******************************************************************************/
+
+void mysql_stop()
+{
+
+ stop_master();
+
+ stop_slave();
+
+ /* activate the test screen */
+#ifdef __NETWARE__
+ ActivateScreen(getscreenhandle());
+#endif
+}
+
+/******************************************************************************
+
+ mysql_restart()
+
+ Restart the mysql servers.
+
+******************************************************************************/
+
+void mysql_restart()
+{
+/* log_info("Restarting the MySQL server(s): %u", ++restarts); */
+
+ mysql_stop();
+
+ mlog(DASH);
+
+ mysql_start();
+}
+
+/******************************************************************************
+
+ read_option()
+
+ Read the option file.
+
+******************************************************************************/
+
+int read_option(char *opt_file, char *opt)
+{
+ int fd, err;
+ char *p;
+ char buf[FN_REFLEN];
+
+ /* copy current option */
+ strncpy(buf, opt, FN_REFLEN);
+
+ /* open options file */
+ fd= open(opt_file, O_RDONLY);
+ err= read(fd, opt, FN_REFLEN);
+ close(fd);
+
+ if (err > 0)
+ {
+ /* terminate string */
+ if ((p= strchr(opt, '\n')) != NULL)
+ {
+ *p= 0;
+
+ /* check for a '\r' */
+ if ((p= strchr(opt, '\r')) != NULL)
+ {
+ *p= 0;
+ }
+ }
+ else
+ {
+ opt[err]= 0;
+ }
+
+ /* check for $MYSQL_TEST_DIR */
+ if ((p= strstr(opt, "$MYSQL_TEST_DIR")) != NULL)
+ {
+ char temp[FN_REFLEN];
+
+ *p= 0;
+
+ strcpy(temp, p + strlen("$MYSQL_TEST_DIR"));
+ strcat(opt, mysql_test_dir);
+ strcat(opt, temp);
+ }
+ /* Check for double backslash and replace it with single bakslash */
+ if ((p= strstr(opt, "\\\\")) != NULL)
+ {
+ /* bmove is guranteed to work byte by byte */
+ bmove(p, p+1, strlen(p+1));
+ }
+ }
+ else
+ {
+ /* clear option */
+ *opt= 0;
+ }
+
+ /* compare current option with previous */
+ return strcmp(opt, buf);
+}
+
+/******************************************************************************
+
+ run_test()
+
+ Run the given test case.
+
+******************************************************************************/
+
+void run_test(char *test)
+{
+ char temp[FN_REFLEN];
+ const char *rstr;
+ int skip= FALSE, ignore=FALSE;
+ int restart= FALSE;
+ int flag= FALSE;
+ struct stat info;
+
+ /* skip tests in the skip list */
+ snprintf(temp, FN_REFLEN, " %s ", test);
+ skip= (strinstr(skip_test, temp) != 0);
+ if (skip == FALSE)
+ ignore= (strinstr(ignore_test, temp) != 0);
+
+ snprintf(master_init_script, FN_REFLEN, "%s/%s-master.sh", test_dir, test);
+ snprintf(slave_init_script, FN_REFLEN, "%s/%s-slave.sh", test_dir, test);
+#ifdef __WIN__
+ if (! stat(master_init_script, &info))
+ skip= TRUE;
+ if (!stat(slave_init_script, &info))
+ skip= TRUE;
+#endif
+ if (ignore)
+ {
+ /* show test */
+ mlog("%-46s ", test);
+
+ /* ignore */
+ rstr= TEST_IGNORE;
+ ++total_ignore;
+ }
+ else if (!skip) /* skip test? */
+ {
+ char test_file[FN_REFLEN];
+ char master_opt_file[FN_REFLEN];
+ char slave_opt_file[FN_REFLEN];
+ char slave_master_info_file[FN_REFLEN];
+ char result_file[FN_REFLEN];
+ char reject_file[FN_REFLEN];
+ char out_file[FN_REFLEN];
+ char err_file[FN_REFLEN];
+ int err;
+ arg_list_t al;
+#ifdef __WIN__
+ /* Clean test database */
+ removef("%s/test/*.*", master_dir);
+ removef("%s/test/*.*", slave_dir);
+ removef("%s/mysqltest/*.*", master_dir);
+ removef("%s/mysqltest/*.*", slave_dir);
+
+#endif
+ /* skip slave? */
+ flag= skip_slave;
+ skip_slave= (strncmp(test, "rpl", 3) != 0);
+ if (flag != skip_slave) restart= TRUE;
+
+ /* create files */
+ snprintf(master_opt_file, FN_REFLEN, "%s/%s-master.opt", test_dir, test);
+ snprintf(slave_opt_file, FN_REFLEN, "%s/%s-slave.opt", test_dir, test);
+ snprintf(slave_master_info_file, FN_REFLEN, "%s/%s.slave-mi",
+ test_dir, test);
+ snprintf(reject_file, FN_REFLEN, "%s/%s%s",
+ result_dir, test, REJECT_SUFFIX);
+ snprintf(out_file, FN_REFLEN, "%s/%s%s", result_dir, test, OUT_SUFFIX);
+ snprintf(err_file, FN_REFLEN, "%s/%s%s", result_dir, test, ERR_SUFFIX);
+
+ /* netware specific files */
+ snprintf(test_file, FN_REFLEN, "%s/%s%s", test_dir, test, NW_TEST_SUFFIX);
+ if (stat(test_file, &info))
+ {
+ snprintf(test_file, FN_REFLEN, "%s/%s%s", test_dir, test, TEST_SUFFIX);
+ if (access(test_file,0))
+ {
+ printf("Invalid test name %s, %s file not found\n",test,test_file);
+ return;
+ }
+ }
+
+ snprintf(result_file, FN_REFLEN, "%s/%s%s",
+ result_dir, test, NW_RESULT_SUFFIX);
+ if (stat(result_file, &info))
+ {
+ snprintf(result_file, FN_REFLEN, "%s/%s%s",
+ result_dir, test, RESULT_SUFFIX);
+ }
+
+ /* init scripts */
+ if (stat(master_init_script, &info))
+ master_init_script[0]= 0;
+ else
+ restart= TRUE;
+
+ if (stat(slave_init_script, &info))
+ slave_init_script[0]= 0;
+ else
+ restart= TRUE;
+
+ /* read options */
+ if (read_option(master_opt_file, master_opt)) restart= TRUE;
+ if (read_option(slave_opt_file, slave_opt)) restart= TRUE;
+ if (read_option(slave_master_info_file, slave_master_info)) restart= TRUE;
+
+ /* cleanup previous run */
+ remove(reject_file);
+ remove(out_file);
+ remove(err_file);
+
+ /* start or restart? */
+ if (!master_running) mysql_start();
+ else if (restart) mysql_restart();
+
+ /* let the system stabalize */
+ sleep(1);
+
+ /* show test */
+ mlog("%-46s ", test);
+
+ /* args */
+ init_args(&al);
+ add_arg(&al, "%s", mysqltest_file);
+ add_arg(&al, "--no-defaults");
+ add_arg(&al, "--port=%u", master_port);
+#if !defined(__NETWARE__) && !defined(__WIN__)
+ add_arg(&al, "--socket=%s", master_socket);
+ add_arg(&al, "--tmpdir=%s", mysql_tmp_dir);
+#endif
+ add_arg(&al, "--database=%s", db);
+ add_arg(&al, "--user=%s", user);
+ add_arg(&al, "--password=%s", password);
+ add_arg(&al, "--silent");
+ add_arg(&al, "--basedir=%s/", mysql_test_dir);
+ add_arg(&al, "--host=127.0.0.1");
+ add_arg(&al, "-v");
+ add_arg(&al, "-R");
+ add_arg(&al, "%s", result_file);
+
+ if (use_openssl)
+ {
+ add_arg(&al, "--ssl-ca=%s", ca_cert);
+ add_arg(&al, "--ssl-cert=%s", client_cert);
+ add_arg(&al, "--ssl-key=%s", client_key);
+ }
+
+ /* spawn */
+ err= spawn(mysqltest_file, &al, TRUE, test_file, out_file, err_file, NULL);
+
+ /* free args */
+ free_args(&al);
+
+ remove_empty_file(out_file);
+ remove_empty_file(err_file);
+
+ if (err == 0)
+ {
+ /* pass */
+ rstr= TEST_PASS;
+ ++total_pass;
+
+ /* increment total */
+ ++total_test;
+ }
+ else if (err == 2)
+ {
+ /* skip */
+ rstr= TEST_SKIP;
+ ++total_skip;
+ }
+ else if (err == 1)
+ {
+ /* fail */
+ rstr= TEST_FAIL;
+ ++total_fail;
+
+ /* increment total */
+ ++total_test;
+ }
+ else
+ {
+ rstr= TEST_BAD;
+ }
+ }
+ else /* early skips */
+ {
+ /* show test */
+ mlog("%-46s ", test);
+
+ /* skip */
+ rstr= TEST_SKIP;
+ ++total_skip;
+ }
+
+ /* result */
+ mlog("%-14s\n", rstr);
+}
+
+/******************************************************************************
+
+ vlog()
+
+ Log the message.
+
+******************************************************************************/
+
+void vlog(const char *format, va_list ap)
+{
+ vfprintf(stdout, format, ap);
+ fflush(stdout);
+
+ if (log_fd)
+ {
+ vfprintf(log_fd, format, ap);
+ fflush(log_fd);
+ }
+}
+
+/******************************************************************************
+
+ log()
+
+ Log the message.
+
+******************************************************************************/
+
+void mlog(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ vlog(format, ap);
+
+ va_end(ap);
+}
+
+/******************************************************************************
+
+ log_info()
+
+ Log the given information.
+
+******************************************************************************/
+
+void log_info(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ mlog("-- INFO : ");
+ vlog(format, ap);
+ mlog("\n");
+
+ va_end(ap);
+}
+
+/******************************************************************************
+
+ log_error()
+
+ Log the given error.
+
+******************************************************************************/
+
+void log_error(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ mlog("-- ERROR: ");
+ vlog(format, ap);
+ mlog("\n");
+
+ va_end(ap);
+}
+
+/******************************************************************************
+
+ log_errno()
+
+ Log the given error and errno.
+
+******************************************************************************/
+
+void log_errno(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ mlog("-- ERROR: (%003u) ", errno);
+ vlog(format, ap);
+ mlog("\n");
+
+ va_end(ap);
+}
+
+/******************************************************************************
+
+ die()
+
+ Exit the application.
+
+******************************************************************************/
+
+void die(const char *msg)
+{
+ log_error(msg);
+#ifdef __NETWARE__
+ pressanykey();
+#endif
+ exit(-1);
+}
+
+/******************************************************************************
+
+ setup()
+
+ Setup the mysql test enviornment.
+
+******************************************************************************/
+
+void setup(char *file __attribute__((unused)))
+{
+ char temp[FN_REFLEN];
+ char file_path[FN_REFLEN*2];
+ char *p;
+ int position;
+
+ /* set the timezone for the timestamp test */
+#ifdef __WIN__
+ _putenv( "TZ=GMT-3" );
+#else
+ putenv((char *)"TZ=GMT-3");
+#endif
+ /* find base dir */
+#ifdef __NETWARE__
+ strcpy(temp, strlwr(file));
+ while ((p= strchr(temp, '\\')) != NULL) *p= '/';
+#else
+ getcwd(temp, FN_REFLEN);
+ position= strlen(temp);
+ temp[position]= '/';
+ temp[position+1]= 0;
+#ifdef __WIN__
+ while ((p= strchr(temp, '\\')) != NULL) *p= '/';
+#endif
+#endif
+
+ if ((position= strinstr(temp, "/mysql-test/")) != 0)
+ {
+ p= temp + position - 1;
+ *p= 0;
+ strcpy(base_dir, temp);
+ }
+
+ log_info("Currect directory: %s",base_dir);
+
+#ifdef __NETWARE__
+ /* setup paths */
+ snprintf(bin_dir, FN_REFLEN, "%s/bin", base_dir);
+ snprintf(mysql_test_dir, FN_REFLEN, "%s/mysql-test", base_dir);
+ snprintf(test_dir, FN_REFLEN, "%s/t", mysql_test_dir);
+ snprintf(mysql_tmp_dir, FN_REFLEN, "%s/var/tmp", mysql_test_dir);
+ snprintf(result_dir, FN_REFLEN, "%s/r", mysql_test_dir);
+ snprintf(master_dir, FN_REFLEN, "%s/var/master-data", mysql_test_dir);
+ snprintf(slave_dir, FN_REFLEN, "%s/var/slave-data", mysql_test_dir);
+ snprintf(lang_dir, FN_REFLEN, "%s/share/english", base_dir);
+ snprintf(char_dir, FN_REFLEN, "%s/share/charsets", base_dir);
+
+#ifdef HAVE_OPENSSL
+ use_openssl= TRUE;
+#endif /* HAVE_OPENSSL */
+
+ /* OpenSSL paths */
+ snprintf(ca_cert, FN_REFLEN, "%s/SSL/cacert.pem", base_dir);
+ snprintf(server_cert, FN_REFLEN, "%s/SSL/server-cert.pem", base_dir);
+ snprintf(server_key, FN_REFLEN, "%s/SSL/server-key.pem", base_dir);
+ snprintf(client_cert, FN_REFLEN, "%s/SSL/client-cert.pem", base_dir);
+ snprintf(client_key, FN_REFLEN, "%s/SSL/client-key.pem", base_dir);
+
+ /* setup files */
+ snprintf(mysqld_file, FN_REFLEN, "%s/mysqld", bin_dir);
+ snprintf(mysqltest_file, FN_REFLEN, "%s/mysqltest", bin_dir);
+ snprintf(mysqladmin_file, FN_REFLEN, "%s/mysqladmin", bin_dir);
+ snprintf(master_pid, FN_REFLEN, "%s/var/run/master.pid", mysql_test_dir);
+ snprintf(slave_pid, FN_REFLEN, "%s/var/run/slave.pid", mysql_test_dir);
+#elif __WIN__
+ /* setup paths */
+#ifdef _DEBUG
+ snprintf(bin_dir, FN_REFLEN, "%s/client_debug", base_dir);
+#else
+ snprintf(bin_dir, FN_REFLEN, "%s/client_release", base_dir);
+#endif
+ snprintf(mysql_test_dir, FN_REFLEN, "%s/mysql-test", base_dir);
+ snprintf(test_dir, FN_REFLEN, "%s/t", mysql_test_dir);
+ snprintf(mysql_tmp_dir, FN_REFLEN, "%s/var/tmp", mysql_test_dir);
+ snprintf(result_dir, FN_REFLEN, "%s/r", mysql_test_dir);
+ snprintf(master_dir, FN_REFLEN, "%s/var/master-data", mysql_test_dir);
+ snprintf(slave_dir, FN_REFLEN, "%s/var/slave-data", mysql_test_dir);
+ snprintf(lang_dir, FN_REFLEN, "%s/share/english", base_dir);
+ snprintf(char_dir, FN_REFLEN, "%s/share/charsets", base_dir);
+
+#ifdef HAVE_OPENSSL
+ use_openssl= TRUE;
+#endif /* HAVE_OPENSSL */
+
+ /* OpenSSL paths */
+ snprintf(ca_cert, FN_REFLEN, "%s/SSL/cacert.pem", base_dir);
+ snprintf(server_cert, FN_REFLEN, "%s/SSL/server-cert.pem", base_dir);
+ snprintf(server_key, FN_REFLEN, "%s/SSL/server-key.pem", base_dir);
+ snprintf(client_cert, FN_REFLEN, "%s/SSL/client-cert.pem", base_dir);
+ snprintf(client_key, FN_REFLEN, "%s/SSL/client-key.pem", base_dir);
+
+ /* setup files */
+ snprintf(mysqld_file, FN_REFLEN, "%s/mysqld.exe", bin_dir);
+ snprintf(mysqltest_file, FN_REFLEN, "%s/mysqltest.exe", bin_dir);
+ snprintf(mysqladmin_file, FN_REFLEN, "%s/mysqladmin.exe", bin_dir);
+#else
+ /* setup paths */
+ snprintf(bin_dir, FN_REFLEN, "%s/client", base_dir);
+ snprintf(mysql_test_dir, FN_REFLEN, "%s/mysql-test", base_dir);
+ snprintf(test_dir, FN_REFLEN, "%s/t", mysql_test_dir);
+ snprintf(mysql_tmp_dir, FN_REFLEN, "%s/var/tmp", mysql_test_dir);
+ snprintf(result_dir, FN_REFLEN, "%s/r", mysql_test_dir);
+ snprintf(master_dir, FN_REFLEN, "%s/var/master-data", mysql_test_dir);
+ snprintf(slave_dir, FN_REFLEN, "%s/var/slave-data", mysql_test_dir);
+ snprintf(lang_dir, FN_REFLEN, "%s/sql/share/english", base_dir);
+ snprintf(char_dir, FN_REFLEN, "%s/sql/share/charsets", base_dir);
+
+#ifdef HAVE_OPENSSL
+ use_openssl= TRUE;
+#endif /* HAVE_OPENSSL */
+
+ /* OpenSSL paths */
+ snprintf(ca_cert, FN_REFLEN, "%s/SSL/cacert.pem", base_dir);
+ snprintf(server_cert, FN_REFLEN, "%s/SSL/server-cert.pem", base_dir);
+ snprintf(server_key, FN_REFLEN, "%s/SSL/server-key.pem", base_dir);
+ snprintf(client_cert, FN_REFLEN, "%s/SSL/client-cert.pem", base_dir);
+ snprintf(client_key, FN_REFLEN, "%s/SSL/client-key.pem", base_dir);
+
+ /* setup files */
+ snprintf(mysqld_file, FN_REFLEN, "%s/sql/mysqld", base_dir);
+ snprintf(mysqltest_file, FN_REFLEN, "%s/mysqltest", bin_dir);
+ snprintf(mysqladmin_file, FN_REFLEN, "%s/mysqladmin", bin_dir);
+ snprintf(master_pid, FN_REFLEN, "%s/var/run/master.pid", mysql_test_dir);
+ snprintf(slave_pid, FN_REFLEN, "%s/var/run/slave.pid", mysql_test_dir);
+
+ snprintf(master_socket,FN_REFLEN, "%s/var/tmp/master.sock", mysql_test_dir);
+ snprintf(slave_socket,FN_REFLEN, "%s/var/tmp/slave.sock", mysql_test_dir);
+
+#endif
+ /* create log file */
+ snprintf(temp, FN_REFLEN, "%s/mysql-test-run.log", mysql_test_dir);
+ if ((log_fd= fopen(temp, "w+")) == NULL)
+ {
+ log_errno("Unable to create log file.");
+ }
+
+ /* prepare skip test list */
+ while ((p= strchr(skip_test, ',')) != NULL) *p= ' ';
+ strcpy(temp, strlwr(skip_test));
+ snprintf(skip_test, FN_REFLEN, " %s ", temp);
+
+ /* environment */
+#ifdef __NETWARE__
+ setenv("MYSQL_TEST_DIR", mysql_test_dir, 1);
+ snprintf(file_path, FN_REFLEN*2,
+ "%s/client/mysqldump --no-defaults -u root --port=%u",
+ bin_dir, master_port);
+ setenv("MYSQL_DUMP", file_path, 1);
+ snprintf(file_path, FN_REFLEN*2,
+ "%s/client/mysqlbinlog --no-defaults --local-load=%s",
+ bin_dir, mysql_tmp_dir);
+ setenv("MYSQL_BINLOG", file_path, 1);
+#elif __WIN__
+ snprintf(file_path,FN_REFLEN,"MYSQL_TEST_DIR=%s",mysql_test_dir);
+ _putenv(file_path);
+ snprintf(file_path, FN_REFLEN*2,
+ "MYSQL_DUMP=%s/mysqldump.exe --no-defaults -u root --port=%u",
+ bin_dir, master_port);
+ _putenv(file_path);
+ snprintf(file_path, FN_REFLEN*2,
+ "MYSQL_BINLOG=%s/mysqlbinlog.exe --no-defaults --local-load=%s",
+ bin_dir, mysql_tmp_dir);
+ _putenv(file_path);
+#else
+ snprintf(file_path,FN_REFLEN,"MYSQL_TEST_DIR=%s",mysql_test_dir);
+ putenv(file_path);
+ snprintf(file_path, FN_REFLEN*2,
+ "MYSQL_DUMP=%s/mysqldump --no-defaults -u root --port=%u --socket=%s",
+ bin_dir, master_port, master_socket);
+ putenv(file_path);
+ snprintf(file_path, FN_REFLEN*2,
+ "MYSQL_BINLOG=%s/mysqlbinlog --no-defaults --local-load=%s",
+ bin_dir, mysql_tmp_dir);
+ putenv(file_path);
+#endif
+
+#ifndef __WIN__
+ putenv((char *)"MASTER_MYPORT=9306");
+ putenv((char *)"SLAVE_MYPORT=9307");
+ putenv((char *)"MYSQL_TCP_PORT=3306");
+#else
+ _putenv("MASTER_MYPORT=9306");
+ _putenv("SLAVE_MYPORT=9307");
+ _putenv("MYSQL_TCP_PORT=3306");
+#endif
+
+}
+
+/*
+ Compare names of testes for right order
+*/
+#ifdef __WIN__
+int compare( const void *arg1, const void *arg2 )
+{
+ return _stricmp( * ( char** ) arg1, * ( char** ) arg2 );
+}
+#endif
+
+
+/******************************************************************************
+
+ main()
+
+******************************************************************************/
+
+int main(int argc, char **argv)
+{
+ int is_ignore_list= 0;
+ /* setup */
+ setup(argv[0]);
+
+ /*
+ The --ignore option is comma saperated list of test cases to skip and
+ should be very first command line option to the test suite.
+
+ The usage is now:
+ mysql_test_run --ignore=test1,test2 test3 test4
+ where test1 and test2 are test cases to ignore
+ and test3 and test4 are test cases to run.
+ */
+ if (argc >= 2 && !strnicmp(argv[1], "--ignore=", sizeof("--ignore=")-1))
+ {
+ char *temp, *token;
+ temp= strdup(strchr(argv[1],'=') + 1);
+ for (token=str_tok(temp, ","); token != NULL; token=str_tok(NULL, ","))
+ {
+ if (strlen(ignore_test) + strlen(token) + 2 <= FN_REFLEN-1)
+ sprintf(ignore_test+strlen(ignore_test), " %s ", token);
+ else
+ {
+ free(temp);
+ die("ignore list too long.");
+ }
+ }
+ free(temp);
+ is_ignore_list= 1;
+ }
+ /* header */
+#ifndef __WIN__
+ mlog("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE);
+#else
+ mlog("MySQL Server ---, for %s (%s)\n\n", SYSTEM_TYPE, MACHINE_TYPE);
+#endif
+
+ mlog("Initializing Tests...\n");
+
+ /* install test databases */
+ mysql_install_db();
+
+ mlog("Starting Tests...\n");
+
+ mlog("\n");
+ mlog(HEADER);
+ mlog(DASH);
+
+ if ( argc > 1 + is_ignore_list )
+ {
+ int i;
+
+ /* single test */
+ single_test= TRUE;
+
+ for (i= 1 + is_ignore_list; i < argc; i++)
+ {
+ /* run given test */
+ run_test(argv[i]);
+ }
+ }
+ else
+ {
+ /* run all tests */
+#ifndef __WIN__
+ struct dirent *entry;
+ DIR *parent;
+ char test[FN_LEN];
+ int position;
+
+ /* FIXME are we sure the list is sorted if using readdir()? */
+ if ((parent= opendir(test_dir)) == NULL) /* Not thread safe */
+ die("Unable to open tests directory.");
+ else
+ {
+ while ((entry= readdir(parent)) != NULL) /* Not thread safe */
+ {
+ strcpy(test, strlwr(entry->d_name));
+ /* find the test suffix */
+ if ((position= strinstr(test, TEST_SUFFIX)) != 0)
+ {
+ /* null terminate at the suffix */
+ *(test + position - 1)= '\0';
+ /* run test */
+ run_test(test);
+ }
+ }
+ closedir(parent);
+ }
+#else
+ struct _finddata_t dir;
+ intptr_t handle;
+ char test[FN_LEN];
+ char mask[FN_REFLEN];
+ char *p;
+ int position;
+ char **names= 0;
+ char **testes= 0;
+ int name_index;
+ int index;
+
+ /* single test */
+ single_test= FALSE;
+
+ snprintf(mask,FN_REFLEN,"%s/*.test",test_dir);
+
+ if ((handle=_findfirst(mask,&dir)) == -1L)
+ {
+ die("Unable to open tests directory.");
+ }
+
+ names= malloc(MAX_COUNT_TESTES*4);
+ testes= names;
+ name_index= 0;
+
+ do
+ {
+ if (!(dir.attrib & _A_SUBDIR))
+ {
+ strcpy(test, strlwr(dir.name));
+
+ /* find the test suffix */
+ if ((position= strinstr(test, TEST_SUFFIX)) != 0)
+ {
+ p= test + position - 1;
+ /* null terminate at the suffix */
+ *p= 0;
+
+ /* insert test */
+ *names= malloc(FN_REFLEN);
+ strcpy(*names,test);
+ names++;
+ name_index++;
+ }
+ }
+ }while (_findnext(handle,&dir) == 0);
+
+ _findclose(handle);
+
+ qsort( (void *)testes, name_index, sizeof( char * ), compare );
+
+ for (index= 0; index <= name_index; index++)
+ {
+ run_test(testes[index]);
+ free(testes[index]);
+ }
+
+ free(testes);
+#endif
+ }
+
+ /* stop server */
+ mysql_stop();
+
+ mlog(DASH);
+ mlog("\n");
+
+ mlog("Ending Tests...\n");
+
+ /* report stats */
+ report_stats();
+
+ /* close log */
+ if (log_fd) fclose(log_fd);
+
+ /* keep results up */
+#ifdef __NETWARE__
+ pressanykey();
+#endif
+ return 0;
+}
+
+
+/*
+ Synopsis:
+ This function breaks the string into a sequence of tokens. The difference
+ between this function and strtok is that it respects the quoted string i.e.
+ it skips any delimiter character within the quoted part of the string.
+ It return tokens by eliminating quote character. It modifies the input string
+ passed. It will work with whitespace delimeter but may not work properly with
+ other delimeter. If the delimeter will contain any quote character, then
+ function will not tokenize and will return null string.
+ e.g. if input string is
+ --init-slave="set global max_connections=500" --skip-external-locking
+ then the output will two string i.e.
+ --init-slave=set global max_connections=500
+ --skip-external-locking
+
+Arguments:
+ string: input string
+ delim: set of delimiter character
+Output:
+ return the null terminated token of NULL.
+*/
+
+char *str_tok(char *string, const char *delim)
+{
+ char *token; /* current token received from strtok */
+ char *qt_token; /* token delimeted by the matching pair of quote */
+ /*
+ if there are any quote chars found in the token then this variable
+ will hold the concatenated string to return to the caller
+ */
+ char *ptr_token=NULL;
+ /* pointer to the quote character in the token from strtok */
+ char *ptr_quote=NULL;
+
+ /* See if the delimeter contains any quote character */
+ if (strchr(delim,'\'') || strchr(delim,'\"'))
+ return NULL;
+
+ /* repeate till we are getting some token from strtok */
+ while ((token= (char*)strtok(string, delim) ) != NULL)
+ {
+ /*
+ make the input string NULL so that next time onward strtok can
+ be called with NULL input string.
+ */
+ string= NULL;
+ /* We don't need to remove any quote character for Windows version */
+#ifndef __WIN__
+ /* check if the current token contain double quote character*/
+ if ((ptr_quote= (char*)strchr(token,'\"')) != NULL)
+ {
+ /*
+ get the matching the matching double quote in the remaining
+ input string
+ */
+ qt_token= (char*)strtok(NULL,"\"");
+ }
+ /* check if the current token contain single quote character*/
+ else if ((ptr_quote= (char*)strchr(token,'\'')) != NULL)
+ {
+ /*
+ get the matching the matching single quote in the remaining
+ input string
+ */
+ qt_token= (char*)strtok(NULL,"\'");
+ }
+#endif
+ /*
+ if the current token does not contains any quote character then
+ return to the caller.
+ */
+ if (ptr_quote == NULL)
+ {
+ /*
+ if there is any earlier token i.e. ptr_token then append the
+ current token in it and return it else return the current
+ token directly
+ */
+ return ptr_token ? strcat(ptr_token,token) : token;
+ }
+
+ /*
+ remove the quote character i.e. make NULL so that the token will
+ be devided in two part and later both part can be concatenated
+ and hence quote will be removed
+ */
+ *ptr_quote= 0;
+
+ /* check if ptr_token has been initialized or not */
+ if (ptr_token == NULL)
+ {
+ /* initialize the ptr_token with current token */
+ ptr_token= token;
+ /* copy entire string between matching pair of quote*/
+ sprintf(ptr_token+strlen(ptr_token),"%s %s", ptr_quote+1, qt_token);
+ }
+ else
+ {
+ /*
+ copy the current token and entire string between matching pair
+ of quote
+ */
+ if (qt_token == NULL)
+ {
+ sprintf(ptr_token+strlen(ptr_token),"%s%s", token, ptr_quote+1);
+ }
+ else
+ {
+ sprintf(ptr_token+strlen(ptr_token),"%s%s %s", token, ptr_quote+1,
+ qt_token );
+ }
+ }
+ }
+
+ /* return the concatenated token */
+ return ptr_token;
+}
+
+#ifndef __WIN__
+
+/*
+ Synopsis:
+ This function run scripts files on Linux and Netware
+
+Arguments:
+ script_name: name of script file
+
+Output:
+ nothing
+*/
+
+void run_init_script(const char *script_name)
+{
+ arg_list_t al;
+ int err;
+
+ /* args */
+ init_args(&al);
+ add_arg(&al, sh_file);
+ add_arg(&al, script_name);
+
+ /* spawn */
+ if ((err= spawn(sh_file, &al, TRUE, NULL, NULL, NULL, NULL)) != 0)
+ {
+ die("Unable to run script.");
+ }
+
+ /* free args */
+ free_args(&al);
+}
+#endif
diff --git a/mysql-test/ndb/Makefile.am b/mysql-test/ndb/Makefile.am
new file mode 100644
index 00000000000..502ccee099e
--- /dev/null
+++ b/mysql-test/ndb/Makefile.am
@@ -0,0 +1,25 @@
+
+benchdir_root= $(prefix)
+testdir = $(benchdir_root)/mysql-test/ndb
+
+test_SCRIPTS = ndbcluster
+
+noinst_HEADERS = ndbcluster.sh
+
+dist_test_DATA = ndb_config_2_node.ini
+
+SUFFIXES = .sh
+
+.sh:
+ @RM@ -f $@ $@-t
+ @SED@ \
+ -e 's!@''ndb_port''@!$(ndb_port)!g' \
+ -e 's!@''ndb_port_base''@!$(ndb_port_base)!g' \
+ -e 's!@''ndbbindir''@!$(ndbbindir)!g' \
+ -e 's!@''ndbtoolsdir''@!$(ndbtoolsdir)!g' \
+ $< > $@-t
+ @CHMOD@ +x $@-t
+ @MV@ $@-t $@
+
+# Don't update the files from bitkeeper
+%::SCCS/s.%
diff --git a/mysql-test/ndb/basic.result b/mysql-test/ndb/basic.result
new file mode 100644
index 00000000000..5ebd20a7f83
--- /dev/null
+++ b/mysql-test/ndb/basic.result
@@ -0,0 +1,69 @@
+-- NDB Cluster -- Management Client --
+---------------------------------------------------------------------------
+ NDB Cluster -- Management Client -- Help
+---------------------------------------------------------------------------
+HELP Print help text
+HELP SHOW Help for SHOW command
+HELP DEBUG Help for debug compiled version
+SHOW Print information about cluster
+START BACKUP [NOWAIT | WAIT STARTED | WAIT COMPLETED]
+ Start backup (default WAIT COMPLETED)
+ABORT BACKUP <backup id> Abort backup
+SHUTDOWN Shutdown all processes in cluster
+CLUSTERLOG ON [<severity>] ... Enable Cluster logging
+CLUSTERLOG OFF [<severity>] ... Disable Cluster logging
+CLUSTERLOG TOGGLE [<severity>] ... Toggle severity filter on/off
+CLUSTERLOG INFO Print cluster log information
+<id> START Start DB node (started with -n)
+<id> RESTART [-n] [-i] Restart DB node
+<id> STOP Stop DB node
+ENTER SINGLE USER MODE <api-node> Enter single user mode
+EXIT SINGLE USER MODE Exit single user mode
+<id> STATUS Print status
+<id> CLUSTERLOG {<category>=<level>}+ Set log level for cluster log
+PURGE STALE SESSIONS Reset reserved nodeid's in the mgmt server
+CONNECT [<connectstring>] Connect to management server (reconnect if already connected)
+QUIT Quit management client
+
+<severity> = ALERT | CRITICAL | ERROR | WARNING | INFO | DEBUG
+<category> = STARTUP | SHUTDOWN | STATISTICS | CHECKPOINT | NODERESTART | CONNECTION | INFO | ERROR | GREP | DEBUG | BACKUP
+<level> = 0 - 15
+<id> = ALL | Any database node id
+
+Connected to Management Server at: localhost:1186
+Node 1: started (Version 4.1.9)
+Node 2: started (Version 4.1.9)
+
+Node 1: started (Version 4.1.9)
+
+Node 2: started (Version 4.1.9)
+
+Executing CLUSTERLOG on node 1 OK!
+Executing CLUSTERLOG on node 2 OK!
+
+Executing CLUSTERLOG on node 1 OK!
+Executing CLUSTERLOG on node 2 OK!
+
+Executing CLUSTERLOG on node 1 OK!
+Executing CLUSTERLOG on node 2 OK!
+
+Executing CLUSTERLOG on node 1 OK!
+Executing CLUSTERLOG on node 2 OK!
+
+Executing CLUSTERLOG on node 1 OK!
+Executing CLUSTERLOG on node 2 OK!
+
+Executing CLUSTERLOG on node 1 OK!
+Executing CLUSTERLOG on node 2 OK!
+
+Executing CLUSTERLOG on node 1 OK!
+Executing CLUSTERLOG on node 2 OK!
+
+Executing CLUSTERLOG on node 1 OK!
+Executing CLUSTERLOG on node 2 OK!
+
+Cluster logging is disabled
+Cluster logging is enabled.
+Cluster logging is disabled
+ALL disabled
+ALL enabled
diff --git a/mysql-test/ndb/basic.test b/mysql-test/ndb/basic.test
new file mode 100644
index 00000000000..945bda94ff6
--- /dev/null
+++ b/mysql-test/ndb/basic.test
@@ -0,0 +1,17 @@
+help
+all status
+1 status
+2 status
+all clusterlog connection=8
+all clusterlog startup=7
+all clusterlog checkpoint=7
+all clusterlog noderestart=15
+all clusterlog statistics=7
+all clusterlog error=7
+all clusterlog info=7
+all clusterlog backup=15
+clusterlog off
+clusterlog toggle
+clusterlog off
+clusterlog off all
+clusterlog on all
diff --git a/mysql-test/t/README b/mysql-test/ndb/basic_log.result
index e69de29bb2d..e69de29bb2d 100644
--- a/mysql-test/t/README
+++ b/mysql-test/ndb/basic_log.result
diff --git a/mysql-test/ndb/ndb_config_2_node.ini b/mysql-test/ndb/ndb_config_2_node.ini
new file mode 100644
index 00000000000..8c89d2aa2cc
--- /dev/null
+++ b/mysql-test/ndb/ndb_config_2_node.ini
@@ -0,0 +1,30 @@
+[ndbd default]
+NoOfReplicas= 2
+MaxNoOfConcurrentOperations= CHOOSE_MaxNoOfConcurrentOperations
+DataMemory= CHOOSE_DataMemory
+IndexMemory= CHOOSE_IndexMemory
+Diskless= CHOOSE_Diskless
+TimeBetweenWatchDogCheck= 30000
+DataDir= CHOOSE_FILESYSTEM
+MaxNoOfOrderedIndexes= CHOOSE_MaxNoOfOrderedIndexes
+
+[ndbd]
+HostName= CHOOSE_HOSTNAME_1
+
+[ndbd]
+HostName= CHOOSE_HOSTNAME_2
+
+[ndb_mgmd]
+DataDir= CHOOSE_FILESYSTEM
+PortNumber= CHOOSE_PORT_MGM
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[tcp default]
+PortNumber= CHOOSE_PORT_TRANSPORTER
diff --git a/mysql-test/ndb/ndb_range_bounds.pl b/mysql-test/ndb/ndb_range_bounds.pl
new file mode 100644
index 00000000000..75b7f8a33e1
--- /dev/null
+++ b/mysql-test/ndb/ndb_range_bounds.pl
@@ -0,0 +1,138 @@
+#
+# test range scan bounds
+# output to mysql-test/t/ndb_range_bounds.test
+#
+# give option --all to generate all cases
+#
+
+use strict;
+use integer;
+use Getopt::Long;
+
+my $opt_all = 0;
+my $opt_cnt = 5;
+GetOptions("all" => \$opt_all, "cnt=i" => \$opt_cnt)
+ or die "options are: --all --cnt=N";
+
+my $table = 't';
+
+print <<EOF;
+--source include/have_ndb.inc
+
+--disable_warnings
+drop table if exists $table;
+--enable_warnings
+
+# test range scan bounds
+# generated by mysql-test/ndb/ndb_range_bounds.pl
+# all selects must return 0
+
+EOF
+
+sub cut ($$@) {
+ my($op, $key, @v) = @_;
+ $op = '==' if $op eq '=';
+ my(@w);
+ eval "\@w = grep(\$_ $op $key, \@v)";
+ $@ and die $@;
+ return @w;
+}
+
+sub mkdummy (\@) {
+ my ($val) = @_;
+ return {
+ 'dummy' => 1,
+ 'exp' => '9 = 9',
+ 'cnt' => scalar @$val,
+ };
+}
+
+sub mkone ($$$\@) {
+ my($col, $op, $key, $val) = @_;
+ my $cnt = scalar cut($op, $key, @$val);
+ return {
+ 'exp' => "$col $op $key",
+ 'cnt' => $cnt,
+ };
+}
+
+sub mktwo ($$$$$\@) {
+ my($col, $op1, $key1, $op2, $key2, $val) = @_;
+ my $cnt = scalar cut($op2, $key2, cut($op1, $key1, @$val));
+ return {
+ 'exp' => "$col $op1 $key1 and $col $op2 $key2",
+ 'cnt' => $cnt,
+ };
+}
+
+sub mkall ($$$\@) {
+ my($col, $key1, $key2, $val) = @_;
+ my @a = ();
+ my $p = mkdummy(@$val);
+ push(@a, $p) if $opt_all;
+ my @ops = qw(< <= = >= >);
+ for my $op (@ops) {
+ my $p = mkone($col, $op, $key1, @$val);
+ push(@a, $p) if $opt_all || $p->{cnt} != 0;
+ }
+ my @ops1 = $opt_all ? @ops : qw(= >= >);
+ my @ops2 = $opt_all ? @ops : qw(<= <);
+ for my $op1 (@ops1) {
+ for my $op2 (@ops2) {
+ my $p = mktwo($col, $op1, $key1, $op2, $key2, @$val);
+ push(@a, $p) if $opt_all || $p->{cnt} != 0;
+ }
+ }
+ return \@a;
+}
+
+for my $nn ("bcd", "") {
+ my %nn;
+ for my $x (qw(b c d)) {
+ $nn{$x} = $nn =~ /$x/ ? "not null" : "null";
+ }
+ print <<EOF;
+create table $table (
+ a int primary key,
+ b int $nn{b},
+ c int $nn{c},
+ d int $nn{d},
+ index (b, c, d)
+) engine=ndb;
+EOF
+ my @val = (0..($opt_cnt-1));
+ my $v0 = 0;
+ for my $v1 (@val) {
+ for my $v2 (@val) {
+ for my $v3 (@val) {
+ print "insert into $table values($v0, $v1, $v2, $v3);\n";
+ $v0++;
+ }
+ }
+ }
+ my $key1 = 1;
+ my $key2 = 3;
+ my $a1 = mkall('b', $key1, $key2, @val);
+ my $a2 = mkall('c', $key1, $key2, @val);
+ my $a3 = mkall('d', $key1, $key2, @val);
+ for my $p1 (@$a1) {
+ my $cnt1 = $p1->{cnt} * @val * @val;
+ print "select count(*) - $cnt1 from $table";
+ print " where $p1->{exp};\n";
+ for my $p2 (@$a2) {
+ my $cnt2 = $p1->{cnt} * $p2->{cnt} * @val;
+ print "select count(*) - $cnt2 from $table";
+ print " where $p1->{exp} and $p2->{exp};\n";
+ for my $p3 (@$a3) {
+ my $cnt3 = $p1->{cnt} * $p2->{cnt} * $p3->{cnt};
+ print "select count(*) - $cnt3 from $table";
+ print " where $p1->{exp} and $p2->{exp} and $p3->{exp};\n";
+ }
+ }
+ }
+ print <<EOF;
+drop table $table;
+EOF
+}
+
+# vim: set sw=2:
diff --git a/mysql-test/ndb/ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh
new file mode 100644
index 00000000000..848223a091c
--- /dev/null
+++ b/mysql-test/ndb/ndbcluster.sh
@@ -0,0 +1,342 @@
+#!/bin/sh
+# Copyright (C) 2004 MySQL AB
+# For a more info consult the file COPYRIGHT distributed with this file
+
+# This scripts starts the table handler ndbcluster
+
+# configurable parameters, make sure to change in mysqlcluterd as well
+port=@ndb_port@
+port_base=@ndb_port_base@
+fsdir=`pwd`
+# end configurable parameters
+
+#BASEDIR is always one above mysql-test directory
+CWD=`pwd`
+cd ..
+BASEDIR=`pwd`
+cd $CWD
+
+# Are we using a source or a binary distribution?
+if [ -d ../sql ] ; then
+ SOURCE_DIST=1
+ ndbtop=$BASEDIR/ndb
+ exec_ndb=$ndbtop/src/kernel/ndbd
+ exec_mgmtsrvr=$ndbtop/src/mgmsrv/ndb_mgmd
+ exec_waiter=$ndbtop/tools/ndb_waiter
+ exec_test=$ndbtop/tools/ndb_test_platform
+ exec_mgmtclient=$ndbtop/src/mgmclient/ndb_mgm
+else
+ BINARY_DIST=1
+ if test -x "$BASEDIR/libexec/ndbd"
+ then
+ exec_ndb=$BASEDIR/libexec/ndbd
+ exec_mgmtsrvr=$BASEDIR/libexec/ndb_mgmd
+ else
+ exec_ndb=$BASEDIR/bin/ndbd
+ exec_mgmtsrvr=$BASEDIR/bin/ndb_mgmd
+ fi
+ exec_waiter=$BASEDIR/bin/ndb_waiter
+ exec_test=$BASEDIR/bin/ndb_test_platform
+ exec_mgmtclient=$BASEDIR/bin/ndb_mgm
+fi
+
+if $exec_test ; then :; else
+ echo "ndb not correctly compiled to support this platform"
+ exit 1
+fi
+
+pidfile=ndbcluster.pid
+cfgfile=Ndb.cfg
+test_ndb=
+stop_ndb=
+initial_ndb=
+status_ndb=
+ndb_diskless=0
+
+ndb_no_ord=512
+ndb_con_op=105000
+ndb_dmem=80M
+ndb_imem=24M
+
+while test $# -gt 0; do
+ case "$1" in
+ --test)
+ test_ndb=1
+ ;;
+ --stop)
+ stop_ndb=1
+ ;;
+ --initial)
+ flags_ndb="$flags_ndb --initial"
+ initial_ndb=1
+ ;;
+ --debug*)
+ flags_ndb="$flags_ndb $1"
+ ;;
+ --status)
+ status_ndb=1
+ ;;
+ --small)
+ ndb_no_ord=128
+ ndb_con_op=10000
+ ndb_dmem=40M
+ ndb_imem=12M
+ ;;
+ --diskless)
+ ndb_diskless=1
+ ;;
+ --data-dir=*)
+ fsdir=`echo "$1" | sed -e "s;--data-dir=;;"`
+ ;;
+ --port=*)
+ port=`echo "$1" | sed -e "s;--port=;;"`
+ ;;
+ --port-base=*)
+ port_base=`echo "$1" | sed -e "s;--port-base=;;"`
+ ;;
+ -- ) shift; break ;;
+ --* ) $ECHO "Unrecognized option: $1"; exit 1 ;;
+ * ) break ;;
+ esac
+ shift
+done
+
+fs_ndb="$fsdir/ndbcluster-$port"
+
+NDB_HOME=
+if [ ! -x "$fsdir" ]; then
+ echo "$fsdir missing"
+ exit 1
+fi
+if [ ! -x "$exec_ndb" ]; then
+ echo "$exec_ndb missing"
+ exit 1
+fi
+if [ ! -x "$exec_mgmtsrvr" ]; then
+ echo "$exec_mgmtsrvr missing"
+ exit 1
+fi
+if [ ! -x "$exec_waiter" ]; then
+ echo "$exec_waiter missing"
+ exit 1
+fi
+
+exec_mgmtclient="$exec_mgmtclient --no-defaults"
+exec_mgmtsrvr="$exec_mgmtsrvr --no-defaults"
+exec_ndb="$exec_ndb --no-defaults"
+exec_waiter="$exec_waiter --no-defaults"
+
+ndb_host="localhost"
+ndb_mgmd_port=$port
+NDB_CONNECTSTRING="host=$ndb_host:$ndb_mgmd_port"
+export NDB_CONNECTSTRING
+
+sleep_until_file_created () {
+ file=$1
+ loop=$2
+ org_time=$2
+ message=$3
+ while (test $loop -gt 0)
+ do
+ if [ -r $file ]
+ then
+ return 0
+ fi
+ sleep 1
+ loop=`expr $loop - 1`
+ done
+ if [ $message ]
+ then
+ echo $message
+ fi
+ echo "ERROR: $file was not created in $org_time seconds; Aborting"
+ return 1;
+}
+
+start_default_ndbcluster() {
+
+# do some checks
+
+if [ "$initial_ndb" ] ; then
+ [ -d "$fs_ndb" ] || mkdir "$fs_ndb"
+fi
+if [ -d "$fs_ndb" ]; then :; else
+ echo "$fs_ndb filesystem directory does not exist"
+ exit 1
+fi
+
+# Start management server as deamon
+
+# Edit file system path and ports in config file
+if [ $initial_ndb ] ; then
+ rm -f $fs_ndb/ndb_*
+sed \
+ -e s,"CHOOSE_MaxNoOfOrderedIndexes","$ndb_no_ord",g \
+ -e s,"CHOOSE_MaxNoOfConcurrentOperations","$ndb_con_op",g \
+ -e s,"CHOOSE_DataMemory","$ndb_dmem",g \
+ -e s,"CHOOSE_IndexMemory","$ndb_imem",g \
+ -e s,"CHOOSE_Diskless","$ndb_diskless",g \
+ -e s,"CHOOSE_HOSTNAME_".*,"$ndb_host",g \
+ -e s,"CHOOSE_FILESYSTEM","$fs_ndb",g \
+ -e s,"CHOOSE_PORT_MGM","$ndb_mgmd_port",g \
+ -e s,"CHOOSE_PORT_TRANSPORTER","$port_base",g \
+ < ndb/ndb_config_2_node.ini \
+ > "$fs_ndb/config.ini"
+fi
+
+rm -f "$cfgfile" 2>&1 | cat > /dev/null
+rm -f "$fs_ndb/$cfgfile" 2>&1 | cat > /dev/null
+
+if ( cd "$fs_ndb" ; $exec_mgmtsrvr -f config.ini ) ; then :; else
+ echo "Unable to start $exec_mgmtsrvr from `pwd`"
+ exit 1
+fi
+if sleep_until_file_created $fs_ndb/ndb_3.pid 30
+then :; else
+ exit 1
+fi
+cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
+
+# Start database node
+
+echo "Starting ndbd"
+( cd "$fs_ndb" ; $exec_ndb $flags_ndb & )
+if sleep_until_file_created $fs_ndb/ndb_1.pid 30
+then :; else
+ stop_default_ndbcluster
+ exit 1
+fi
+cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
+
+# Start database node
+
+echo "Starting ndbd"
+( cd "$fs_ndb" ; $exec_ndb $flags_ndb & )
+if sleep_until_file_created $fs_ndb/ndb_2.pid 30
+then :; else
+ stop_default_ndbcluster
+ exit 1
+fi
+cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
+
+# test if Ndb Cluster starts properly
+
+echo "Waiting for started..."
+if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK"; then :; else
+ echo "Ndbcluster startup failed"
+ stop_default_ndbcluster
+ exit 1
+fi
+
+cat `find "$fs_ndb" -name 'ndb_*.pid'` > $fs_ndb/$pidfile
+
+status_ndbcluster
+}
+
+status_ndbcluster() {
+ # Start management client
+ $exec_mgmtclient -e show
+}
+
+stop_default_ndbcluster() {
+
+# Start management client
+
+exec_mgmtclient="$exec_mgmtclient --try-reconnect=1"
+
+$exec_mgmtclient -e shutdown 2>&1 | cat > /dev/null
+
+if [ -f "$fs_ndb/$pidfile" ] ; then
+ kill_pids=`cat "$fs_ndb/$pidfile"`
+ attempt=0
+ while [ $attempt -lt 10 ] ; do
+ new_kill_pid=""
+ kill_pids2=""
+ for p in $kill_pids ; do
+ kill -0 $p 2> /dev/null
+ if [ $? -eq 0 ] ; then
+ new_kill_pid="$p $new_kill_pid"
+ kill_pids2="-$p $kill_pids2"
+ fi
+ done
+ kill_pids=$new_kill_pid
+ if [ -z "$kill_pids" ] ; then
+ break
+ fi
+ sleep 1
+ attempt=`expr $attempt + 1`
+ done
+ if [ "$kill_pids2" != "" ] ; then
+ echo "Failed to shutdown ndbcluster, executing kill "$kill_pids2
+ kill -9 -- $kill_pids2 2> /dev/null
+ /bin/kill -9 -- $kill_pids2 2> /dev/null
+ /usr/bin/kill -9 -- $kill_pids2 2> /dev/null
+ kill -9 $kill_pids2 2> /dev/null
+ /bin/kill -9 $kill_pids2 2> /dev/null
+ /usr/bin/kill -9 $kill_pids2 2> /dev/null
+ fi
+ rm "$fs_ndb/$pidfile"
+fi
+}
+
+initialize_ndb_test ()
+{
+ fs_result=$fs_ndb/r
+ rm -rf $fs_result
+ mkdir $fs_result
+ echo ------------------
+ echo starting ndb tests
+ echo ------------------
+}
+
+do_ndb_test ()
+{
+ test_name=$1
+
+ clusterlog=$fs_ndb/ndb_3_cluster.log
+
+ test_log_result=$fs_result/${test_name}_log.result
+ test_log_reject=$fs_result/${test_name}_log.reject
+ test_result=$fs_result/${test_name}.result
+ test_reject=$fs_result/${test_name}.reject
+
+ clean_log='s/.*\[MgmSrvr\]//'
+
+ cat $clusterlog ndb/${test_name}_log.result | sed -e $clean_log > $test_log_result
+
+ cp ndb/${test_name}.result $test_result
+
+ cat ndb/${test_name}.test | $exec_mgmtclient > $test_reject
+ cat $clusterlog | sed -e $clean_log > $test_log_reject
+
+ t="pass"
+ diff -C 5 $test_result $test_reject || t="fail"
+ printf "ndb_mgm output %20s [%s]\n" $test_name $t
+ t="pass"
+ diff -C 5 $test_log_result $test_log_reject || t="fail"
+ printf "clusterlog output %20s [%s]\n" $test_name $t
+}
+
+if [ $status_ndb ] ; then
+ status_ndbcluster
+ exit 0
+fi
+
+if [ $stop_ndb ] ; then
+ stop_default_ndbcluster
+else
+ start_default_ndbcluster
+fi
+
+if [ $test_ndb ] ; then
+ initialize_ndb_test
+ all_tests=`ls ndb/*.test | sed "s#ndb/##" | sed "s#.test##"`
+ for a in $all_tests ; do
+ do_ndb_test $a
+ done
+ echo ------------------
+ echo shutting down cluster
+ stop_default_ndbcluster
+fi
+
+exit 0
diff --git a/mysql-test/ndb/restart.result b/mysql-test/ndb/restart.result
new file mode 100644
index 00000000000..efa1399b5d9
--- /dev/null
+++ b/mysql-test/ndb/restart.result
@@ -0,0 +1,16 @@
+-- NDB Cluster -- Management Client --
+Connected to Management Server at: localhost:1186
+ALL disabled
+Cluster logging is enabled.
+ALERT enabled
+Executing CLUSTERLOG on node 1 OK!
+Executing CLUSTERLOG on node 2 OK!
+
+Node 1 is being restarted.
+
+Executing CLUSTERLOG on node 1 OK!
+Executing CLUSTERLOG on node 2 OK!
+
+Node 1 is being restarted.
+
+ALL enabled
diff --git a/mysql-test/ndb/restart.test b/mysql-test/ndb/restart.test
new file mode 100644
index 00000000000..6ea9e919368
--- /dev/null
+++ b/mysql-test/ndb/restart.test
@@ -0,0 +1,12 @@
+clusterlog off all
+clusterlog on
+clusterlog on alert
+all clusterlog connection=0
+sleep 1
+1 restart
+sleep 5
+all clusterlog connection=8
+sleep 1
+1 restart
+sleep 5
+clusterlog on all
diff --git a/mysql-test/ndb/restart_log.result b/mysql-test/ndb/restart_log.result
new file mode 100644
index 00000000000..2b25fc7b5b6
--- /dev/null
+++ b/mysql-test/ndb/restart_log.result
@@ -0,0 +1,20 @@
+ ALERT -- Node 2: Network partitioning - arbitration required
+ ALERT -- Node 2: Arbitration won - positive reply from node 3
+ ALERT -- Node 2: Node 1 has failed. The Node state at failure was 0
+ ALERT -- Node 2: Node failure of 1 DBLQH completed
+ ALERT -- Node 2: Node failure of 1 DBDICT completed
+ ALERT -- Node 2: Node failure of 1 DBDIH completed
+ ALERT -- Node 2: Node failure of 1 DBTC completed
+ ALERT -- Node 2: Node 2 completed failure of Node 1
+ ALERT -- Node 2: All nodes completed failure of Node 1
+ ALERT -- Node 3: Node 1 Disconnected
+ ALERT -- Node 2: Node 1 Disconnected
+ ALERT -- Node 2: Network partitioning - arbitration required
+ ALERT -- Node 2: Arbitration won - positive reply from node 3
+ ALERT -- Node 2: Node 1 has failed. The Node state at failure was 0
+ ALERT -- Node 2: Node failure of 1 DBLQH completed
+ ALERT -- Node 2: Node failure of 1 DBDICT completed
+ ALERT -- Node 2: Node failure of 1 DBDIH completed
+ ALERT -- Node 2: Node failure of 1 DBTC completed
+ ALERT -- Node 2: Node 2 completed failure of Node 1
+ ALERT -- Node 2: All nodes completed failure of Node 1
diff --git a/mysql-test/r/alias.result b/mysql-test/r/alias.result
index 3d6273144d0..587c21e9129 100644
--- a/mysql-test/r/alias.result
+++ b/mysql-test/r/alias.result
@@ -47,7 +47,7 @@ KEY prov_hdl_nr(prov_hdl_nr),
KEY mcbs_aufnr(mcbs_aufnr),
KEY kundentyp(kundentyp),
KEY p_nr(p_nr,suffix)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (3359356,405,3359356,'Mustermann Musterfrau',52500,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1485525,2122316,'+','','N',1909160,'MobilComSuper92000D2',NULL,NULL,'MS9ND2',3,24,'MobilCom Shop Koeln',52500,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
INSERT INTO t1 VALUES (3359357,468,3359357,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1503580,2139699,'+','','P',1909171,'MobilComSuper9D1T10SFreisprech(Akquise)',NULL,NULL,'MS9NS1',327,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
INSERT INTO t1 VALUES (3359358,407,3359358,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1501358,2137473,'N','','N',1909159,'MobilComSuper92000D2',NULL,NULL,'MS9ND2',325,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index e7a8d2c7cdf..9e14ca85a29 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -51,10 +51,10 @@ PRIMARY KEY (GROUP_ID,LANG_ID),
KEY NAME (NAME));
ALTER TABLE t1 CHANGE NAME NAME CHAR(80) not null;
SHOW FULL COLUMNS FROM t1;
-Field Type Null Key Default Extra Privileges
-GROUP_ID int(10) unsigned PRI 0 select,insert,update,references
-LANG_ID smallint(5) unsigned PRI 0 select,insert,update,references
-NAME char(80) MUL select,insert,update,references
+Field Type Collation Null Key Default Extra Privileges Comment
+GROUP_ID int(10) unsigned NULL PRI 0 select,insert,update,references
+LANG_ID smallint(5) unsigned NULL PRI 0 select,insert,update,references
+NAME char(80) latin1_swedish_ci MUL select,insert,update,references
DROP TABLE t1;
create table t1 (n int);
insert into t1 values(9),(3),(12),(10);
@@ -74,10 +74,10 @@ body text NOT NULL,
user_id int(11) unsigned NOT NULL default '0',
status enum('new','old') NOT NULL default 'new',
PRIMARY KEY (id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
ALTER TABLE t1 ORDER BY t1.id, t1.status, t1.type_id, t1.user_id, t1.body;
DROP TABLE t1;
-CREATE TABLE t1 (AnamneseId int(10) unsigned NOT NULL auto_increment,B BLOB,PRIMARY KEY (AnamneseId)) type=myisam;
+CREATE TABLE t1 (AnamneseId int(10) unsigned NOT NULL auto_increment,B BLOB,PRIMARY KEY (AnamneseId)) engine=myisam;
insert into t1 values (null,"hello");
LOCK TABLES t1 WRITE;
ALTER TABLE t1 ADD Column new_col int not null;
@@ -108,7 +108,7 @@ select * from mysqltest.t1;
name
mysqltest
alter table t1 rename mysqltest.t1;
-Table 't1' already exists
+ERROR 42S01: Table 't1' already exists
select * from t1;
name
current
@@ -121,9 +121,9 @@ create database mysqltest;
create table mysqltest.t1 (a int,b int,c int);
grant all on mysqltest.t1 to mysqltest_1@localhost;
alter table t1 rename t2;
-insert command denied to user: 'mysqltest_1@localhost' for table 't2'
+ERROR 42000: insert command denied to user 'mysqltest_1'@'localhost' for table 't2'
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
-delete from mysql.user where user='mysqltest_1';
+delete from mysql.user where user=_binary'mysqltest_1';
drop database mysqltest;
create table t1 (n1 int not null, n2 int, n3 int, n4 float,
unique(n1),
@@ -311,11 +311,90 @@ ALTER TABLE t1 DISABLE KEYS;
INSERT DELAYED INTO t1 VALUES(1),(2),(3);
ALTER TABLE t1 ENABLE KEYS;
drop table t1;
+set names koi8r;
+create table t1 (a char(10) character set koi8r);
+insert into t1 values ('ÔÅÓÔ');
+select a,hex(a) from t1;
+a hex(a)
+ÔÅÓÔ D4C5D3D4
+alter table t1 change a a char(10) character set cp1251;
+select a,hex(a) from t1;
+a hex(a)
+ÔÅÓÔ F2E5F1F2
+alter table t1 change a a binary(10);
+select a,hex(a) from t1;
+a hex(a)
+òåñò F2E5F1F2
+alter table t1 change a a char(10) character set cp1251;
+select a,hex(a) from t1;
+a hex(a)
+ÔÅÓÔ F2E5F1F2
+alter table t1 change a a char(10) character set koi8r;
+select a,hex(a) from t1;
+a hex(a)
+ÔÅÓÔ D4C5D3D4
+alter table t1 change a a varchar(10) character set cp1251;
+select a,hex(a) from t1;
+a hex(a)
+ÔÅÓÔ F2E5F1F2
+alter table t1 change a a char(10) character set koi8r;
+select a,hex(a) from t1;
+a hex(a)
+ÔÅÓÔ D4C5D3D4
+alter table t1 change a a text character set cp1251;
+select a,hex(a) from t1;
+a hex(a)
+ÔÅÓÔ F2E5F1F2
+alter table t1 change a a char(10) character set koi8r;
+select a,hex(a) from t1;
+a hex(a)
+ÔÅÓÔ D4C5D3D4
+delete from t1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) character set koi8r default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+alter table t1 DEFAULT CHARACTER SET latin1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) character set koi8r default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+alter table t1 CONVERT TO CHARACTER SET latin1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+alter table t1 DEFAULT CHARACTER SET cp1251;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) character set latin1 default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=cp1251
+drop table t1;
+create table t1 (myblob longblob,mytext longtext)
+default charset latin1 collate latin1_general_cs;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `myblob` longblob,
+ `mytext` longtext collate latin1_general_cs
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs
+alter table t1 character set latin2;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `myblob` longblob,
+ `mytext` longtext character set latin1 collate latin1_general_cs
+) ENGINE=MyISAM DEFAULT CHARSET=latin2
+drop table t1;
CREATE TABLE t1 (
Host varchar(16) binary NOT NULL default '',
User varchar(16) binary NOT NULL default '',
PRIMARY KEY (Host,User)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
ALTER TABLE t1 DISABLE KEYS;
LOCK TABLES t1 WRITE;
INSERT INTO t1 VALUES ('localhost','root'),('localhost',''),('games','monty');
@@ -334,7 +413,7 @@ Host varchar(16) binary NOT NULL default '',
User varchar(16) binary NOT NULL default '',
PRIMARY KEY (Host,User),
KEY (Host)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
ALTER TABLE t1 DISABLE KEYS;
SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
@@ -371,7 +450,7 @@ Host varchar(16) binary NOT NULL default '',
User varchar(16) binary NOT NULL default '',
PRIMARY KEY (Host,User),
KEY (Host)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
LOCK TABLES t1 WRITE;
ALTER TABLE t1 DISABLE KEYS;
SHOW INDEX FROM t1;
@@ -380,9 +459,37 @@ t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
t1 0 PRIMARY 2 User A 0 NULL NULL BTREE
t1 1 Host 1 Host A NULL NULL NULL BTREE disabled
DROP TABLE t1;
+CREATE TABLE t1 (a int PRIMARY KEY, b INT UNIQUE);
+ALTER TABLE t1 DROP PRIMARY KEY;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL default '0',
+ `b` int(11) default NULL,
+ UNIQUE KEY `b` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ALTER TABLE t1 DROP PRIMARY KEY;
+ERROR 42000: Can't DROP 'PRIMARY'; check that column/key exists
+DROP TABLE t1;
+create table t1 (a int, b int, key(a));
+insert into t1 values (1,1), (2,2);
+alter table t1 drop key no_such_key;
+ERROR 42000: Can't DROP 'no_such_key'; check that column/key exists
+alter table t1 drop key a;
+drop table t1;
create table t1 (a int);
alter table t1 rename to `t1\\`;
-Incorrect table name 't1\\'
+ERROR 42000: Incorrect table name 't1\\'
rename table t1 to `t1\\`;
-Incorrect table name 't1\\'
+ERROR 42000: Incorrect table name 't1\\'
+drop table t1;
+create table t1 (a text) character set koi8r;
+insert into t1 values (_koi8r'ÔÅÓÔ');
+select hex(a) from t1;
+hex(a)
+D4C5D3D4
+alter table t1 convert to character set cp1251;
+select hex(a) from t1;
+hex(a)
+F2E5F1F2
drop table t1;
diff --git a/mysql-test/r/alter_table.result.es b/mysql-test/r/alter_table.result.es
new file mode 100644
index 00000000000..4f93b40a573
--- /dev/null
+++ b/mysql-test/r/alter_table.result.es
@@ -0,0 +1,483 @@
+drop table if exists t1,t2;
+drop database if exists mysqltest;
+create table t1 (
+col1 int not null auto_increment primary key,
+col2 varchar(30) not null,
+col3 varchar (20) not null,
+col4 varchar(4) not null,
+col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null,
+col6 int not null, to_be_deleted int);
+insert into t1 values (2,4,3,5,"PENDING",1,7);
+alter table t1
+add column col4_5 varchar(20) not null after col4,
+add column col7 varchar(30) not null after col5,
+add column col8 datetime not null, drop column to_be_deleted,
+change column col2 fourth varchar(30) not null after col3,
+modify column col6 int not null first;
+select * from t1;
+col6 col1 col3 fourth col4 col4_5 col5 col7 col8
+1 2 3 4 5 PENDING 0000-00-00 00:00:00
+drop table t1;
+create table t1 (bandID MEDIUMINT UNSIGNED NOT NULL PRIMARY KEY, payoutID SMALLINT UNSIGNED NOT NULL);
+insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7,12),(8,12);
+alter table t1 add column new_col int, order by payoutid,bandid;
+select * from t1;
+bandID payoutID new_col
+6 1 NULL
+3 4 NULL
+1 6 NULL
+2 6 NULL
+4 9 NULL
+5 10 NULL
+7 12 NULL
+8 12 NULL
+alter table t1 order by bandid,payoutid;
+select * from t1;
+bandID payoutID new_col
+1 6 NULL
+2 6 NULL
+3 4 NULL
+4 9 NULL
+5 10 NULL
+6 1 NULL
+7 12 NULL
+8 12 NULL
+drop table t1;
+CREATE TABLE t1 (
+GROUP_ID int(10) unsigned DEFAULT '0' NOT NULL,
+LANG_ID smallint(5) unsigned DEFAULT '0' NOT NULL,
+NAME varchar(80) DEFAULT '' NOT NULL,
+PRIMARY KEY (GROUP_ID,LANG_ID),
+KEY NAME (NAME));
+ALTER TABLE t1 CHANGE NAME NAME CHAR(80) not null;
+SHOW FULL COLUMNS FROM t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+GROUP_ID int(10) unsigned NULL PRI 0
+LANG_ID smallint(5) unsigned NULL PRI 0
+NAME char(80) latin1_swedish_ci MUL
+DROP TABLE t1;
+create table t1 (n int);
+insert into t1 values(9),(3),(12),(10);
+alter table t1 order by n;
+select * from t1;
+n
+3
+9
+10
+12
+drop table t1;
+CREATE TABLE t1 (
+id int(11) unsigned NOT NULL default '0',
+category_id tinyint(4) unsigned NOT NULL default '0',
+type_id tinyint(4) unsigned NOT NULL default '0',
+body text NOT NULL,
+user_id int(11) unsigned NOT NULL default '0',
+status enum('new','old') NOT NULL default 'new',
+PRIMARY KEY (id)
+) ENGINE=MyISAM;
+ALTER TABLE t1 ORDER BY t1.id, t1.status, t1.type_id, t1.user_id, t1.body;
+DROP TABLE t1;
+CREATE TABLE t1 (AnamneseId int(10) unsigned NOT NULL auto_increment,B BLOB,PRIMARY KEY (AnamneseId)) engine=myisam;
+insert into t1 values (null,"hello");
+LOCK TABLES t1 WRITE;
+ALTER TABLE t1 ADD Column new_col int not null;
+UNLOCK TABLES;
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+DROP TABLE t1;
+create table t1 (i int unsigned not null auto_increment primary key);
+insert into t1 values (null),(null),(null),(null);
+alter table t1 drop i,add i int unsigned not null auto_increment, drop primary key, add primary key (i);
+select * from t1;
+i
+1
+2
+3
+4
+drop table t1;
+create table t1 (name char(15));
+insert into t1 (name) values ("current");
+create database mysqltest;
+create table mysqltest.t1 (name char(15));
+insert into mysqltest.t1 (name) values ("mysqltest");
+select * from t1;
+name
+current
+select * from mysqltest.t1;
+name
+mysqltest
+alter table t1 rename mysqltest.t1;
+ERROR 42S01: Table 't1' already exists
+select * from t1;
+name
+current
+select * from mysqltest.t1;
+name
+mysqltest
+drop table t1;
+drop database mysqltest;
+create database mysqltest;
+create table mysqltest.t1 (a int,b int,c int);
+grant all on mysqltest.t1 to mysqltest_1@localhost;
+alter table t1 rename t2;
+revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
+delete from mysql.user where user=_binary'mysqltest_1';
+drop database mysqltest;
+create table t1 (n1 int not null, n2 int, n3 int, n4 float,
+unique(n1),
+key (n1, n2, n3, n4),
+key (n2, n3, n4, n1),
+key (n3, n4, n1, n2),
+key (n4, n1, n2, n3) );
+alter table t1 disable keys;
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 n1 1 n1 A 0 NULL NULL BTREE
+t1 1 n1_2 1 n1 A NULL NULL NULL BTREE disabled
+t1 1 n1_2 2 n2 A NULL NULL NULL YES BTREE disabled
+t1 1 n1_2 3 n3 A NULL NULL NULL YES BTREE disabled
+t1 1 n1_2 4 n4 A NULL NULL NULL YES BTREE disabled
+t1 1 n2 1 n2 A NULL NULL NULL YES BTREE disabled
+t1 1 n2 2 n3 A NULL NULL NULL YES BTREE disabled
+t1 1 n2 3 n4 A NULL NULL NULL YES BTREE disabled
+t1 1 n2 4 n1 A NULL NULL NULL BTREE disabled
+t1 1 n3 1 n3 A NULL NULL NULL YES BTREE disabled
+t1 1 n3 2 n4 A NULL NULL NULL YES BTREE disabled
+t1 1 n3 3 n1 A NULL NULL NULL BTREE disabled
+t1 1 n3 4 n2 A NULL NULL NULL YES BTREE disabled
+t1 1 n4 1 n4 A NULL NULL NULL YES BTREE disabled
+t1 1 n4 2 n1 A NULL NULL NULL BTREE disabled
+t1 1 n4 3 n2 A NULL NULL NULL YES BTREE disabled
+t1 1 n4 4 n3 A NULL NULL NULL YES BTREE disabled
+insert into t1 values(10,RAND()*1000,RAND()*1000,RAND());
+insert into t1 values(9,RAND()*1000,RAND()*1000,RAND());
+insert into t1 values(8,RAND()*1000,RAND()*1000,RAND());
+insert into t1 values(7,RAND()*1000,RAND()*1000,RAND());
+insert into t1 values(6,RAND()*1000,RAND()*1000,RAND());
+insert into t1 values(5,RAND()*1000,RAND()*1000,RAND());
+insert into t1 values(4,RAND()*1000,RAND()*1000,RAND());
+insert into t1 values(3,RAND()*1000,RAND()*1000,RAND());
+insert into t1 values(2,RAND()*1000,RAND()*1000,RAND());
+insert into t1 values(1,RAND()*1000,RAND()*1000,RAND());
+alter table t1 enable keys;
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 n1 1 n1 A 10 NULL NULL BTREE
+t1 1 n1_2 1 n1 A 10 NULL NULL BTREE
+t1 1 n1_2 2 n2 A 10 NULL NULL YES BTREE
+t1 1 n1_2 3 n3 A 10 NULL NULL YES BTREE
+t1 1 n1_2 4 n4 A 10 NULL NULL YES BTREE
+t1 1 n2 1 n2 A 10 NULL NULL YES BTREE
+t1 1 n2 2 n3 A 10 NULL NULL YES BTREE
+t1 1 n2 3 n4 A 10 NULL NULL YES BTREE
+t1 1 n2 4 n1 A 10 NULL NULL BTREE
+t1 1 n3 1 n3 A 10 NULL NULL YES BTREE
+t1 1 n3 2 n4 A 10 NULL NULL YES BTREE
+t1 1 n3 3 n1 A 10 NULL NULL BTREE
+t1 1 n3 4 n2 A 10 NULL NULL YES BTREE
+t1 1 n4 1 n4 A 10 NULL NULL YES BTREE
+t1 1 n4 2 n1 A 10 NULL NULL BTREE
+t1 1 n4 3 n2 A 10 NULL NULL YES BTREE
+t1 1 n4 4 n3 A 10 NULL NULL YES BTREE
+drop table t1;
+create table t1 (i int unsigned not null auto_increment primary key);
+alter table t1 rename t2;
+alter table t2 rename t1, add c char(10) comment "no comment";
+show columns from t1;
+Field Type Null Key Default Extra
+i int(10) unsigned PRI NULL auto_increment
+c char(10) YES NULL
+drop table t1;
+create table t1 (a int, b int);
+insert into t1 values(1,100), (2,100), (3, 100);
+insert into t1 values(1,99), (2,99), (3, 99);
+insert into t1 values(1,98), (2,98), (3, 98);
+insert into t1 values(1,97), (2,97), (3, 97);
+insert into t1 values(1,96), (2,96), (3, 96);
+insert into t1 values(1,95), (2,95), (3, 95);
+insert into t1 values(1,94), (2,94), (3, 94);
+insert into t1 values(1,93), (2,93), (3, 93);
+insert into t1 values(1,92), (2,92), (3, 92);
+insert into t1 values(1,91), (2,91), (3, 91);
+insert into t1 values(1,90), (2,90), (3, 90);
+insert into t1 values(1,89), (2,89), (3, 89);
+insert into t1 values(1,88), (2,88), (3, 88);
+insert into t1 values(1,87), (2,87), (3, 87);
+insert into t1 values(1,86), (2,86), (3, 86);
+insert into t1 values(1,85), (2,85), (3, 85);
+insert into t1 values(1,84), (2,84), (3, 84);
+insert into t1 values(1,83), (2,83), (3, 83);
+insert into t1 values(1,82), (2,82), (3, 82);
+insert into t1 values(1,81), (2,81), (3, 81);
+insert into t1 values(1,80), (2,80), (3, 80);
+insert into t1 values(1,79), (2,79), (3, 79);
+insert into t1 values(1,78), (2,78), (3, 78);
+insert into t1 values(1,77), (2,77), (3, 77);
+insert into t1 values(1,76), (2,76), (3, 76);
+insert into t1 values(1,75), (2,75), (3, 75);
+insert into t1 values(1,74), (2,74), (3, 74);
+insert into t1 values(1,73), (2,73), (3, 73);
+insert into t1 values(1,72), (2,72), (3, 72);
+insert into t1 values(1,71), (2,71), (3, 71);
+insert into t1 values(1,70), (2,70), (3, 70);
+insert into t1 values(1,69), (2,69), (3, 69);
+insert into t1 values(1,68), (2,68), (3, 68);
+insert into t1 values(1,67), (2,67), (3, 67);
+insert into t1 values(1,66), (2,66), (3, 66);
+insert into t1 values(1,65), (2,65), (3, 65);
+insert into t1 values(1,64), (2,64), (3, 64);
+insert into t1 values(1,63), (2,63), (3, 63);
+insert into t1 values(1,62), (2,62), (3, 62);
+insert into t1 values(1,61), (2,61), (3, 61);
+insert into t1 values(1,60), (2,60), (3, 60);
+insert into t1 values(1,59), (2,59), (3, 59);
+insert into t1 values(1,58), (2,58), (3, 58);
+insert into t1 values(1,57), (2,57), (3, 57);
+insert into t1 values(1,56), (2,56), (3, 56);
+insert into t1 values(1,55), (2,55), (3, 55);
+insert into t1 values(1,54), (2,54), (3, 54);
+insert into t1 values(1,53), (2,53), (3, 53);
+insert into t1 values(1,52), (2,52), (3, 52);
+insert into t1 values(1,51), (2,51), (3, 51);
+insert into t1 values(1,50), (2,50), (3, 50);
+insert into t1 values(1,49), (2,49), (3, 49);
+insert into t1 values(1,48), (2,48), (3, 48);
+insert into t1 values(1,47), (2,47), (3, 47);
+insert into t1 values(1,46), (2,46), (3, 46);
+insert into t1 values(1,45), (2,45), (3, 45);
+insert into t1 values(1,44), (2,44), (3, 44);
+insert into t1 values(1,43), (2,43), (3, 43);
+insert into t1 values(1,42), (2,42), (3, 42);
+insert into t1 values(1,41), (2,41), (3, 41);
+insert into t1 values(1,40), (2,40), (3, 40);
+insert into t1 values(1,39), (2,39), (3, 39);
+insert into t1 values(1,38), (2,38), (3, 38);
+insert into t1 values(1,37), (2,37), (3, 37);
+insert into t1 values(1,36), (2,36), (3, 36);
+insert into t1 values(1,35), (2,35), (3, 35);
+insert into t1 values(1,34), (2,34), (3, 34);
+insert into t1 values(1,33), (2,33), (3, 33);
+insert into t1 values(1,32), (2,32), (3, 32);
+insert into t1 values(1,31), (2,31), (3, 31);
+insert into t1 values(1,30), (2,30), (3, 30);
+insert into t1 values(1,29), (2,29), (3, 29);
+insert into t1 values(1,28), (2,28), (3, 28);
+insert into t1 values(1,27), (2,27), (3, 27);
+insert into t1 values(1,26), (2,26), (3, 26);
+insert into t1 values(1,25), (2,25), (3, 25);
+insert into t1 values(1,24), (2,24), (3, 24);
+insert into t1 values(1,23), (2,23), (3, 23);
+insert into t1 values(1,22), (2,22), (3, 22);
+insert into t1 values(1,21), (2,21), (3, 21);
+insert into t1 values(1,20), (2,20), (3, 20);
+insert into t1 values(1,19), (2,19), (3, 19);
+insert into t1 values(1,18), (2,18), (3, 18);
+insert into t1 values(1,17), (2,17), (3, 17);
+insert into t1 values(1,16), (2,16), (3, 16);
+insert into t1 values(1,15), (2,15), (3, 15);
+insert into t1 values(1,14), (2,14), (3, 14);
+insert into t1 values(1,13), (2,13), (3, 13);
+insert into t1 values(1,12), (2,12), (3, 12);
+insert into t1 values(1,11), (2,11), (3, 11);
+insert into t1 values(1,10), (2,10), (3, 10);
+insert into t1 values(1,9), (2,9), (3, 9);
+insert into t1 values(1,8), (2,8), (3, 8);
+insert into t1 values(1,7), (2,7), (3, 7);
+insert into t1 values(1,6), (2,6), (3, 6);
+insert into t1 values(1,5), (2,5), (3, 5);
+insert into t1 values(1,4), (2,4), (3, 4);
+insert into t1 values(1,3), (2,3), (3, 3);
+insert into t1 values(1,2), (2,2), (3, 2);
+insert into t1 values(1,1), (2,1), (3, 1);
+alter table t1 add unique (a,b), add key (b);
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 a 1 a A NULL NULL NULL YES BTREE
+t1 0 a 2 b A NULL NULL NULL YES BTREE
+t1 1 b 1 b A 100 NULL NULL YES BTREE
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 a 1 a A 3 NULL NULL YES BTREE
+t1 0 a 2 b A 300 NULL NULL YES BTREE
+t1 1 b 1 b A 100 NULL NULL YES BTREE
+drop table t1;
+CREATE TABLE t1 (i int(10), index(i) );
+ALTER TABLE t1 DISABLE KEYS;
+INSERT DELAYED INTO t1 VALUES(1),(2),(3);
+ALTER TABLE t1 ENABLE KEYS;
+drop table t1;
+set names koi8r;
+create table t1 (a char(10) character set koi8r);
+insert into t1 values ('ÔÅÓÔ');
+select a,hex(a) from t1;
+a hex(a)
+ÔÅÓÔ D4C5D3D4
+alter table t1 change a a char(10) character set cp1251;
+select a,hex(a) from t1;
+a hex(a)
+ÔÅÓÔ F2E5F1F2
+alter table t1 change a a binary(10);
+select a,hex(a) from t1;
+a hex(a)
+òåñò F2E5F1F2
+alter table t1 change a a char(10) character set cp1251;
+select a,hex(a) from t1;
+a hex(a)
+ÔÅÓÔ F2E5F1F2
+alter table t1 change a a char(10) character set koi8r;
+select a,hex(a) from t1;
+a hex(a)
+ÔÅÓÔ D4C5D3D4
+alter table t1 change a a varchar(10) character set cp1251;
+select a,hex(a) from t1;
+a hex(a)
+ÔÅÓÔ F2E5F1F2
+alter table t1 change a a char(10) character set koi8r;
+select a,hex(a) from t1;
+a hex(a)
+ÔÅÓÔ D4C5D3D4
+alter table t1 change a a text character set cp1251;
+select a,hex(a) from t1;
+a hex(a)
+ÔÅÓÔ F2E5F1F2
+alter table t1 change a a char(10) character set koi8r;
+select a,hex(a) from t1;
+a hex(a)
+ÔÅÓÔ D4C5D3D4
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) character set koi8r default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+alter table t1 DEFAULT CHARACTER SET latin1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) character set koi8r default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+alter table t1 CONVERT TO CHARACTER SET latin1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+alter table t1 DEFAULT CHARACTER SET cp1251;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) character set latin1 default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=cp1251
+drop table t1;
+create table t1 (myblob longblob,mytext longtext)
+default charset latin1 collate latin1_general_cs;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `myblob` longblob,
+ `mytext` longtext collate latin1_general_cs
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs
+alter table t1 character set latin2;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `myblob` longblob,
+ `mytext` longtext character set latin1 collate latin1_general_cs
+) ENGINE=MyISAM DEFAULT CHARSET=latin2
+drop table t1;
+CREATE TABLE t1 (
+Host varchar(16) binary NOT NULL default '',
+User varchar(16) binary NOT NULL default '',
+PRIMARY KEY (Host,User)
+) ENGINE=MyISAM;
+ALTER TABLE t1 DISABLE KEYS;
+LOCK TABLES t1 WRITE;
+INSERT INTO t1 VALUES ('localhost','root'),('localhost',''),('games','monty');
+SHOW INDEX FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
+t1 0 PRIMARY 2 User A 3 NULL NULL BTREE
+ALTER TABLE t1 ENABLE KEYS;
+UNLOCK TABLES;
+CHECK TABLES t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1;
+CREATE TABLE t1 (
+Host varchar(16) binary NOT NULL default '',
+User varchar(16) binary NOT NULL default '',
+PRIMARY KEY (Host,User),
+KEY (Host)
+) ENGINE=MyISAM;
+ALTER TABLE t1 DISABLE KEYS;
+SHOW INDEX FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
+t1 0 PRIMARY 2 User A 0 NULL NULL BTREE
+t1 1 Host 1 Host A NULL NULL NULL BTREE disabled
+LOCK TABLES t1 WRITE;
+INSERT INTO t1 VALUES ('localhost','root'),('localhost','');
+SHOW INDEX FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
+t1 0 PRIMARY 2 User A 2 NULL NULL BTREE
+t1 1 Host 1 Host A NULL NULL NULL BTREE disabled
+ALTER TABLE t1 ENABLE KEYS;
+SHOW INDEX FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
+t1 0 PRIMARY 2 User A 2 NULL NULL BTREE
+t1 1 Host 1 Host A 1 NULL NULL BTREE
+UNLOCK TABLES;
+CHECK TABLES t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+LOCK TABLES t1 WRITE;
+ALTER TABLE t1 RENAME t2;
+UNLOCK TABLES;
+select * from t2;
+Host User
+localhost
+localhost root
+DROP TABLE t2;
+CREATE TABLE t1 (
+Host varchar(16) binary NOT NULL default '',
+User varchar(16) binary NOT NULL default '',
+PRIMARY KEY (Host,User),
+KEY (Host)
+) ENGINE=MyISAM;
+LOCK TABLES t1 WRITE;
+ALTER TABLE t1 DISABLE KEYS;
+SHOW INDEX FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
+t1 0 PRIMARY 2 User A 0 NULL NULL BTREE
+t1 1 Host 1 Host A NULL NULL NULL BTREE disabled
+DROP TABLE t1;
+CREATE TABLE t1 (a int PRIMARY KEY, b INT UNIQUE);
+ALTER TABLE t1 DROP PRIMARY KEY;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL default '0',
+ `b` int(11) default NULL,
+ UNIQUE KEY `b` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ALTER TABLE t1 DROP PRIMARY KEY;
+ERROR 42000: Can't DROP 'PRIMARY'; check that column/key exists
+DROP TABLE t1;
+create table t1 (a int, b int, key(a));
+insert into t1 values (1,1), (2,2);
+alter table t1 drop key no_such_key;
+ERROR 42000: Can't DROP 'no_such_key'; check that column/key exists
+alter table t1 drop key a;
+drop table t1;
+create table t1 (a int);
+alter table t1 rename to `t1\\`;
+ERROR 42000: Incorrect table name 't1\\'
+rename table t1 to `t1\\`;
+ERROR 42000: Incorrect table name 't1\\'
+drop table t1;
diff --git a/mysql-test/r/analyse.result b/mysql-test/r/analyse.result
index 5e859bb0b7a..b51afab5b54 100644
--- a/mysql-test/r/analyse.result
+++ b/mysql-test/r/analyse.result
@@ -1,26 +1,98 @@
drop table if exists t1,t2;
create table t1 (i int, j int, empty_string char(10), bool char(1), d date);
insert into t1 values (1,2,"","Y","2002-03-03"), (3,4,"","N","2002-03-04"), (5,6,"","Y","2002-03-04"), (7,8,"","N","2002-03-05");
+select count(*) from t1 procedure analyse();
+Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
+count(*) 4 4 1 1 0 0 4.0000 0.0000 ENUM('4') NOT NULL
select * from t1 procedure analyse();
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
-t1.i 1 7 1 1 0 0 4.0000 2.2361 ENUM('1','3','5','7') NOT NULL
-t1.j 2 8 1 1 0 0 5.0000 2.2361 ENUM('2','4','6','8') NOT NULL
-t1.empty_string 0 0 4 0 0.0000 NULL CHAR(0) NOT NULL
-t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL
-t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
+test.t1.i 1 7 1 1 0 0 4.0000 2.2361 ENUM('1','3','5','7') NOT NULL
+test.t1.j 2 8 1 1 0 0 5.0000 2.2361 ENUM('2','4','6','8') NOT NULL
+test.t1.empty_string 0 0 4 0 0.0000 NULL CHAR(0) NOT NULL
+test.t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL
+test.t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
select * from t1 procedure analyse(2);
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
-t1.i 1 7 1 1 0 0 4.0000 2.2361 TINYINT(1) UNSIGNED NOT NULL
-t1.j 2 8 1 1 0 0 5.0000 2.2361 TINYINT(1) UNSIGNED NOT NULL
-t1.empty_string 0 0 4 0 0.0000 NULL CHAR(0) NOT NULL
-t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL
-t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
+test.t1.i 1 7 1 1 0 0 4.0000 2.2361 TINYINT(1) UNSIGNED NOT NULL
+test.t1.j 2 8 1 1 0 0 5.0000 2.2361 TINYINT(1) UNSIGNED NOT NULL
+test.t1.empty_string 0 0 4 0 0.0000 NULL CHAR(0) NOT NULL
+test.t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL
+test.t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
create table t2 select * from t1 procedure analyse();
select * from t2;
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
-t1.i 1 7 1 1 0 0 4.0000 2.2361 ENUM('1','3','5','7') NOT NULL
-t1.j 2 8 1 1 0 0 5.0000 2.2361 ENUM('2','4','6','8') NOT NULL
-t1.empty_string 0 0 4 0 0.0000 NULL CHAR(0) NOT NULL
-t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL
-t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
+test.t1.i 1 7 1 1 0 0 4.0000 2.2361 ENUM('1','3','5','7') NOT NULL
+test.t1.j 2 8 1 1 0 0 5.0000 2.2361 ENUM('2','4','6','8') NOT NULL
+test.t1.empty_string 0 0 4 0 0.0000 NULL CHAR(0) NOT NULL
+test.t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL
+test.t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
+drop table t1,t2;
+EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE();
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> system NULL NULL NULL NULL 1
+2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
+create table t1 (a int not null);
+create table t2 select * from t1 where 0=1 procedure analyse();
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `Field_name` char(255) NOT NULL default '',
+ `Min_value` char(255) default NULL,
+ `Max_value` char(255) default NULL,
+ `Min_length` bigint(11) NOT NULL default '0',
+ `Max_length` bigint(11) NOT NULL default '0',
+ `Empties_or_zeros` bigint(11) NOT NULL default '0',
+ `Nulls` bigint(11) NOT NULL default '0',
+ `Avg_value_or_avg_length` char(255) NOT NULL default '',
+ `Std` char(255) default NULL,
+ `Optimal_fieldtype` char(64) NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1 where 0=1 procedure analyse();
+Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
+insert into t1 values(1);
+drop table t2;
+create table t2 select * from t1 where 0=1 procedure analyse();
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `Field_name` char(255) NOT NULL default '',
+ `Min_value` char(255) default NULL,
+ `Max_value` char(255) default NULL,
+ `Min_length` bigint(11) NOT NULL default '0',
+ `Max_length` bigint(11) NOT NULL default '0',
+ `Empties_or_zeros` bigint(11) NOT NULL default '0',
+ `Nulls` bigint(11) NOT NULL default '0',
+ `Avg_value_or_avg_length` char(255) NOT NULL default '',
+ `Std` char(255) default NULL,
+ `Optimal_fieldtype` char(64) NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t2;
+Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
+insert into t2 select * from t1 procedure analyse();
+select * from t2;
+Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
+test.t1.a 1 1 1 1 0 0 1.0000 0.0000 ENUM('1') NOT NULL
+insert into t1 values(2);
+drop table t2;
+create table t2 select * from t1 where 0=1 procedure analyse();
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `Field_name` char(255) NOT NULL default '',
+ `Min_value` char(255) default NULL,
+ `Max_value` char(255) default NULL,
+ `Min_length` bigint(11) NOT NULL default '0',
+ `Max_length` bigint(11) NOT NULL default '0',
+ `Empties_or_zeros` bigint(11) NOT NULL default '0',
+ `Nulls` bigint(11) NOT NULL default '0',
+ `Avg_value_or_avg_length` char(255) NOT NULL default '',
+ `Std` char(255) default NULL,
+ `Optimal_fieldtype` char(64) NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t2;
+Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
+insert into t2 select * from t1 procedure analyse();
+select * from t2;
+Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
+test.t1.a 1 2 1 1 0 0 1.5000 0.5000 ENUM('1','2') NOT NULL
drop table t1,t2;
diff --git a/mysql-test/r/ansi.result b/mysql-test/r/ansi.result
index f9f96310b73..0b86634f67b 100644
--- a/mysql-test/r/ansi.result
+++ b/mysql-test/r/ansi.result
@@ -1,4 +1,12 @@
drop table if exists t1;
+set sql_mode="MySQL40";
+select @@sql_mode;
+@@sql_mode
+NO_FIELD_OPTIONS,MYSQL40
+set @@sql_mode="ANSI";
+select @@sql_mode;
+@@sql_mode
+REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ONLY_FULL_GROUP_BY,ANSI
SELECT 'A' || 'B';
'A' || 'B'
AB
@@ -6,5 +14,6 @@ CREATE TABLE t1 (id INT, id2 int);
SELECT id,NULL,1,1.1,'a' FROM t1 GROUP BY id;
id NULL 1 1.1 a
SELECT id FROM t1 GROUP BY id2;
-'t1.id' isn't in GROUP BY
+ERROR 42000: 'test.t1.id' isn't in GROUP BY
drop table t1;
+SET @@SQL_MODE="";
diff --git a/mysql-test/r/archive.result b/mysql-test/r/archive.result
new file mode 100644
index 00000000000..4adb8a5410e
--- /dev/null
+++ b/mysql-test/r/archive.result
@@ -0,0 +1,2604 @@
+drop table if exists t1,t2;
+CREATE TABLE t1 (
+Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
+Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
+) ENGINE=archive;
+INSERT INTO t1 VALUES (9410,9412);
+select period from t1;
+period
+9410
+select * from t1;
+Period Varor_period
+9410 9412
+select t1.* from t1;
+Period Varor_period
+9410 9412
+CREATE TABLE t2 (
+auto int,
+fld1 int(6) unsigned zerofill DEFAULT '000000' NOT NULL,
+companynr tinyint(2) unsigned zerofill DEFAULT '00' NOT NULL,
+fld3 char(30) DEFAULT '' NOT NULL,
+fld4 char(35) DEFAULT '' NOT NULL,
+fld5 char(35) DEFAULT '' NOT NULL,
+fld6 char(4) DEFAULT '' NOT NULL
+) ENGINE=archive;
+select t2.fld3 from t2 where companynr = 58 and fld3 like "%imaginable%";
+fld3
+imaginable
+select fld3 from t2 where fld3 like "%cultivation" ;
+fld3
+cultivation
+select t2.fld3,companynr from t2 where companynr = 57+1 order by fld3;
+fld3 companynr
+concoct 58
+druggists 58
+engrossing 58
+Eurydice 58
+exclaimers 58
+ferociousness 58
+hopelessness 58
+Huey 58
+imaginable 58
+judges 58
+merging 58
+ostrich 58
+peering 58
+Phelps 58
+presumes 58
+Ruth 58
+sentences 58
+Shylock 58
+straggled 58
+synergy 58
+thanking 58
+tying 58
+unlocks 58
+select fld3,companynr from t2 where companynr = 58 order by fld3;
+fld3 companynr
+concoct 58
+druggists 58
+engrossing 58
+Eurydice 58
+exclaimers 58
+ferociousness 58
+hopelessness 58
+Huey 58
+imaginable 58
+judges 58
+merging 58
+ostrich 58
+peering 58
+Phelps 58
+presumes 58
+Ruth 58
+sentences 58
+Shylock 58
+straggled 58
+synergy 58
+thanking 58
+tying 58
+unlocks 58
+select fld3 from t2 order by fld3 desc limit 10;
+fld3
+youthfulness
+yelped
+Wotan
+workers
+Witt
+witchcraft
+Winsett
+Willy
+willed
+wildcats
+select fld3 from t2 order by fld3 desc limit 5;
+fld3
+youthfulness
+yelped
+Wotan
+workers
+Witt
+select fld3 from t2 order by fld3 desc limit 5,5;
+fld3
+witchcraft
+Winsett
+Willy
+willed
+wildcats
+select t2.fld3 from t2 where fld3 = 'honeysuckle';
+fld3
+honeysuckle
+select t2.fld3 from t2 where fld3 LIKE 'honeysuckl_';
+fld3
+honeysuckle
+select t2.fld3 from t2 where fld3 LIKE 'hon_ysuckl_';
+fld3
+honeysuckle
+select t2.fld3 from t2 where fld3 LIKE 'honeysuckle%';
+fld3
+honeysuckle
+select t2.fld3 from t2 where fld3 LIKE 'h%le';
+fld3
+honeysuckle
+select t2.fld3 from t2 where fld3 LIKE 'honeysuckle_';
+fld3
+select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%';
+fld3
+select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
+fld3
+honeysuckle
+honoring
+select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3;
+fld1 fld3
+148504 Colombo
+068305 Colombo
+000000 nondecreasing
+select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%';
+fld1 fld3
+012001 flanking
+013602 foldout
+013606 fingerings
+018007 fanatic
+018017 featherweight
+018054 fetters
+018103 flint
+018104 flopping
+036002 funereal
+038017 fetched
+038205 firearm
+058004 Fenton
+088303 feminine
+186002 freakish
+188007 flurried
+188505 fitting
+198006 furthermore
+202301 Fitzpatrick
+208101 fiftieth
+208113 freest
+218008 finishers
+218022 feed
+218401 faithful
+226205 foothill
+226209 furnishings
+228306 forthcoming
+228311 fated
+231315 freezes
+232102 forgivably
+238007 filial
+238008 fixedly
+select fld3 from t2 where fld3 like "L%" and fld3 = "ok";
+fld3
+select fld3 from t2 where (fld3 like "C%" and fld3 = "Chantilly");
+fld3
+Chantilly
+select fld1,fld3 from t2 where fld1 like "25050%";
+fld1 fld3
+250501 poisoning
+250502 Iraqis
+250503 heaving
+250504 population
+250505 bomb
+select fld1,fld3 from t2 where fld1 like "25050_";
+fld1 fld3
+250501 poisoning
+250502 Iraqis
+250503 heaving
+250504 population
+250505 bomb
+INSERT INTO t2 VALUES (1,000001,00,'Omaha','teethe','neat','');
+INSERT INTO t2 VALUES (2,011401,37,'breaking','dreaded','Steinberg','W');
+INSERT INTO t2 VALUES (3,011402,37,'Romans','scholastics','jarring','');
+INSERT INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily','');
+SELECT * FROM t2;
+auto fld1 companynr fld3 fld4 fld5 fld6
+1 000001 00 Omaha teethe neat
+2 011401 37 breaking dreaded Steinberg W
+3 011402 37 Romans scholastics jarring
+4 011403 37 intercepted audiology tinily
+5 011501 37 bewilderingly wallet balled
+6 011701 37 astound parters persist W
+7 011702 37 admonishing eschew attainments
+8 011703 37 sumac quitter fanatic
+9 012001 37 flanking neat measures FAS
+10 012003 37 combed Steinberg rightfulness
+11 012004 37 subjective jarring capably
+12 012005 37 scatterbrain tinily impulsive
+13 012301 37 Eulerian balled starlet
+14 012302 36 dubbed persist terminators
+15 012303 37 Kane attainments untying
+16 012304 37 overlay fanatic announces FAS
+17 012305 37 perturb measures featherweight FAS
+18 012306 37 goblins rightfulness pessimist FAS
+19 012501 37 annihilates capably daughter
+20 012602 37 Wotan impulsive decliner FAS
+21 012603 37 snatching starlet lawgiver
+22 012604 37 concludes terminators stated
+23 012605 37 laterally untying readable
+24 012606 37 yelped announces attrition
+25 012701 37 grazing featherweight cascade FAS
+26 012702 37 Baird pessimist motors FAS
+27 012703 37 celery daughter interrogate
+28 012704 37 misunderstander decliner pests W
+29 013601 37 handgun lawgiver stairway
+30 013602 37 foldout stated dopers FAS
+31 013603 37 mystic readable testicle W
+32 013604 37 succumbed attrition Parsifal W
+33 013605 37 Nabisco cascade leavings
+34 013606 37 fingerings motors postulation W
+35 013607 37 aging interrogate squeaking
+36 013608 37 afield pests contrasted
+37 013609 37 ammonium stairway leftover
+38 013610 37 boat dopers whiteners
+39 013801 37 intelligibility testicle erases W
+40 013802 37 Augustine Parsifal Punjab W
+41 013803 37 teethe leavings Merritt
+42 013804 37 dreaded postulation Quixotism
+43 013901 37 scholastics squeaking sweetish FAS
+44 016001 37 audiology contrasted dogging FAS
+45 016201 37 wallet leftover scornfully FAS
+46 016202 37 parters whiteners bellow
+47 016301 37 eschew erases bills
+48 016302 37 quitter Punjab cupboard FAS
+49 016303 37 neat Merritt sureties FAS
+50 016304 37 Steinberg Quixotism puddings
+51 018001 37 jarring sweetish tapestry
+52 018002 37 tinily dogging fetters
+53 018003 37 balled scornfully bivalves
+54 018004 37 persist bellow incurring
+55 018005 37 attainments bills Adolph
+56 018007 37 fanatic cupboard pithed
+57 018008 37 measures sureties emergency
+58 018009 37 rightfulness puddings Miles
+59 018010 37 capably tapestry trimmings
+60 018012 37 impulsive fetters tragedies W
+61 018013 37 starlet bivalves skulking W
+62 018014 37 terminators incurring flint
+63 018015 37 untying Adolph flopping W
+64 018016 37 announces pithed relaxing FAS
+65 018017 37 featherweight emergency offload FAS
+66 018018 37 pessimist Miles suites W
+67 018019 37 daughter trimmings lists FAS
+68 018020 37 decliner tragedies animized FAS
+69 018021 37 lawgiver skulking multilayer W
+70 018022 37 stated flint standardizes FAS
+71 018023 37 readable flopping Judas
+72 018024 37 attrition relaxing vacuuming W
+73 018025 37 cascade offload dentally W
+74 018026 37 motors suites humanness W
+75 018027 37 interrogate lists inch W
+76 018028 37 pests animized Weissmuller W
+77 018029 37 stairway multilayer irresponsibly W
+78 018030 37 dopers standardizes luckily FAS
+79 018032 37 testicle Judas culled W
+80 018033 37 Parsifal vacuuming medical FAS
+81 018034 37 leavings dentally bloodbath FAS
+82 018035 37 postulation humanness subschema W
+83 018036 37 squeaking inch animals W
+84 018037 37 contrasted Weissmuller Micronesia
+85 018038 37 leftover irresponsibly repetitions
+86 018039 37 whiteners luckily Antares
+87 018040 37 erases culled ventilate W
+88 018041 37 Punjab medical pityingly
+89 018042 37 Merritt bloodbath interdependent
+90 018043 37 Quixotism subschema Graves FAS
+91 018044 37 sweetish animals neonatal
+92 018045 37 dogging Micronesia scribbled FAS
+93 018046 37 scornfully repetitions chafe W
+94 018048 37 bellow Antares honoring
+95 018049 37 bills ventilate realtor
+96 018050 37 cupboard pityingly elite
+97 018051 37 sureties interdependent funereal
+98 018052 37 puddings Graves abrogating
+99 018053 50 tapestry neonatal sorters
+100 018054 37 fetters scribbled Conley
+101 018055 37 bivalves chafe lectured
+102 018056 37 incurring honoring Abraham
+103 018057 37 Adolph realtor Hawaii W
+104 018058 37 pithed elite cage
+105 018059 36 emergency funereal hushes
+106 018060 37 Miles abrogating Simla
+107 018061 37 trimmings sorters reporters
+108 018101 37 tragedies Conley Dutchman FAS
+109 018102 37 skulking lectured descendants FAS
+110 018103 37 flint Abraham groupings FAS
+111 018104 37 flopping Hawaii dissociate
+112 018201 37 relaxing cage coexist W
+113 018202 37 offload hushes Beebe
+114 018402 37 suites Simla Taoism
+115 018403 37 lists reporters Connally
+116 018404 37 animized Dutchman fetched FAS
+117 018405 37 multilayer descendants checkpoints FAS
+118 018406 37 standardizes groupings rusting
+119 018409 37 Judas dissociate galling
+120 018601 37 vacuuming coexist obliterates
+121 018602 37 dentally Beebe traitor
+122 018603 37 humanness Taoism resumes FAS
+123 018801 37 inch Connally analyzable FAS
+124 018802 37 Weissmuller fetched terminator FAS
+125 018803 37 irresponsibly checkpoints gritty FAS
+126 018804 37 luckily rusting firearm W
+127 018805 37 culled galling minima
+128 018806 37 medical obliterates Selfridge
+129 018807 37 bloodbath traitor disable
+130 018808 37 subschema resumes witchcraft W
+131 018809 37 animals analyzable betroth W
+132 018810 37 Micronesia terminator Manhattanize
+133 018811 37 repetitions gritty imprint
+134 018812 37 Antares firearm peeked
+135 019101 37 ventilate minima swelling
+136 019102 37 pityingly Selfridge interrelationships W
+137 019103 37 interdependent disable riser
+138 019201 37 Graves witchcraft Gandhian W
+139 030501 37 neonatal betroth peacock A
+140 030502 50 scribbled Manhattanize bee A
+141 030503 37 chafe imprint kanji
+142 030504 37 honoring peeked dental
+143 031901 37 realtor swelling scarf FAS
+144 036001 37 elite interrelationships chasm A
+145 036002 37 funereal riser insolence A
+146 036004 37 abrogating Gandhian syndicate
+147 036005 37 sorters peacock alike
+148 038001 37 Conley bee imperial A
+149 038002 37 lectured kanji convulsion A
+150 038003 37 Abraham dental railway A
+151 038004 37 Hawaii scarf validate A
+152 038005 37 cage chasm normalizes A
+153 038006 37 hushes insolence comprehensive
+154 038007 37 Simla syndicate chewing
+155 038008 37 reporters alike denizen
+156 038009 37 Dutchman imperial schemer
+157 038010 37 descendants convulsion chronicle
+158 038011 37 groupings railway Kline
+159 038012 37 dissociate validate Anatole
+160 038013 37 coexist normalizes partridges
+161 038014 37 Beebe comprehensive brunch
+162 038015 37 Taoism chewing recruited
+163 038016 37 Connally denizen dimensions W
+164 038017 37 fetched schemer Chicana W
+165 038018 37 checkpoints chronicle announced
+166 038101 37 rusting Kline praised FAS
+167 038102 37 galling Anatole employing
+168 038103 37 obliterates partridges linear
+169 038104 37 traitor brunch quagmire
+170 038201 37 resumes recruited western A
+171 038202 37 analyzable dimensions relishing
+172 038203 37 terminator Chicana serving A
+173 038204 37 gritty announced scheduling
+174 038205 37 firearm praised lore
+175 038206 37 minima employing eventful
+176 038208 37 Selfridge linear arteriole A
+177 042801 37 disable quagmire disentangle
+178 042802 37 witchcraft western cured A
+179 046101 37 betroth relishing Fenton W
+180 048001 37 Manhattanize serving avoidable A
+181 048002 37 imprint scheduling drains A
+182 048003 37 peeked lore detectably FAS
+183 048004 37 swelling eventful husky
+184 048005 37 interrelationships arteriole impelling
+185 048006 37 riser disentangle undoes
+186 048007 37 Gandhian cured evened
+187 048008 37 peacock Fenton squeezes
+188 048101 37 bee avoidable destroyer FAS
+189 048102 37 kanji drains rudeness
+190 048201 37 dental detectably beaner FAS
+191 048202 37 scarf husky boorish
+192 048203 37 chasm impelling Everhart
+193 048204 37 insolence undoes encompass A
+194 048205 37 syndicate evened mushrooms
+195 048301 37 alike squeezes Alison A
+196 048302 37 imperial destroyer externally FAS
+197 048303 37 convulsion rudeness pellagra
+198 048304 37 railway beaner cult
+199 048305 37 validate boorish creek A
+200 048401 37 normalizes Everhart Huffman
+201 048402 37 comprehensive encompass Majorca FAS
+202 048403 37 chewing mushrooms governing A
+203 048404 37 denizen Alison gadfly FAS
+204 048405 37 schemer externally reassigned FAS
+205 048406 37 chronicle pellagra intentness W
+206 048407 37 Kline cult craziness
+207 048408 37 Anatole creek psychic
+208 048409 37 partridges Huffman squabbled
+209 048410 37 brunch Majorca burlesque
+210 048411 37 recruited governing capped
+211 048412 37 dimensions gadfly extracted A
+212 048413 37 Chicana reassigned DiMaggio
+213 048601 37 announced intentness exclamation FAS
+214 048602 37 praised craziness subdirectory
+215 048603 37 employing psychic fangs
+216 048604 37 linear squabbled buyer A
+217 048801 37 quagmire burlesque pithing A
+218 050901 37 western capped transistorizing A
+219 051201 37 relishing extracted nonbiodegradable
+220 056002 37 serving DiMaggio dislocate
+221 056003 37 scheduling exclamation monochromatic FAS
+222 056004 37 lore subdirectory batting
+223 056102 37 eventful fangs postcondition A
+224 056203 37 arteriole buyer catalog FAS
+225 056204 37 disentangle pithing Remus
+226 058003 37 cured transistorizing devices A
+227 058004 37 Fenton nonbiodegradable bike A
+228 058005 37 avoidable dislocate qualify
+229 058006 37 drains monochromatic detained
+230 058007 37 detectably batting commended
+231 058101 37 husky postcondition civilize
+232 058102 37 impelling catalog Elmhurst
+233 058103 37 undoes Remus anesthetizing
+234 058105 37 evened devices deaf
+235 058111 37 squeezes bike Brigham
+236 058112 37 destroyer qualify title
+237 058113 37 rudeness detained coarse
+238 058114 37 beaner commended combinations
+239 058115 37 boorish civilize grayness
+240 058116 37 Everhart Elmhurst innumerable FAS
+241 058117 37 encompass anesthetizing Caroline A
+242 058118 37 mushrooms deaf fatty FAS
+243 058119 37 Alison Brigham eastbound
+244 058120 37 externally title inexperienced
+245 058121 37 pellagra coarse hoarder A
+246 058122 37 cult combinations scotch W
+247 058123 37 creek grayness passport A
+248 058124 37 Huffman innumerable strategic FAS
+249 058125 37 Majorca Caroline gated
+250 058126 37 governing fatty flog
+251 058127 37 gadfly eastbound Pipestone
+252 058128 37 reassigned inexperienced Dar
+253 058201 37 intentness hoarder Corcoran
+254 058202 37 craziness scotch flyers A
+255 058303 37 psychic passport competitions W
+256 058304 37 squabbled strategic suppliers FAS
+257 058602 37 burlesque gated skips
+258 058603 37 capped flog institutes
+259 058604 37 extracted Pipestone troop A
+260 058605 37 DiMaggio Dar connective W
+261 058606 37 exclamation Corcoran denies
+262 058607 37 subdirectory flyers polka
+263 060401 36 fangs competitions observations FAS
+264 061701 36 buyer suppliers askers
+265 066201 36 pithing skips homeless FAS
+266 066501 36 transistorizing institutes Anna
+267 068001 36 nonbiodegradable troop subdirectories W
+268 068002 36 dislocate connective decaying FAS
+269 068005 36 monochromatic denies outwitting W
+270 068006 36 batting polka Harpy W
+271 068007 36 postcondition observations crazed
+272 068008 36 catalog askers suffocate
+273 068009 36 Remus homeless provers FAS
+274 068010 36 devices Anna technically
+275 068011 36 bike subdirectories Franklinizations
+276 068202 36 qualify decaying considered
+277 068302 36 detained outwitting tinnily
+278 068303 36 commended Harpy uninterruptedly
+279 068401 36 civilize crazed whistled A
+280 068501 36 Elmhurst suffocate automate
+281 068502 36 anesthetizing provers gutting W
+282 068503 36 deaf technically surreptitious
+283 068602 36 Brigham Franklinizations Choctaw
+284 068603 36 title considered cooks
+285 068701 36 coarse tinnily millivolt FAS
+286 068702 36 combinations uninterruptedly counterpoise
+287 068703 36 grayness whistled Gothicism
+288 076001 36 innumerable automate feminine
+289 076002 36 Caroline gutting metaphysically W
+290 076101 36 fatty surreptitious sanding A
+291 076102 36 eastbound Choctaw contributorily
+292 076103 36 inexperienced cooks receivers FAS
+293 076302 36 hoarder millivolt adjourn
+294 076303 36 scotch counterpoise straggled A
+295 076304 36 passport Gothicism druggists
+296 076305 36 strategic feminine thanking FAS
+297 076306 36 gated metaphysically ostrich
+298 076307 36 flog sanding hopelessness FAS
+299 076402 36 Pipestone contributorily Eurydice
+300 076501 36 Dar receivers excitation W
+301 076502 36 Corcoran adjourn presumes FAS
+302 076701 36 flyers straggled imaginable FAS
+303 078001 36 competitions druggists concoct W
+304 078002 36 suppliers thanking peering W
+305 078003 36 skips ostrich Phelps FAS
+306 078004 36 institutes hopelessness ferociousness FAS
+307 078005 36 troop Eurydice sentences
+308 078006 36 connective excitation unlocks
+309 078007 36 denies presumes engrossing W
+310 078008 36 polka imaginable Ruth
+311 078101 36 observations concoct tying
+312 078103 36 askers peering exclaimers
+313 078104 36 homeless Phelps synergy
+314 078105 36 Anna ferociousness Huey W
+315 082101 36 subdirectories sentences merging
+316 083401 36 decaying unlocks judges A
+317 084001 36 outwitting engrossing Shylock W
+318 084002 36 Harpy Ruth Miltonism
+319 086001 36 crazed tying hen W
+320 086102 36 suffocate exclaimers honeybee FAS
+321 086201 36 provers synergy towers
+322 088001 36 technically Huey dilutes W
+323 088002 36 Franklinizations merging numerals FAS
+324 088003 36 considered judges democracy FAS
+325 088004 36 tinnily Shylock Ibero-
+326 088101 36 uninterruptedly Miltonism invalids
+327 088102 36 whistled hen behavior
+328 088103 36 automate honeybee accruing
+329 088104 36 gutting towers relics A
+330 088105 36 surreptitious dilutes rackets
+331 088106 36 Choctaw numerals Fischbein W
+332 088201 36 cooks democracy phony W
+333 088203 36 millivolt Ibero- cross FAS
+334 088204 36 counterpoise invalids cleanup
+335 088302 37 Gothicism behavior conspirator
+336 088303 37 feminine accruing label FAS
+337 088305 37 metaphysically relics university
+338 088402 37 sanding rackets cleansed FAS
+339 088501 36 contributorily Fischbein ballgown
+340 088502 36 receivers phony starlet
+341 088503 36 adjourn cross aqueous
+342 098001 58 straggled cleanup portrayal A
+343 098002 58 druggists conspirator despising W
+344 098003 58 thanking label distort W
+345 098004 58 ostrich university palmed
+346 098005 58 hopelessness cleansed faced
+347 098006 58 Eurydice ballgown silverware
+348 141903 29 excitation starlet assessor
+349 098008 58 presumes aqueous spiders
+350 098009 58 imaginable portrayal artificially
+351 098010 58 concoct despising reminiscence
+352 098011 58 peering distort Mexican
+353 098012 58 Phelps palmed obnoxious
+354 098013 58 ferociousness faced fragile
+355 098014 58 sentences silverware apprehensible
+356 098015 58 unlocks assessor births
+357 098016 58 engrossing spiders garages
+358 098017 58 Ruth artificially panty
+359 098018 58 tying reminiscence anteater
+360 098019 58 exclaimers Mexican displacement A
+361 098020 58 synergy obnoxious drovers A
+362 098021 58 Huey fragile patenting A
+363 098022 58 merging apprehensible far A
+364 098023 58 judges births shrieks
+365 098024 58 Shylock garages aligning W
+366 098025 37 Miltonism panty pragmatism
+367 106001 36 hen anteater fevers W
+368 108001 36 honeybee displacement reexamines A
+369 108002 36 towers drovers occupancies
+370 108003 36 dilutes patenting sweats FAS
+371 108004 36 numerals far modulators
+372 108005 36 democracy shrieks demand W
+373 108007 36 Ibero- aligning Madeira
+374 108008 36 invalids pragmatism Viennese W
+375 108009 36 behavior fevers chillier W
+376 108010 36 accruing reexamines wildcats FAS
+377 108011 36 relics occupancies gentle
+378 108012 36 rackets sweats Angles W
+379 108101 36 Fischbein modulators accuracies
+380 108102 36 phony demand toggle
+381 108103 36 cross Madeira Mendelssohn W
+382 108111 50 cleanup Viennese behaviorally
+383 108105 36 conspirator chillier Rochford
+384 108106 36 label wildcats mirror W
+385 108107 36 university gentle Modula
+386 108108 50 cleansed Angles clobbering
+387 108109 36 ballgown accuracies chronography
+388 108110 36 starlet toggle Eskimoizeds
+389 108201 36 aqueous Mendelssohn British W
+390 108202 36 portrayal behaviorally pitfalls
+391 108203 36 despising Rochford verify W
+392 108204 36 distort mirror scatter FAS
+393 108205 36 palmed Modula Aztecan
+394 108301 36 faced clobbering acuity W
+395 108302 36 silverware chronography sinking W
+396 112101 36 assessor Eskimoizeds beasts FAS
+397 112102 36 spiders British Witt W
+398 113701 36 artificially pitfalls physicists FAS
+399 116001 36 reminiscence verify folksong A
+400 116201 36 Mexican scatter strokes FAS
+401 116301 36 obnoxious Aztecan crowder
+402 116302 36 fragile acuity merry
+403 116601 36 apprehensible sinking cadenced
+404 116602 36 births beasts alimony A
+405 116603 36 garages Witt principled A
+406 116701 36 panty physicists golfing
+407 116702 36 anteater folksong undiscovered
+408 118001 36 displacement strokes irritates
+409 118002 36 drovers crowder patriots A
+410 118003 36 patenting merry rooms FAS
+411 118004 36 far cadenced towering W
+412 118005 36 shrieks alimony displease
+413 118006 36 aligning principled photosensitive
+414 118007 36 pragmatism golfing inking
+415 118008 36 fevers undiscovered gainers
+416 118101 36 reexamines irritates leaning A
+417 118102 36 occupancies patriots hydrant A
+418 118103 36 sweats rooms preserve
+419 118202 36 modulators towering blinded A
+420 118203 36 demand displease interactions A
+421 118204 36 Madeira photosensitive Barry
+422 118302 36 Viennese inking whiteness A
+423 118304 36 chillier gainers pastimes W
+424 118305 36 wildcats leaning Edenization
+425 118306 36 gentle hydrant Muscat
+426 118307 36 Angles preserve assassinated
+427 123101 36 accuracies blinded labeled
+428 123102 36 toggle interactions glacial A
+429 123301 36 Mendelssohn Barry implied W
+430 126001 36 behaviorally whiteness bibliographies W
+431 126002 36 Rochford pastimes Buchanan
+432 126003 36 mirror Edenization forgivably FAS
+433 126101 36 Modula Muscat innuendo A
+434 126301 36 clobbering assassinated den FAS
+435 126302 36 chronography labeled submarines W
+436 126402 36 Eskimoizeds glacial mouthful A
+437 126601 36 British implied expiring
+438 126602 36 pitfalls bibliographies unfulfilled FAS
+439 126702 36 verify Buchanan precession
+440 128001 36 scatter forgivably nullified
+441 128002 36 Aztecan innuendo affects
+442 128003 36 acuity den Cynthia
+443 128004 36 sinking submarines Chablis A
+444 128005 36 beasts mouthful betterments FAS
+445 128007 36 Witt expiring advertising
+446 128008 36 physicists unfulfilled rubies A
+447 128009 36 folksong precession southwest FAS
+448 128010 36 strokes nullified superstitious A
+449 128011 36 crowder affects tabernacle W
+450 128012 36 merry Cynthia silk A
+451 128013 36 cadenced Chablis handsomest A
+452 128014 36 alimony betterments Persian A
+453 128015 36 principled advertising analog W
+454 128016 36 golfing rubies complex W
+455 128017 36 undiscovered southwest Taoist
+456 128018 36 irritates superstitious suspend
+457 128019 36 patriots tabernacle relegated
+458 128020 36 rooms silk awesome W
+459 128021 36 towering handsomest Bruxelles
+460 128022 36 displease Persian imprecisely A
+461 128023 36 photosensitive analog televise
+462 128101 36 inking complex braking
+463 128102 36 gainers Taoist true FAS
+464 128103 36 leaning suspend disappointing FAS
+465 128104 36 hydrant relegated navally W
+466 128106 36 preserve awesome circus
+467 128107 36 blinded Bruxelles beetles
+468 128108 36 interactions imprecisely trumps
+469 128202 36 Barry televise fourscore W
+470 128203 36 whiteness braking Blackfoots
+471 128301 36 pastimes true Grady
+472 128302 36 Edenization disappointing quiets FAS
+473 128303 36 Muscat navally floundered FAS
+474 128304 36 assassinated circus profundity W
+475 128305 36 labeled beetles Garrisonian W
+476 128307 36 glacial trumps Strauss
+477 128401 36 implied fourscore cemented FAS
+478 128502 36 bibliographies Blackfoots contrition A
+479 128503 36 Buchanan Grady mutations
+480 128504 36 forgivably quiets exhibits W
+481 128505 36 innuendo floundered tits
+482 128601 36 den profundity mate A
+483 128603 36 submarines Garrisonian arches
+484 128604 36 mouthful Strauss Moll
+485 128702 36 expiring cemented ropers
+486 128703 36 unfulfilled contrition bombast
+487 128704 36 precession mutations difficultly A
+488 138001 36 nullified exhibits adsorption
+489 138002 36 affects tits definiteness FAS
+490 138003 36 Cynthia mate cultivation A
+491 138004 36 Chablis arches heals A
+492 138005 36 betterments Moll Heusen W
+493 138006 36 advertising ropers target FAS
+494 138007 36 rubies bombast cited A
+495 138008 36 southwest difficultly congresswoman W
+496 138009 36 superstitious adsorption Katherine
+497 138102 36 tabernacle definiteness titter A
+498 138103 36 silk cultivation aspire A
+499 138104 36 handsomest heals Mardis
+500 138105 36 Persian Heusen Nadia W
+501 138201 36 analog target estimating FAS
+502 138302 36 complex cited stuck A
+503 138303 36 Taoist congresswoman fifteenth A
+504 138304 36 suspend Katherine Colombo
+505 138401 29 relegated titter survey A
+506 140102 29 awesome aspire staffing
+507 140103 29 Bruxelles Mardis obtain
+508 140104 29 imprecisely Nadia loaded
+509 140105 29 televise estimating slaughtered
+510 140201 29 braking stuck lights A
+511 140701 29 true fifteenth circumference
+512 141501 29 disappointing Colombo dull A
+513 141502 29 navally survey weekly A
+514 141901 29 circus staffing wetness
+515 141902 29 beetles obtain visualized
+516 142101 29 trumps loaded Tannenbaum
+517 142102 29 fourscore slaughtered moribund
+518 142103 29 Blackfoots lights demultiplex
+519 142701 29 Grady circumference lockings
+520 143001 29 quiets dull thugs FAS
+521 143501 29 floundered weekly unnerves
+522 143502 29 profundity wetness abut
+523 148001 29 Garrisonian visualized Chippewa A
+524 148002 29 Strauss Tannenbaum stratifications A
+525 148003 29 cemented moribund signaled
+526 148004 29 contrition demultiplex Italianizes A
+527 148005 29 mutations lockings algorithmic A
+528 148006 29 exhibits thugs paranoid FAS
+529 148007 29 tits unnerves camping A
+530 148009 29 mate abut signifying A
+531 148010 29 arches Chippewa Patrice W
+532 148011 29 Moll stratifications search A
+533 148012 29 ropers signaled Angeles A
+534 148013 29 bombast Italianizes semblance
+535 148023 36 difficultly algorithmic taxed
+536 148015 29 adsorption paranoid Beatrice
+537 148016 29 definiteness camping retrace
+538 148017 29 cultivation signifying lockout
+539 148018 29 heals Patrice grammatic
+540 148019 29 Heusen search helmsman
+541 148020 29 target Angeles uniform W
+542 148021 29 cited semblance hamming
+543 148022 29 congresswoman taxed disobedience
+544 148101 29 Katherine Beatrice captivated A
+545 148102 29 titter retrace transferals A
+546 148201 29 aspire lockout cartographer A
+547 148401 29 Mardis grammatic aims FAS
+548 148402 29 Nadia helmsman Pakistani
+549 148501 29 estimating uniform burglarized FAS
+550 148502 29 stuck hamming saucepans A
+551 148503 29 fifteenth disobedience lacerating A
+552 148504 29 Colombo captivated corny
+553 148601 29 survey transferals megabytes FAS
+554 148602 29 staffing cartographer chancellor
+555 150701 29 obtain aims bulk A
+556 152101 29 loaded Pakistani commits A
+557 152102 29 slaughtered burglarized meson W
+558 155202 36 lights saucepans deputies
+559 155203 29 circumference lacerating northeaster A
+560 155204 29 dull corny dipole
+561 155205 29 weekly megabytes machining 0
+562 156001 29 wetness chancellor therefore
+563 156002 29 visualized bulk Telefunken
+564 156102 29 Tannenbaum commits salvaging
+565 156301 29 moribund meson Corinthianizes A
+566 156302 29 demultiplex deputies restlessly A
+567 156303 29 lockings northeaster bromides
+568 156304 29 thugs dipole generalized A
+569 156305 29 unnerves machining mishaps
+570 156306 29 abut therefore quelling
+571 156501 29 Chippewa Telefunken spiritual A
+572 158001 29 stratifications salvaging beguiles FAS
+573 158002 29 signaled Corinthianizes Trobriand FAS
+574 158101 29 Italianizes restlessly fleeing A
+575 158102 29 algorithmic bromides Armour A
+576 158103 29 paranoid generalized chin A
+577 158201 29 camping mishaps provers A
+578 158202 29 signifying quelling aeronautic A
+579 158203 29 Patrice spiritual voltage W
+580 158204 29 search beguiles sash
+581 158301 29 Angeles Trobriand anaerobic A
+582 158302 29 semblance fleeing simultaneous A
+583 158303 29 taxed Armour accumulating A
+584 158304 29 Beatrice chin Medusan A
+585 158305 29 retrace provers shouted A
+586 158306 29 lockout aeronautic freakish
+587 158501 29 grammatic voltage index FAS
+588 160301 29 helmsman sash commercially
+589 166101 50 uniform anaerobic mistiness A
+590 166102 50 hamming simultaneous endpoint
+591 168001 29 disobedience accumulating straight A
+592 168002 29 captivated Medusan flurried
+593 168003 29 transferals shouted denotative A
+594 168101 29 cartographer freakish coming FAS
+595 168102 29 aims index commencements FAS
+596 168103 29 Pakistani commercially gentleman
+597 168104 29 burglarized mistiness gifted
+598 168202 29 saucepans endpoint Shanghais
+599 168301 29 lacerating straight sportswriting A
+600 168502 29 corny flurried sloping A
+601 168503 29 megabytes denotative navies
+602 168601 29 chancellor coming leaflet A
+603 173001 40 bulk commencements shooter
+604 173701 40 commits gentleman Joplin FAS
+605 173702 40 meson gifted babies
+606 176001 40 deputies Shanghais subdivision FAS
+607 176101 40 northeaster sportswriting burstiness W
+608 176201 40 dipole sloping belted FAS
+609 176401 40 machining navies assails FAS
+610 176501 40 therefore leaflet admiring W
+611 176601 40 Telefunken shooter swaying 0
+612 176602 40 salvaging Joplin Goldstine FAS
+613 176603 40 Corinthianizes babies fitting
+614 178001 40 restlessly subdivision Norwalk W
+615 178002 40 bromides burstiness weakening W
+616 178003 40 generalized belted analogy FAS
+617 178004 40 mishaps assails deludes
+618 178005 40 quelling admiring cokes
+619 178006 40 spiritual swaying Clayton
+620 178007 40 beguiles Goldstine exhausts
+621 178008 40 Trobriand fitting causality
+622 178101 40 fleeing Norwalk sating FAS
+623 178102 40 Armour weakening icon
+624 178103 40 chin analogy throttles
+625 178201 40 provers deludes communicants FAS
+626 178202 40 aeronautic cokes dehydrate FAS
+627 178301 40 voltage Clayton priceless FAS
+628 178302 40 sash exhausts publicly
+629 178401 40 anaerobic causality incidentals FAS
+630 178402 40 simultaneous sating commonplace
+631 178403 40 accumulating icon mumbles
+632 178404 40 Medusan throttles furthermore W
+633 178501 40 shouted communicants cautioned W
+634 186002 37 freakish dehydrate parametrized A
+635 186102 37 index priceless registration A
+636 186201 40 commercially publicly sadly FAS
+637 186202 40 mistiness incidentals positioning
+638 186203 40 endpoint commonplace babysitting
+639 186302 37 straight mumbles eternal A
+640 188007 37 flurried furthermore hoarder
+641 188008 37 denotative cautioned congregates
+642 188009 37 coming parametrized rains
+643 188010 37 commencements registration workers W
+644 188011 37 gentleman sadly sags A
+645 188012 37 gifted positioning unplug W
+646 188013 37 Shanghais babysitting garage A
+647 188014 37 sportswriting eternal boulder A
+648 188015 37 sloping hoarder hollowly A
+649 188016 37 navies congregates specifics
+650 188017 37 leaflet rains Teresa
+651 188102 37 shooter workers Winsett
+652 188103 37 Joplin sags convenient A
+653 188202 37 babies unplug buckboards FAS
+654 188301 40 subdivision garage amenities
+655 188302 40 burstiness boulder resplendent FAS
+656 188303 40 belted hollowly priding FAS
+657 188401 37 assails specifics configurations
+658 188402 37 admiring Teresa untidiness A
+659 188503 37 swaying Winsett Brice W
+660 188504 37 Goldstine convenient sews FAS
+661 188505 37 fitting buckboards participated
+662 190701 37 Norwalk amenities Simon FAS
+663 190703 50 weakening resplendent certificates
+664 191701 37 analogy priding Fitzpatrick
+665 191702 37 deludes configurations Evanston A
+666 191703 37 cokes untidiness misted
+667 196001 37 Clayton Brice textures A
+668 196002 37 exhausts sews save
+669 196003 37 causality participated count
+670 196101 37 sating Simon rightful A
+671 196103 37 icon certificates chaperone
+672 196104 37 throttles Fitzpatrick Lizzy A
+673 196201 37 communicants Evanston clenched A
+674 196202 37 dehydrate misted effortlessly
+675 196203 37 priceless textures accessed
+676 198001 37 publicly save beaters A
+677 198003 37 incidentals count Hornblower FAS
+678 198004 37 commonplace rightful vests A
+679 198005 37 mumbles chaperone indulgences FAS
+680 198006 37 furthermore Lizzy infallibly A
+681 198007 37 cautioned clenched unwilling FAS
+682 198008 37 parametrized effortlessly excrete FAS
+683 198009 37 registration accessed spools A
+684 198010 37 sadly beaters crunches FAS
+685 198011 37 positioning Hornblower overestimating FAS
+686 198012 37 babysitting vests ineffective
+687 198013 37 eternal indulgences humiliation A
+688 198014 37 hoarder infallibly sophomore
+689 198015 37 congregates unwilling star
+690 198017 37 rains excrete rifles
+691 198018 37 workers spools dialysis
+692 198019 37 sags crunches arriving
+693 198020 37 unplug overestimating indulge
+694 198021 37 garage ineffective clockers
+695 198022 37 boulder humiliation languages
+696 198023 50 hollowly sophomore Antarctica A
+697 198024 37 specifics star percentage
+698 198101 37 Teresa rifles ceiling A
+699 198103 37 Winsett dialysis specification
+700 198105 37 convenient arriving regimented A
+701 198106 37 buckboards indulge ciphers
+702 198201 37 amenities clockers pictures A
+703 198204 37 resplendent languages serpents A
+704 198301 53 priding Antarctica allot A
+705 198302 53 configurations percentage realized A
+706 198303 53 untidiness ceiling mayoral A
+707 198304 53 Brice specification opaquely A
+708 198401 37 sews regimented hostess FAS
+709 198402 37 participated ciphers fiftieth
+710 198403 37 Simon pictures incorrectly
+711 202101 37 certificates serpents decomposition FAS
+712 202301 37 Fitzpatrick allot stranglings
+713 202302 37 Evanston realized mixture FAS
+714 202303 37 misted mayoral electroencephalography FAS
+715 202304 37 textures opaquely similarities FAS
+716 202305 37 save hostess charges W
+717 202601 37 count fiftieth freest FAS
+718 202602 37 rightful incorrectly Greenberg FAS
+719 202605 37 chaperone decomposition tinting
+720 202606 37 Lizzy stranglings expelled W
+721 202607 37 clenched mixture warm
+722 202901 37 effortlessly electroencephalography smoothed
+723 202902 37 accessed similarities deductions FAS
+724 202903 37 beaters charges Romano W
+725 202904 37 Hornblower freest bitterroot
+726 202907 37 vests Greenberg corset
+727 202908 37 indulgences tinting securing
+728 203101 37 infallibly expelled environing FAS
+729 203103 37 unwilling warm cute
+730 203104 37 excrete smoothed Crays
+731 203105 37 spools deductions heiress FAS
+732 203401 37 crunches Romano inform FAS
+733 203402 37 overestimating bitterroot avenge
+734 203404 37 ineffective corset universals
+735 203901 37 humiliation securing Kinsey W
+736 203902 37 sophomore environing ravines FAS
+737 203903 37 star cute bestseller
+738 203906 37 rifles Crays equilibrium
+739 203907 37 dialysis heiress extents 0
+740 203908 37 arriving inform relatively
+741 203909 37 indulge avenge pressure FAS
+742 206101 37 clockers universals critiques FAS
+743 206201 37 languages Kinsey befouled
+744 206202 37 Antarctica ravines rightfully FAS
+745 206203 37 percentage bestseller mechanizing FAS
+746 206206 37 ceiling equilibrium Latinizes
+747 206207 37 specification extents timesharing
+748 206208 37 regimented relatively Aden
+749 208001 37 ciphers pressure embassies
+750 208002 37 pictures critiques males FAS
+751 208003 37 serpents befouled shapelessly FAS
+752 208004 37 allot rightfully genres FAS
+753 208008 37 realized mechanizing mastering
+754 208009 37 mayoral Latinizes Newtonian
+755 208010 37 opaquely timesharing finishers FAS
+756 208011 37 hostess Aden abates
+757 208101 37 fiftieth embassies teem
+758 208102 37 incorrectly males kiting FAS
+759 208103 37 decomposition shapelessly stodgy FAS
+760 208104 37 stranglings genres scalps FAS
+761 208105 37 mixture mastering feed FAS
+762 208110 37 electroencephalography Newtonian guitars
+763 208111 37 similarities finishers airships
+764 208112 37 charges abates store
+765 208113 37 freest teem denounces
+766 208201 37 Greenberg kiting Pyle FAS
+767 208203 37 tinting stodgy Saxony
+768 208301 37 expelled scalps serializations FAS
+769 208302 37 warm feed Peruvian FAS
+770 208305 37 smoothed guitars taxonomically FAS
+771 208401 37 deductions airships kingdom A
+772 208402 37 Romano store stint A
+773 208403 37 bitterroot denounces Sault A
+774 208404 37 corset Pyle faithful
+775 208501 37 securing Saxony Ganymede FAS
+776 208502 37 environing serializations tidiness FAS
+777 208503 37 cute Peruvian gainful FAS
+778 208504 37 Crays taxonomically contrary FAS
+779 208505 37 heiress kingdom Tipperary FAS
+780 210101 37 inform stint tropics W
+781 210102 37 avenge Sault theorizers
+782 210103 37 universals faithful renew 0
+783 210104 37 Kinsey Ganymede already
+784 210105 37 ravines tidiness terminal
+785 210106 37 bestseller gainful Hegelian
+786 210107 37 equilibrium contrary hypothesizer
+787 210401 37 extents Tipperary warningly FAS
+788 213201 37 relatively tropics journalizing FAS
+789 213203 37 pressure theorizers nested
+790 213204 37 critiques renew Lars
+791 213205 37 befouled already saplings
+792 213206 37 rightfully terminal foothill
+793 213207 37 mechanizing Hegelian labeled
+794 216101 37 Latinizes hypothesizer imperiously FAS
+795 216103 37 timesharing warningly reporters FAS
+796 218001 37 Aden journalizing furnishings FAS
+797 218002 37 embassies nested precipitable FAS
+798 218003 37 males Lars discounts FAS
+799 218004 37 shapelessly saplings excises FAS
+800 143503 50 genres foothill Stalin
+801 218006 37 mastering labeled despot FAS
+802 218007 37 Newtonian imperiously ripeness FAS
+803 218008 37 finishers reporters Arabia
+804 218009 37 abates furnishings unruly
+805 218010 37 teem precipitable mournfulness
+806 218011 37 kiting discounts boom FAS
+807 218020 37 stodgy excises slaughter A
+808 218021 50 scalps Stalin Sabine
+809 218022 37 feed despot handy FAS
+810 218023 37 guitars ripeness rural
+811 218024 37 airships Arabia organizer
+812 218101 37 store unruly shipyard FAS
+813 218102 37 denounces mournfulness civics FAS
+814 218103 37 Pyle boom inaccuracy FAS
+815 218201 37 Saxony slaughter rules FAS
+816 218202 37 serializations Sabine juveniles FAS
+817 218203 37 Peruvian handy comprised W
+818 218204 37 taxonomically rural investigations
+819 218205 37 kingdom organizer stabilizes A
+820 218301 37 stint shipyard seminaries FAS
+821 218302 37 Sault civics Hunter A
+822 218401 37 faithful inaccuracy sporty FAS
+823 218402 37 Ganymede rules test FAS
+824 218403 37 tidiness juveniles weasels
+825 218404 37 gainful comprised CERN
+826 218407 37 contrary investigations tempering
+827 218408 37 Tipperary stabilizes afore FAS
+828 218409 37 tropics seminaries Galatean
+829 218410 37 theorizers Hunter techniques W
+830 226001 37 renew sporty error
+831 226002 37 already test veranda
+832 226003 37 terminal weasels severely
+833 226004 37 Hegelian CERN Cassites FAS
+834 226005 37 hypothesizer tempering forthcoming
+835 226006 37 warningly afore guides
+836 226007 37 journalizing Galatean vanish FAS
+837 226008 37 nested techniques lied A
+838 226203 37 Lars error sawtooth FAS
+839 226204 37 saplings veranda fated FAS
+840 226205 37 foothill severely gradually
+841 226206 37 labeled Cassites widens
+842 226207 37 imperiously forthcoming preclude
+843 226208 37 reporters guides Jobrel
+844 226209 37 furnishings vanish hooker
+845 226210 37 precipitable lied rainstorm
+846 226211 37 discounts sawtooth disconnects
+847 228001 37 excises fated cruelty
+848 228004 37 Stalin gradually exponentials A
+849 228005 37 despot widens affective A
+850 228006 37 ripeness preclude arteries
+851 228007 37 Arabia Jobrel Crosby FAS
+852 228008 37 unruly hooker acquaint
+853 228009 37 mournfulness rainstorm evenhandedly
+854 228101 37 boom disconnects percentage
+855 228108 37 slaughter cruelty disobedience
+856 228109 37 Sabine exponentials humility
+857 228110 37 handy affective gleaning A
+858 228111 37 rural arteries petted A
+859 228112 37 organizer Crosby bloater A
+860 228113 37 shipyard acquaint minion A
+861 228114 37 civics evenhandedly marginal A
+862 228115 37 inaccuracy percentage apiary A
+863 228116 37 rules disobedience measures
+864 228117 37 juveniles humility precaution
+865 228118 37 comprised gleaning repelled
+866 228119 37 investigations petted primary FAS
+867 228120 37 stabilizes bloater coverings
+868 228121 37 seminaries minion Artemia A
+869 228122 37 Hunter marginal navigate
+870 228201 37 sporty apiary spatial
+871 228206 37 test measures Gurkha
+872 228207 37 weasels precaution meanwhile A
+873 228208 37 CERN repelled Melinda A
+874 228209 37 tempering primary Butterfield
+875 228210 37 afore coverings Aldrich A
+876 228211 37 Galatean Artemia previewing A
+877 228212 37 techniques navigate glut A
+878 228213 37 error spatial unaffected
+879 228214 37 veranda Gurkha inmate
+880 228301 37 severely meanwhile mineral
+881 228305 37 Cassites Melinda impending A
+882 228306 37 forthcoming Butterfield meditation A
+883 228307 37 guides Aldrich ideas
+884 228308 37 vanish previewing miniaturizes W
+885 228309 37 lied glut lewdly
+886 228310 37 sawtooth unaffected title
+887 228311 37 fated inmate youthfulness
+888 228312 37 gradually mineral creak FAS
+889 228313 37 widens impending Chippewa
+890 228314 37 preclude meditation clamored
+891 228401 65 Jobrel ideas freezes
+892 228402 65 hooker miniaturizes forgivably FAS
+893 228403 65 rainstorm lewdly reduce FAS
+894 228404 65 disconnects title McGovern W
+895 228405 65 cruelty youthfulness Nazis W
+896 228406 65 exponentials creak epistle W
+897 228407 65 affective Chippewa socializes W
+898 228408 65 arteries clamored conceptions
+899 228409 65 Crosby freezes Kevin
+900 228410 65 acquaint forgivably uncovering
+901 230301 37 evenhandedly reduce chews FAS
+902 230302 37 percentage McGovern appendixes FAS
+903 230303 37 disobedience Nazis raining
+904 018062 37 humility epistle infest
+905 230501 37 gleaning socializes compartment
+906 230502 37 petted conceptions minting
+907 230503 37 bloater Kevin ducks
+908 230504 37 minion uncovering roped A
+909 230505 37 marginal chews waltz
+910 230506 37 apiary appendixes Lillian
+911 230507 37 measures raining repressions A
+912 230508 37 precaution infest chillingly
+913 230509 37 repelled compartment noncritical
+914 230901 37 primary minting lithograph
+915 230902 37 coverings ducks spongers
+916 230903 37 Artemia roped parenthood
+917 230904 37 navigate waltz posed
+918 230905 37 spatial Lillian instruments
+919 230906 37 Gurkha repressions filial
+920 230907 37 meanwhile chillingly fixedly
+921 230908 37 Melinda noncritical relives
+922 230909 37 Butterfield lithograph Pandora
+923 230910 37 Aldrich spongers watering A
+924 230911 37 previewing parenthood ungrateful
+925 230912 37 glut posed secures
+926 230913 37 unaffected instruments chastisers
+927 230914 37 inmate filial icon
+928 231304 37 mineral fixedly reuniting A
+929 231305 37 impending relives imagining A
+930 231306 37 meditation Pandora abiding A
+931 231307 37 ideas watering omnisciently
+932 231308 37 miniaturizes ungrateful Britannic
+933 231309 37 lewdly secures scholastics A
+934 231310 37 title chastisers mechanics A
+935 231311 37 youthfulness icon humidly A
+936 231312 37 creak reuniting masterpiece
+937 231313 37 Chippewa imagining however
+938 231314 37 clamored abiding Mendelian
+939 231315 37 freezes omnisciently jarred
+940 232102 37 forgivably Britannic scolds
+941 232103 37 reduce scholastics infatuate
+942 232104 37 McGovern mechanics willed A
+943 232105 37 Nazis humidly joyfully
+944 232106 37 epistle masterpiece Microsoft
+945 232107 37 socializes however fibrosities
+946 232108 37 conceptions Mendelian Baltimorean
+947 232601 37 Kevin jarred equestrian
+948 232602 37 uncovering scolds Goodrich
+949 232603 37 chews infatuate apish A
+950 232605 37 appendixes willed Adlerian
+5950 1232605 37 appendixes willed Adlerian
+5951 1232606 37 appendixes willed Adlerian
+5952 1232607 37 appendixes willed Adlerian
+5953 1232608 37 appendixes willed Adlerian
+5954 1232609 37 appendixes willed Adlerian
+951 232606 37 raining joyfully Tropez
+952 232607 37 infest Microsoft nouns
+953 232608 37 compartment fibrosities distracting
+954 232609 37 minting Baltimorean mutton
+955 236104 37 ducks equestrian bridgeable A
+956 236105 37 roped Goodrich stickers A
+957 236106 37 waltz apish transcontinental A
+958 236107 37 Lillian Adlerian amateurish
+959 236108 37 repressions Tropez Gandhian
+960 236109 37 chillingly nouns stratified
+961 236110 37 noncritical distracting chamberlains
+962 236111 37 lithograph mutton creditably
+963 236112 37 spongers bridgeable philosophic
+964 236113 37 parenthood stickers ores
+965 238005 37 posed transcontinental Carleton
+966 238006 37 instruments amateurish tape A
+967 238007 37 filial Gandhian afloat A
+968 238008 37 fixedly stratified goodness A
+969 238009 37 relives chamberlains welcoming
+970 238010 37 Pandora creditably Pinsky FAS
+971 238011 37 watering philosophic halting
+972 238012 37 ungrateful ores bibliography
+973 238013 37 secures Carleton decoding
+974 240401 41 chastisers tape variance A
+975 240402 41 icon afloat allowed A
+976 240901 41 reuniting goodness dire A
+977 240902 41 imagining welcoming dub A
+978 241801 41 abiding Pinsky poisoning
+979 242101 41 omnisciently halting Iraqis A
+980 242102 41 Britannic bibliography heaving
+981 242201 41 scholastics decoding population A
+982 242202 41 mechanics variance bomb A
+983 242501 41 humidly allowed Majorca A
+984 242502 41 masterpiece dire Gershwins
+985 246201 41 however dub explorers
+986 246202 41 Mendelian poisoning libretto A
+987 246203 41 jarred Iraqis occurred
+988 246204 41 scolds heaving Lagos
+989 246205 41 infatuate population rats
+990 246301 41 willed bomb bankruptcies A
+991 246302 41 joyfully Majorca crying
+992 248001 41 Microsoft Gershwins unexpected
+993 248002 41 fibrosities explorers accessed A
+994 248003 41 Baltimorean libretto colorful A
+995 248004 41 equestrian occurred versatility A
+996 248005 41 Goodrich Lagos cosy
+997 248006 41 apish rats Darius A
+998 248007 41 Adlerian bankruptcies mastering A
+999 248008 41 Tropez crying Asiaticizations A
+1000 248009 41 nouns unexpected offerers A
+1001 248010 41 distracting accessed uncles A
+1002 248011 41 mutton colorful sleepwalk
+1003 248012 41 bridgeable versatility Ernestine
+1004 248013 41 stickers cosy checksumming
+1005 248014 41 transcontinental Darius stopped
+1006 248015 41 amateurish mastering sicker
+1007 248016 41 Gandhian Asiaticizations Italianization
+1008 248017 41 stratified offerers alphabetic
+1009 248018 41 chamberlains uncles pharmaceutic
+1010 248019 41 creditably sleepwalk creator
+1011 248020 41 philosophic Ernestine chess
+1012 248021 41 ores checksumming charcoal
+1013 248101 41 Carleton stopped Epiphany A
+1014 248102 41 tape sicker bulldozes A
+1015 248201 41 afloat Italianization Pygmalion A
+1016 248202 41 goodness alphabetic caressing A
+1017 248203 41 welcoming pharmaceutic Palestine A
+1018 248204 41 Pinsky creator regimented A
+1019 248205 41 halting chess scars A
+1020 248206 41 bibliography charcoal realest A
+1021 248207 41 decoding Epiphany diffusing A
+1022 248208 41 variance bulldozes clubroom A
+1023 248209 41 allowed Pygmalion Blythe A
+1024 248210 41 dire caressing ahead
+1025 248211 50 dub Palestine reviver
+1026 250501 34 poisoning regimented retransmitting A
+1027 250502 34 Iraqis scars landslide
+1028 250503 34 heaving realest Eiffel
+1029 250504 34 population diffusing absentee
+1030 250505 34 bomb clubroom aye
+1031 250601 34 Majorca Blythe forked A
+1032 250602 34 Gershwins ahead Peruvianizes
+1033 250603 34 explorers reviver clerked
+1034 250604 34 libretto retransmitting tutor
+1035 250605 34 occurred landslide boulevard
+1036 251001 34 Lagos Eiffel shuttered
+1037 251002 34 rats absentee quotes A
+1038 251003 34 bankruptcies aye Caltech
+1039 251004 34 crying forked Mossberg
+1040 251005 34 unexpected Peruvianizes kept
+1041 251301 34 accessed clerked roundly
+1042 251302 34 colorful tutor features A
+1043 251303 34 versatility boulevard imaginable A
+1044 251304 34 cosy shuttered controller
+1045 251305 34 Darius quotes racial
+1046 251401 34 mastering Caltech uprisings A
+1047 251402 34 Asiaticizations Mossberg narrowed A
+1048 251403 34 offerers kept cannot A
+1049 251404 34 uncles roundly vest
+1050 251405 34 sleepwalk features famine
+1051 251406 34 Ernestine imaginable sugars
+1052 251801 34 checksumming controller exterminated A
+1053 251802 34 stopped racial belays
+1054 252101 34 sicker uprisings Hodges A
+1055 252102 34 Italianization narrowed translatable
+1056 252301 34 alphabetic cannot duality A
+1057 252302 34 pharmaceutic vest recording A
+1058 252303 34 creator famine rouses A
+1059 252304 34 chess sugars poison
+1060 252305 34 charcoal exterminated attitude
+1061 252306 34 Epiphany belays dusted
+1062 252307 34 bulldozes Hodges encompasses
+1063 252308 34 Pygmalion translatable presentation
+1064 252309 34 caressing duality Kantian
+1065 256001 34 Palestine recording imprecision A
+1066 256002 34 regimented rouses saving
+1067 256003 34 scars poison maternal
+1068 256004 34 realest attitude hewed
+1069 256005 34 diffusing dusted kerosene
+1070 258001 34 clubroom encompasses Cubans
+1071 258002 34 Blythe presentation photographers
+1072 258003 34 ahead Kantian nymph A
+1073 258004 34 reviver imprecision bedlam A
+1074 258005 34 retransmitting saving north A
+1075 258006 34 landslide maternal Schoenberg A
+1076 258007 34 Eiffel hewed botany A
+1077 258008 34 absentee kerosene curs
+1078 258009 34 aye Cubans solidification
+1079 258010 34 forked photographers inheritresses
+1080 258011 34 Peruvianizes nymph stiller
+1081 258101 68 clerked bedlam t1 A
+1082 258102 68 tutor north suite A
+1083 258103 34 boulevard Schoenberg ransomer
+1084 258104 68 shuttered botany Willy
+1085 258105 68 quotes curs Rena A
+1086 258106 68 Caltech solidification Seattle A
+1087 258107 68 Mossberg inheritresses relaxes A
+1088 258108 68 kept stiller exclaim
+1089 258109 68 roundly t1 implicated A
+1090 258110 68 features suite distinguish
+1091 258111 68 imaginable ransomer assayed
+1092 258112 68 controller Willy homeowner
+1093 258113 68 racial Rena and
+1094 258201 34 uprisings Seattle stealth
+1095 258202 34 narrowed relaxes coinciding A
+1096 258203 34 cannot exclaim founder A
+1097 258204 34 vest implicated environing
+1098 258205 34 famine distinguish jewelry
+1099 258301 34 sugars assayed lemons A
+1100 258401 34 exterminated homeowner brokenness A
+1101 258402 34 belays and bedpost A
+1102 258403 34 Hodges stealth assurers A
+1103 258404 34 translatable coinciding annoyers
+1104 258405 34 duality founder affixed
+1105 258406 34 recording environing warbling
+1106 258407 34 rouses jewelry seriously
+1107 228123 37 poison lemons boasted
+1108 250606 34 attitude brokenness Chantilly
+1109 208405 37 dusted bedpost Iranizes
+1110 212101 37 encompasses assurers violinist
+1111 218206 37 presentation annoyers extramarital
+1112 150401 37 Kantian affixed spates
+1113 248212 41 imprecision warbling cloakroom
+1114 128026 00 saving seriously gazer
+1115 128024 00 maternal boasted hand
+1116 128027 00 hewed Chantilly tucked
+1117 128025 00 kerosene Iranizes gems
+1118 128109 00 Cubans violinist clinker
+1119 128705 00 photographers extramarital refiner
+1120 126303 00 nymph spates callus
+1121 128308 00 bedlam cloakroom leopards
+1122 128204 00 north gazer comfortingly
+1123 128205 00 Schoenberg hand generically
+1124 128206 00 botany tucked getters
+1125 128207 00 curs gems sexually
+1126 118205 00 solidification clinker spear
+1127 116801 00 inheritresses refiner serums
+1128 116803 00 stiller callus Italianization
+1129 116804 00 t1 leopards attendants
+1130 116802 00 suite comfortingly spies
+1131 128605 00 ransomer generically Anthony
+1132 118308 00 Willy getters planar
+1133 113702 00 Rena sexually cupped
+1134 113703 00 Seattle spear cleanser
+1135 112103 00 relaxes serums commuters
+1136 118009 00 exclaim Italianization honeysuckle
+5136 1118009 00 exclaim Italianization honeysuckle
+1137 138011 00 implicated attendants orphanage
+1138 138010 00 distinguish spies skies
+1139 138012 00 assayed Anthony crushers
+1140 068304 00 homeowner planar Puritan
+1141 078009 00 and cupped squeezer
+1142 108013 00 stealth cleanser bruises
+1143 084004 00 coinciding commuters bonfire
+1144 083402 00 founder honeysuckle Colombo
+1145 084003 00 environing orphanage nondecreasing
+1146 088504 00 jewelry skies innocents
+1147 088005 00 lemons crushers masked
+1148 088007 00 brokenness Puritan file
+1149 088006 00 bedpost squeezer brush
+1150 148025 00 assurers bruises mutilate
+1151 148024 00 annoyers bonfire mommy
+1152 138305 00 affixed Colombo bulkheads
+1153 138306 00 warbling nondecreasing undeclared
+1154 152701 00 seriously innocents displacements
+1155 148505 00 boasted masked nieces
+1156 158003 00 Chantilly file coeducation
+1157 156201 00 Iranizes brush brassy
+1158 156202 00 violinist mutilate authenticator
+1159 158307 00 extramarital mommy Washoe
+1160 158402 00 spates bulkheads penny
+1161 158401 00 cloakroom undeclared Flagler
+1162 068013 00 gazer displacements stoned
+1163 068012 00 hand nieces cranes
+1164 068203 00 tucked coeducation masterful
+1165 088205 00 gems brassy biracial
+1166 068704 00 clinker authenticator steamships
+1167 068604 00 refiner Washoe windmills
+1168 158502 00 callus penny exploit
+1169 123103 00 leopards Flagler riverfront
+1170 148026 00 comfortingly stoned sisterly
+1171 123302 00 generically cranes sharpshoot
+1172 076503 00 getters masterful mittens
+1173 126304 00 sexually biracial interdependency
+1174 068306 00 spear steamships policy
+1175 143504 00 serums windmills unleashing
+1176 160201 00 Italianization exploit pretenders
+1177 148028 00 attendants riverfront overstatements
+1178 148027 00 spies sisterly birthed
+1179 143505 00 Anthony sharpshoot opportunism
+1180 108014 00 planar mittens showroom
+1181 076104 00 cupped interdependency compromisingly
+1182 078106 00 cleanser policy Medicare
+1183 126102 00 commuters unleashing corresponds
+1184 128029 00 honeysuckle pretenders hardware
+1185 128028 00 orphanage overstatements implant
+1186 018410 00 skies birthed Alicia
+1187 128110 00 crushers opportunism requesting
+1188 148506 00 Puritan showroom produced
+1189 123303 00 squeezer compromisingly criticizes
+1190 123304 00 bruises Medicare backer
+1191 068504 00 bonfire corresponds positively
+1192 068305 00 Colombo hardware colicky
+1193 000000 00 nondecreasing implant thrillingly
+1 000001 00 Omaha teethe neat
+2 011401 37 breaking dreaded Steinberg W
+3 011402 37 Romans scholastics jarring
+4 011403 37 intercepted audiology tinily
+OPTIMIZE TABLE t2;
+Table Op Msg_type Msg_text
+test.t2 optimize status OK
+SELECT * FROM t2;
+auto fld1 companynr fld3 fld4 fld5 fld6
+1 000001 00 Omaha teethe neat
+2 011401 37 breaking dreaded Steinberg W
+3 011402 37 Romans scholastics jarring
+4 011403 37 intercepted audiology tinily
+5 011501 37 bewilderingly wallet balled
+6 011701 37 astound parters persist W
+7 011702 37 admonishing eschew attainments
+8 011703 37 sumac quitter fanatic
+9 012001 37 flanking neat measures FAS
+10 012003 37 combed Steinberg rightfulness
+11 012004 37 subjective jarring capably
+12 012005 37 scatterbrain tinily impulsive
+13 012301 37 Eulerian balled starlet
+14 012302 36 dubbed persist terminators
+15 012303 37 Kane attainments untying
+16 012304 37 overlay fanatic announces FAS
+17 012305 37 perturb measures featherweight FAS
+18 012306 37 goblins rightfulness pessimist FAS
+19 012501 37 annihilates capably daughter
+20 012602 37 Wotan impulsive decliner FAS
+21 012603 37 snatching starlet lawgiver
+22 012604 37 concludes terminators stated
+23 012605 37 laterally untying readable
+24 012606 37 yelped announces attrition
+25 012701 37 grazing featherweight cascade FAS
+26 012702 37 Baird pessimist motors FAS
+27 012703 37 celery daughter interrogate
+28 012704 37 misunderstander decliner pests W
+29 013601 37 handgun lawgiver stairway
+30 013602 37 foldout stated dopers FAS
+31 013603 37 mystic readable testicle W
+32 013604 37 succumbed attrition Parsifal W
+33 013605 37 Nabisco cascade leavings
+34 013606 37 fingerings motors postulation W
+35 013607 37 aging interrogate squeaking
+36 013608 37 afield pests contrasted
+37 013609 37 ammonium stairway leftover
+38 013610 37 boat dopers whiteners
+39 013801 37 intelligibility testicle erases W
+40 013802 37 Augustine Parsifal Punjab W
+41 013803 37 teethe leavings Merritt
+42 013804 37 dreaded postulation Quixotism
+43 013901 37 scholastics squeaking sweetish FAS
+44 016001 37 audiology contrasted dogging FAS
+45 016201 37 wallet leftover scornfully FAS
+46 016202 37 parters whiteners bellow
+47 016301 37 eschew erases bills
+48 016302 37 quitter Punjab cupboard FAS
+49 016303 37 neat Merritt sureties FAS
+50 016304 37 Steinberg Quixotism puddings
+51 018001 37 jarring sweetish tapestry
+52 018002 37 tinily dogging fetters
+53 018003 37 balled scornfully bivalves
+54 018004 37 persist bellow incurring
+55 018005 37 attainments bills Adolph
+56 018007 37 fanatic cupboard pithed
+57 018008 37 measures sureties emergency
+58 018009 37 rightfulness puddings Miles
+59 018010 37 capably tapestry trimmings
+60 018012 37 impulsive fetters tragedies W
+61 018013 37 starlet bivalves skulking W
+62 018014 37 terminators incurring flint
+63 018015 37 untying Adolph flopping W
+64 018016 37 announces pithed relaxing FAS
+65 018017 37 featherweight emergency offload FAS
+66 018018 37 pessimist Miles suites W
+67 018019 37 daughter trimmings lists FAS
+68 018020 37 decliner tragedies animized FAS
+69 018021 37 lawgiver skulking multilayer W
+70 018022 37 stated flint standardizes FAS
+71 018023 37 readable flopping Judas
+72 018024 37 attrition relaxing vacuuming W
+73 018025 37 cascade offload dentally W
+74 018026 37 motors suites humanness W
+75 018027 37 interrogate lists inch W
+76 018028 37 pests animized Weissmuller W
+77 018029 37 stairway multilayer irresponsibly W
+78 018030 37 dopers standardizes luckily FAS
+79 018032 37 testicle Judas culled W
+80 018033 37 Parsifal vacuuming medical FAS
+81 018034 37 leavings dentally bloodbath FAS
+82 018035 37 postulation humanness subschema W
+83 018036 37 squeaking inch animals W
+84 018037 37 contrasted Weissmuller Micronesia
+85 018038 37 leftover irresponsibly repetitions
+86 018039 37 whiteners luckily Antares
+87 018040 37 erases culled ventilate W
+88 018041 37 Punjab medical pityingly
+89 018042 37 Merritt bloodbath interdependent
+90 018043 37 Quixotism subschema Graves FAS
+91 018044 37 sweetish animals neonatal
+92 018045 37 dogging Micronesia scribbled FAS
+93 018046 37 scornfully repetitions chafe W
+94 018048 37 bellow Antares honoring
+95 018049 37 bills ventilate realtor
+96 018050 37 cupboard pityingly elite
+97 018051 37 sureties interdependent funereal
+98 018052 37 puddings Graves abrogating
+99 018053 50 tapestry neonatal sorters
+100 018054 37 fetters scribbled Conley
+101 018055 37 bivalves chafe lectured
+102 018056 37 incurring honoring Abraham
+103 018057 37 Adolph realtor Hawaii W
+104 018058 37 pithed elite cage
+105 018059 36 emergency funereal hushes
+106 018060 37 Miles abrogating Simla
+107 018061 37 trimmings sorters reporters
+108 018101 37 tragedies Conley Dutchman FAS
+109 018102 37 skulking lectured descendants FAS
+110 018103 37 flint Abraham groupings FAS
+111 018104 37 flopping Hawaii dissociate
+112 018201 37 relaxing cage coexist W
+113 018202 37 offload hushes Beebe
+114 018402 37 suites Simla Taoism
+115 018403 37 lists reporters Connally
+116 018404 37 animized Dutchman fetched FAS
+117 018405 37 multilayer descendants checkpoints FAS
+118 018406 37 standardizes groupings rusting
+119 018409 37 Judas dissociate galling
+120 018601 37 vacuuming coexist obliterates
+121 018602 37 dentally Beebe traitor
+122 018603 37 humanness Taoism resumes FAS
+123 018801 37 inch Connally analyzable FAS
+124 018802 37 Weissmuller fetched terminator FAS
+125 018803 37 irresponsibly checkpoints gritty FAS
+126 018804 37 luckily rusting firearm W
+127 018805 37 culled galling minima
+128 018806 37 medical obliterates Selfridge
+129 018807 37 bloodbath traitor disable
+130 018808 37 subschema resumes witchcraft W
+131 018809 37 animals analyzable betroth W
+132 018810 37 Micronesia terminator Manhattanize
+133 018811 37 repetitions gritty imprint
+134 018812 37 Antares firearm peeked
+135 019101 37 ventilate minima swelling
+136 019102 37 pityingly Selfridge interrelationships W
+137 019103 37 interdependent disable riser
+138 019201 37 Graves witchcraft Gandhian W
+139 030501 37 neonatal betroth peacock A
+140 030502 50 scribbled Manhattanize bee A
+141 030503 37 chafe imprint kanji
+142 030504 37 honoring peeked dental
+143 031901 37 realtor swelling scarf FAS
+144 036001 37 elite interrelationships chasm A
+145 036002 37 funereal riser insolence A
+146 036004 37 abrogating Gandhian syndicate
+147 036005 37 sorters peacock alike
+148 038001 37 Conley bee imperial A
+149 038002 37 lectured kanji convulsion A
+150 038003 37 Abraham dental railway A
+151 038004 37 Hawaii scarf validate A
+152 038005 37 cage chasm normalizes A
+153 038006 37 hushes insolence comprehensive
+154 038007 37 Simla syndicate chewing
+155 038008 37 reporters alike denizen
+156 038009 37 Dutchman imperial schemer
+157 038010 37 descendants convulsion chronicle
+158 038011 37 groupings railway Kline
+159 038012 37 dissociate validate Anatole
+160 038013 37 coexist normalizes partridges
+161 038014 37 Beebe comprehensive brunch
+162 038015 37 Taoism chewing recruited
+163 038016 37 Connally denizen dimensions W
+164 038017 37 fetched schemer Chicana W
+165 038018 37 checkpoints chronicle announced
+166 038101 37 rusting Kline praised FAS
+167 038102 37 galling Anatole employing
+168 038103 37 obliterates partridges linear
+169 038104 37 traitor brunch quagmire
+170 038201 37 resumes recruited western A
+171 038202 37 analyzable dimensions relishing
+172 038203 37 terminator Chicana serving A
+173 038204 37 gritty announced scheduling
+174 038205 37 firearm praised lore
+175 038206 37 minima employing eventful
+176 038208 37 Selfridge linear arteriole A
+177 042801 37 disable quagmire disentangle
+178 042802 37 witchcraft western cured A
+179 046101 37 betroth relishing Fenton W
+180 048001 37 Manhattanize serving avoidable A
+181 048002 37 imprint scheduling drains A
+182 048003 37 peeked lore detectably FAS
+183 048004 37 swelling eventful husky
+184 048005 37 interrelationships arteriole impelling
+185 048006 37 riser disentangle undoes
+186 048007 37 Gandhian cured evened
+187 048008 37 peacock Fenton squeezes
+188 048101 37 bee avoidable destroyer FAS
+189 048102 37 kanji drains rudeness
+190 048201 37 dental detectably beaner FAS
+191 048202 37 scarf husky boorish
+192 048203 37 chasm impelling Everhart
+193 048204 37 insolence undoes encompass A
+194 048205 37 syndicate evened mushrooms
+195 048301 37 alike squeezes Alison A
+196 048302 37 imperial destroyer externally FAS
+197 048303 37 convulsion rudeness pellagra
+198 048304 37 railway beaner cult
+199 048305 37 validate boorish creek A
+200 048401 37 normalizes Everhart Huffman
+201 048402 37 comprehensive encompass Majorca FAS
+202 048403 37 chewing mushrooms governing A
+203 048404 37 denizen Alison gadfly FAS
+204 048405 37 schemer externally reassigned FAS
+205 048406 37 chronicle pellagra intentness W
+206 048407 37 Kline cult craziness
+207 048408 37 Anatole creek psychic
+208 048409 37 partridges Huffman squabbled
+209 048410 37 brunch Majorca burlesque
+210 048411 37 recruited governing capped
+211 048412 37 dimensions gadfly extracted A
+212 048413 37 Chicana reassigned DiMaggio
+213 048601 37 announced intentness exclamation FAS
+214 048602 37 praised craziness subdirectory
+215 048603 37 employing psychic fangs
+216 048604 37 linear squabbled buyer A
+217 048801 37 quagmire burlesque pithing A
+218 050901 37 western capped transistorizing A
+219 051201 37 relishing extracted nonbiodegradable
+220 056002 37 serving DiMaggio dislocate
+221 056003 37 scheduling exclamation monochromatic FAS
+222 056004 37 lore subdirectory batting
+223 056102 37 eventful fangs postcondition A
+224 056203 37 arteriole buyer catalog FAS
+225 056204 37 disentangle pithing Remus
+226 058003 37 cured transistorizing devices A
+227 058004 37 Fenton nonbiodegradable bike A
+228 058005 37 avoidable dislocate qualify
+229 058006 37 drains monochromatic detained
+230 058007 37 detectably batting commended
+231 058101 37 husky postcondition civilize
+232 058102 37 impelling catalog Elmhurst
+233 058103 37 undoes Remus anesthetizing
+234 058105 37 evened devices deaf
+235 058111 37 squeezes bike Brigham
+236 058112 37 destroyer qualify title
+237 058113 37 rudeness detained coarse
+238 058114 37 beaner commended combinations
+239 058115 37 boorish civilize grayness
+240 058116 37 Everhart Elmhurst innumerable FAS
+241 058117 37 encompass anesthetizing Caroline A
+242 058118 37 mushrooms deaf fatty FAS
+243 058119 37 Alison Brigham eastbound
+244 058120 37 externally title inexperienced
+245 058121 37 pellagra coarse hoarder A
+246 058122 37 cult combinations scotch W
+247 058123 37 creek grayness passport A
+248 058124 37 Huffman innumerable strategic FAS
+249 058125 37 Majorca Caroline gated
+250 058126 37 governing fatty flog
+251 058127 37 gadfly eastbound Pipestone
+252 058128 37 reassigned inexperienced Dar
+253 058201 37 intentness hoarder Corcoran
+254 058202 37 craziness scotch flyers A
+255 058303 37 psychic passport competitions W
+256 058304 37 squabbled strategic suppliers FAS
+257 058602 37 burlesque gated skips
+258 058603 37 capped flog institutes
+259 058604 37 extracted Pipestone troop A
+260 058605 37 DiMaggio Dar connective W
+261 058606 37 exclamation Corcoran denies
+262 058607 37 subdirectory flyers polka
+263 060401 36 fangs competitions observations FAS
+264 061701 36 buyer suppliers askers
+265 066201 36 pithing skips homeless FAS
+266 066501 36 transistorizing institutes Anna
+267 068001 36 nonbiodegradable troop subdirectories W
+268 068002 36 dislocate connective decaying FAS
+269 068005 36 monochromatic denies outwitting W
+270 068006 36 batting polka Harpy W
+271 068007 36 postcondition observations crazed
+272 068008 36 catalog askers suffocate
+273 068009 36 Remus homeless provers FAS
+274 068010 36 devices Anna technically
+275 068011 36 bike subdirectories Franklinizations
+276 068202 36 qualify decaying considered
+277 068302 36 detained outwitting tinnily
+278 068303 36 commended Harpy uninterruptedly
+279 068401 36 civilize crazed whistled A
+280 068501 36 Elmhurst suffocate automate
+281 068502 36 anesthetizing provers gutting W
+282 068503 36 deaf technically surreptitious
+283 068602 36 Brigham Franklinizations Choctaw
+284 068603 36 title considered cooks
+285 068701 36 coarse tinnily millivolt FAS
+286 068702 36 combinations uninterruptedly counterpoise
+287 068703 36 grayness whistled Gothicism
+288 076001 36 innumerable automate feminine
+289 076002 36 Caroline gutting metaphysically W
+290 076101 36 fatty surreptitious sanding A
+291 076102 36 eastbound Choctaw contributorily
+292 076103 36 inexperienced cooks receivers FAS
+293 076302 36 hoarder millivolt adjourn
+294 076303 36 scotch counterpoise straggled A
+295 076304 36 passport Gothicism druggists
+296 076305 36 strategic feminine thanking FAS
+297 076306 36 gated metaphysically ostrich
+298 076307 36 flog sanding hopelessness FAS
+299 076402 36 Pipestone contributorily Eurydice
+300 076501 36 Dar receivers excitation W
+301 076502 36 Corcoran adjourn presumes FAS
+302 076701 36 flyers straggled imaginable FAS
+303 078001 36 competitions druggists concoct W
+304 078002 36 suppliers thanking peering W
+305 078003 36 skips ostrich Phelps FAS
+306 078004 36 institutes hopelessness ferociousness FAS
+307 078005 36 troop Eurydice sentences
+308 078006 36 connective excitation unlocks
+309 078007 36 denies presumes engrossing W
+310 078008 36 polka imaginable Ruth
+311 078101 36 observations concoct tying
+312 078103 36 askers peering exclaimers
+313 078104 36 homeless Phelps synergy
+314 078105 36 Anna ferociousness Huey W
+315 082101 36 subdirectories sentences merging
+316 083401 36 decaying unlocks judges A
+317 084001 36 outwitting engrossing Shylock W
+318 084002 36 Harpy Ruth Miltonism
+319 086001 36 crazed tying hen W
+320 086102 36 suffocate exclaimers honeybee FAS
+321 086201 36 provers synergy towers
+322 088001 36 technically Huey dilutes W
+323 088002 36 Franklinizations merging numerals FAS
+324 088003 36 considered judges democracy FAS
+325 088004 36 tinnily Shylock Ibero-
+326 088101 36 uninterruptedly Miltonism invalids
+327 088102 36 whistled hen behavior
+328 088103 36 automate honeybee accruing
+329 088104 36 gutting towers relics A
+330 088105 36 surreptitious dilutes rackets
+331 088106 36 Choctaw numerals Fischbein W
+332 088201 36 cooks democracy phony W
+333 088203 36 millivolt Ibero- cross FAS
+334 088204 36 counterpoise invalids cleanup
+335 088302 37 Gothicism behavior conspirator
+336 088303 37 feminine accruing label FAS
+337 088305 37 metaphysically relics university
+338 088402 37 sanding rackets cleansed FAS
+339 088501 36 contributorily Fischbein ballgown
+340 088502 36 receivers phony starlet
+341 088503 36 adjourn cross aqueous
+342 098001 58 straggled cleanup portrayal A
+343 098002 58 druggists conspirator despising W
+344 098003 58 thanking label distort W
+345 098004 58 ostrich university palmed
+346 098005 58 hopelessness cleansed faced
+347 098006 58 Eurydice ballgown silverware
+348 141903 29 excitation starlet assessor
+349 098008 58 presumes aqueous spiders
+350 098009 58 imaginable portrayal artificially
+351 098010 58 concoct despising reminiscence
+352 098011 58 peering distort Mexican
+353 098012 58 Phelps palmed obnoxious
+354 098013 58 ferociousness faced fragile
+355 098014 58 sentences silverware apprehensible
+356 098015 58 unlocks assessor births
+357 098016 58 engrossing spiders garages
+358 098017 58 Ruth artificially panty
+359 098018 58 tying reminiscence anteater
+360 098019 58 exclaimers Mexican displacement A
+361 098020 58 synergy obnoxious drovers A
+362 098021 58 Huey fragile patenting A
+363 098022 58 merging apprehensible far A
+364 098023 58 judges births shrieks
+365 098024 58 Shylock garages aligning W
+366 098025 37 Miltonism panty pragmatism
+367 106001 36 hen anteater fevers W
+368 108001 36 honeybee displacement reexamines A
+369 108002 36 towers drovers occupancies
+370 108003 36 dilutes patenting sweats FAS
+371 108004 36 numerals far modulators
+372 108005 36 democracy shrieks demand W
+373 108007 36 Ibero- aligning Madeira
+374 108008 36 invalids pragmatism Viennese W
+375 108009 36 behavior fevers chillier W
+376 108010 36 accruing reexamines wildcats FAS
+377 108011 36 relics occupancies gentle
+378 108012 36 rackets sweats Angles W
+379 108101 36 Fischbein modulators accuracies
+380 108102 36 phony demand toggle
+381 108103 36 cross Madeira Mendelssohn W
+382 108111 50 cleanup Viennese behaviorally
+383 108105 36 conspirator chillier Rochford
+384 108106 36 label wildcats mirror W
+385 108107 36 university gentle Modula
+386 108108 50 cleansed Angles clobbering
+387 108109 36 ballgown accuracies chronography
+388 108110 36 starlet toggle Eskimoizeds
+389 108201 36 aqueous Mendelssohn British W
+390 108202 36 portrayal behaviorally pitfalls
+391 108203 36 despising Rochford verify W
+392 108204 36 distort mirror scatter FAS
+393 108205 36 palmed Modula Aztecan
+394 108301 36 faced clobbering acuity W
+395 108302 36 silverware chronography sinking W
+396 112101 36 assessor Eskimoizeds beasts FAS
+397 112102 36 spiders British Witt W
+398 113701 36 artificially pitfalls physicists FAS
+399 116001 36 reminiscence verify folksong A
+400 116201 36 Mexican scatter strokes FAS
+401 116301 36 obnoxious Aztecan crowder
+402 116302 36 fragile acuity merry
+403 116601 36 apprehensible sinking cadenced
+404 116602 36 births beasts alimony A
+405 116603 36 garages Witt principled A
+406 116701 36 panty physicists golfing
+407 116702 36 anteater folksong undiscovered
+408 118001 36 displacement strokes irritates
+409 118002 36 drovers crowder patriots A
+410 118003 36 patenting merry rooms FAS
+411 118004 36 far cadenced towering W
+412 118005 36 shrieks alimony displease
+413 118006 36 aligning principled photosensitive
+414 118007 36 pragmatism golfing inking
+415 118008 36 fevers undiscovered gainers
+416 118101 36 reexamines irritates leaning A
+417 118102 36 occupancies patriots hydrant A
+418 118103 36 sweats rooms preserve
+419 118202 36 modulators towering blinded A
+420 118203 36 demand displease interactions A
+421 118204 36 Madeira photosensitive Barry
+422 118302 36 Viennese inking whiteness A
+423 118304 36 chillier gainers pastimes W
+424 118305 36 wildcats leaning Edenization
+425 118306 36 gentle hydrant Muscat
+426 118307 36 Angles preserve assassinated
+427 123101 36 accuracies blinded labeled
+428 123102 36 toggle interactions glacial A
+429 123301 36 Mendelssohn Barry implied W
+430 126001 36 behaviorally whiteness bibliographies W
+431 126002 36 Rochford pastimes Buchanan
+432 126003 36 mirror Edenization forgivably FAS
+433 126101 36 Modula Muscat innuendo A
+434 126301 36 clobbering assassinated den FAS
+435 126302 36 chronography labeled submarines W
+436 126402 36 Eskimoizeds glacial mouthful A
+437 126601 36 British implied expiring
+438 126602 36 pitfalls bibliographies unfulfilled FAS
+439 126702 36 verify Buchanan precession
+440 128001 36 scatter forgivably nullified
+441 128002 36 Aztecan innuendo affects
+442 128003 36 acuity den Cynthia
+443 128004 36 sinking submarines Chablis A
+444 128005 36 beasts mouthful betterments FAS
+445 128007 36 Witt expiring advertising
+446 128008 36 physicists unfulfilled rubies A
+447 128009 36 folksong precession southwest FAS
+448 128010 36 strokes nullified superstitious A
+449 128011 36 crowder affects tabernacle W
+450 128012 36 merry Cynthia silk A
+451 128013 36 cadenced Chablis handsomest A
+452 128014 36 alimony betterments Persian A
+453 128015 36 principled advertising analog W
+454 128016 36 golfing rubies complex W
+455 128017 36 undiscovered southwest Taoist
+456 128018 36 irritates superstitious suspend
+457 128019 36 patriots tabernacle relegated
+458 128020 36 rooms silk awesome W
+459 128021 36 towering handsomest Bruxelles
+460 128022 36 displease Persian imprecisely A
+461 128023 36 photosensitive analog televise
+462 128101 36 inking complex braking
+463 128102 36 gainers Taoist true FAS
+464 128103 36 leaning suspend disappointing FAS
+465 128104 36 hydrant relegated navally W
+466 128106 36 preserve awesome circus
+467 128107 36 blinded Bruxelles beetles
+468 128108 36 interactions imprecisely trumps
+469 128202 36 Barry televise fourscore W
+470 128203 36 whiteness braking Blackfoots
+471 128301 36 pastimes true Grady
+472 128302 36 Edenization disappointing quiets FAS
+473 128303 36 Muscat navally floundered FAS
+474 128304 36 assassinated circus profundity W
+475 128305 36 labeled beetles Garrisonian W
+476 128307 36 glacial trumps Strauss
+477 128401 36 implied fourscore cemented FAS
+478 128502 36 bibliographies Blackfoots contrition A
+479 128503 36 Buchanan Grady mutations
+480 128504 36 forgivably quiets exhibits W
+481 128505 36 innuendo floundered tits
+482 128601 36 den profundity mate A
+483 128603 36 submarines Garrisonian arches
+484 128604 36 mouthful Strauss Moll
+485 128702 36 expiring cemented ropers
+486 128703 36 unfulfilled contrition bombast
+487 128704 36 precession mutations difficultly A
+488 138001 36 nullified exhibits adsorption
+489 138002 36 affects tits definiteness FAS
+490 138003 36 Cynthia mate cultivation A
+491 138004 36 Chablis arches heals A
+492 138005 36 betterments Moll Heusen W
+493 138006 36 advertising ropers target FAS
+494 138007 36 rubies bombast cited A
+495 138008 36 southwest difficultly congresswoman W
+496 138009 36 superstitious adsorption Katherine
+497 138102 36 tabernacle definiteness titter A
+498 138103 36 silk cultivation aspire A
+499 138104 36 handsomest heals Mardis
+500 138105 36 Persian Heusen Nadia W
+501 138201 36 analog target estimating FAS
+502 138302 36 complex cited stuck A
+503 138303 36 Taoist congresswoman fifteenth A
+504 138304 36 suspend Katherine Colombo
+505 138401 29 relegated titter survey A
+506 140102 29 awesome aspire staffing
+507 140103 29 Bruxelles Mardis obtain
+508 140104 29 imprecisely Nadia loaded
+509 140105 29 televise estimating slaughtered
+510 140201 29 braking stuck lights A
+511 140701 29 true fifteenth circumference
+512 141501 29 disappointing Colombo dull A
+513 141502 29 navally survey weekly A
+514 141901 29 circus staffing wetness
+515 141902 29 beetles obtain visualized
+516 142101 29 trumps loaded Tannenbaum
+517 142102 29 fourscore slaughtered moribund
+518 142103 29 Blackfoots lights demultiplex
+519 142701 29 Grady circumference lockings
+520 143001 29 quiets dull thugs FAS
+521 143501 29 floundered weekly unnerves
+522 143502 29 profundity wetness abut
+523 148001 29 Garrisonian visualized Chippewa A
+524 148002 29 Strauss Tannenbaum stratifications A
+525 148003 29 cemented moribund signaled
+526 148004 29 contrition demultiplex Italianizes A
+527 148005 29 mutations lockings algorithmic A
+528 148006 29 exhibits thugs paranoid FAS
+529 148007 29 tits unnerves camping A
+530 148009 29 mate abut signifying A
+531 148010 29 arches Chippewa Patrice W
+532 148011 29 Moll stratifications search A
+533 148012 29 ropers signaled Angeles A
+534 148013 29 bombast Italianizes semblance
+535 148023 36 difficultly algorithmic taxed
+536 148015 29 adsorption paranoid Beatrice
+537 148016 29 definiteness camping retrace
+538 148017 29 cultivation signifying lockout
+539 148018 29 heals Patrice grammatic
+540 148019 29 Heusen search helmsman
+541 148020 29 target Angeles uniform W
+542 148021 29 cited semblance hamming
+543 148022 29 congresswoman taxed disobedience
+544 148101 29 Katherine Beatrice captivated A
+545 148102 29 titter retrace transferals A
+546 148201 29 aspire lockout cartographer A
+547 148401 29 Mardis grammatic aims FAS
+548 148402 29 Nadia helmsman Pakistani
+549 148501 29 estimating uniform burglarized FAS
+550 148502 29 stuck hamming saucepans A
+551 148503 29 fifteenth disobedience lacerating A
+552 148504 29 Colombo captivated corny
+553 148601 29 survey transferals megabytes FAS
+554 148602 29 staffing cartographer chancellor
+555 150701 29 obtain aims bulk A
+556 152101 29 loaded Pakistani commits A
+557 152102 29 slaughtered burglarized meson W
+558 155202 36 lights saucepans deputies
+559 155203 29 circumference lacerating northeaster A
+560 155204 29 dull corny dipole
+561 155205 29 weekly megabytes machining 0
+562 156001 29 wetness chancellor therefore
+563 156002 29 visualized bulk Telefunken
+564 156102 29 Tannenbaum commits salvaging
+565 156301 29 moribund meson Corinthianizes A
+566 156302 29 demultiplex deputies restlessly A
+567 156303 29 lockings northeaster bromides
+568 156304 29 thugs dipole generalized A
+569 156305 29 unnerves machining mishaps
+570 156306 29 abut therefore quelling
+571 156501 29 Chippewa Telefunken spiritual A
+572 158001 29 stratifications salvaging beguiles FAS
+573 158002 29 signaled Corinthianizes Trobriand FAS
+574 158101 29 Italianizes restlessly fleeing A
+575 158102 29 algorithmic bromides Armour A
+576 158103 29 paranoid generalized chin A
+577 158201 29 camping mishaps provers A
+578 158202 29 signifying quelling aeronautic A
+579 158203 29 Patrice spiritual voltage W
+580 158204 29 search beguiles sash
+581 158301 29 Angeles Trobriand anaerobic A
+582 158302 29 semblance fleeing simultaneous A
+583 158303 29 taxed Armour accumulating A
+584 158304 29 Beatrice chin Medusan A
+585 158305 29 retrace provers shouted A
+586 158306 29 lockout aeronautic freakish
+587 158501 29 grammatic voltage index FAS
+588 160301 29 helmsman sash commercially
+589 166101 50 uniform anaerobic mistiness A
+590 166102 50 hamming simultaneous endpoint
+591 168001 29 disobedience accumulating straight A
+592 168002 29 captivated Medusan flurried
+593 168003 29 transferals shouted denotative A
+594 168101 29 cartographer freakish coming FAS
+595 168102 29 aims index commencements FAS
+596 168103 29 Pakistani commercially gentleman
+597 168104 29 burglarized mistiness gifted
+598 168202 29 saucepans endpoint Shanghais
+599 168301 29 lacerating straight sportswriting A
+600 168502 29 corny flurried sloping A
+601 168503 29 megabytes denotative navies
+602 168601 29 chancellor coming leaflet A
+603 173001 40 bulk commencements shooter
+604 173701 40 commits gentleman Joplin FAS
+605 173702 40 meson gifted babies
+606 176001 40 deputies Shanghais subdivision FAS
+607 176101 40 northeaster sportswriting burstiness W
+608 176201 40 dipole sloping belted FAS
+609 176401 40 machining navies assails FAS
+610 176501 40 therefore leaflet admiring W
+611 176601 40 Telefunken shooter swaying 0
+612 176602 40 salvaging Joplin Goldstine FAS
+613 176603 40 Corinthianizes babies fitting
+614 178001 40 restlessly subdivision Norwalk W
+615 178002 40 bromides burstiness weakening W
+616 178003 40 generalized belted analogy FAS
+617 178004 40 mishaps assails deludes
+618 178005 40 quelling admiring cokes
+619 178006 40 spiritual swaying Clayton
+620 178007 40 beguiles Goldstine exhausts
+621 178008 40 Trobriand fitting causality
+622 178101 40 fleeing Norwalk sating FAS
+623 178102 40 Armour weakening icon
+624 178103 40 chin analogy throttles
+625 178201 40 provers deludes communicants FAS
+626 178202 40 aeronautic cokes dehydrate FAS
+627 178301 40 voltage Clayton priceless FAS
+628 178302 40 sash exhausts publicly
+629 178401 40 anaerobic causality incidentals FAS
+630 178402 40 simultaneous sating commonplace
+631 178403 40 accumulating icon mumbles
+632 178404 40 Medusan throttles furthermore W
+633 178501 40 shouted communicants cautioned W
+634 186002 37 freakish dehydrate parametrized A
+635 186102 37 index priceless registration A
+636 186201 40 commercially publicly sadly FAS
+637 186202 40 mistiness incidentals positioning
+638 186203 40 endpoint commonplace babysitting
+639 186302 37 straight mumbles eternal A
+640 188007 37 flurried furthermore hoarder
+641 188008 37 denotative cautioned congregates
+642 188009 37 coming parametrized rains
+643 188010 37 commencements registration workers W
+644 188011 37 gentleman sadly sags A
+645 188012 37 gifted positioning unplug W
+646 188013 37 Shanghais babysitting garage A
+647 188014 37 sportswriting eternal boulder A
+648 188015 37 sloping hoarder hollowly A
+649 188016 37 navies congregates specifics
+650 188017 37 leaflet rains Teresa
+651 188102 37 shooter workers Winsett
+652 188103 37 Joplin sags convenient A
+653 188202 37 babies unplug buckboards FAS
+654 188301 40 subdivision garage amenities
+655 188302 40 burstiness boulder resplendent FAS
+656 188303 40 belted hollowly priding FAS
+657 188401 37 assails specifics configurations
+658 188402 37 admiring Teresa untidiness A
+659 188503 37 swaying Winsett Brice W
+660 188504 37 Goldstine convenient sews FAS
+661 188505 37 fitting buckboards participated
+662 190701 37 Norwalk amenities Simon FAS
+663 190703 50 weakening resplendent certificates
+664 191701 37 analogy priding Fitzpatrick
+665 191702 37 deludes configurations Evanston A
+666 191703 37 cokes untidiness misted
+667 196001 37 Clayton Brice textures A
+668 196002 37 exhausts sews save
+669 196003 37 causality participated count
+670 196101 37 sating Simon rightful A
+671 196103 37 icon certificates chaperone
+672 196104 37 throttles Fitzpatrick Lizzy A
+673 196201 37 communicants Evanston clenched A
+674 196202 37 dehydrate misted effortlessly
+675 196203 37 priceless textures accessed
+676 198001 37 publicly save beaters A
+677 198003 37 incidentals count Hornblower FAS
+678 198004 37 commonplace rightful vests A
+679 198005 37 mumbles chaperone indulgences FAS
+680 198006 37 furthermore Lizzy infallibly A
+681 198007 37 cautioned clenched unwilling FAS
+682 198008 37 parametrized effortlessly excrete FAS
+683 198009 37 registration accessed spools A
+684 198010 37 sadly beaters crunches FAS
+685 198011 37 positioning Hornblower overestimating FAS
+686 198012 37 babysitting vests ineffective
+687 198013 37 eternal indulgences humiliation A
+688 198014 37 hoarder infallibly sophomore
+689 198015 37 congregates unwilling star
+690 198017 37 rains excrete rifles
+691 198018 37 workers spools dialysis
+692 198019 37 sags crunches arriving
+693 198020 37 unplug overestimating indulge
+694 198021 37 garage ineffective clockers
+695 198022 37 boulder humiliation languages
+696 198023 50 hollowly sophomore Antarctica A
+697 198024 37 specifics star percentage
+698 198101 37 Teresa rifles ceiling A
+699 198103 37 Winsett dialysis specification
+700 198105 37 convenient arriving regimented A
+701 198106 37 buckboards indulge ciphers
+702 198201 37 amenities clockers pictures A
+703 198204 37 resplendent languages serpents A
+704 198301 53 priding Antarctica allot A
+705 198302 53 configurations percentage realized A
+706 198303 53 untidiness ceiling mayoral A
+707 198304 53 Brice specification opaquely A
+708 198401 37 sews regimented hostess FAS
+709 198402 37 participated ciphers fiftieth
+710 198403 37 Simon pictures incorrectly
+711 202101 37 certificates serpents decomposition FAS
+712 202301 37 Fitzpatrick allot stranglings
+713 202302 37 Evanston realized mixture FAS
+714 202303 37 misted mayoral electroencephalography FAS
+715 202304 37 textures opaquely similarities FAS
+716 202305 37 save hostess charges W
+717 202601 37 count fiftieth freest FAS
+718 202602 37 rightful incorrectly Greenberg FAS
+719 202605 37 chaperone decomposition tinting
+720 202606 37 Lizzy stranglings expelled W
+721 202607 37 clenched mixture warm
+722 202901 37 effortlessly electroencephalography smoothed
+723 202902 37 accessed similarities deductions FAS
+724 202903 37 beaters charges Romano W
+725 202904 37 Hornblower freest bitterroot
+726 202907 37 vests Greenberg corset
+727 202908 37 indulgences tinting securing
+728 203101 37 infallibly expelled environing FAS
+729 203103 37 unwilling warm cute
+730 203104 37 excrete smoothed Crays
+731 203105 37 spools deductions heiress FAS
+732 203401 37 crunches Romano inform FAS
+733 203402 37 overestimating bitterroot avenge
+734 203404 37 ineffective corset universals
+735 203901 37 humiliation securing Kinsey W
+736 203902 37 sophomore environing ravines FAS
+737 203903 37 star cute bestseller
+738 203906 37 rifles Crays equilibrium
+739 203907 37 dialysis heiress extents 0
+740 203908 37 arriving inform relatively
+741 203909 37 indulge avenge pressure FAS
+742 206101 37 clockers universals critiques FAS
+743 206201 37 languages Kinsey befouled
+744 206202 37 Antarctica ravines rightfully FAS
+745 206203 37 percentage bestseller mechanizing FAS
+746 206206 37 ceiling equilibrium Latinizes
+747 206207 37 specification extents timesharing
+748 206208 37 regimented relatively Aden
+749 208001 37 ciphers pressure embassies
+750 208002 37 pictures critiques males FAS
+751 208003 37 serpents befouled shapelessly FAS
+752 208004 37 allot rightfully genres FAS
+753 208008 37 realized mechanizing mastering
+754 208009 37 mayoral Latinizes Newtonian
+755 208010 37 opaquely timesharing finishers FAS
+756 208011 37 hostess Aden abates
+757 208101 37 fiftieth embassies teem
+758 208102 37 incorrectly males kiting FAS
+759 208103 37 decomposition shapelessly stodgy FAS
+760 208104 37 stranglings genres scalps FAS
+761 208105 37 mixture mastering feed FAS
+762 208110 37 electroencephalography Newtonian guitars
+763 208111 37 similarities finishers airships
+764 208112 37 charges abates store
+765 208113 37 freest teem denounces
+766 208201 37 Greenberg kiting Pyle FAS
+767 208203 37 tinting stodgy Saxony
+768 208301 37 expelled scalps serializations FAS
+769 208302 37 warm feed Peruvian FAS
+770 208305 37 smoothed guitars taxonomically FAS
+771 208401 37 deductions airships kingdom A
+772 208402 37 Romano store stint A
+773 208403 37 bitterroot denounces Sault A
+774 208404 37 corset Pyle faithful
+775 208501 37 securing Saxony Ganymede FAS
+776 208502 37 environing serializations tidiness FAS
+777 208503 37 cute Peruvian gainful FAS
+778 208504 37 Crays taxonomically contrary FAS
+779 208505 37 heiress kingdom Tipperary FAS
+780 210101 37 inform stint tropics W
+781 210102 37 avenge Sault theorizers
+782 210103 37 universals faithful renew 0
+783 210104 37 Kinsey Ganymede already
+784 210105 37 ravines tidiness terminal
+785 210106 37 bestseller gainful Hegelian
+786 210107 37 equilibrium contrary hypothesizer
+787 210401 37 extents Tipperary warningly FAS
+788 213201 37 relatively tropics journalizing FAS
+789 213203 37 pressure theorizers nested
+790 213204 37 critiques renew Lars
+791 213205 37 befouled already saplings
+792 213206 37 rightfully terminal foothill
+793 213207 37 mechanizing Hegelian labeled
+794 216101 37 Latinizes hypothesizer imperiously FAS
+795 216103 37 timesharing warningly reporters FAS
+796 218001 37 Aden journalizing furnishings FAS
+797 218002 37 embassies nested precipitable FAS
+798 218003 37 males Lars discounts FAS
+799 218004 37 shapelessly saplings excises FAS
+800 143503 50 genres foothill Stalin
+801 218006 37 mastering labeled despot FAS
+802 218007 37 Newtonian imperiously ripeness FAS
+803 218008 37 finishers reporters Arabia
+804 218009 37 abates furnishings unruly
+805 218010 37 teem precipitable mournfulness
+806 218011 37 kiting discounts boom FAS
+807 218020 37 stodgy excises slaughter A
+808 218021 50 scalps Stalin Sabine
+809 218022 37 feed despot handy FAS
+810 218023 37 guitars ripeness rural
+811 218024 37 airships Arabia organizer
+812 218101 37 store unruly shipyard FAS
+813 218102 37 denounces mournfulness civics FAS
+814 218103 37 Pyle boom inaccuracy FAS
+815 218201 37 Saxony slaughter rules FAS
+816 218202 37 serializations Sabine juveniles FAS
+817 218203 37 Peruvian handy comprised W
+818 218204 37 taxonomically rural investigations
+819 218205 37 kingdom organizer stabilizes A
+820 218301 37 stint shipyard seminaries FAS
+821 218302 37 Sault civics Hunter A
+822 218401 37 faithful inaccuracy sporty FAS
+823 218402 37 Ganymede rules test FAS
+824 218403 37 tidiness juveniles weasels
+825 218404 37 gainful comprised CERN
+826 218407 37 contrary investigations tempering
+827 218408 37 Tipperary stabilizes afore FAS
+828 218409 37 tropics seminaries Galatean
+829 218410 37 theorizers Hunter techniques W
+830 226001 37 renew sporty error
+831 226002 37 already test veranda
+832 226003 37 terminal weasels severely
+833 226004 37 Hegelian CERN Cassites FAS
+834 226005 37 hypothesizer tempering forthcoming
+835 226006 37 warningly afore guides
+836 226007 37 journalizing Galatean vanish FAS
+837 226008 37 nested techniques lied A
+838 226203 37 Lars error sawtooth FAS
+839 226204 37 saplings veranda fated FAS
+840 226205 37 foothill severely gradually
+841 226206 37 labeled Cassites widens
+842 226207 37 imperiously forthcoming preclude
+843 226208 37 reporters guides Jobrel
+844 226209 37 furnishings vanish hooker
+845 226210 37 precipitable lied rainstorm
+846 226211 37 discounts sawtooth disconnects
+847 228001 37 excises fated cruelty
+848 228004 37 Stalin gradually exponentials A
+849 228005 37 despot widens affective A
+850 228006 37 ripeness preclude arteries
+851 228007 37 Arabia Jobrel Crosby FAS
+852 228008 37 unruly hooker acquaint
+853 228009 37 mournfulness rainstorm evenhandedly
+854 228101 37 boom disconnects percentage
+855 228108 37 slaughter cruelty disobedience
+856 228109 37 Sabine exponentials humility
+857 228110 37 handy affective gleaning A
+858 228111 37 rural arteries petted A
+859 228112 37 organizer Crosby bloater A
+860 228113 37 shipyard acquaint minion A
+861 228114 37 civics evenhandedly marginal A
+862 228115 37 inaccuracy percentage apiary A
+863 228116 37 rules disobedience measures
+864 228117 37 juveniles humility precaution
+865 228118 37 comprised gleaning repelled
+866 228119 37 investigations petted primary FAS
+867 228120 37 stabilizes bloater coverings
+868 228121 37 seminaries minion Artemia A
+869 228122 37 Hunter marginal navigate
+870 228201 37 sporty apiary spatial
+871 228206 37 test measures Gurkha
+872 228207 37 weasels precaution meanwhile A
+873 228208 37 CERN repelled Melinda A
+874 228209 37 tempering primary Butterfield
+875 228210 37 afore coverings Aldrich A
+876 228211 37 Galatean Artemia previewing A
+877 228212 37 techniques navigate glut A
+878 228213 37 error spatial unaffected
+879 228214 37 veranda Gurkha inmate
+880 228301 37 severely meanwhile mineral
+881 228305 37 Cassites Melinda impending A
+882 228306 37 forthcoming Butterfield meditation A
+883 228307 37 guides Aldrich ideas
+884 228308 37 vanish previewing miniaturizes W
+885 228309 37 lied glut lewdly
+886 228310 37 sawtooth unaffected title
+887 228311 37 fated inmate youthfulness
+888 228312 37 gradually mineral creak FAS
+889 228313 37 widens impending Chippewa
+890 228314 37 preclude meditation clamored
+891 228401 65 Jobrel ideas freezes
+892 228402 65 hooker miniaturizes forgivably FAS
+893 228403 65 rainstorm lewdly reduce FAS
+894 228404 65 disconnects title McGovern W
+895 228405 65 cruelty youthfulness Nazis W
+896 228406 65 exponentials creak epistle W
+897 228407 65 affective Chippewa socializes W
+898 228408 65 arteries clamored conceptions
+899 228409 65 Crosby freezes Kevin
+900 228410 65 acquaint forgivably uncovering
+901 230301 37 evenhandedly reduce chews FAS
+902 230302 37 percentage McGovern appendixes FAS
+903 230303 37 disobedience Nazis raining
+904 018062 37 humility epistle infest
+905 230501 37 gleaning socializes compartment
+906 230502 37 petted conceptions minting
+907 230503 37 bloater Kevin ducks
+908 230504 37 minion uncovering roped A
+909 230505 37 marginal chews waltz
+910 230506 37 apiary appendixes Lillian
+911 230507 37 measures raining repressions A
+912 230508 37 precaution infest chillingly
+913 230509 37 repelled compartment noncritical
+914 230901 37 primary minting lithograph
+915 230902 37 coverings ducks spongers
+916 230903 37 Artemia roped parenthood
+917 230904 37 navigate waltz posed
+918 230905 37 spatial Lillian instruments
+919 230906 37 Gurkha repressions filial
+920 230907 37 meanwhile chillingly fixedly
+921 230908 37 Melinda noncritical relives
+922 230909 37 Butterfield lithograph Pandora
+923 230910 37 Aldrich spongers watering A
+924 230911 37 previewing parenthood ungrateful
+925 230912 37 glut posed secures
+926 230913 37 unaffected instruments chastisers
+927 230914 37 inmate filial icon
+928 231304 37 mineral fixedly reuniting A
+929 231305 37 impending relives imagining A
+930 231306 37 meditation Pandora abiding A
+931 231307 37 ideas watering omnisciently
+932 231308 37 miniaturizes ungrateful Britannic
+933 231309 37 lewdly secures scholastics A
+934 231310 37 title chastisers mechanics A
+935 231311 37 youthfulness icon humidly A
+936 231312 37 creak reuniting masterpiece
+937 231313 37 Chippewa imagining however
+938 231314 37 clamored abiding Mendelian
+939 231315 37 freezes omnisciently jarred
+940 232102 37 forgivably Britannic scolds
+941 232103 37 reduce scholastics infatuate
+942 232104 37 McGovern mechanics willed A
+943 232105 37 Nazis humidly joyfully
+944 232106 37 epistle masterpiece Microsoft
+945 232107 37 socializes however fibrosities
+946 232108 37 conceptions Mendelian Baltimorean
+947 232601 37 Kevin jarred equestrian
+948 232602 37 uncovering scolds Goodrich
+949 232603 37 chews infatuate apish A
+950 232605 37 appendixes willed Adlerian
+5950 1232605 37 appendixes willed Adlerian
+5951 1232606 37 appendixes willed Adlerian
+5952 1232607 37 appendixes willed Adlerian
+5953 1232608 37 appendixes willed Adlerian
+5954 1232609 37 appendixes willed Adlerian
+951 232606 37 raining joyfully Tropez
+952 232607 37 infest Microsoft nouns
+953 232608 37 compartment fibrosities distracting
+954 232609 37 minting Baltimorean mutton
+955 236104 37 ducks equestrian bridgeable A
+956 236105 37 roped Goodrich stickers A
+957 236106 37 waltz apish transcontinental A
+958 236107 37 Lillian Adlerian amateurish
+959 236108 37 repressions Tropez Gandhian
+960 236109 37 chillingly nouns stratified
+961 236110 37 noncritical distracting chamberlains
+962 236111 37 lithograph mutton creditably
+963 236112 37 spongers bridgeable philosophic
+964 236113 37 parenthood stickers ores
+965 238005 37 posed transcontinental Carleton
+966 238006 37 instruments amateurish tape A
+967 238007 37 filial Gandhian afloat A
+968 238008 37 fixedly stratified goodness A
+969 238009 37 relives chamberlains welcoming
+970 238010 37 Pandora creditably Pinsky FAS
+971 238011 37 watering philosophic halting
+972 238012 37 ungrateful ores bibliography
+973 238013 37 secures Carleton decoding
+974 240401 41 chastisers tape variance A
+975 240402 41 icon afloat allowed A
+976 240901 41 reuniting goodness dire A
+977 240902 41 imagining welcoming dub A
+978 241801 41 abiding Pinsky poisoning
+979 242101 41 omnisciently halting Iraqis A
+980 242102 41 Britannic bibliography heaving
+981 242201 41 scholastics decoding population A
+982 242202 41 mechanics variance bomb A
+983 242501 41 humidly allowed Majorca A
+984 242502 41 masterpiece dire Gershwins
+985 246201 41 however dub explorers
+986 246202 41 Mendelian poisoning libretto A
+987 246203 41 jarred Iraqis occurred
+988 246204 41 scolds heaving Lagos
+989 246205 41 infatuate population rats
+990 246301 41 willed bomb bankruptcies A
+991 246302 41 joyfully Majorca crying
+992 248001 41 Microsoft Gershwins unexpected
+993 248002 41 fibrosities explorers accessed A
+994 248003 41 Baltimorean libretto colorful A
+995 248004 41 equestrian occurred versatility A
+996 248005 41 Goodrich Lagos cosy
+997 248006 41 apish rats Darius A
+998 248007 41 Adlerian bankruptcies mastering A
+999 248008 41 Tropez crying Asiaticizations A
+1000 248009 41 nouns unexpected offerers A
+1001 248010 41 distracting accessed uncles A
+1002 248011 41 mutton colorful sleepwalk
+1003 248012 41 bridgeable versatility Ernestine
+1004 248013 41 stickers cosy checksumming
+1005 248014 41 transcontinental Darius stopped
+1006 248015 41 amateurish mastering sicker
+1007 248016 41 Gandhian Asiaticizations Italianization
+1008 248017 41 stratified offerers alphabetic
+1009 248018 41 chamberlains uncles pharmaceutic
+1010 248019 41 creditably sleepwalk creator
+1011 248020 41 philosophic Ernestine chess
+1012 248021 41 ores checksumming charcoal
+1013 248101 41 Carleton stopped Epiphany A
+1014 248102 41 tape sicker bulldozes A
+1015 248201 41 afloat Italianization Pygmalion A
+1016 248202 41 goodness alphabetic caressing A
+1017 248203 41 welcoming pharmaceutic Palestine A
+1018 248204 41 Pinsky creator regimented A
+1019 248205 41 halting chess scars A
+1020 248206 41 bibliography charcoal realest A
+1021 248207 41 decoding Epiphany diffusing A
+1022 248208 41 variance bulldozes clubroom A
+1023 248209 41 allowed Pygmalion Blythe A
+1024 248210 41 dire caressing ahead
+1025 248211 50 dub Palestine reviver
+1026 250501 34 poisoning regimented retransmitting A
+1027 250502 34 Iraqis scars landslide
+1028 250503 34 heaving realest Eiffel
+1029 250504 34 population diffusing absentee
+1030 250505 34 bomb clubroom aye
+1031 250601 34 Majorca Blythe forked A
+1032 250602 34 Gershwins ahead Peruvianizes
+1033 250603 34 explorers reviver clerked
+1034 250604 34 libretto retransmitting tutor
+1035 250605 34 occurred landslide boulevard
+1036 251001 34 Lagos Eiffel shuttered
+1037 251002 34 rats absentee quotes A
+1038 251003 34 bankruptcies aye Caltech
+1039 251004 34 crying forked Mossberg
+1040 251005 34 unexpected Peruvianizes kept
+1041 251301 34 accessed clerked roundly
+1042 251302 34 colorful tutor features A
+1043 251303 34 versatility boulevard imaginable A
+1044 251304 34 cosy shuttered controller
+1045 251305 34 Darius quotes racial
+1046 251401 34 mastering Caltech uprisings A
+1047 251402 34 Asiaticizations Mossberg narrowed A
+1048 251403 34 offerers kept cannot A
+1049 251404 34 uncles roundly vest
+1050 251405 34 sleepwalk features famine
+1051 251406 34 Ernestine imaginable sugars
+1052 251801 34 checksumming controller exterminated A
+1053 251802 34 stopped racial belays
+1054 252101 34 sicker uprisings Hodges A
+1055 252102 34 Italianization narrowed translatable
+1056 252301 34 alphabetic cannot duality A
+1057 252302 34 pharmaceutic vest recording A
+1058 252303 34 creator famine rouses A
+1059 252304 34 chess sugars poison
+1060 252305 34 charcoal exterminated attitude
+1061 252306 34 Epiphany belays dusted
+1062 252307 34 bulldozes Hodges encompasses
+1063 252308 34 Pygmalion translatable presentation
+1064 252309 34 caressing duality Kantian
+1065 256001 34 Palestine recording imprecision A
+1066 256002 34 regimented rouses saving
+1067 256003 34 scars poison maternal
+1068 256004 34 realest attitude hewed
+1069 256005 34 diffusing dusted kerosene
+1070 258001 34 clubroom encompasses Cubans
+1071 258002 34 Blythe presentation photographers
+1072 258003 34 ahead Kantian nymph A
+1073 258004 34 reviver imprecision bedlam A
+1074 258005 34 retransmitting saving north A
+1075 258006 34 landslide maternal Schoenberg A
+1076 258007 34 Eiffel hewed botany A
+1077 258008 34 absentee kerosene curs
+1078 258009 34 aye Cubans solidification
+1079 258010 34 forked photographers inheritresses
+1080 258011 34 Peruvianizes nymph stiller
+1081 258101 68 clerked bedlam t1 A
+1082 258102 68 tutor north suite A
+1083 258103 34 boulevard Schoenberg ransomer
+1084 258104 68 shuttered botany Willy
+1085 258105 68 quotes curs Rena A
+1086 258106 68 Caltech solidification Seattle A
+1087 258107 68 Mossberg inheritresses relaxes A
+1088 258108 68 kept stiller exclaim
+1089 258109 68 roundly t1 implicated A
+1090 258110 68 features suite distinguish
+1091 258111 68 imaginable ransomer assayed
+1092 258112 68 controller Willy homeowner
+1093 258113 68 racial Rena and
+1094 258201 34 uprisings Seattle stealth
+1095 258202 34 narrowed relaxes coinciding A
+1096 258203 34 cannot exclaim founder A
+1097 258204 34 vest implicated environing
+1098 258205 34 famine distinguish jewelry
+1099 258301 34 sugars assayed lemons A
+1100 258401 34 exterminated homeowner brokenness A
+1101 258402 34 belays and bedpost A
+1102 258403 34 Hodges stealth assurers A
+1103 258404 34 translatable coinciding annoyers
+1104 258405 34 duality founder affixed
+1105 258406 34 recording environing warbling
+1106 258407 34 rouses jewelry seriously
+1107 228123 37 poison lemons boasted
+1108 250606 34 attitude brokenness Chantilly
+1109 208405 37 dusted bedpost Iranizes
+1110 212101 37 encompasses assurers violinist
+1111 218206 37 presentation annoyers extramarital
+1112 150401 37 Kantian affixed spates
+1113 248212 41 imprecision warbling cloakroom
+1114 128026 00 saving seriously gazer
+1115 128024 00 maternal boasted hand
+1116 128027 00 hewed Chantilly tucked
+1117 128025 00 kerosene Iranizes gems
+1118 128109 00 Cubans violinist clinker
+1119 128705 00 photographers extramarital refiner
+1120 126303 00 nymph spates callus
+1121 128308 00 bedlam cloakroom leopards
+1122 128204 00 north gazer comfortingly
+1123 128205 00 Schoenberg hand generically
+1124 128206 00 botany tucked getters
+1125 128207 00 curs gems sexually
+1126 118205 00 solidification clinker spear
+1127 116801 00 inheritresses refiner serums
+1128 116803 00 stiller callus Italianization
+1129 116804 00 t1 leopards attendants
+1130 116802 00 suite comfortingly spies
+1131 128605 00 ransomer generically Anthony
+1132 118308 00 Willy getters planar
+1133 113702 00 Rena sexually cupped
+1134 113703 00 Seattle spear cleanser
+1135 112103 00 relaxes serums commuters
+1136 118009 00 exclaim Italianization honeysuckle
+5136 1118009 00 exclaim Italianization honeysuckle
+1137 138011 00 implicated attendants orphanage
+1138 138010 00 distinguish spies skies
+1139 138012 00 assayed Anthony crushers
+1140 068304 00 homeowner planar Puritan
+1141 078009 00 and cupped squeezer
+1142 108013 00 stealth cleanser bruises
+1143 084004 00 coinciding commuters bonfire
+1144 083402 00 founder honeysuckle Colombo
+1145 084003 00 environing orphanage nondecreasing
+1146 088504 00 jewelry skies innocents
+1147 088005 00 lemons crushers masked
+1148 088007 00 brokenness Puritan file
+1149 088006 00 bedpost squeezer brush
+1150 148025 00 assurers bruises mutilate
+1151 148024 00 annoyers bonfire mommy
+1152 138305 00 affixed Colombo bulkheads
+1153 138306 00 warbling nondecreasing undeclared
+1154 152701 00 seriously innocents displacements
+1155 148505 00 boasted masked nieces
+1156 158003 00 Chantilly file coeducation
+1157 156201 00 Iranizes brush brassy
+1158 156202 00 violinist mutilate authenticator
+1159 158307 00 extramarital mommy Washoe
+1160 158402 00 spates bulkheads penny
+1161 158401 00 cloakroom undeclared Flagler
+1162 068013 00 gazer displacements stoned
+1163 068012 00 hand nieces cranes
+1164 068203 00 tucked coeducation masterful
+1165 088205 00 gems brassy biracial
+1166 068704 00 clinker authenticator steamships
+1167 068604 00 refiner Washoe windmills
+1168 158502 00 callus penny exploit
+1169 123103 00 leopards Flagler riverfront
+1170 148026 00 comfortingly stoned sisterly
+1171 123302 00 generically cranes sharpshoot
+1172 076503 00 getters masterful mittens
+1173 126304 00 sexually biracial interdependency
+1174 068306 00 spear steamships policy
+1175 143504 00 serums windmills unleashing
+1176 160201 00 Italianization exploit pretenders
+1177 148028 00 attendants riverfront overstatements
+1178 148027 00 spies sisterly birthed
+1179 143505 00 Anthony sharpshoot opportunism
+1180 108014 00 planar mittens showroom
+1181 076104 00 cupped interdependency compromisingly
+1182 078106 00 cleanser policy Medicare
+1183 126102 00 commuters unleashing corresponds
+1184 128029 00 honeysuckle pretenders hardware
+1185 128028 00 orphanage overstatements implant
+1186 018410 00 skies birthed Alicia
+1187 128110 00 crushers opportunism requesting
+1188 148506 00 Puritan showroom produced
+1189 123303 00 squeezer compromisingly criticizes
+1190 123304 00 bruises Medicare backer
+1191 068504 00 bonfire corresponds positively
+1192 068305 00 Colombo hardware colicky
+1193 000000 00 nondecreasing implant thrillingly
+1 000001 00 Omaha teethe neat
+2 011401 37 breaking dreaded Steinberg W
+3 011402 37 Romans scholastics jarring
+4 011403 37 intercepted audiology tinily
+drop table t1, t2;
diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result
index 2d6b058d9c5..428b2769fdb 100644
--- a/mysql-test/r/auto_increment.result
+++ b/mysql-test/r/auto_increment.result
@@ -1,5 +1,7 @@
drop table if exists t1;
-create table t1 (a int not null auto_increment,b int, primary key (a)) type=myisam auto_increment=3;
+drop table if exists t2;
+SET SQL_WARNINGS=1;
+create table t1 (a int not null auto_increment,b int, primary key (a)) engine=myisam auto_increment=3;
insert into t1 values (1,1),(NULL,3),(NULL,4);
delete from t1 where a=4;
insert into t1 values (NULL,5),(NULL,6);
@@ -118,7 +120,7 @@ a
1
2
drop table t1;
-create table t1 (a int not null auto_increment primary key) /*!40102 type=heap */;
+create table t1 (a int not null auto_increment primary key) /*!40102 engine=heap */;
insert into t1 values (NULL);
insert into t1 values (-1);
select last_insert_id();
@@ -127,7 +129,215 @@ last_insert_id()
insert into t1 values (NULL);
select * from t1;
a
+1
-1
+2
+drop table t1;
+create table t1 (i tinyint unsigned not null auto_increment primary key);
+insert into t1 set i = 254;
+insert into t1 set i = null;
+select last_insert_id();
+last_insert_id()
+255
+explain extended select last_insert_id();
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select sql_no_cache last_insert_id() AS `last_insert_id()`
+insert into t1 set i = 254;
+ERROR 23000: Duplicate entry '254' for key 1
+select last_insert_id();
+last_insert_id()
+255
+insert into t1 set i = null;
+ERROR 23000: Duplicate entry '255' for key 1
+select last_insert_id();
+last_insert_id()
+0
+drop table t1;
+create table t1 (i tinyint unsigned not null auto_increment, key (i));
+insert into t1 set i = 254;
+insert into t1 set i = null;
+select last_insert_id();
+last_insert_id()
+255
+insert into t1 set i = null;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'i' at row 1
+select last_insert_id();
+last_insert_id()
+255
+drop table t1;
+create table t1 (i tinyint unsigned not null auto_increment primary key, b int, unique (b));
+insert into t1 values (NULL, 10);
+select last_insert_id();
+last_insert_id()
1
+insert into t1 values (NULL, 15);
+select last_insert_id();
+last_insert_id()
2
+insert into t1 values (NULL, 10);
+ERROR 23000: Duplicate entry '10' for key 2
+select last_insert_id();
+last_insert_id()
+0
+drop table t1;
+create table t1(a int auto_increment,b int null,primary key(a));
+SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
+insert into t1(a,b)values(NULL,1);
+insert into t1(a,b)values(200,2);
+insert into t1(a,b)values(0,3);
+insert into t1(b)values(4);
+insert into t1(b)values(5);
+insert into t1(b)values(6);
+insert into t1(b)values(7);
+select * from t1 order by b;
+a b
+1 1
+200 2
+0 3
+201 4
+202 5
+203 6
+204 7
+alter table t1 modify b mediumint;
+select * from t1 order by b;
+a b
+1 1
+200 2
+0 3
+201 4
+202 5
+203 6
+204 7
+create table t2 (a int);
+insert t2 values (1),(2);
+alter table t2 add b int auto_increment primary key;
+select * from t2;
+a b
+1 1
+2 2
+drop table t2;
+delete from t1 where a=0;
+update t1 set a=0 where b=5;
+select * from t1 order by b;
+a b
+1 1
+200 2
+201 4
+0 5
+203 6
+204 7
+delete from t1 where a=0;
+update t1 set a=NULL where b=6;
+Warnings:
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 4
+update t1 set a=300 where b=7;
+SET SQL_MODE='';
+insert into t1(a,b)values(NULL,8);
+insert into t1(a,b)values(400,9);
+insert into t1(a,b)values(0,10);
+insert into t1(b)values(11);
+insert into t1(b)values(12);
+insert into t1(b)values(13);
+insert into t1(b)values(14);
+select * from t1 order by b;
+a b
+1 1
+200 2
+201 4
+0 6
+300 7
+301 8
+400 9
+401 10
+402 11
+403 12
+404 13
+405 14
+delete from t1 where a=0;
+update t1 set a=0 where b=12;
+select * from t1 order by b;
+a b
+1 1
+200 2
+201 4
+300 7
+301 8
+400 9
+401 10
+402 11
+0 12
+404 13
+405 14
+delete from t1 where a=0;
+update t1 set a=NULL where b=13;
+Warnings:
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 9
+update t1 set a=500 where b=14;
+select * from t1 order by b;
+a b
+1 1
+200 2
+201 4
+300 7
+301 8
+400 9
+401 10
+402 11
+0 13
+500 14
+drop table t1;
+create table t1 (a bigint);
+insert into t1 values (1), (2), (3), (NULL), (NULL);
+alter table t1 modify a bigint not null auto_increment primary key;
+select * from t1;
+a
+1
+2
+3
+4
+5
+drop table t1;
+create table t1 (a bigint);
+insert into t1 values (1), (2), (3), (0), (0);
+alter table t1 modify a bigint not null auto_increment primary key;
+select * from t1;
+a
+1
+2
+3
+4
+5
+drop table t1;
+create table t1 (a bigint);
+insert into t1 values (0), (1), (2), (3);
+set sql_mode=NO_AUTO_VALUE_ON_ZERO;
+alter table t1 modify a bigint not null auto_increment primary key;
+set sql_mode= '';
+select * from t1;
+a
+0
+1
+2
+3
+drop table t1;
+create table t1 (a int auto_increment primary key , b int null);
+set sql_mode=NO_AUTO_VALUE_ON_ZERO;
+insert into t1 values (0,1),(1,2),(2,3);
+select * from t1;
+a b
+0 1
+1 2
+2 3
+set sql_mode= '';
+alter table t1 modify b varchar(255);
+insert into t1 values (0,4);
+select * from t1;
+a b
+0 1
+1 2
+2 3
+3 4
drop table t1;
diff --git a/mysql-test/r/backup.result b/mysql-test/r/backup.result
index 0e0a87172f2..e53c3c3eb55 100644
--- a/mysql-test/r/backup.result
+++ b/mysql-test/r/backup.result
@@ -1,4 +1,5 @@
set SQL_LOG_BIN=0;
+drop table if exists t1, t2, t3;
create table t4(n int);
backup table t4 to '../bogus';
Table Op Msg_type Msg_text
diff --git a/mysql-test/r/bdb-alter-table-1.result b/mysql-test/r/bdb-alter-table-1.result
index 095d89355ad..0401002f1f3 100644
--- a/mysql-test/r/bdb-alter-table-1.result
+++ b/mysql-test/r/bdb-alter-table-1.result
@@ -1,5 +1,5 @@
drop table if exists t1;
-create table t1(objid BIGINT not null, tablename varchar(64), oid BIGINT not null, test BIGINT, PRIMARY KEY (objid), UNIQUE(tablename)) type=BDB;
+create table t1(objid BIGINT not null, tablename varchar(64), oid BIGINT not null, test BIGINT, PRIMARY KEY (objid), UNIQUE(tablename)) engine=BDB;
insert into t1 values(1, 't1',4,9);
insert into t1 values(2, 'metatable',1,9);
insert into t1 values(3, 'metaindex',1,9 );
diff --git a/mysql-test/r/bdb-crash.result b/mysql-test/r/bdb-crash.result
index 16e51c61504..778890e85e3 100644
--- a/mysql-test/r/bdb-crash.result
+++ b/mysql-test/r/bdb-crash.result
@@ -14,7 +14,7 @@ ChargeTimeStamp varchar(20),
PRIMARY KEY (ChargeID),
KEY ServiceID (ServiceID),
KEY ChargeDate (ChargeDate)
-) type=BDB;
+) engine=BDB;
BEGIN;
INSERT INTO t1
VALUES(NULL,1,'2001-03-01',1,1,1,'New',NULL,NULL,'now');
diff --git a/mysql-test/r/bdb-deadlock.result b/mysql-test/r/bdb-deadlock.result
index 55b3d3ea2a5..9394c90ff00 100644
--- a/mysql-test/r/bdb-deadlock.result
+++ b/mysql-test/r/bdb-deadlock.result
@@ -1,6 +1,6 @@
drop table if exists t1,t2;
-create table t1 (id integer, x integer) type=BDB;
-create table t2 (id integer, x integer) type=BDB;
+create table t1 (id integer, x integer) engine=BDB;
+create table t2 (id integer, x integer) engine=BDB;
insert into t1 values(0, 0);
insert into t2 values(0, 0);
set autocommit=0;
@@ -9,7 +9,7 @@ set autocommit=0;
update t2 set x = 1 where id = 0;
select x from t1 where id = 0;
select x from t2 where id = 0;
-Deadlock found when trying to get lock; Try restarting transaction
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
commit;
x
1
diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result
index 684efc3ef1b..6da3dbb929d 100644
--- a/mysql-test/r/bdb.result
+++ b/mysql-test/r/bdb.result
@@ -1,5 +1,5 @@
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8;
-create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=bdb;
+create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=bdb;
insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt');
select id, code, name from t1 order by id;
id code name
@@ -38,7 +38,7 @@ level tinyint(4) DEFAULT '0' NOT NULL,
PRIMARY KEY (id),
KEY parent_id (parent_id),
KEY level (level)
-) type=bdb;
+) engine=bdb;
INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2);
update t1 set parent_id=parent_id+100;
select * from t1 where parent_id=102;
@@ -48,7 +48,7 @@ id parent_id level
15 102 2
update t1 set id=id+1000;
update t1 set id=1024 where id=1009;
-Duplicate entry '1024' for key 1
+ERROR 23000: Duplicate entry '1024' for key 1
select * from t1;
id parent_id level
1001 100 0
@@ -139,14 +139,14 @@ id parent_id level
1010 102 2
1015 102 2
explain select level from t1 where level=1;
-table type possible_keys key key_len ref rows Extra
-t1 ref level level 1 const 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const 1 Using where; Using index
explain select level,id from t1 where level=1;
-table type possible_keys key key_len ref rows Extra
-t1 ref level level 1 const 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const 1 Using where; Using index
explain select level,id,parent_id from t1 where level=1;
-table type possible_keys key key_len ref rows Extra
-t1 ref level level 1 const 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const 1 Using where
select level,id from t1 where level=1;
level id
1 1002
@@ -176,7 +176,7 @@ CREATE TABLE t1 (
gesuchnr int(11) DEFAULT '0' NOT NULL,
benutzer_id int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (gesuchnr,benutzer_id)
-) type=BDB;
+) engine=BDB;
replace into t1 (gesuchnr,benutzer_id) values (2,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
@@ -185,14 +185,14 @@ gesuchnr benutzer_id
1 1
2 1
drop table t1;
-create table t1 (id int not null primary key, x int not null, key (x)) type=bdb;
+create table t1 (id int not null primary key, x int not null, key (x)) engine=bdb;
insert into t1 (id, x) values (1, 1);
replace into t1 (id, x) values (1, 2);
select * from t1;
id x
1 2
drop table t1;
-create table t1 (a int) type=bdb;
+create table t1 (a int) engine=bdb;
insert into t1 values (1), (2);
optimize table t1;
Table Op Msg_type Msg_text
@@ -203,9 +203,9 @@ a
2
check table t1;
Table Op Msg_type Msg_text
-test.t1 check error The handler for the table doesn't support check
+test.t1 check note The storage engine for the table doesn't support check
drop table t1;
-create table t1 (a int,b varchar(20)) type=bdb;
+create table t1 (a int,b varchar(20)) engine=bdb;
insert into t1 values (1,""), (2,"testing");
delete from t1 where a = 1;
select * from t1;
@@ -220,13 +220,13 @@ show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 skr 1 a A 3 NULL NULL YES BTREE
drop table t1;
-create table t1 (a int,b varchar(20),key(a)) type=bdb;
+create table t1 (a int,b varchar(20),key(a)) engine=bdb;
insert into t1 values (1,""), (2,"testing");
select * from t1 where a = 1;
a b
1
drop table t1;
-create table t1 (a char(10) not null, b int not null auto_increment, primary key(a,b)) type=BDB;
+create table t1 (a char(10) not null, b int not null auto_increment, primary key(a,b)) engine=BDB;
insert into t1 values ("a",1),("b",2),("a",2),("c",1);
insert into t1 values ("a",NULL),("b",NULL),("c",NULL),("e",NULL);
insert into t1 (a) values ("a"),("b"),("c"),("d");
@@ -256,7 +256,7 @@ select count(*) from t1;
count(*)
16
drop table t1;
-create table t1 (n int not null primary key) type=bdb;
+create table t1 (n int not null primary key) engine=bdb;
set autocommit=0;
insert into t1 values (4);
rollback;
@@ -270,7 +270,7 @@ n after commit
commit;
insert into t1 values (5);
insert into t1 values (4);
-Duplicate entry '4' for key 1
+ERROR 23000: Duplicate entry '4' for key 1
commit;
select n, "after commit" from t1;
n after commit
@@ -279,7 +279,7 @@ n after commit
set autocommit=1;
insert into t1 values (6);
insert into t1 values (4);
-Duplicate entry '4' for key 1
+ERROR 23000: Duplicate entry '4' for key 1
select n from t1;
n
4
@@ -287,7 +287,7 @@ n
6
rollback;
drop table t1;
-create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) type=BDB;
+create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) engine=BDB;
begin;
insert into t1 values(1,'hamdouni');
select id as afterbegin_id,nom as afterbegin_nom from t1;
@@ -306,10 +306,10 @@ select id as afterrollback_id,nom as afterrollback_nom from t1;
afterrollback_id afterrollback_nom
set autocommit=1;
drop table t1;
-CREATE TABLE t1 (id char(8) not null primary key, val int not null) type=bdb;
+CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=bdb;
insert into t1 values ('pippo', 12);
insert into t1 values ('pippo', 12);
-Duplicate entry 'pippo' for key 1
+ERROR 23000: Duplicate entry 'pippo' for key 1
delete from t1;
delete from t1 where id = 'pippo';
select * from t1;
@@ -327,13 +327,13 @@ select * from t1;
id val
drop table t1;
set autocommit=1;
-CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) TYPE=BDB;
+CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) ENGINE=BDB;
INSERT INTO t1 VALUES (1, 'Jochen');
select * from t1;
ID NAME
1 Jochen
drop table t1;
-CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) TYPE=BDB;
+CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) ENGINE=BDB;
set autocommit=0;
INSERT INTO t1 SET _userid='marc@anyware.co.uk';
COMMIT;
@@ -352,7 +352,7 @@ phone varchar(100),
ref_email varchar(100) DEFAULT '' NOT NULL,
detail varchar(200),
PRIMARY KEY (user_id,ref_email)
-)type=bdb;
+)engine=bdb;
INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar');
select * from t1 where user_id=10292;
user_id name phone ref_email detail
@@ -390,7 +390,7 @@ t1 1 a 1 a A NULL NULL NULL BTREE
t1 1 a_2 1 a A NULL NULL NULL BTREE
drop table t1;
create table t1 (col1 int not null, col2 char(4) not null, primary key(col1));
-alter table t1 type=BDB;
+alter table t1 engine=BDB;
insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4');
select * from t1;
col1 col2
@@ -424,8 +424,8 @@ col1 col2 co3
4 7 0
5 2 0
drop table t1;
-create table t1 (a int not null , b int, primary key (a)) type = BDB;
-create table t2 (a int not null , b int, primary key (a)) type = myisam;
+create table t1 (a int not null , b int, primary key (a)) engine = BDB;
+create table t2 (a int not null , b int, primary key (a)) engine = myisam;
insert into t1 VALUES (1,3) , (2,3), (3,3);
select * from t1;
a b
@@ -460,13 +460,13 @@ email varchar(64) DEFAULT '' NOT NULL,
passwd varchar(32) binary DEFAULT '' NOT NULL,
PRIMARY KEY (id),
UNIQUE ggid (ggid)
-) TYPE=BDB;
+) ENGINE=BDB;
insert into t1 (ggid,passwd) values ('test1','xxx');
insert into t1 (ggid,passwd) values ('test2','yyy');
insert into t1 (ggid,passwd) values ('test2','this will fail');
-Duplicate entry 'test2' for key 2
+ERROR 23000: Duplicate entry 'test2' for key 2
insert into t1 (ggid,id) values ('this will fail',1);
-Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 1
select * from t1 where ggid='test1';
id ggid email passwd
1 test1 xxx
@@ -479,7 +479,7 @@ id ggid email passwd
replace into t1 (ggid,id) values ('this will work',1);
replace into t1 (ggid,passwd) values ('test2','this will work');
update t1 set id=100,ggid='test2' where id=1;
-Duplicate entry 'test2' for key 2
+ERROR 23000: Duplicate entry 'test2' for key 2
select * from t1;
id ggid email passwd
1 this will work
@@ -502,7 +502,7 @@ access_time time,
approved datetime,
dummy_primary_key int(11) NOT NULL auto_increment,
PRIMARY KEY (dummy_primary_key)
-) TYPE=BDB;
+) ENGINE=BDB;
INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1);
INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2);
INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3);
@@ -523,7 +523,7 @@ level tinyint(4) DEFAULT '0' NOT NULL,
KEY (id),
KEY parent_id (parent_id),
KEY level (level)
-) type=bdb;
+) engine=bdb;
INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1);
INSERT INTO t1 values (179,5,2);
update t1 set parent_id=parent_id+100;
@@ -624,8 +624,8 @@ id parent_id level
1025 102 2
1016 102 2
explain select level from t1 where level=1;
-table type possible_keys key key_len ref rows Extra
-t1 ref level level 1 const 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const 1 Using where; Using index
select level,id from t1 where level=1;
level id
1 1004
@@ -697,7 +697,7 @@ sca_sdesc varchar(50),
sca_sch_desc varchar(16),
PRIMARY KEY (sca_code, cat_code, lan_code),
INDEX sca_pic (sca_pic)
-) type = bdb ;
+) engine = bdb ;
INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
select count(*) from t1 where sca_code = 'PD';
count(*)
@@ -730,7 +730,7 @@ update t1 set sca_pic="test" where sca_pic is null;
delete from t1 where sca_code='pd';
drop table t1;
set @a:=now();
-CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) type=bdb;
+CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=bdb;
insert into t1 (a) values(1),(2),(3);
select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a;
a
@@ -745,7 +745,7 @@ a
5
drop table t1;
flush logs;
-create table t1 (b blob, i int, key (b(100)), key (i), key (i, b(20))) type=bdb;
+create table t1 (b blob, i int, key (b(100)), key (i), key (i, b(20))) engine=bdb;
insert into t1 values ('this is a blob', 1), (null, -1), (null, null),("",1),("",2),("",3);
select b from t1 where b = 'this is a blob';
b
@@ -774,7 +774,7 @@ updated 1
2
3
drop table t1;
-create table t1 (a varchar(100) not null, primary key(a), b int not null) type=bdb;
+create table t1 (a varchar(100) not null, primary key(a), b int not null) engine=bdb;
insert into t1 values("hello",1),("world",2);
select * from t1 order by b desc;
a b
@@ -787,7 +787,7 @@ show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 0 PRIMARY 1 a A 2 NULL NULL BTREE
drop table t1;
-create table t1 (i int, j int )TYPE=BDB;
+create table t1 (i int, j int )ENGINE=BDB;
insert into t1 values (1,2);
select * from t1 where i=1 and j=2;
i j
@@ -797,7 +797,6 @@ select * from t1 where i=1 and j=2;
i j
1 2
drop table t1;
-drop table if exists t1, t2, t3, t4, t5, t6, t7;
create table t1
(
branch_id int auto_increment primary key,
@@ -805,8 +804,7 @@ branch_name varchar(255) not null,
branch_active int not null default 1,
unique branch_name(branch_name),
index branch_active(branch_active)
-) type=bdb;
-drop table if exists t2 ;
+) engine=bdb;
create table t2
(
target_id int auto_increment primary key,
@@ -814,8 +812,7 @@ target_name varchar(255) not null,
target_active int not null default 1,
unique target_name(target_name),
index target_active(target_active)
-) type=bdb;
-drop table if exists t3 ;
+) engine=bdb;
create table t3
(
platform_id int auto_increment primary key,
@@ -823,8 +820,7 @@ platform_name varchar(255) not null,
platform_active int not null default 1,
unique platform_name(platform_name),
index platform_active(platform_active)
-) type=bdb;
-drop table if exists t4 ;
+) engine=bdb;
create table t4
(
product_id int auto_increment primary key,
@@ -833,8 +829,7 @@ version_file varchar(255) not null,
product_active int not null default 1,
unique product_name(product_name),
index product_active(product_active)
-) type=bdb;
-drop table if exists t5 ;
+) engine=bdb;
create table t5
(
product_file_id int auto_increment primary key,
@@ -846,8 +841,7 @@ module_name varchar(255) not null,
file_included int not null default 1,
unique product_file(product_id,file_name),
index file_included(file_included)
-) type=bdb;
-drop table if exists t6 ;
+) engine=bdb;
create table t6
(
file_platform_id int auto_increment primary key,
@@ -859,8 +853,7 @@ build_filename varchar(255) not null,
/* default filename in the build archive */
archive_filename varchar(255) not null,
unique file_platform(product_file_id,platform_id,branch_id)
-) type=bdb;
-drop table if exists t8 ;
+) engine=bdb;
create table t8
(
archive_id int auto_increment primary key,
@@ -871,8 +864,7 @@ product_id int not null,
status_id int not null default 1,
unique archive(branch_id,target_id,platform_id,product_id),
index status_id(status_id)
-) type=bdb;
-drop table if exists t7 ;
+) engine=bdb;
create table t7
(
build_id int auto_increment primary key,
@@ -885,7 +877,7 @@ build_tag varchar(255) not null,
/* path relative to the build archive root, e.g. 'current' */
build_path text not null,
unique build(branch_id,target_id,build_number)
-) type=bdb;
+) engine=bdb;
insert into t1 (branch_name)
values ('RealMedia');
insert into t1 (branch_name)
@@ -989,7 +981,7 @@ CREATE TABLE t1 (
a tinytext NOT NULL,
b tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (a(32),b)
-) TYPE=BDB;
+) ENGINE=BDB;
INSERT INTO t1 VALUES ('a',1),('a',2);
SELECT * FROM t1 WHERE a='a' AND b=2;
a b
@@ -1006,17 +998,17 @@ CREATE TABLE t1 (
a int3 unsigned NOT NULL,
b int1 unsigned NOT NULL,
UNIQUE (a, b)
-) TYPE = BDB;
+) ENGINE = BDB;
INSERT INTO t1 VALUES (1, 1);
SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1;
MIN(B) MAX(b)
1 1
drop table t1;
-create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=bdb;
+create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=bdb;
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
LOCK TABLES t1 WRITE;
insert into t1 values (99,1,2,'D'),(1,1,2,'D');
-Duplicate entry '1-1' for key 1
+ERROR 23000: Duplicate entry '1-1' for key 1
select id from t1;
id
0
@@ -1029,12 +1021,12 @@ id
2
UNLOCK TABLES;
DROP TABLE t1;
-create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=bdb;
+create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=bdb;
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
LOCK TABLES t1 WRITE;
begin;
insert into t1 values (99,1,2,'D'),(1,1,2,'D');
-Duplicate entry '1-1' for key 1
+ERROR 23000: Duplicate entry '1-1' for key 1
select id from t1;
id
0
@@ -1050,15 +1042,14 @@ id id3
100 2
UNLOCK TABLES;
DROP TABLE t1;
-CREATE TABLE t1 (SYAIN_NO char(5) NOT NULL default '', KINMU_DATE char(6) NOT NULL default '', PRIMARY KEY (SYAIN_NO,KINMU_DATE)) TYPE=BerkeleyDB;
-CREATE TABLE t2 ( SYAIN_NO char(5) NOT NULL default '',STR_DATE char(8) NOT NULL default '',PRIMARY KEY (SYAIN_NO,STR_DATE) ) TYPE=BerkeleyDB;
+CREATE TABLE t1 (SYAIN_NO char(5) NOT NULL default '', KINMU_DATE char(6) NOT NULL default '', PRIMARY KEY (SYAIN_NO,KINMU_DATE)) ENGINE=BerkeleyDB;
+CREATE TABLE t2 ( SYAIN_NO char(5) NOT NULL default '',STR_DATE char(8) NOT NULL default '',PRIMARY KEY (SYAIN_NO,STR_DATE) ) ENGINE=BerkeleyDB;
select T1.KINMU_DATE from t1 T1 ,t2 T2 where T1.SYAIN_NO = '12345' and T1.KINMU_DATE = '200106' and T2.SYAIN_NO = T1.SYAIN_NO;
KINMU_DATE
select T1.KINMU_DATE from t1 T1 ,t2 T2 where T1.SYAIN_NO = '12345' and T1.KINMU_DATE = '200106' and T2.SYAIN_NO = T1.SYAIN_NO;
KINMU_DATE
DROP TABLE t1,t2;
-drop table if exists t1;
-create table t1 (a int(11) not null, b int(11) not null, unique (a,b)) type=bdb;
+create table t1 (a int(11) not null, b int(11) not null, unique (a,b)) engine=bdb;
insert into t1 values (1,1), (1,2);
select * from t1 where a = 1;
a b
@@ -1075,9 +1066,9 @@ a b
1 1
1 2
drop table t1;
-create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=bdb;
+create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=bdb;
insert into t1 values (0,0,0,'ABCDEFGHIJ');
-create table t2 (id int NOT NULL,primary key (id)) type=bdb;
+create table t2 (id int NOT NULL,primary key (id)) engine=bdb;
LOCK TABLES t1 WRITE, t2 WRITE;
insert into t2 values(1);
SELECT t1.* FROM t1 WHERE id IN (1);
@@ -1087,13 +1078,13 @@ id id2 id3 dummy1
NULL NULL NULL NULL
delete from t1 where id3 >= 0 and id3 <= 0;
drop table t1,t2;
-CREATE TABLE t1 (i varchar(48) NOT NULL default '', p varchar(255) default NULL,s varchar(48) NOT NULL default '', PRIMARY KEY (i), UNIQUE(p,s)) TYPE=BDB;
+CREATE TABLE t1 (i varchar(48) NOT NULL default '', p varchar(255) default NULL,s varchar(48) NOT NULL default '', PRIMARY KEY (i), UNIQUE(p,s)) ENGINE=BDB;
INSERT INTO t1 VALUES ('00000000-e6c4ddeaa6-003b8-83458387','programs/xxxxxxxx.wmv','00000000-e6c4ddeb32-003bc-83458387');
SELECT * FROM t1 WHERE p='programs/xxxxxxxx.wmv';
i p s
00000000-e6c4ddeaa6-003b8-83458387 programs/xxxxxxxx.wmv 00000000-e6c4ddeb32-003bc-83458387
drop table t1;
-CREATE TABLE t1 ( STR_DATE varchar(8) NOT NULL default '',INFO_NOTE varchar(200) default NULL,PRIMARY KEY (STR_DATE) ) TYPE=BerkeleyDB;
+CREATE TABLE t1 ( STR_DATE varchar(8) NOT NULL default '',INFO_NOTE varchar(200) default NULL,PRIMARY KEY (STR_DATE) ) ENGINE=BerkeleyDB;
select INFO_NOTE from t1 where STR_DATE = '20010610';
INFO_NOTE
select INFO_NOTE from t1 where STR_DATE < '20010610';
@@ -1101,8 +1092,8 @@ INFO_NOTE
select INFO_NOTE from t1 where STR_DATE > '20010610';
INFO_NOTE
drop table t1;
-create table t1 (a int not null, b int, primary key (a)) type =bdb;
-create table t2 (a int not null, b int, primary key (a)) type =bdb;
+create table t1 (a int not null, b int, primary key (a)) engine =bdb;
+create table t2 (a int not null, b int, primary key (a)) engine =bdb;
insert into t1 values (2, 3),(1, 7),(10, 7);
insert into t2 values (2, 3),(1, 7),(10, 7);
select * from t1;
@@ -1123,7 +1114,7 @@ a b
select * from t2;
a b
drop table t1,t2;
-create table t1 (x int not null, index(x)) type=bdb;
+create table t1 (x int not null, index(x)) engine=bdb;
insert into t1 values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
select * from t1 where x <= 10 and x >= 7;
x
@@ -1154,37 +1145,37 @@ x
7
6
drop table t1;
-create table t1 ( c char(8) not null ) type=bdb;
+create table t1 ( c char(8) not null ) engine=bdb;
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
alter table t1 add b char(8) not null;
alter table t1 add a char(8) not null;
alter table t1 add primary key (a,b,c);
update t1 set a=c, b=c;
-create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) type=bdb;
+create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=bdb;
insert into t2 select * from t1;
delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
drop table t1,t2;
create table t1 (a char(10), key(a), b int not null, key(b)) engine=bdb;
insert into t1 values ('a',1),('A',2);
explain select a from t1;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 2
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2
select a from t1;
a
a
A
explain select b from t1;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL b 4 NULL 2 Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL b 4 NULL 2 Using index
select b from t1;
b
1
2
alter table t1 modify a char(10) binary;
explain select a from t1;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL a 11 NULL 2 Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL a 11 NULL 2 Using index
select a from t1;
a
A
@@ -1224,3 +1215,72 @@ bb b--b 2 2
ccc c--c 2 2
dddd d--d 2 2
drop table t1;
+set autocommit=0;
+create table t1(b varchar(30)) engine=bdb;
+insert into t1 values ('one');
+commit;
+select b FROM t1 outer_table where
+exists (select 'two' from t1 where 'two' = outer_table.b);
+b
+drop table t1;
+set autocommit=1;
+create table t1(a int primary key, b varchar(30)) engine=bdb;
+insert into t1 values (1,'one'), (2,'two'), (3,'three'), (4,'four');
+create table t2 like t1;
+insert t2 select * from t1;
+select a from t1 where a in (select a from t2);
+a
+1
+2
+3
+4
+delete from t2;
+insert into t2 (a, b)
+select a, b from t1 where (a, b) in (select a, b from t1);
+select * from t2;
+a b
+1 one
+2 two
+3 three
+4 four
+drop table t1, t2;
+create table t1 (a int, b varchar(30), primary key(a)) engine = bdb;
+insert into t1 values (1,'one');
+commit;
+truncate t1;
+select * from t1;
+a b
+drop table t1;
+SET NAMES utf8;
+create table t1 (a varchar(255) character set utf8) engine=bdb;
+set @a:= convert(repeat(_latin1 0xFF, 255) using utf8);
+insert into t1 values (@a);
+select a, length(a), char_length(a) from t1;
+a length(a) char_length(a)
+ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ 510 255
+drop table t1;
+SET NAMES latin1;
+CREATE TABLE t1 (
+id int unsigned NOT NULL auto_increment,
+list_id smallint unsigned NOT NULL,
+term TEXT NOT NULL,
+PRIMARY KEY(id),
+INDEX(list_id, term(4))
+) ENGINE=BDB CHARSET=utf8;
+INSERT INTO t1 SET list_id = 1, term = "letterc";
+INSERT INTO t1 SET list_id = 1, term = "letterb";
+INSERT INTO t1 SET list_id = 1, term = "lettera";
+INSERT INTO t1 SET list_id = 1, term = "letterd";
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterc");
+id
+1
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterb");
+id
+2
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "lettera");
+id
+3
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd");
+id
+4
+DROP TABLE t1;
diff --git a/mysql-test/r/bdb_cache.result b/mysql-test/r/bdb_cache.result
index e5c6923162a..218fd489c6a 100644
--- a/mysql-test/r/bdb_cache.result
+++ b/mysql-test/r/bdb_cache.result
@@ -1,7 +1,7 @@
drop table if exists t1, t2, t3;
flush status;
set autocommit=0;
-create table t1 (a int not null) type=bdb;
+create table t1 (a int not null) engine=bdb;
insert into t1 values (1),(2),(3);
select * from t1;
a
@@ -15,7 +15,7 @@ drop table t1;
commit;
set autocommit=1;
begin;
-create table t1 (a int not null) type=bdb;
+create table t1 (a int not null) engine=bdb;
insert into t1 values (1),(2),(3);
select * from t1;
a
@@ -27,9 +27,9 @@ Variable_name Value
Qcache_queries_in_cache 0
drop table t1;
commit;
-create table t1 (a int not null) type=bdb;
-create table t2 (a int not null) type=bdb;
-create table t3 (a int not null) type=bdb;
+create table t1 (a int not null) engine=bdb;
+create table t2 (a int not null) engine=bdb;
+create table t3 (a int not null) engine=bdb;
insert into t1 values (1),(2);
insert into t2 values (1),(2);
insert into t3 values (1),(2);
@@ -98,3 +98,4 @@ commit;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
+drop table if exists t1, t2, t3;
diff --git a/mysql-test/r/bench_count_distinct.result b/mysql-test/r/bench_count_distinct.result
index d414e8e466e..fcc0c0948b3 100644
--- a/mysql-test/r/bench_count_distinct.result
+++ b/mysql-test/r/bench_count_distinct.result
@@ -3,4 +3,9 @@ create table t1(n int not null, key(n)) delay_key_write = 1;
select count(distinct n) from t1;
count(distinct n)
100
+explain extended select count(distinct n) from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL n 4 NULL 200 Using index
+Warnings:
+Note 1003 select count(distinct test.t1.n) AS `count(distinct n)` from test.t1
drop table t1;
diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result
index 308adc881f2..4c70e72bdfb 100644
--- a/mysql-test/r/bigint.result
+++ b/mysql-test/r/bigint.result
@@ -1,11 +1,12 @@
+drop table if exists t1;
select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296;
-0 256 00000000000000065536 2147483647 -2147483648 2147483648 +4294967296
+0 256 00000000000000065536 2147483647 -2147483648 2147483648 4294967296
0 256 65536 2147483647 -2147483648 2147483648 4294967296
select 9223372036854775807,-009223372036854775808;
9223372036854775807 -009223372036854775808
9223372036854775807 -9223372036854775808
select +9999999999999999999,-9999999999999999999;
-+9999999999999999999 -9999999999999999999
+9999999999999999999 -9999999999999999999
9999999999999999999 -10000000000000000000
select cast(9223372036854775808 as unsigned)+1;
cast(9223372036854775808 as unsigned)+1
@@ -13,7 +14,9 @@ cast(9223372036854775808 as unsigned)+1
select 9223372036854775808+1;
9223372036854775808+1
9223372036854775809
-drop table if exists t1;
+select -(0-3),round(-(0-3)), round(9999999999999999999);
+-(0-3) round(-(0-3)) round(9999999999999999999)
+3 3 10000000000000000000
create table t1 (a bigint unsigned not null, primary key(a));
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
select * from t1;
@@ -81,3 +84,6 @@ quantity
10000000000000000000
10000000000000000000
drop table t1;
+SELECT '0x8000000000000001'+0;
+'0x8000000000000001'+0
+0
diff --git a/mysql-test/r/binary.result b/mysql-test/r/binary.result
index 054918e8df3..5b5f673b071 100644
--- a/mysql-test/r/binary.result
+++ b/mysql-test/r/binary.result
@@ -45,30 +45,35 @@ name
drop table t1,t2;
create table t1 (a char(10) not null, b char(10) binary not null,key (a), key(b));
insert into t1 values ("hello ","hello "),("hello2 ","hello2 ");
-select * from t1 where a="hello";
-a b
-hello hello
-select * from t1 where a="hello ";
-a b
-hello hello
-select * from t1 ignore index (a) where a="hello ";
-a b
-hello hello
-select * from t1 where b="hello";
-a b
-hello hello
-select * from t1 where b="hello ";
-a b
-hello hello
-select * from t1 ignore index (b) where b="hello ";
-a b
+select concat("-",a,"-",b,"-") from t1 where a="hello";
+concat("-",a,"-",b,"-")
+-hello-hello-
+select concat("-",a,"-",b,"-") from t1 where a="hello ";
+concat("-",a,"-",b,"-")
+-hello-hello-
+select concat("-",a,"-",b,"-") from t1 ignore index (a) where a="hello ";
+concat("-",a,"-",b,"-")
+-hello-hello-
+select concat("-",a,"-",b,"-") from t1 where b="hello";
+concat("-",a,"-",b,"-")
+-hello-hello-
+select concat("-",a,"-",b,"-") from t1 where b="hello ";
+concat("-",a,"-",b,"-")
+-hello-hello-
+select concat("-",a,"-",b,"-") from t1 ignore index (b) where b="hello ";
+concat("-",a,"-",b,"-")
+-hello-hello-
alter table t1 modify b tinytext not null, drop key b, add key (b(100));
-select * from t1 where b="hello ";
-a b
-hello hello
-select * from t1 ignore index (b) where b="hello ";
-a b
-hello hello
+select concat("-",a,"-",b,"-") from t1;
+concat("-",a,"-",b,"-")
+-hello-hello-
+-hello2-hello2-
+select concat("-",a,"-",b,"-") from t1 where b="hello ";
+concat("-",a,"-",b,"-")
+-hello-hello-
+select concat("-",a,"-",b,"-") from t1 ignore index (b) where b="hello ";
+concat("-",a,"-",b,"-")
+-hello-hello-
drop table t1;
create table t1 (b char(8));
insert into t1 values(NULL);
@@ -80,6 +85,37 @@ NULL
select b from t1 having binary b like '';
b
drop table t1;
+create table t1 (a char(15) binary, b binary(15));
+insert into t1 values ('aaa','bbb'),('AAA','BBB');
+select upper(a),upper(b) from t1;
+upper(a) upper(b)
+AAA bbb
+AAA BBB
+select lower(a),lower(b) from t1;
+lower(a) lower(b)
+aaa bbb
+aaa BBB
+select * from t1 where upper(a)='AAA';
+a b
+aaa bbb
+AAA BBB
+select * from t1 where lower(a)='aaa';
+a b
+aaa bbb
+AAA BBB
+select * from t1 where upper(b)='BBB';
+a b
+AAA BBB
+select * from t1 where lower(b)='bbb';
+a b
+aaa bbb
+select charset(a), charset(b), charset(binary 'ccc') from t1 limit 1;
+charset(a) charset(b) charset(binary 'ccc')
+latin1 binary binary
+select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1;
+collation(a) collation(b) collation(binary 'ccc')
+latin1_bin binary binary
+drop table t1;
create table t1( firstname char(20), lastname char(20));
insert into t1 values ("john","doe"),("John","Doe");
select * from t1 where firstname='john' and firstname like binary 'john';
@@ -98,3 +134,10 @@ select * from t1 where firstname='john' and firstname like binary 'John';
firstname lastname
John Doe
drop table t1;
+create table t1 (a binary);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` binary(1) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
diff --git a/mysql-test/r/bool.result b/mysql-test/r/bool.result
index cb82c6baa0f..a054eceec0c 100644
--- a/mysql-test/r/bool.result
+++ b/mysql-test/r/bool.result
@@ -42,14 +42,10 @@ SELECT * FROM t1 WHERE a=2 OR (NULL AND (@a:=@a+1));
a
SELECT * FROM t1 WHERE NOT(a=2 OR (NULL AND (@b:=@b+1)));
a
-SELECT @a, @b;
-@a @b
-0 6
DROP TABLE t1;
-drop table if exists t;
-create table t(a int, b int);
-insert into t values(null, null), (0, null), (1, null), (null, 0), (null, 1), (0, 0), (0, 1), (1, 0), (1, 1);
-select ifnull(A, 'N') as A, ifnull(B, 'N') as B, ifnull(not A, 'N') as nA, ifnull(not B, 'N') as nB, ifnull(A and B, 'N') as AB, ifnull(not (A and B), 'N') as `n(AB)`, ifnull((not A or not B), 'N') as nAonB, ifnull(A or B, 'N') as AoB, ifnull(not(A or B), 'N') as `n(AoB)`, ifnull(not A and not B, 'N') as nAnB from t;
+create table t1 (a int, b int);
+insert into t1 values(null, null), (0, null), (1, null), (null, 0), (null, 1), (0, 0), (0, 1), (1, 0), (1, 1);
+select ifnull(A, 'N') as A, ifnull(B, 'N') as B, ifnull(not A, 'N') as nA, ifnull(not B, 'N') as nB, ifnull(A and B, 'N') as AB, ifnull(not (A and B), 'N') as `n(AB)`, ifnull((not A or not B), 'N') as nAonB, ifnull(A or B, 'N') as AoB, ifnull(not(A or B), 'N') as `n(AoB)`, ifnull(not A and not B, 'N') as nAnB from t1;
A B nA nB AB n(AB) nAonB AoB n(AoB) nAnB
N N N N N N N N N N
0 N 1 N 0 1 1 N N N
@@ -60,7 +56,7 @@ N 1 N 0 N N N 1 0 0
0 1 1 0 0 1 1 1 0 0
1 0 0 1 0 1 1 1 0 0
1 1 0 0 1 0 0 1 0 0
-select ifnull(A=1, 'N') as A, ifnull(B=1, 'N') as B, ifnull(not (A=1), 'N') as nA, ifnull(not (B=1), 'N') as nB, ifnull((A=1) and (B=1), 'N') as AB, ifnull(not ((A=1) and (B=1)), 'N') as `n(AB)`, ifnull((not (A=1) or not (B=1)), 'N') as nAonB, ifnull((A=1) or (B=1), 'N') as AoB, ifnull(not((A=1) or (B=1)), 'N') as `n(AoB)`, ifnull(not (A=1) and not (B=1), 'N') as nAnB from t;
+select ifnull(A=1, 'N') as A, ifnull(B=1, 'N') as B, ifnull(not (A=1), 'N') as nA, ifnull(not (B=1), 'N') as nB, ifnull((A=1) and (B=1), 'N') as AB, ifnull(not ((A=1) and (B=1)), 'N') as `n(AB)`, ifnull((not (A=1) or not (B=1)), 'N') as nAonB, ifnull((A=1) or (B=1), 'N') as AoB, ifnull(not((A=1) or (B=1)), 'N') as `n(AoB)`, ifnull(not (A=1) and not (B=1), 'N') as nAnB from t1;
A B nA nB AB n(AB) nAonB AoB n(AoB) nAnB
N N N N N N N N N N
0 N 1 N 0 1 1 N N N
@@ -71,4 +67,4 @@ N 1 N 0 N N N 1 0 0
0 1 1 0 0 1 1 1 0 0
1 0 0 1 0 1 1 1 0 0
1 1 0 0 1 0 0 1 0 0
-drop table t;
+drop table t1;
diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result
index 4c16b375400..1aa838140fd 100644
--- a/mysql-test/r/case.result
+++ b/mysql-test/r/case.result
@@ -23,6 +23,11 @@ false
select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END;
CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END
one
+explain extended select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END;
+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 (case 1 when 1 then _latin1'one' when 2 then _latin1'two' else _latin1'more' end) AS `CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END`
select CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END;
CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END
two
@@ -57,6 +62,11 @@ fcase count(*)
0 2
2 1
3 1
+explain extended select case a when 1 then 2 when 2 then 3 else 0 end as fcase, count(*) from t1 group by fcase;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort
+Warnings:
+Note 1003 select (case test.t1.a when 1 then 2 when 2 then 3 else 0 end) AS `fcase`,count(0) AS `count(*)` from test.t1 group by (case test.t1.a when 1 then 2 when 2 then 3 else 0 end)
select case a when 1 then "one" when 2 then "two" else "nothing" end as fcase, count(*) from t1 group by fcase;
fcase count(*)
nothing 2
@@ -71,3 +81,76 @@ orange
yellow
green
drop table t1;
+SET NAMES latin1;
+CREATE TABLE t1 SELECT
+CASE WHEN 1 THEN _latin1'a' COLLATE latin1_danish_ci ELSE _latin1'a' END AS c1,
+CASE WHEN 1 THEN _latin1'a' ELSE _latin1'a' COLLATE latin1_danish_ci END AS c2,
+CASE WHEN 1 THEN 'a' ELSE 1 END AS c3,
+CASE WHEN 1 THEN 1 ELSE 'a' END AS c4,
+CASE WHEN 1 THEN 'a' ELSE 1.0 END AS c5,
+CASE WHEN 1 THEN 1.0 ELSE 'a' END AS c6,
+CASE WHEN 1 THEN 1 ELSE 1.0 END AS c7,
+CASE WHEN 1 THEN 1.0 ELSE 1 END AS c8,
+CASE WHEN 1 THEN 1.0 END AS c9
+;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` char(1) character set latin1 collate latin1_danish_ci NOT NULL default '',
+ `c2` char(1) character set latin1 collate latin1_danish_ci NOT NULL default '',
+ `c3` char(1) NOT NULL default '',
+ `c4` char(1) NOT NULL default '',
+ `c5` char(3) NOT NULL default '',
+ `c6` char(3) NOT NULL default '',
+ `c7` double(3,1) NOT NULL default '0.0',
+ `c8` double(3,1) NOT NULL default '0.0',
+ `c9` double(3,1) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SELECT CASE
+WHEN 1
+THEN _latin1'a' COLLATE latin1_danish_ci
+ELSE _latin1'a' COLLATE latin1_swedish_ci
+END;
+ERROR HY000: Illegal mix of collations (latin1_danish_ci,EXPLICIT) and (latin1_swedish_ci,EXPLICIT) for operation 'case'
+SELECT CASE _latin1'a' COLLATE latin1_general_ci
+WHEN _latin1'a' COLLATE latin1_danish_ci THEN 1
+WHEN _latin1'a' COLLATE latin1_swedish_ci THEN 2
+END;
+ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT), (latin1_danish_ci,EXPLICIT), (latin1_swedish_ci,EXPLICIT) for operation 'case'
+SELECT
+CASE _latin1'a' COLLATE latin1_general_ci WHEN _latin1'A' THEN '1' ELSE 2 END,
+CASE _latin1'a' COLLATE latin1_bin WHEN _latin1'A' THEN '1' ELSE 2 END,
+CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_swedish_ci THEN '1' ELSE 2 END,
+CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_bin THEN '1' ELSE 2 END
+;
+CASE _latin1'a' COLLATE latin1_general_ci WHEN _latin1'A' THEN '1' ELSE 2 END CASE _latin1'a' COLLATE latin1_bin WHEN _latin1'A' THEN '1' ELSE 2 END CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_swedish_ci THEN '1' ELSE 2 END CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_bin THEN '1' ELSE 2 END
+1 2 1 2
+CREATE TABLE t1 SELECT COALESCE(_latin1'a',_latin2'a');
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'coalesce'
+CREATE TABLE t1 SELECT COALESCE('a' COLLATE latin1_swedish_ci,'b' COLLATE latin1_bin);
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation 'coalesce'
+CREATE TABLE t1 SELECT
+COALESCE(1), COALESCE(1.0),COALESCE('a'),
+COALESCE(1,1.0), COALESCE(1,'1'),COALESCE(1.1,'1'),
+COALESCE('a' COLLATE latin1_bin,'b');
+explain extended SELECT
+COALESCE(1), COALESCE(1.0),COALESCE('a'),
+COALESCE(1,1.0), COALESCE(1,'1'),COALESCE(1.1,'1'),
+COALESCE('a' COLLATE latin1_bin,'b');
+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 coalesce(1) AS `COALESCE(1)`,coalesce(1.0) AS `COALESCE(1.0)`,coalesce(_latin1'a') AS `COALESCE('a')`,coalesce(1,1.0) AS `COALESCE(1,1.0)`,coalesce(1,_latin1'1') AS `COALESCE(1,'1')`,coalesce(1.1,_latin1'1') AS `COALESCE(1.1,'1')`,coalesce((_latin1'a' collate _latin1'latin1_bin'),_latin1'b') AS `COALESCE('a' COLLATE latin1_bin,'b')`
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `COALESCE(1)` int(1) NOT NULL default '0',
+ `COALESCE(1.0)` double(3,1) NOT NULL default '0.0',
+ `COALESCE('a')` char(1) NOT NULL default '',
+ `COALESCE(1,1.0)` double(3,1) NOT NULL default '0.0',
+ `COALESCE(1,'1')` char(1) NOT NULL default '',
+ `COALESCE(1.1,'1')` char(3) NOT NULL default '',
+ `COALESCE('a' COLLATE latin1_bin,'b')` char(1) character set latin1 collate latin1_bin NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result
index 572b32c171c..ccf75f68e88 100644
--- a/mysql-test/r/cast.result
+++ b/mysql-test/r/cast.result
@@ -16,24 +16,165 @@ cast(-5 as unsigned) -1 cast(-5 as unsigned) + 1
select ~5, cast(~5 as signed);
~5 cast(~5 as signed)
18446744073709551610 -6
+explain extended select ~5, cast(~5 as signed);
+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 ~(5) AS `~5`,cast(~(5) as signed) AS `cast(~5 as signed)`
select cast(5 as unsigned) -6.0;
cast(5 as unsigned) -6.0
-1.0
+select cast(NULL as signed), cast(1/0 as signed);
+cast(NULL as signed) cast(1/0 as signed)
+NULL NULL
+select cast(NULL as unsigned), cast(1/0 as unsigned);
+cast(NULL as unsigned) cast(1/0 as unsigned)
+NULL NULL
select cast("A" as binary) = "a", cast(BINARY "a" as CHAR) = "A";
cast("A" as binary) = "a" cast(BINARY "a" as CHAR) = "A"
0 1
select cast("2001-1-1" as DATE), cast("2001-1-1" as DATETIME);
cast("2001-1-1" as DATE) cast("2001-1-1" as DATETIME)
-2001-1-1 2001-1-1
+2001-01-01 2001-01-01 00:00:00
select cast("1:2:3" as TIME);
cast("1:2:3" as TIME)
-1:2:3
+01:02:03
+select CONVERT("2004-01-22 21:45:33",DATE);
+CONVERT("2004-01-22 21:45:33",DATE)
+2004-01-22
+select CONVERT(DATE "2004-01-22 21:45:33" USING latin1);
+CONVERT(DATE "2004-01-22 21:45:33" USING latin1)
+2004-01-22 21:45:33
+select CONVERT(DATE "2004-01-22 21:45:33",CHAR);
+CONVERT(DATE "2004-01-22 21:45:33",CHAR)
+2004-01-22 21:45:33
+select CONVERT(DATE "2004-01-22 21:45:33",CHAR(4));
+CONVERT(DATE "2004-01-22 21:45:33",CHAR(4))
+2004
+select CONVERT(DATE "2004-01-22 21:45:33",BINARY(4));
+CONVERT(DATE "2004-01-22 21:45:33",BINARY(4))
+2004
+select CAST(DATE "2004-01-22 21:45:33" AS BINARY(4));
+CAST(DATE "2004-01-22 21:45:33" AS BINARY(4))
+2004
+set names binary;
+select cast(_latin1'test' as char character set latin2);
+cast(_latin1'test' as char character set latin2)
+test
+select cast(_koi8r'ÔÅÓÔ' as char character set cp1251);
+cast(_koi8r'ÔÅÓÔ' as char character set cp1251)
+òåñò
+create table t1 select cast(_koi8r'ÔÅÓÔ' as char character set cp1251) as t;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `t` char(4) character set cp1251 NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select
+cast(_latin1'ab' AS char) as c1,
+cast(_latin1'a ' AS char) as c2,
+cast(_latin1'abc' AS char(2)) as c3,
+cast(_latin1'a ' AS char(2)) as c4,
+cast(_latin1'a' AS char(2)) as c5;
+c1 c2 c3 c4 c5
+ab a ab a a
+create table t1 select
+cast(_latin1'ab' AS char) as c1,
+cast(_latin1'a ' AS char) as c2,
+cast(_latin1'abc' AS char(2)) as c3,
+cast(_latin1'a ' AS char(2)) as c4,
+cast(_latin1'a' AS char(2)) as c5;
+select * from t1;
+c1 c2 c3 c4 c5
+ab a ab a a
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` binary(2) NOT NULL default '',
+ `c2` binary(2) NOT NULL default '',
+ `c3` binary(2) NOT NULL default '',
+ `c4` binary(2) NOT NULL default '',
+ `c5` binary(2) NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select
+cast(_koi8r'ÆÇ' AS nchar) as c1,
+cast(_koi8r'Æ ' AS nchar) as c2,
+cast(_koi8r'ÆÇÈ' AS nchar(2)) as c3,
+cast(_koi8r'Æ ' AS nchar(2)) as c4,
+cast(_koi8r'Æ' AS nchar(2)) as c5;
+c1 c2 c3 c4 c5
+фг ф фг ф ф
+create table t1 select
+cast(_koi8r'ÆÇ' AS nchar) as c1,
+cast(_koi8r'Æ ' AS nchar) as c2,
+cast(_koi8r'ÆÇÈ' AS nchar(2)) as c3,
+cast(_koi8r'Æ ' AS nchar(2)) as c4,
+cast(_koi8r'Æ' AS nchar(2)) as c5;
+select * from t1;
+c1 c2 c3 c4 c5
+фг ф фг ф ф
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` char(2) character set utf8 NOT NULL default '',
+ `c2` char(2) character set utf8 NOT NULL default '',
+ `c3` char(2) character set utf8 NOT NULL default '',
+ `c4` char(2) character set utf8 NOT NULL default '',
+ `c5` char(2) character set utf8 NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (a binary(10), b char(10) character set koi8r);
+insert into t1 values (_binary'ÔÅÓÔ',_binary'ÔÅÓÔ');
+select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
+a b cast(a as char character set cp1251) cast(b as binary)
+ÔÅÓÔ ÔÅÓÔ ÔÅÓÔ ÔÅÓÔ
+set names koi8r;
+select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
+a b cast(a as char character set cp1251) cast(b as binary)
+ÔÅÓÔ ÔÅÓÔ æåõæ ÔÅÓÔ
+set names cp1251;
+select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
+a b cast(a as char character set cp1251) cast(b as binary)
+ÔÅÓÔ òåñò ÔÅÓÔ ÔÅÓÔ
+drop table t1;
+set names binary;
select cast("2001-1-1" as date) = "2001-01-01";
cast("2001-1-1" as date) = "2001-01-01"
-0
+1
select cast("2001-1-1" as datetime) = "2001-01-01 00:00:00";
cast("2001-1-1" as datetime) = "2001-01-01 00:00:00"
-0
+1
select cast("1:2:3" as TIME) = "1:02:03";
cast("1:2:3" as TIME) = "1:02:03"
0
+select cast(NULL as DATE);
+cast(NULL as DATE)
+NULL
+select cast(NULL as BINARY);
+cast(NULL as BINARY)
+NULL
+CREATE TABLE t1 (a enum ('aac','aab','aaa') not null);
+INSERT INTO t1 VALUES ('aaa'),('aab'),('aac');
+SELECT a, CAST(a AS CHAR) FROM t1 ORDER BY CAST(a AS UNSIGNED) ;
+a CAST(a AS CHAR)
+aac aac
+aab aab
+aaa aaa
+SELECT a, CAST(a AS CHAR(3)) FROM t1 ORDER BY CAST(a AS CHAR(2)), a;
+a CAST(a AS CHAR(3))
+aac aac
+aab aab
+aaa aaa
+SELECT a, CAST(a AS UNSIGNED) FROM t1 ORDER BY CAST(a AS CHAR) ;
+a CAST(a AS UNSIGNED)
+aaa 3
+aab 2
+aac 1
+SELECT a, CAST(a AS CHAR(2)) FROM t1 ORDER BY CAST(a AS CHAR(3)), a;
+a CAST(a AS CHAR(2))
+aaa aa
+aab aa
+aac aa
+DROP TABLE t1;
diff --git a/mysql-test/r/comments.result b/mysql-test/r/comments.result
index 8092f789954..a9106ce0538 100644
--- a/mysql-test/r/comments.result
+++ b/mysql-test/r/comments.result
@@ -6,7 +6,7 @@ multi line comment */;
1
1
;
-Query was empty
+ERROR 42000: Query was empty
select 1 /*!32301 +1 */;
1 /*!32301 +1
2
diff --git a/mysql-test/r/compare.result b/mysql-test/r/compare.result
index afd2a1a086b..bf8a5106044 100644
--- a/mysql-test/r/compare.result
+++ b/mysql-test/r/compare.result
@@ -2,8 +2,8 @@ drop table if exists t1;
CREATE TABLE t1 (id CHAR(12) not null, PRIMARY KEY (id));
insert into t1 values ('000000000001'),('000000000002');
explain select * from t1 where id=000000000001;
-table type possible_keys key key_len ref rows Extra
-t1 index PRIMARY PRIMARY 12 NULL 2 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index PRIMARY PRIMARY 12 NULL 2 Using where; Using index
select * from t1 where id=000000000001;
id
000000000001
@@ -12,3 +12,27 @@ select * from t1;
id
000000000001
drop table t1;
+SELECT 'a' = 'a ';
+'a' = 'a '
+1
+SELECT 'a\0' < 'a';
+'a\0' < 'a'
+1
+SELECT 'a\0' < 'a ';
+'a\0' < 'a '
+1
+SELECT 'a\t' < 'a';
+'a\t' < 'a'
+1
+SELECT 'a\t' < 'a ';
+'a\t' < 'a '
+1
+CREATE TABLE t1 (a char(10) not null);
+INSERT INTO t1 VALUES ('a'),('a\0'),('a\t'),('a ');
+SELECT hex(a),STRCMP(a,'a'), STRCMP(a,'a ') FROM t1;
+hex(a) STRCMP(a,'a') STRCMP(a,'a ')
+61 0 0
+6100 -1 -1
+6109 -1 -1
+61 0 0
+DROP TABLE t1;
diff --git a/mysql-test/r/connect.result b/mysql-test/r/connect.result
new file mode 100644
index 00000000000..edf30e7f6e4
--- /dev/null
+++ b/mysql-test/r/connect.result
@@ -0,0 +1,67 @@
+show tables;
+Tables_in_mysql
+columns_priv
+db
+func
+help_category
+help_keyword
+help_relation
+help_topic
+host
+tables_priv
+time_zone
+time_zone_leap_second
+time_zone_name
+time_zone_transition
+time_zone_transition_type
+user
+show tables;
+Tables_in_test
+grant ALL on *.* to test@localhost identified by "gambling";
+grant ALL on *.* to test@127.0.0.1 identified by "gambling";
+show tables;
+Tables_in_mysql
+columns_priv
+db
+func
+help_category
+help_keyword
+help_relation
+help_topic
+host
+tables_priv
+time_zone
+time_zone_leap_second
+time_zone_name
+time_zone_transition
+time_zone_transition_type
+user
+show tables;
+Tables_in_test
+update mysql.user set password=old_password("gambling2") where user=_binary"test";
+flush privileges;
+set password="";
+set password='gambling3';
+ERROR HY000: Password hash should be a 41-digit hexadecimal number
+set password=old_password('gambling3');
+show tables;
+Tables_in_mysql
+columns_priv
+db
+func
+help_category
+help_keyword
+help_relation
+help_topic
+host
+tables_priv
+time_zone
+time_zone_leap_second
+time_zone_name
+time_zone_transition
+time_zone_transition_type
+user
+show tables;
+Tables_in_test
+delete from mysql.user where user=_binary"test";
+flush privileges;
diff --git a/mysql-test/r/consistent_snapshot.result b/mysql-test/r/consistent_snapshot.result
new file mode 100644
index 00000000000..90606abbe4e
--- /dev/null
+++ b/mysql-test/r/consistent_snapshot.result
@@ -0,0 +1,15 @@
+drop table if exists t1;
+create table t1 (a int) engine=innodb;
+start transaction with consistent snapshot;
+insert into t1 values(1);
+select * from t1;
+a
+commit;
+delete from t1;
+start transaction;
+insert into t1 values(1);
+select * from t1;
+a
+1
+commit;
+drop table t1;
diff --git a/mysql-test/r/constraints.result b/mysql-test/r/constraints.result
index 3b41e291e0f..d4d525c8991 100644
--- a/mysql-test/r/constraints.result
+++ b/mysql-test/r/constraints.result
@@ -14,3 +14,16 @@ drop table t1;
create table t1 (a int null);
insert into t1 values (1),(NULL);
drop table t1;
+create table t1 (a int null);
+alter table t1 add constraint constraint_1 unique (a);
+alter table t1 add constraint unique key_1(a);
+alter table t1 add constraint constraint_2 unique key_2(a);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) default NULL,
+ UNIQUE KEY `constraint_1` (`a`),
+ UNIQUE KEY `key_1` (`a`),
+ UNIQUE KEY `key_2` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
diff --git a/mysql-test/r/convert.result b/mysql-test/r/convert.result
deleted file mode 100644
index f8dad8c69ba..00000000000
--- a/mysql-test/r/convert.result
+++ /dev/null
@@ -1,17 +0,0 @@
-select @@convert_character_set;
-@@convert_character_set
-
-select @@global.convert_character_set;
-@@global.convert_character_set
-
-show variables like "%convert_character_set%";
-Variable_name Value
-convert_character_set
-SET CHARACTER SET cp1251_koi8;
-select @@convert_character_set;
-@@convert_character_set
-cp1251_koi8
-SET CHARACTER SET DEFAULT;
-select @@convert_character_set;
-@@convert_character_set
-
diff --git a/mysql-test/r/count_distinct3.result b/mysql-test/r/count_distinct3.result
new file mode 100644
index 00000000000..086e1360b0c
--- /dev/null
+++ b/mysql-test/r/count_distinct3.result
@@ -0,0 +1,8 @@
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (id INTEGER, grp TINYINT, id_rev INTEGER);
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4181000
+SELECT COUNT(DISTINCT id) FROM t1 GROUP BY grp;
+DROP TABLE t1;
+set @@read_buffer_size=default;
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 7cb79d5a990..92c825f547d 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -1,4 +1,5 @@
-drop table if exists t1,t2;
+drop table if exists t1,t2,t3;
+drop database if exists mysqltest;
create table t1 (b char(0));
insert into t1 values (""),(null);
select * from t1;
@@ -9,33 +10,46 @@ drop table if exists t1;
create table t1 (b char(0) not null);
create table if not exists t1 (b char(0) not null);
insert into t1 values (""),(null);
+Warnings:
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'b' at row 2
select * from t1;
b
-drop table if exists t1;
-create table t2 type=heap select * from t1;
-Table 'test.t1' doesn't exist
+drop table t1;
+create table t1 (a int not null auto_increment,primary key (a)) engine=heap;
+drop table t1;
+create table t2 engine=heap select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
create table t2 select auto+1 from t1;
-Table 'test.t1' doesn't exist
+ERROR 42S02: Table 'test.t1' doesn't exist
drop table if exists t1,t2;
+Warnings:
+Note 1051 Unknown table 't1'
+Note 1051 Unknown table 't2'
create table t1 (b char(0) not null, index(b));
-The used table handler can't index column 'b'
-create table t1 (a int not null auto_increment,primary key (a)) type=heap;
-The used table type doesn't support AUTO_INCREMENT columns
-create table t1 (a int not null,b text) type=heap;
-The used table type doesn't support BLOB/TEXT columns
+ERROR 42000: The used storage engine can't index column 'b'
+create table t1 (a int not null,b text) engine=heap;
+ERROR 42000: The used table type doesn't support BLOB/TEXT columns
drop table if exists t1;
-create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=heap;
-The used table type doesn't support AUTO_INCREMENT columns
+Warnings:
+Note 1051 Unknown table 't1'
+create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) engine=heap;
+ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
create table not_existing_database.test (a int);
Got one of the listed errors
create table `a/a` (a int);
-Incorrect table name 'a/a'
+ERROR 42000: Incorrect table name 'a/a'
create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int);
-Incorrect table name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
+ERROR 42000: Incorrect table name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
create table a (`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` int);
-Identifier name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' is too long
+ERROR 42000: Identifier name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' is too long
+create table test (a datetime default now());
+ERROR 42000: Invalid default value for 'a'
+create table test (a datetime on update now());
+ERROR HY000: Invalid ON UPDATE clause for 'a' column
+create table test (a int default 100 auto_increment);
+ERROR 42000: Invalid default value for 'a'
create table 1ea10 (1a20 int,1e int);
insert into 1ea10 values(1,1);
select 1ea10.1a20,1e+ 1e+10 from 1ea10;
@@ -44,29 +58,32 @@ select 1ea10.1a20,1e+ 1e+10 from 1ea10;
drop table 1ea10;
create table t1 (t1.index int);
drop table t1;
-drop database if exists test_$1;
-create database test_$1;
-create table test_$1.$test1 (a$1 int, $b int, c$ int);
-insert into test_$1.$test1 values (1,2,3);
-select a$1, $b, c$ from test_$1.$test1;
+drop database if exists mysqltest;
+Warnings:
+Note 1008 Can't drop database 'mysqltest'; database doesn't exist
+create database mysqltest;
+create table mysqltest.$test1 (a$1 int, $b int, c$ int);
+insert into mysqltest.$test1 values (1,2,3);
+select a$1, $b, c$ from mysqltest.$test1;
a$1 $b c$
1 2 3
-create table test_$1.test2$ (a int);
-drop table test_$1.test2$;
-drop database test_$1;
+create table mysqltest.test2$ (a int);
+drop table mysqltest.test2$;
+drop database mysqltest;
create table `` (a int);
-Incorrect table name ''
+ERROR 42000: Incorrect table name ''
drop table if exists ``;
-Incorrect table name ''
+ERROR 42000: Incorrect table name ''
create table t1 (`` int);
-Incorrect column name ''
-drop table if exists t1;
+ERROR 42000: Incorrect column name ''
+create table t1 (i int, index `` (i));
+ERROR 42000: Incorrect index name ''
create table t1 (a int auto_increment not null primary key, B CHAR(20));
insert into t1 (b) values ("hello"),("my"),("world");
create table t2 (key (b)) select * from t1;
explain select * from t2 where b="world";
-table type possible_keys key key_len ref rows Extra
-t2 ref B B 21 const 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref B B 21 const 1 Using where
select * from t2 where b="world";
a B
3 world
@@ -93,10 +110,44 @@ drop table t2;
create table t2 select CAST("2001-12-29" AS DATE) as d, CAST("20:45:11" AS TIME) as t, CAST("2001-12-29 20:45:11" AS DATETIME) as dt;
describe t2;
Field Type Null Key Default Extra
-d date 0000-00-00
-t time 00:00:00
-dt datetime 0000-00-00 00:00:00
+d date YES NULL
+t time YES NULL
+dt datetime YES NULL
drop table t1,t2;
+create table t1 (a tinyint);
+create table t2 (a int) select * from t1;
+describe t1;
+Field Type Null Key Default Extra
+a tinyint(4) YES NULL
+describe t2;
+Field Type Null Key Default Extra
+a int(11) YES NULL
+drop table if exists t2;
+create table t2 (a int, a float) select * from t1;
+ERROR 42S21: Duplicate column name 'a'
+drop table if exists t2;
+Warnings:
+Note 1051 Unknown table 't2'
+create table t2 (a int) select a as b, a+1 as b from t1;
+ERROR 42S21: Duplicate column name 'b'
+drop table if exists t2;
+Warnings:
+Note 1051 Unknown table 't2'
+create table t2 (b int) select a as b, a+1 as b from t1;
+ERROR 42S21: Duplicate column name 'b'
+drop table if exists t1,t2;
+Warnings:
+Note 1051 Unknown table 't2'
+CREATE TABLE t1 (a int not null);
+INSERT INTO t1 values (1),(2),(1);
+CREATE TABLE t2 (primary key(a)) SELECT * FROM t1;
+ERROR 23000: Duplicate entry '1' for key 1
+SELECT * from t2;
+ERROR 42S02: Table 'test.t2' doesn't exist
+DROP TABLE t1;
+DROP TABLE IF EXISTS t2;
+Warnings:
+Note 1051 Unknown table 't2'
create table t1 (a int not null, b int, primary key(a), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b));
show create table t1;
Table Create Table
@@ -135,7 +186,7 @@ t1 CREATE TABLE `t1` (
KEY `b_29` (`b`),
KEY `b_30` (`b`),
KEY `b_31` (`b`)
-) TYPE=MyISAM
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 select if(1,'1','0'), month("2002-08-02");
drop table t1;
@@ -144,44 +195,45 @@ select * from t1;
if('2002'='2002','Y','N')
Y
drop table if exists t1;
-SET SESSION table_type="heap";
-SELECT @@table_type;
-@@table_type
+SET SESSION storage_engine="heap";
+SELECT @@storage_engine;
+@@storage_engine
HEAP
CREATE TABLE t1 (a int not null);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0'
-) TYPE=HEAP
+) ENGINE=HEAP DEFAULT CHARSET=latin1
drop table t1;
-SET SESSION table_type="gemini";
-SELECT @@table_type;
-@@table_type
-GEMINI
+SET SESSION storage_engine="gemini";
+ERROR 42000: Unknown table engine 'gemini'
+SELECT @@storage_engine;
+@@storage_engine
+HEAP
CREATE TABLE t1 (a int not null);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0'
-) TYPE=MyISAM
-SET SESSION table_type=default;
+) ENGINE=HEAP DEFAULT CHARSET=latin1
+SET SESSION storage_engine=default;
drop table t1;
create table t1 ( k1 varchar(2), k2 int, primary key(k1,k2));
insert into t1 values ("a", 1), ("b", 2);
insert into t1 values ("c", NULL);
-Column 'k2' cannot be null
+ERROR 23000: Column 'k2' cannot be null
insert into t1 values (NULL, 3);
-Column 'k1' cannot be null
+ERROR 23000: Column 'k1' cannot be null
insert into t1 values (NULL, NULL);
-Column 'k1' cannot be null
+ERROR 23000: Column 'k1' cannot be null
drop table t1;
create table t1 select x'4132';
drop table t1;
create table t1 select 1,2,3;
create table if not exists t1 select 1,2;
create table if not exists t1 select 1,2,3,4;
-Column count doesn't match value count at row 1
+ERROR 21S01: Column count doesn't match value count at row 1
create table if not exists t1 select 1;
select * from t1;
1 2 3
@@ -192,7 +244,7 @@ drop table t1;
create table t1 select 1,2,3;
create table if not exists t1 select 1,2;
create table if not exists t1 select 1,2,3,4;
-Column count doesn't match value count at row 1
+ERROR 21S01: Column count doesn't match value count at row 1
create table if not exists t1 select 1;
select * from t1;
1 2 3
@@ -209,7 +261,7 @@ a b
0 2
create table if not exists t1 select 3 as 'a',4 as 'b';
create table if not exists t1 select 3 as 'a',3 as 'b';
-Duplicate entry '3' for key 1
+ERROR 23000: Duplicate entry '3' for key 1
select * from t1;
a b
1 1
@@ -217,14 +269,286 @@ a b
3 4
drop table t1;
create table `t1 `(a int);
-Incorrect table name 't1 '
+ERROR 42000: Incorrect table name 't1 '
create database `db1 `;
-Incorrect database name 'db1 '
+ERROR 42000: Incorrect database name 'db1 '
create table t1(`a ` int);
-Incorrect column name 'a '
+ERROR 42000: Incorrect column name 'a '
create table t1 (a int,);
-You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
create table t1 (a int,,b int);
-You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'b int)' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'b int)' at line 1
create table t1 (,b int);
-You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'b int)' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'b int)' at line 1
+create table t1 (a int, key(a));
+create table t2 (b int, foreign key(b) references t1(a), key(b));
+drop table if exists t1,t2;
+create table t1(id int not null, name char(20));
+insert into t1 values(10,'mysql'),(20,'monty- the creator');
+create table t2(id int not null);
+insert into t2 values(10),(20);
+create table t3 like t1;
+show create table t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `id` int(11) NOT NULL default '0',
+ `name` char(20) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t3;
+id name
+create table if not exists t3 like t1;
+Warnings:
+Warning 1050 Table 't3' already exists
+select @@warning_count;
+@@warning_count
+1
+create temporary table t3 like t2;
+show create table t3;
+Table Create Table
+t3 CREATE TEMPORARY TABLE `t3` (
+ `id` int(11) NOT NULL default '0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t3;
+id
+drop table t3;
+show create table t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `id` int(11) NOT NULL default '0',
+ `name` char(20) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t3;
+id name
+drop table t2, t3;
+create database mysqltest;
+create table mysqltest.t3 like t1;
+create temporary table t3 like mysqltest.t3;
+show create table t3;
+Table Create Table
+t3 CREATE TEMPORARY TABLE `t3` (
+ `id` int(11) NOT NULL default '0',
+ `name` char(20) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create table t2 like t3;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ `name` char(20) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t2;
+id name
+create table t3 like t1;
+create table t3 like mysqltest.t3;
+ERROR 42S01: Table 't3' already exists
+create table non_existing_database.t1 like t1;
+Got one of the listed errors
+create table t3 like non_existing_table;
+ERROR 42S02: Unknown table 'non_existing_table'
+create temporary table t3 like t1;
+ERROR 42S01: Table 't3' already exists
+create table t3 like `a/a`;
+ERROR 42000: Incorrect table name 'a/a'
+drop table t1, t2, t3;
+drop table t3;
+drop database mysqltest;
+SET SESSION storage_engine="heap";
+SELECT @@storage_engine;
+@@storage_engine
+HEAP
+CREATE TABLE t1 (a int not null);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL default '0'
+) ENGINE=HEAP DEFAULT CHARSET=latin1
+drop table t1;
+SET SESSION storage_engine="gemini";
+ERROR 42000: Unknown table engine 'gemini'
+SELECT @@storage_engine;
+@@storage_engine
+HEAP
+CREATE TABLE t1 (a int not null);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL default '0'
+) ENGINE=HEAP DEFAULT CHARSET=latin1
+SET SESSION storage_engine=default;
+drop table t1;
+create table t1(a int,b int,c int unsigned,d date,e char,f datetime,g time,h blob);
+insert into t1(a)values(1);
+insert into t1(a,b,c,d,e,f,g,h)
+values(2,-2,2,'1825-12-14','a','2003-1-1 3:2:1','4:3:2','binary data');
+select * from t1;
+a b c d e f g h
+1 NULL NULL NULL NULL NULL NULL NULL
+2 -2 2 1825-12-14 a 2003-01-01 03:02:01 04:03:02 binary data
+select a,
+ifnull(b,cast(-7 as signed)) as b,
+ifnull(c,cast(7 as unsigned)) as c,
+ifnull(d,cast('2000-01-01' as date)) as d,
+ifnull(e,cast('b' as char)) as e,
+ifnull(f,cast('2000-01-01' as datetime)) as f,
+ifnull(g,cast('5:4:3' as time)) as g,
+ifnull(h,cast('yet another binary data' as binary)) as h,
+addtime(cast('1:0:0' as time),cast('1:0:0' as time)) as dd
+from t1;
+a b c d e f g h dd
+1 -7 7 2000-01-01 b 2000-01-01 00:00:00 05:04:03 yet another binary data 02:00:00
+2 -2 2 1825-12-14 a 2003-01-01 03:02:01 04:03:02 binary data 02:00:00
+create table t2
+select
+a,
+ifnull(b,cast(-7 as signed)) as b,
+ifnull(c,cast(7 as unsigned)) as c,
+ifnull(d,cast('2000-01-01' as date)) as d,
+ifnull(e,cast('b' as char)) as e,
+ifnull(f,cast('2000-01-01' as datetime)) as f,
+ifnull(g,cast('5:4:3' as time)) as g,
+ifnull(h,cast('yet another binary data' as binary)) as h,
+addtime(cast('1:0:0' as time),cast('1:0:0' as time)) as dd
+from t1;
+explain t2;
+Field Type Null Key Default Extra
+a int(11) YES NULL
+b bigint(11) 0
+c bigint(10) 0
+d date YES NULL
+e char(1)
+f datetime YES NULL
+g time YES NULL
+h longblob
+dd time YES NULL
+select * from t2;
+a b c d e f g h dd
+1 -7 7 2000-01-01 b 2000-01-01 00:00:00 05:04:03 yet another binary data 02:00:00
+2 -2 2 1825-12-14 a 2003-01-01 03:02:01 04:03:02 binary data 02:00:00
+drop table t1, t2;
+create table t1 (a tinyint, b smallint, c mediumint, d int, e bigint, f float(3,2), g double(4,3), h decimal(5,4), i year, j date, k timestamp, l datetime, m enum('a','b'), n set('a','b'), o char(10));
+create table t2 select ifnull(a,a), ifnull(b,b), ifnull(c,c), ifnull(d,d), ifnull(e,e), ifnull(f,f), ifnull(g,g), ifnull(h,h), ifnull(i,i), ifnull(j,j), ifnull(k,k), ifnull(l,l), ifnull(m,m), ifnull(n,n), ifnull(o,o) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `ifnull(a,a)` tinyint(4) default NULL,
+ `ifnull(b,b)` smallint(6) default NULL,
+ `ifnull(c,c)` mediumint(9) default NULL,
+ `ifnull(d,d)` int(11) default NULL,
+ `ifnull(e,e)` bigint(20) default NULL,
+ `ifnull(f,f)` float(3,2) default NULL,
+ `ifnull(g,g)` double(4,3) default NULL,
+ `ifnull(h,h)` decimal(5,4) default NULL,
+ `ifnull(i,i)` year(4) default NULL,
+ `ifnull(j,j)` date default NULL,
+ `ifnull(k,k)` datetime NOT NULL default '0000-00-00 00:00:00',
+ `ifnull(l,l)` datetime default NULL,
+ `ifnull(m,m)` char(1) default NULL,
+ `ifnull(n,n)` char(3) default NULL,
+ `ifnull(o,o)` char(10) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1,t2;
+create table t1(str varchar(10) default 'def',strnull varchar(10),intg int default '10',rel double default '3.14');
+insert into t1 values ('','',0,0.0);
+describe t1;
+Field Type Null Key Default Extra
+str varchar(10) YES def
+strnull varchar(10) YES NULL
+intg int(11) YES 10
+rel double YES 3.14
+create table t2 select default(str) as str, default(strnull) as strnull, default(intg) as intg, default(rel) as rel from t1;
+describe t2;
+Field Type Null Key Default Extra
+str varchar(10) YES NULL
+strnull varchar(10) YES NULL
+intg int(11) YES NULL
+rel double YES NULL
+drop table t1, t2;
+create table t1(name varchar(10), age smallint default -1);
+describe t1;
+Field Type Null Key Default Extra
+name varchar(10) YES NULL
+age smallint(6) YES -1
+create table t2(name varchar(10), age smallint default - 1);
+describe t2;
+Field Type Null Key Default Extra
+name varchar(10) YES NULL
+age smallint(6) YES -1
+drop table t1, t2;
+create table t1(cenum enum('a'), cset set('b'));
+create table t2(cenum enum('a','a'), cset set('b','b'));
+Warnings:
+Note 1291 Column 'cenum' has duplicated value 'a' in ENUM
+Note 1291 Column 'cset' has duplicated value 'b' in SET
+create table t3(cenum enum('a','A','a','c','c'), cset set('b','B','b','d','d'));
+Warnings:
+Note 1291 Column 'cenum' has duplicated value 'a' in ENUM
+Note 1291 Column 'cenum' has duplicated value 'A' in ENUM
+Note 1291 Column 'cenum' has duplicated value 'c' in ENUM
+Note 1291 Column 'cset' has duplicated value 'b' in SET
+Note 1291 Column 'cset' has duplicated value 'B' in SET
+Note 1291 Column 'cset' has duplicated value 'd' in SET
+drop table t1, t2, t3;
+create database mysqltest;
+use mysqltest;
+select database();
+database()
+mysqltest
+drop database mysqltest;
+select database();
+database()
+NULL
+select database();
+database()
+NULL
+use test;
+create table t1 (a int, index `primary` (a));
+ERROR 42000: Incorrect index name 'primary'
+create table t1 (a int, index `PRIMARY` (a));
+ERROR 42000: Incorrect index name 'PRIMARY'
+create table t1 (`primary` int, index(`primary`));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `primary` int(11) default NULL,
+ KEY `primary_2` (`primary`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create table t2 (`PRIMARY` int, index(`PRIMARY`));
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `PRIMARY` int(11) default NULL,
+ KEY `PRIMARY_2` (`PRIMARY`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create table t3 (a int);
+alter table t3 add index `primary` (a);
+ERROR 42000: Incorrect index name 'primary'
+alter table t3 add index `PRIMARY` (a);
+ERROR 42000: Incorrect index name 'PRIMARY'
+create table t4 (`primary` int);
+alter table t4 add index(`primary`);
+show create table t4;
+Table Create Table
+t4 CREATE TABLE `t4` (
+ `primary` int(11) default NULL,
+ KEY `primary_2` (`primary`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create table t5 (`PRIMARY` int);
+alter table t5 add index(`PRIMARY`);
+show create table t5;
+Table Create Table
+t5 CREATE TABLE `t5` (
+ `PRIMARY` int(11) default NULL,
+ KEY `PRIMARY_2` (`PRIMARY`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2, t3, t4, t5;
+CREATE TABLE t1(id varchar(10) NOT NULL PRIMARY KEY, dsc longtext);
+INSERT INTO t1 VALUES ('5000000001', NULL),('5000000003', 'Test'),('5000000004', NULL);
+CREATE TABLE t2(id varchar(15) NOT NULL, proc varchar(100) NOT NULL, runID varchar(16) NOT NULL, start datetime NOT NULL, PRIMARY KEY (id,proc,runID,start));
+INSERT INTO t2 VALUES ('5000000001', 'proc01', '20031029090650', '2003-10-29 13:38:40'),('5000000001', 'proc02', '20031029090650', '2003-10-29 13:38:51'),('5000000001', 'proc03', '20031029090650', '2003-10-29 13:38:11'),('5000000002', 'proc09', '20031024013310', '2003-10-24 01:33:11'),('5000000002', 'proc09', '20031024153537', '2003-10-24 15:36:04'),('5000000004', 'proc01', '20031024013641', '2003-10-24 01:37:29'),('5000000004', 'proc02', '20031024013641', '2003-10-24 01:37:39');
+CREATE TABLE t3 SELECT t1.dsc,COUNT(DISTINCT t2.id) AS countOfRuns FROM t1 LEFT JOIN t2 ON (t1.id=t2.id) GROUP BY t1.id;
+SELECT * FROM t3;
+dsc countOfRuns
+NULL 1
+Test 0
+NULL 1
+drop table t1, t2, t3;
diff --git a/mysql-test/r/create_select_tmp.result b/mysql-test/r/create_select_tmp.result
index 610ee70b3e3..b99bf3e3591 100644
--- a/mysql-test/r/create_select_tmp.result
+++ b/mysql-test/r/create_select_tmp.result
@@ -1,19 +1,19 @@
drop table if exists t1, t2;
CREATE TABLE t1 ( a int );
INSERT INTO t1 VALUES (1),(2),(1);
-CREATE TABLE t2 ( PRIMARY KEY (a) ) TYPE=INNODB SELECT a FROM t1;
-Duplicate entry '1' for key 1
+CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
+ERROR 23000: Duplicate entry '1' for key 1
select * from t2;
-Table 'test.t2' doesn't exist
-CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) TYPE=INNODB SELECT a FROM t1;
-Duplicate entry '1' for key 1
+ERROR 42S02: Table 'test.t2' doesn't exist
+CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
+ERROR 23000: Duplicate entry '1' for key 1
select * from t2;
-Table 'test.t2' doesn't exist
-CREATE TABLE t2 ( PRIMARY KEY (a) ) TYPE=MYISAM SELECT a FROM t1;
-Duplicate entry '1' for key 1
+ERROR 42S02: Table 'test.t2' doesn't exist
+CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
+ERROR 23000: Duplicate entry '1' for key 1
select * from t2;
-Table 'test.t2' doesn't exist
-CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) TYPE=MYISAM SELECT a FROM t1;
-Duplicate entry '1' for key 1
+ERROR 42S02: Table 'test.t2' doesn't exist
+CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
+ERROR 23000: Duplicate entry '1' for key 1
select * from t2;
-Table 'test.t2' doesn't exist
+ERROR 42S02: Table 'test.t2' doesn't exist
diff --git a/mysql-test/r/csv.result b/mysql-test/r/csv.result
new file mode 100644
index 00000000000..ea0d34271b5
--- /dev/null
+++ b/mysql-test/r/csv.result
@@ -0,0 +1,4931 @@
+drop table if exists t1,t2,t3,t4;
+CREATE TABLE t1 (
+Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
+Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
+) ENGINE = CSV;
+INSERT INTO t1 VALUES (9410,9412);
+select period from t1;
+period
+9410
+select * from t1;
+Period Varor_period
+9410 9412
+select t1.* from t1;
+Period Varor_period
+9410 9412
+CREATE TABLE t2 (
+auto int not null,
+fld1 int(6) unsigned zerofill DEFAULT '000000' NOT NULL,
+companynr tinyint(2) unsigned zerofill DEFAULT '00' NOT NULL,
+fld3 char(30) DEFAULT '' NOT NULL,
+fld4 char(35) DEFAULT '' NOT NULL,
+fld5 char(35) DEFAULT '' NOT NULL,
+fld6 char(4) DEFAULT '' NOT NULL
+) ENGINE = CSV;
+select t2.fld3 from t2 where companynr = 58 and fld3 like "%imaginable%";
+fld3
+imaginable
+select fld3 from t2 where fld3 like "%cultivation" ;
+fld3
+cultivation
+select t2.fld3,companynr from t2 where companynr = 57+1 order by fld3;
+fld3 companynr
+concoct 58
+druggists 58
+engrossing 58
+Eurydice 58
+exclaimers 58
+ferociousness 58
+hopelessness 58
+Huey 58
+imaginable 58
+judges 58
+merging 58
+ostrich 58
+peering 58
+Phelps 58
+presumes 58
+Ruth 58
+sentences 58
+Shylock 58
+straggled 58
+synergy 58
+thanking 58
+tying 58
+unlocks 58
+select fld3,companynr from t2 where companynr = 58 order by fld3;
+fld3 companynr
+concoct 58
+druggists 58
+engrossing 58
+Eurydice 58
+exclaimers 58
+ferociousness 58
+hopelessness 58
+Huey 58
+imaginable 58
+judges 58
+merging 58
+ostrich 58
+peering 58
+Phelps 58
+presumes 58
+Ruth 58
+sentences 58
+Shylock 58
+straggled 58
+synergy 58
+thanking 58
+tying 58
+unlocks 58
+select fld3 from t2 order by fld3 desc limit 10;
+fld3
+youthfulness
+yelped
+Wotan
+workers
+Witt
+witchcraft
+Winsett
+Willy
+willed
+wildcats
+select fld3 from t2 order by fld3 desc limit 5;
+fld3
+youthfulness
+yelped
+Wotan
+workers
+Witt
+select fld3 from t2 order by fld3 desc limit 5,5;
+fld3
+witchcraft
+Winsett
+Willy
+willed
+wildcats
+UPDATE t2 SET fld3="foo" WHERE fld3="b%";
+select fld3 from t2;
+fld3
+Omaha
+breaking
+Romans
+intercepted
+bewilderingly
+astound
+admonishing
+sumac
+flanking
+combed
+subjective
+scatterbrain
+Eulerian
+dubbed
+Kane
+overlay
+perturb
+goblins
+annihilates
+Wotan
+snatching
+concludes
+laterally
+yelped
+grazing
+Baird
+celery
+misunderstander
+handgun
+foldout
+mystic
+succumbed
+Nabisco
+fingerings
+aging
+afield
+ammonium
+boat
+intelligibility
+Augustine
+teethe
+dreaded
+scholastics
+audiology
+wallet
+parters
+eschew
+quitter
+neat
+Steinberg
+jarring
+tinily
+balled
+persist
+attainments
+fanatic
+measures
+rightfulness
+capably
+impulsive
+starlet
+terminators
+untying
+announces
+featherweight
+pessimist
+daughter
+decliner
+lawgiver
+stated
+readable
+attrition
+cascade
+motors
+interrogate
+pests
+stairway
+dopers
+testicle
+Parsifal
+leavings
+postulation
+squeaking
+contrasted
+leftover
+whiteners
+erases
+Punjab
+Merritt
+Quixotism
+sweetish
+dogging
+scornfully
+bellow
+bills
+cupboard
+sureties
+puddings
+tapestry
+fetters
+bivalves
+incurring
+Adolph
+pithed
+emergency
+Miles
+trimmings
+tragedies
+skulking
+flint
+flopping
+relaxing
+offload
+suites
+lists
+animized
+multilayer
+standardizes
+Judas
+vacuuming
+dentally
+humanness
+inch
+Weissmuller
+irresponsibly
+luckily
+culled
+medical
+bloodbath
+subschema
+animals
+Micronesia
+repetitions
+Antares
+ventilate
+pityingly
+interdependent
+Graves
+neonatal
+scribbled
+chafe
+honoring
+realtor
+elite
+funereal
+abrogating
+sorters
+Conley
+lectured
+Abraham
+Hawaii
+cage
+hushes
+Simla
+reporters
+Dutchman
+descendants
+groupings
+dissociate
+coexist
+Beebe
+Taoism
+Connally
+fetched
+checkpoints
+rusting
+galling
+obliterates
+traitor
+resumes
+analyzable
+terminator
+gritty
+firearm
+minima
+Selfridge
+disable
+witchcraft
+betroth
+Manhattanize
+imprint
+peeked
+swelling
+interrelationships
+riser
+Gandhian
+peacock
+bee
+kanji
+dental
+scarf
+chasm
+insolence
+syndicate
+alike
+imperial
+convulsion
+railway
+validate
+normalizes
+comprehensive
+chewing
+denizen
+schemer
+chronicle
+Kline
+Anatole
+partridges
+brunch
+recruited
+dimensions
+Chicana
+announced
+praised
+employing
+linear
+quagmire
+western
+relishing
+serving
+scheduling
+lore
+eventful
+arteriole
+disentangle
+cured
+Fenton
+avoidable
+drains
+detectably
+husky
+impelling
+undoes
+evened
+squeezes
+destroyer
+rudeness
+beaner
+boorish
+Everhart
+encompass
+mushrooms
+Alison
+externally
+pellagra
+cult
+creek
+Huffman
+Majorca
+governing
+gadfly
+reassigned
+intentness
+craziness
+psychic
+squabbled
+burlesque
+capped
+extracted
+DiMaggio
+exclamation
+subdirectory
+fangs
+buyer
+pithing
+transistorizing
+nonbiodegradable
+dislocate
+monochromatic
+batting
+postcondition
+catalog
+Remus
+devices
+bike
+qualify
+detained
+commended
+civilize
+Elmhurst
+anesthetizing
+deaf
+Brigham
+title
+coarse
+combinations
+grayness
+innumerable
+Caroline
+fatty
+eastbound
+inexperienced
+hoarder
+scotch
+passport
+strategic
+gated
+flog
+Pipestone
+Dar
+Corcoran
+flyers
+competitions
+suppliers
+skips
+institutes
+troop
+connective
+denies
+polka
+observations
+askers
+homeless
+Anna
+subdirectories
+decaying
+outwitting
+Harpy
+crazed
+suffocate
+provers
+technically
+Franklinizations
+considered
+tinnily
+uninterruptedly
+whistled
+automate
+gutting
+surreptitious
+Choctaw
+cooks
+millivolt
+counterpoise
+Gothicism
+feminine
+metaphysically
+sanding
+contributorily
+receivers
+adjourn
+straggled
+druggists
+thanking
+ostrich
+hopelessness
+Eurydice
+excitation
+presumes
+imaginable
+concoct
+peering
+Phelps
+ferociousness
+sentences
+unlocks
+engrossing
+Ruth
+tying
+exclaimers
+synergy
+Huey
+merging
+judges
+Shylock
+Miltonism
+hen
+honeybee
+towers
+dilutes
+numerals
+democracy
+Ibero-
+invalids
+behavior
+accruing
+relics
+rackets
+Fischbein
+phony
+cross
+cleanup
+conspirator
+label
+university
+cleansed
+ballgown
+starlet
+aqueous
+portrayal
+despising
+distort
+palmed
+faced
+silverware
+assessor
+spiders
+artificially
+reminiscence
+Mexican
+obnoxious
+fragile
+apprehensible
+births
+garages
+panty
+anteater
+displacement
+drovers
+patenting
+far
+shrieks
+aligning
+pragmatism
+fevers
+reexamines
+occupancies
+sweats
+modulators
+demand
+Madeira
+Viennese
+chillier
+wildcats
+gentle
+Angles
+accuracies
+toggle
+Mendelssohn
+behaviorally
+Rochford
+mirror
+Modula
+clobbering
+chronography
+Eskimoizeds
+British
+pitfalls
+verify
+scatter
+Aztecan
+acuity
+sinking
+beasts
+Witt
+physicists
+folksong
+strokes
+crowder
+merry
+cadenced
+alimony
+principled
+golfing
+undiscovered
+irritates
+patriots
+rooms
+towering
+displease
+photosensitive
+inking
+gainers
+leaning
+hydrant
+preserve
+blinded
+interactions
+Barry
+whiteness
+pastimes
+Edenization
+Muscat
+assassinated
+labeled
+glacial
+implied
+bibliographies
+Buchanan
+forgivably
+innuendo
+den
+submarines
+mouthful
+expiring
+unfulfilled
+precession
+nullified
+affects
+Cynthia
+Chablis
+betterments
+advertising
+rubies
+southwest
+superstitious
+tabernacle
+silk
+handsomest
+Persian
+analog
+complex
+Taoist
+suspend
+relegated
+awesome
+Bruxelles
+imprecisely
+televise
+braking
+true
+disappointing
+navally
+circus
+beetles
+trumps
+fourscore
+Blackfoots
+Grady
+quiets
+floundered
+profundity
+Garrisonian
+Strauss
+cemented
+contrition
+mutations
+exhibits
+tits
+mate
+arches
+Moll
+ropers
+bombast
+difficultly
+adsorption
+definiteness
+cultivation
+heals
+Heusen
+target
+cited
+congresswoman
+Katherine
+titter
+aspire
+Mardis
+Nadia
+estimating
+stuck
+fifteenth
+Colombo
+survey
+staffing
+obtain
+loaded
+slaughtered
+lights
+circumference
+dull
+weekly
+wetness
+visualized
+Tannenbaum
+moribund
+demultiplex
+lockings
+thugs
+unnerves
+abut
+Chippewa
+stratifications
+signaled
+Italianizes
+algorithmic
+paranoid
+camping
+signifying
+Patrice
+search
+Angeles
+semblance
+taxed
+Beatrice
+retrace
+lockout
+grammatic
+helmsman
+uniform
+hamming
+disobedience
+captivated
+transferals
+cartographer
+aims
+Pakistani
+burglarized
+saucepans
+lacerating
+corny
+megabytes
+chancellor
+bulk
+commits
+meson
+deputies
+northeaster
+dipole
+machining
+therefore
+Telefunken
+salvaging
+Corinthianizes
+restlessly
+bromides
+generalized
+mishaps
+quelling
+spiritual
+beguiles
+Trobriand
+fleeing
+Armour
+chin
+provers
+aeronautic
+voltage
+sash
+anaerobic
+simultaneous
+accumulating
+Medusan
+shouted
+freakish
+index
+commercially
+mistiness
+endpoint
+straight
+flurried
+denotative
+coming
+commencements
+gentleman
+gifted
+Shanghais
+sportswriting
+sloping
+navies
+leaflet
+shooter
+Joplin
+babies
+subdivision
+burstiness
+belted
+assails
+admiring
+swaying
+Goldstine
+fitting
+Norwalk
+weakening
+analogy
+deludes
+cokes
+Clayton
+exhausts
+causality
+sating
+icon
+throttles
+communicants
+dehydrate
+priceless
+publicly
+incidentals
+commonplace
+mumbles
+furthermore
+cautioned
+parametrized
+registration
+sadly
+positioning
+babysitting
+eternal
+hoarder
+congregates
+rains
+workers
+sags
+unplug
+garage
+boulder
+hollowly
+specifics
+Teresa
+Winsett
+convenient
+buckboards
+amenities
+resplendent
+priding
+configurations
+untidiness
+Brice
+sews
+participated
+Simon
+certificates
+Fitzpatrick
+Evanston
+misted
+textures
+save
+count
+rightful
+chaperone
+Lizzy
+clenched
+effortlessly
+accessed
+beaters
+Hornblower
+vests
+indulgences
+infallibly
+unwilling
+excrete
+spools
+crunches
+overestimating
+ineffective
+humiliation
+sophomore
+star
+rifles
+dialysis
+arriving
+indulge
+clockers
+languages
+Antarctica
+percentage
+ceiling
+specification
+regimented
+ciphers
+pictures
+serpents
+allot
+realized
+mayoral
+opaquely
+hostess
+fiftieth
+incorrectly
+decomposition
+stranglings
+mixture
+electroencephalography
+similarities
+charges
+freest
+Greenberg
+tinting
+expelled
+warm
+smoothed
+deductions
+Romano
+bitterroot
+corset
+securing
+environing
+cute
+Crays
+heiress
+inform
+avenge
+universals
+Kinsey
+ravines
+bestseller
+equilibrium
+extents
+relatively
+pressure
+critiques
+befouled
+rightfully
+mechanizing
+Latinizes
+timesharing
+Aden
+embassies
+males
+shapelessly
+genres
+mastering
+Newtonian
+finishers
+abates
+teem
+kiting
+stodgy
+scalps
+feed
+guitars
+airships
+store
+denounces
+Pyle
+Saxony
+serializations
+Peruvian
+taxonomically
+kingdom
+stint
+Sault
+faithful
+Ganymede
+tidiness
+gainful
+contrary
+Tipperary
+tropics
+theorizers
+renew
+already
+terminal
+Hegelian
+hypothesizer
+warningly
+journalizing
+nested
+Lars
+saplings
+foothill
+labeled
+imperiously
+reporters
+furnishings
+precipitable
+discounts
+excises
+Stalin
+despot
+ripeness
+Arabia
+unruly
+mournfulness
+boom
+slaughter
+Sabine
+handy
+rural
+organizer
+shipyard
+civics
+inaccuracy
+rules
+juveniles
+comprised
+investigations
+stabilizes
+seminaries
+Hunter
+sporty
+test
+weasels
+CERN
+tempering
+afore
+Galatean
+techniques
+error
+veranda
+severely
+Cassites
+forthcoming
+guides
+vanish
+lied
+sawtooth
+fated
+gradually
+widens
+preclude
+Jobrel
+hooker
+rainstorm
+disconnects
+cruelty
+exponentials
+affective
+arteries
+Crosby
+acquaint
+evenhandedly
+percentage
+disobedience
+humility
+gleaning
+petted
+bloater
+minion
+marginal
+apiary
+measures
+precaution
+repelled
+primary
+coverings
+Artemia
+navigate
+spatial
+Gurkha
+meanwhile
+Melinda
+Butterfield
+Aldrich
+previewing
+glut
+unaffected
+inmate
+mineral
+impending
+meditation
+ideas
+miniaturizes
+lewdly
+title
+youthfulness
+creak
+Chippewa
+clamored
+freezes
+forgivably
+reduce
+McGovern
+Nazis
+epistle
+socializes
+conceptions
+Kevin
+uncovering
+chews
+appendixes
+appendixes
+appendixes
+appendixes
+appendixes
+appendixes
+raining
+infest
+compartment
+minting
+ducks
+roped
+waltz
+Lillian
+repressions
+chillingly
+noncritical
+lithograph
+spongers
+parenthood
+posed
+instruments
+filial
+fixedly
+relives
+Pandora
+watering
+ungrateful
+secures
+chastisers
+icon
+reuniting
+imagining
+abiding
+omnisciently
+Britannic
+scholastics
+mechanics
+humidly
+masterpiece
+however
+Mendelian
+jarred
+scolds
+infatuate
+willed
+joyfully
+Microsoft
+fibrosities
+Baltimorean
+equestrian
+Goodrich
+apish
+Adlerian
+Tropez
+nouns
+distracting
+mutton
+bridgeable
+stickers
+transcontinental
+amateurish
+Gandhian
+stratified
+chamberlains
+creditably
+philosophic
+ores
+Carleton
+tape
+afloat
+goodness
+welcoming
+Pinsky
+halting
+bibliography
+decoding
+variance
+allowed
+dire
+dub
+poisoning
+Iraqis
+heaving
+population
+bomb
+Majorca
+Gershwins
+explorers
+libretto
+occurred
+Lagos
+rats
+bankruptcies
+crying
+unexpected
+accessed
+colorful
+versatility
+cosy
+Darius
+mastering
+Asiaticizations
+offerers
+uncles
+sleepwalk
+Ernestine
+checksumming
+stopped
+sicker
+Italianization
+alphabetic
+pharmaceutic
+creator
+chess
+charcoal
+Epiphany
+bulldozes
+Pygmalion
+caressing
+Palestine
+regimented
+scars
+realest
+diffusing
+clubroom
+Blythe
+ahead
+reviver
+retransmitting
+landslide
+Eiffel
+absentee
+aye
+forked
+Peruvianizes
+clerked
+tutor
+boulevard
+shuttered
+quotes
+Caltech
+Mossberg
+kept
+roundly
+features
+imaginable
+controller
+racial
+uprisings
+narrowed
+cannot
+vest
+famine
+sugars
+exterminated
+belays
+Hodges
+translatable
+duality
+recording
+rouses
+poison
+attitude
+dusted
+encompasses
+presentation
+Kantian
+imprecision
+saving
+maternal
+hewed
+kerosene
+Cubans
+photographers
+nymph
+bedlam
+north
+Schoenberg
+botany
+curs
+solidification
+inheritresses
+stiller
+t1
+suite
+ransomer
+Willy
+Rena
+Seattle
+relaxes
+exclaim
+exclaim
+implicated
+distinguish
+assayed
+homeowner
+and
+stealth
+coinciding
+founder
+environing
+jewelry
+lemons
+brokenness
+bedpost
+assurers
+annoyers
+affixed
+warbling
+seriously
+boasted
+Chantilly
+Iranizes
+violinist
+extramarital
+spates
+cloakroom
+gazer
+hand
+tucked
+gems
+clinker
+refiner
+callus
+leopards
+comfortingly
+generically
+getters
+sexually
+spear
+serums
+Italianization
+attendants
+spies
+Anthony
+planar
+cupped
+cleanser
+commuters
+honeysuckle
+orphanage
+skies
+crushers
+Puritan
+squeezer
+bruises
+bonfire
+Colombo
+nondecreasing
+UPDATE t2 SET fld3="bar" WHERE fld3="s%";
+select fld3 from t2;
+fld3
+Omaha
+breaking
+Romans
+intercepted
+bewilderingly
+astound
+admonishing
+sumac
+flanking
+combed
+subjective
+scatterbrain
+Eulerian
+dubbed
+Kane
+overlay
+perturb
+goblins
+annihilates
+Wotan
+snatching
+concludes
+laterally
+yelped
+grazing
+Baird
+celery
+misunderstander
+handgun
+foldout
+mystic
+succumbed
+Nabisco
+fingerings
+aging
+afield
+ammonium
+boat
+intelligibility
+Augustine
+teethe
+dreaded
+scholastics
+audiology
+wallet
+parters
+eschew
+quitter
+neat
+Steinberg
+jarring
+tinily
+balled
+persist
+attainments
+fanatic
+measures
+rightfulness
+capably
+impulsive
+starlet
+terminators
+untying
+announces
+featherweight
+pessimist
+daughter
+decliner
+lawgiver
+stated
+readable
+attrition
+cascade
+motors
+interrogate
+pests
+stairway
+dopers
+testicle
+Parsifal
+leavings
+postulation
+squeaking
+contrasted
+leftover
+whiteners
+erases
+Punjab
+Merritt
+Quixotism
+sweetish
+dogging
+scornfully
+bellow
+bills
+cupboard
+sureties
+puddings
+tapestry
+fetters
+bivalves
+incurring
+Adolph
+pithed
+emergency
+Miles
+trimmings
+tragedies
+skulking
+flint
+flopping
+relaxing
+offload
+suites
+lists
+animized
+multilayer
+standardizes
+Judas
+vacuuming
+dentally
+humanness
+inch
+Weissmuller
+irresponsibly
+luckily
+culled
+medical
+bloodbath
+subschema
+animals
+Micronesia
+repetitions
+Antares
+ventilate
+pityingly
+interdependent
+Graves
+neonatal
+scribbled
+chafe
+honoring
+realtor
+elite
+funereal
+abrogating
+sorters
+Conley
+lectured
+Abraham
+Hawaii
+cage
+hushes
+Simla
+reporters
+Dutchman
+descendants
+groupings
+dissociate
+coexist
+Beebe
+Taoism
+Connally
+fetched
+checkpoints
+rusting
+galling
+obliterates
+traitor
+resumes
+analyzable
+terminator
+gritty
+firearm
+minima
+Selfridge
+disable
+witchcraft
+betroth
+Manhattanize
+imprint
+peeked
+swelling
+interrelationships
+riser
+Gandhian
+peacock
+bee
+kanji
+dental
+scarf
+chasm
+insolence
+syndicate
+alike
+imperial
+convulsion
+railway
+validate
+normalizes
+comprehensive
+chewing
+denizen
+schemer
+chronicle
+Kline
+Anatole
+partridges
+brunch
+recruited
+dimensions
+Chicana
+announced
+praised
+employing
+linear
+quagmire
+western
+relishing
+serving
+scheduling
+lore
+eventful
+arteriole
+disentangle
+cured
+Fenton
+avoidable
+drains
+detectably
+husky
+impelling
+undoes
+evened
+squeezes
+destroyer
+rudeness
+beaner
+boorish
+Everhart
+encompass
+mushrooms
+Alison
+externally
+pellagra
+cult
+creek
+Huffman
+Majorca
+governing
+gadfly
+reassigned
+intentness
+craziness
+psychic
+squabbled
+burlesque
+capped
+extracted
+DiMaggio
+exclamation
+subdirectory
+fangs
+buyer
+pithing
+transistorizing
+nonbiodegradable
+dislocate
+monochromatic
+batting
+postcondition
+catalog
+Remus
+devices
+bike
+qualify
+detained
+commended
+civilize
+Elmhurst
+anesthetizing
+deaf
+Brigham
+title
+coarse
+combinations
+grayness
+innumerable
+Caroline
+fatty
+eastbound
+inexperienced
+hoarder
+scotch
+passport
+strategic
+gated
+flog
+Pipestone
+Dar
+Corcoran
+flyers
+competitions
+suppliers
+skips
+institutes
+troop
+connective
+denies
+polka
+observations
+askers
+homeless
+Anna
+subdirectories
+decaying
+outwitting
+Harpy
+crazed
+suffocate
+provers
+technically
+Franklinizations
+considered
+tinnily
+uninterruptedly
+whistled
+automate
+gutting
+surreptitious
+Choctaw
+cooks
+millivolt
+counterpoise
+Gothicism
+feminine
+metaphysically
+sanding
+contributorily
+receivers
+adjourn
+straggled
+druggists
+thanking
+ostrich
+hopelessness
+Eurydice
+excitation
+presumes
+imaginable
+concoct
+peering
+Phelps
+ferociousness
+sentences
+unlocks
+engrossing
+Ruth
+tying
+exclaimers
+synergy
+Huey
+merging
+judges
+Shylock
+Miltonism
+hen
+honeybee
+towers
+dilutes
+numerals
+democracy
+Ibero-
+invalids
+behavior
+accruing
+relics
+rackets
+Fischbein
+phony
+cross
+cleanup
+conspirator
+label
+university
+cleansed
+ballgown
+starlet
+aqueous
+portrayal
+despising
+distort
+palmed
+faced
+silverware
+assessor
+spiders
+artificially
+reminiscence
+Mexican
+obnoxious
+fragile
+apprehensible
+births
+garages
+panty
+anteater
+displacement
+drovers
+patenting
+far
+shrieks
+aligning
+pragmatism
+fevers
+reexamines
+occupancies
+sweats
+modulators
+demand
+Madeira
+Viennese
+chillier
+wildcats
+gentle
+Angles
+accuracies
+toggle
+Mendelssohn
+behaviorally
+Rochford
+mirror
+Modula
+clobbering
+chronography
+Eskimoizeds
+British
+pitfalls
+verify
+scatter
+Aztecan
+acuity
+sinking
+beasts
+Witt
+physicists
+folksong
+strokes
+crowder
+merry
+cadenced
+alimony
+principled
+golfing
+undiscovered
+irritates
+patriots
+rooms
+towering
+displease
+photosensitive
+inking
+gainers
+leaning
+hydrant
+preserve
+blinded
+interactions
+Barry
+whiteness
+pastimes
+Edenization
+Muscat
+assassinated
+labeled
+glacial
+implied
+bibliographies
+Buchanan
+forgivably
+innuendo
+den
+submarines
+mouthful
+expiring
+unfulfilled
+precession
+nullified
+affects
+Cynthia
+Chablis
+betterments
+advertising
+rubies
+southwest
+superstitious
+tabernacle
+silk
+handsomest
+Persian
+analog
+complex
+Taoist
+suspend
+relegated
+awesome
+Bruxelles
+imprecisely
+televise
+braking
+true
+disappointing
+navally
+circus
+beetles
+trumps
+fourscore
+Blackfoots
+Grady
+quiets
+floundered
+profundity
+Garrisonian
+Strauss
+cemented
+contrition
+mutations
+exhibits
+tits
+mate
+arches
+Moll
+ropers
+bombast
+difficultly
+adsorption
+definiteness
+cultivation
+heals
+Heusen
+target
+cited
+congresswoman
+Katherine
+titter
+aspire
+Mardis
+Nadia
+estimating
+stuck
+fifteenth
+Colombo
+survey
+staffing
+obtain
+loaded
+slaughtered
+lights
+circumference
+dull
+weekly
+wetness
+visualized
+Tannenbaum
+moribund
+demultiplex
+lockings
+thugs
+unnerves
+abut
+Chippewa
+stratifications
+signaled
+Italianizes
+algorithmic
+paranoid
+camping
+signifying
+Patrice
+search
+Angeles
+semblance
+taxed
+Beatrice
+retrace
+lockout
+grammatic
+helmsman
+uniform
+hamming
+disobedience
+captivated
+transferals
+cartographer
+aims
+Pakistani
+burglarized
+saucepans
+lacerating
+corny
+megabytes
+chancellor
+bulk
+commits
+meson
+deputies
+northeaster
+dipole
+machining
+therefore
+Telefunken
+salvaging
+Corinthianizes
+restlessly
+bromides
+generalized
+mishaps
+quelling
+spiritual
+beguiles
+Trobriand
+fleeing
+Armour
+chin
+provers
+aeronautic
+voltage
+sash
+anaerobic
+simultaneous
+accumulating
+Medusan
+shouted
+freakish
+index
+commercially
+mistiness
+endpoint
+straight
+flurried
+denotative
+coming
+commencements
+gentleman
+gifted
+Shanghais
+sportswriting
+sloping
+navies
+leaflet
+shooter
+Joplin
+babies
+subdivision
+burstiness
+belted
+assails
+admiring
+swaying
+Goldstine
+fitting
+Norwalk
+weakening
+analogy
+deludes
+cokes
+Clayton
+exhausts
+causality
+sating
+icon
+throttles
+communicants
+dehydrate
+priceless
+publicly
+incidentals
+commonplace
+mumbles
+furthermore
+cautioned
+parametrized
+registration
+sadly
+positioning
+babysitting
+eternal
+hoarder
+congregates
+rains
+workers
+sags
+unplug
+garage
+boulder
+hollowly
+specifics
+Teresa
+Winsett
+convenient
+buckboards
+amenities
+resplendent
+priding
+configurations
+untidiness
+Brice
+sews
+participated
+Simon
+certificates
+Fitzpatrick
+Evanston
+misted
+textures
+save
+count
+rightful
+chaperone
+Lizzy
+clenched
+effortlessly
+accessed
+beaters
+Hornblower
+vests
+indulgences
+infallibly
+unwilling
+excrete
+spools
+crunches
+overestimating
+ineffective
+humiliation
+sophomore
+star
+rifles
+dialysis
+arriving
+indulge
+clockers
+languages
+Antarctica
+percentage
+ceiling
+specification
+regimented
+ciphers
+pictures
+serpents
+allot
+realized
+mayoral
+opaquely
+hostess
+fiftieth
+incorrectly
+decomposition
+stranglings
+mixture
+electroencephalography
+similarities
+charges
+freest
+Greenberg
+tinting
+expelled
+warm
+smoothed
+deductions
+Romano
+bitterroot
+corset
+securing
+environing
+cute
+Crays
+heiress
+inform
+avenge
+universals
+Kinsey
+ravines
+bestseller
+equilibrium
+extents
+relatively
+pressure
+critiques
+befouled
+rightfully
+mechanizing
+Latinizes
+timesharing
+Aden
+embassies
+males
+shapelessly
+genres
+mastering
+Newtonian
+finishers
+abates
+teem
+kiting
+stodgy
+scalps
+feed
+guitars
+airships
+store
+denounces
+Pyle
+Saxony
+serializations
+Peruvian
+taxonomically
+kingdom
+stint
+Sault
+faithful
+Ganymede
+tidiness
+gainful
+contrary
+Tipperary
+tropics
+theorizers
+renew
+already
+terminal
+Hegelian
+hypothesizer
+warningly
+journalizing
+nested
+Lars
+saplings
+foothill
+labeled
+imperiously
+reporters
+furnishings
+precipitable
+discounts
+excises
+Stalin
+despot
+ripeness
+Arabia
+unruly
+mournfulness
+boom
+slaughter
+Sabine
+handy
+rural
+organizer
+shipyard
+civics
+inaccuracy
+rules
+juveniles
+comprised
+investigations
+stabilizes
+seminaries
+Hunter
+sporty
+test
+weasels
+CERN
+tempering
+afore
+Galatean
+techniques
+error
+veranda
+severely
+Cassites
+forthcoming
+guides
+vanish
+lied
+sawtooth
+fated
+gradually
+widens
+preclude
+Jobrel
+hooker
+rainstorm
+disconnects
+cruelty
+exponentials
+affective
+arteries
+Crosby
+acquaint
+evenhandedly
+percentage
+disobedience
+humility
+gleaning
+petted
+bloater
+minion
+marginal
+apiary
+measures
+precaution
+repelled
+primary
+coverings
+Artemia
+navigate
+spatial
+Gurkha
+meanwhile
+Melinda
+Butterfield
+Aldrich
+previewing
+glut
+unaffected
+inmate
+mineral
+impending
+meditation
+ideas
+miniaturizes
+lewdly
+title
+youthfulness
+creak
+Chippewa
+clamored
+freezes
+forgivably
+reduce
+McGovern
+Nazis
+epistle
+socializes
+conceptions
+Kevin
+uncovering
+chews
+appendixes
+appendixes
+appendixes
+appendixes
+appendixes
+appendixes
+raining
+infest
+compartment
+minting
+ducks
+roped
+waltz
+Lillian
+repressions
+chillingly
+noncritical
+lithograph
+spongers
+parenthood
+posed
+instruments
+filial
+fixedly
+relives
+Pandora
+watering
+ungrateful
+secures
+chastisers
+icon
+reuniting
+imagining
+abiding
+omnisciently
+Britannic
+scholastics
+mechanics
+humidly
+masterpiece
+however
+Mendelian
+jarred
+scolds
+infatuate
+willed
+joyfully
+Microsoft
+fibrosities
+Baltimorean
+equestrian
+Goodrich
+apish
+Adlerian
+Tropez
+nouns
+distracting
+mutton
+bridgeable
+stickers
+transcontinental
+amateurish
+Gandhian
+stratified
+chamberlains
+creditably
+philosophic
+ores
+Carleton
+tape
+afloat
+goodness
+welcoming
+Pinsky
+halting
+bibliography
+decoding
+variance
+allowed
+dire
+dub
+poisoning
+Iraqis
+heaving
+population
+bomb
+Majorca
+Gershwins
+explorers
+libretto
+occurred
+Lagos
+rats
+bankruptcies
+crying
+unexpected
+accessed
+colorful
+versatility
+cosy
+Darius
+mastering
+Asiaticizations
+offerers
+uncles
+sleepwalk
+Ernestine
+checksumming
+stopped
+sicker
+Italianization
+alphabetic
+pharmaceutic
+creator
+chess
+charcoal
+Epiphany
+bulldozes
+Pygmalion
+caressing
+Palestine
+regimented
+scars
+realest
+diffusing
+clubroom
+Blythe
+ahead
+reviver
+retransmitting
+landslide
+Eiffel
+absentee
+aye
+forked
+Peruvianizes
+clerked
+tutor
+boulevard
+shuttered
+quotes
+Caltech
+Mossberg
+kept
+roundly
+features
+imaginable
+controller
+racial
+uprisings
+narrowed
+cannot
+vest
+famine
+sugars
+exterminated
+belays
+Hodges
+translatable
+duality
+recording
+rouses
+poison
+attitude
+dusted
+encompasses
+presentation
+Kantian
+imprecision
+saving
+maternal
+hewed
+kerosene
+Cubans
+photographers
+nymph
+bedlam
+north
+Schoenberg
+botany
+curs
+solidification
+inheritresses
+stiller
+t1
+suite
+ransomer
+Willy
+Rena
+Seattle
+relaxes
+exclaim
+exclaim
+implicated
+distinguish
+assayed
+homeowner
+and
+stealth
+coinciding
+founder
+environing
+jewelry
+lemons
+brokenness
+bedpost
+assurers
+annoyers
+affixed
+warbling
+seriously
+boasted
+Chantilly
+Iranizes
+violinist
+extramarital
+spates
+cloakroom
+gazer
+hand
+tucked
+gems
+clinker
+refiner
+callus
+leopards
+comfortingly
+generically
+getters
+sexually
+spear
+serums
+Italianization
+attendants
+spies
+Anthony
+planar
+cupped
+cleanser
+commuters
+honeysuckle
+orphanage
+skies
+crushers
+Puritan
+squeezer
+bruises
+bonfire
+Colombo
+nondecreasing
+DELETE FROM t2 WHERE fld3="r%";
+SELECT fld3 FROM t2;
+fld3
+Omaha
+breaking
+Romans
+intercepted
+bewilderingly
+astound
+admonishing
+sumac
+flanking
+combed
+subjective
+scatterbrain
+Eulerian
+dubbed
+Kane
+overlay
+perturb
+goblins
+annihilates
+Wotan
+snatching
+concludes
+laterally
+yelped
+grazing
+Baird
+celery
+misunderstander
+handgun
+foldout
+mystic
+succumbed
+Nabisco
+fingerings
+aging
+afield
+ammonium
+boat
+intelligibility
+Augustine
+teethe
+dreaded
+scholastics
+audiology
+wallet
+parters
+eschew
+quitter
+neat
+Steinberg
+jarring
+tinily
+balled
+persist
+attainments
+fanatic
+measures
+rightfulness
+capably
+impulsive
+starlet
+terminators
+untying
+announces
+featherweight
+pessimist
+daughter
+decliner
+lawgiver
+stated
+readable
+attrition
+cascade
+motors
+interrogate
+pests
+stairway
+dopers
+testicle
+Parsifal
+leavings
+postulation
+squeaking
+contrasted
+leftover
+whiteners
+erases
+Punjab
+Merritt
+Quixotism
+sweetish
+dogging
+scornfully
+bellow
+bills
+cupboard
+sureties
+puddings
+tapestry
+fetters
+bivalves
+incurring
+Adolph
+pithed
+emergency
+Miles
+trimmings
+tragedies
+skulking
+flint
+flopping
+relaxing
+offload
+suites
+lists
+animized
+multilayer
+standardizes
+Judas
+vacuuming
+dentally
+humanness
+inch
+Weissmuller
+irresponsibly
+luckily
+culled
+medical
+bloodbath
+subschema
+animals
+Micronesia
+repetitions
+Antares
+ventilate
+pityingly
+interdependent
+Graves
+neonatal
+scribbled
+chafe
+honoring
+realtor
+elite
+funereal
+abrogating
+sorters
+Conley
+lectured
+Abraham
+Hawaii
+cage
+hushes
+Simla
+reporters
+Dutchman
+descendants
+groupings
+dissociate
+coexist
+Beebe
+Taoism
+Connally
+fetched
+checkpoints
+rusting
+galling
+obliterates
+traitor
+resumes
+analyzable
+terminator
+gritty
+firearm
+minima
+Selfridge
+disable
+witchcraft
+betroth
+Manhattanize
+imprint
+peeked
+swelling
+interrelationships
+riser
+Gandhian
+peacock
+bee
+kanji
+dental
+scarf
+chasm
+insolence
+syndicate
+alike
+imperial
+convulsion
+railway
+validate
+normalizes
+comprehensive
+chewing
+denizen
+schemer
+chronicle
+Kline
+Anatole
+partridges
+brunch
+recruited
+dimensions
+Chicana
+announced
+praised
+employing
+linear
+quagmire
+western
+relishing
+serving
+scheduling
+lore
+eventful
+arteriole
+disentangle
+cured
+Fenton
+avoidable
+drains
+detectably
+husky
+impelling
+undoes
+evened
+squeezes
+destroyer
+rudeness
+beaner
+boorish
+Everhart
+encompass
+mushrooms
+Alison
+externally
+pellagra
+cult
+creek
+Huffman
+Majorca
+governing
+gadfly
+reassigned
+intentness
+craziness
+psychic
+squabbled
+burlesque
+capped
+extracted
+DiMaggio
+exclamation
+subdirectory
+fangs
+buyer
+pithing
+transistorizing
+nonbiodegradable
+dislocate
+monochromatic
+batting
+postcondition
+catalog
+Remus
+devices
+bike
+qualify
+detained
+commended
+civilize
+Elmhurst
+anesthetizing
+deaf
+Brigham
+title
+coarse
+combinations
+grayness
+innumerable
+Caroline
+fatty
+eastbound
+inexperienced
+hoarder
+scotch
+passport
+strategic
+gated
+flog
+Pipestone
+Dar
+Corcoran
+flyers
+competitions
+suppliers
+skips
+institutes
+troop
+connective
+denies
+polka
+observations
+askers
+homeless
+Anna
+subdirectories
+decaying
+outwitting
+Harpy
+crazed
+suffocate
+provers
+technically
+Franklinizations
+considered
+tinnily
+uninterruptedly
+whistled
+automate
+gutting
+surreptitious
+Choctaw
+cooks
+millivolt
+counterpoise
+Gothicism
+feminine
+metaphysically
+sanding
+contributorily
+receivers
+adjourn
+straggled
+druggists
+thanking
+ostrich
+hopelessness
+Eurydice
+excitation
+presumes
+imaginable
+concoct
+peering
+Phelps
+ferociousness
+sentences
+unlocks
+engrossing
+Ruth
+tying
+exclaimers
+synergy
+Huey
+merging
+judges
+Shylock
+Miltonism
+hen
+honeybee
+towers
+dilutes
+numerals
+democracy
+Ibero-
+invalids
+behavior
+accruing
+relics
+rackets
+Fischbein
+phony
+cross
+cleanup
+conspirator
+label
+university
+cleansed
+ballgown
+starlet
+aqueous
+portrayal
+despising
+distort
+palmed
+faced
+silverware
+assessor
+spiders
+artificially
+reminiscence
+Mexican
+obnoxious
+fragile
+apprehensible
+births
+garages
+panty
+anteater
+displacement
+drovers
+patenting
+far
+shrieks
+aligning
+pragmatism
+fevers
+reexamines
+occupancies
+sweats
+modulators
+demand
+Madeira
+Viennese
+chillier
+wildcats
+gentle
+Angles
+accuracies
+toggle
+Mendelssohn
+behaviorally
+Rochford
+mirror
+Modula
+clobbering
+chronography
+Eskimoizeds
+British
+pitfalls
+verify
+scatter
+Aztecan
+acuity
+sinking
+beasts
+Witt
+physicists
+folksong
+strokes
+crowder
+merry
+cadenced
+alimony
+principled
+golfing
+undiscovered
+irritates
+patriots
+rooms
+towering
+displease
+photosensitive
+inking
+gainers
+leaning
+hydrant
+preserve
+blinded
+interactions
+Barry
+whiteness
+pastimes
+Edenization
+Muscat
+assassinated
+labeled
+glacial
+implied
+bibliographies
+Buchanan
+forgivably
+innuendo
+den
+submarines
+mouthful
+expiring
+unfulfilled
+precession
+nullified
+affects
+Cynthia
+Chablis
+betterments
+advertising
+rubies
+southwest
+superstitious
+tabernacle
+silk
+handsomest
+Persian
+analog
+complex
+Taoist
+suspend
+relegated
+awesome
+Bruxelles
+imprecisely
+televise
+braking
+true
+disappointing
+navally
+circus
+beetles
+trumps
+fourscore
+Blackfoots
+Grady
+quiets
+floundered
+profundity
+Garrisonian
+Strauss
+cemented
+contrition
+mutations
+exhibits
+tits
+mate
+arches
+Moll
+ropers
+bombast
+difficultly
+adsorption
+definiteness
+cultivation
+heals
+Heusen
+target
+cited
+congresswoman
+Katherine
+titter
+aspire
+Mardis
+Nadia
+estimating
+stuck
+fifteenth
+Colombo
+survey
+staffing
+obtain
+loaded
+slaughtered
+lights
+circumference
+dull
+weekly
+wetness
+visualized
+Tannenbaum
+moribund
+demultiplex
+lockings
+thugs
+unnerves
+abut
+Chippewa
+stratifications
+signaled
+Italianizes
+algorithmic
+paranoid
+camping
+signifying
+Patrice
+search
+Angeles
+semblance
+taxed
+Beatrice
+retrace
+lockout
+grammatic
+helmsman
+uniform
+hamming
+disobedience
+captivated
+transferals
+cartographer
+aims
+Pakistani
+burglarized
+saucepans
+lacerating
+corny
+megabytes
+chancellor
+bulk
+commits
+meson
+deputies
+northeaster
+dipole
+machining
+therefore
+Telefunken
+salvaging
+Corinthianizes
+restlessly
+bromides
+generalized
+mishaps
+quelling
+spiritual
+beguiles
+Trobriand
+fleeing
+Armour
+chin
+provers
+aeronautic
+voltage
+sash
+anaerobic
+simultaneous
+accumulating
+Medusan
+shouted
+freakish
+index
+commercially
+mistiness
+endpoint
+straight
+flurried
+denotative
+coming
+commencements
+gentleman
+gifted
+Shanghais
+sportswriting
+sloping
+navies
+leaflet
+shooter
+Joplin
+babies
+subdivision
+burstiness
+belted
+assails
+admiring
+swaying
+Goldstine
+fitting
+Norwalk
+weakening
+analogy
+deludes
+cokes
+Clayton
+exhausts
+causality
+sating
+icon
+throttles
+communicants
+dehydrate
+priceless
+publicly
+incidentals
+commonplace
+mumbles
+furthermore
+cautioned
+parametrized
+registration
+sadly
+positioning
+babysitting
+eternal
+hoarder
+congregates
+rains
+workers
+sags
+unplug
+garage
+boulder
+hollowly
+specifics
+Teresa
+Winsett
+convenient
+buckboards
+amenities
+resplendent
+priding
+configurations
+untidiness
+Brice
+sews
+participated
+Simon
+certificates
+Fitzpatrick
+Evanston
+misted
+textures
+save
+count
+rightful
+chaperone
+Lizzy
+clenched
+effortlessly
+accessed
+beaters
+Hornblower
+vests
+indulgences
+infallibly
+unwilling
+excrete
+spools
+crunches
+overestimating
+ineffective
+humiliation
+sophomore
+star
+rifles
+dialysis
+arriving
+indulge
+clockers
+languages
+Antarctica
+percentage
+ceiling
+specification
+regimented
+ciphers
+pictures
+serpents
+allot
+realized
+mayoral
+opaquely
+hostess
+fiftieth
+incorrectly
+decomposition
+stranglings
+mixture
+electroencephalography
+similarities
+charges
+freest
+Greenberg
+tinting
+expelled
+warm
+smoothed
+deductions
+Romano
+bitterroot
+corset
+securing
+environing
+cute
+Crays
+heiress
+inform
+avenge
+universals
+Kinsey
+ravines
+bestseller
+equilibrium
+extents
+relatively
+pressure
+critiques
+befouled
+rightfully
+mechanizing
+Latinizes
+timesharing
+Aden
+embassies
+males
+shapelessly
+genres
+mastering
+Newtonian
+finishers
+abates
+teem
+kiting
+stodgy
+scalps
+feed
+guitars
+airships
+store
+denounces
+Pyle
+Saxony
+serializations
+Peruvian
+taxonomically
+kingdom
+stint
+Sault
+faithful
+Ganymede
+tidiness
+gainful
+contrary
+Tipperary
+tropics
+theorizers
+renew
+already
+terminal
+Hegelian
+hypothesizer
+warningly
+journalizing
+nested
+Lars
+saplings
+foothill
+labeled
+imperiously
+reporters
+furnishings
+precipitable
+discounts
+excises
+Stalin
+despot
+ripeness
+Arabia
+unruly
+mournfulness
+boom
+slaughter
+Sabine
+handy
+rural
+organizer
+shipyard
+civics
+inaccuracy
+rules
+juveniles
+comprised
+investigations
+stabilizes
+seminaries
+Hunter
+sporty
+test
+weasels
+CERN
+tempering
+afore
+Galatean
+techniques
+error
+veranda
+severely
+Cassites
+forthcoming
+guides
+vanish
+lied
+sawtooth
+fated
+gradually
+widens
+preclude
+Jobrel
+hooker
+rainstorm
+disconnects
+cruelty
+exponentials
+affective
+arteries
+Crosby
+acquaint
+evenhandedly
+percentage
+disobedience
+humility
+gleaning
+petted
+bloater
+minion
+marginal
+apiary
+measures
+precaution
+repelled
+primary
+coverings
+Artemia
+navigate
+spatial
+Gurkha
+meanwhile
+Melinda
+Butterfield
+Aldrich
+previewing
+glut
+unaffected
+inmate
+mineral
+impending
+meditation
+ideas
+miniaturizes
+lewdly
+title
+youthfulness
+creak
+Chippewa
+clamored
+freezes
+forgivably
+reduce
+McGovern
+Nazis
+epistle
+socializes
+conceptions
+Kevin
+uncovering
+chews
+appendixes
+appendixes
+appendixes
+appendixes
+appendixes
+appendixes
+raining
+infest
+compartment
+minting
+ducks
+roped
+waltz
+Lillian
+repressions
+chillingly
+noncritical
+lithograph
+spongers
+parenthood
+posed
+instruments
+filial
+fixedly
+relives
+Pandora
+watering
+ungrateful
+secures
+chastisers
+icon
+reuniting
+imagining
+abiding
+omnisciently
+Britannic
+scholastics
+mechanics
+humidly
+masterpiece
+however
+Mendelian
+jarred
+scolds
+infatuate
+willed
+joyfully
+Microsoft
+fibrosities
+Baltimorean
+equestrian
+Goodrich
+apish
+Adlerian
+Tropez
+nouns
+distracting
+mutton
+bridgeable
+stickers
+transcontinental
+amateurish
+Gandhian
+stratified
+chamberlains
+creditably
+philosophic
+ores
+Carleton
+tape
+afloat
+goodness
+welcoming
+Pinsky
+halting
+bibliography
+decoding
+variance
+allowed
+dire
+dub
+poisoning
+Iraqis
+heaving
+population
+bomb
+Majorca
+Gershwins
+explorers
+libretto
+occurred
+Lagos
+rats
+bankruptcies
+crying
+unexpected
+accessed
+colorful
+versatility
+cosy
+Darius
+mastering
+Asiaticizations
+offerers
+uncles
+sleepwalk
+Ernestine
+checksumming
+stopped
+sicker
+Italianization
+alphabetic
+pharmaceutic
+creator
+chess
+charcoal
+Epiphany
+bulldozes
+Pygmalion
+caressing
+Palestine
+regimented
+scars
+realest
+diffusing
+clubroom
+Blythe
+ahead
+reviver
+retransmitting
+landslide
+Eiffel
+absentee
+aye
+forked
+Peruvianizes
+clerked
+tutor
+boulevard
+shuttered
+quotes
+Caltech
+Mossberg
+kept
+roundly
+features
+imaginable
+controller
+racial
+uprisings
+narrowed
+cannot
+vest
+famine
+sugars
+exterminated
+belays
+Hodges
+translatable
+duality
+recording
+rouses
+poison
+attitude
+dusted
+encompasses
+presentation
+Kantian
+imprecision
+saving
+maternal
+hewed
+kerosene
+Cubans
+photographers
+nymph
+bedlam
+north
+Schoenberg
+botany
+curs
+solidification
+inheritresses
+stiller
+t1
+suite
+ransomer
+Willy
+Rena
+Seattle
+relaxes
+exclaim
+exclaim
+implicated
+distinguish
+assayed
+homeowner
+and
+stealth
+coinciding
+founder
+environing
+jewelry
+lemons
+brokenness
+bedpost
+assurers
+annoyers
+affixed
+warbling
+seriously
+boasted
+Chantilly
+Iranizes
+violinist
+extramarital
+spates
+cloakroom
+gazer
+hand
+tucked
+gems
+clinker
+refiner
+callus
+leopards
+comfortingly
+generically
+getters
+sexually
+spear
+serums
+Italianization
+attendants
+spies
+Anthony
+planar
+cupped
+cleanser
+commuters
+honeysuckle
+orphanage
+skies
+crushers
+Puritan
+squeezer
+bruises
+bonfire
+Colombo
+nondecreasing
+DELETE FROM t2 WHERE fld3="d%" ORDER BY RAND();
+SELECT fld3 FROM t2;
+fld3
+Omaha
+breaking
+Romans
+intercepted
+bewilderingly
+astound
+admonishing
+sumac
+flanking
+combed
+subjective
+scatterbrain
+Eulerian
+dubbed
+Kane
+overlay
+perturb
+goblins
+annihilates
+Wotan
+snatching
+concludes
+laterally
+yelped
+grazing
+Baird
+celery
+misunderstander
+handgun
+foldout
+mystic
+succumbed
+Nabisco
+fingerings
+aging
+afield
+ammonium
+boat
+intelligibility
+Augustine
+teethe
+dreaded
+scholastics
+audiology
+wallet
+parters
+eschew
+quitter
+neat
+Steinberg
+jarring
+tinily
+balled
+persist
+attainments
+fanatic
+measures
+rightfulness
+capably
+impulsive
+starlet
+terminators
+untying
+announces
+featherweight
+pessimist
+daughter
+decliner
+lawgiver
+stated
+readable
+attrition
+cascade
+motors
+interrogate
+pests
+stairway
+dopers
+testicle
+Parsifal
+leavings
+postulation
+squeaking
+contrasted
+leftover
+whiteners
+erases
+Punjab
+Merritt
+Quixotism
+sweetish
+dogging
+scornfully
+bellow
+bills
+cupboard
+sureties
+puddings
+tapestry
+fetters
+bivalves
+incurring
+Adolph
+pithed
+emergency
+Miles
+trimmings
+tragedies
+skulking
+flint
+flopping
+relaxing
+offload
+suites
+lists
+animized
+multilayer
+standardizes
+Judas
+vacuuming
+dentally
+humanness
+inch
+Weissmuller
+irresponsibly
+luckily
+culled
+medical
+bloodbath
+subschema
+animals
+Micronesia
+repetitions
+Antares
+ventilate
+pityingly
+interdependent
+Graves
+neonatal
+scribbled
+chafe
+honoring
+realtor
+elite
+funereal
+abrogating
+sorters
+Conley
+lectured
+Abraham
+Hawaii
+cage
+hushes
+Simla
+reporters
+Dutchman
+descendants
+groupings
+dissociate
+coexist
+Beebe
+Taoism
+Connally
+fetched
+checkpoints
+rusting
+galling
+obliterates
+traitor
+resumes
+analyzable
+terminator
+gritty
+firearm
+minima
+Selfridge
+disable
+witchcraft
+betroth
+Manhattanize
+imprint
+peeked
+swelling
+interrelationships
+riser
+Gandhian
+peacock
+bee
+kanji
+dental
+scarf
+chasm
+insolence
+syndicate
+alike
+imperial
+convulsion
+railway
+validate
+normalizes
+comprehensive
+chewing
+denizen
+schemer
+chronicle
+Kline
+Anatole
+partridges
+brunch
+recruited
+dimensions
+Chicana
+announced
+praised
+employing
+linear
+quagmire
+western
+relishing
+serving
+scheduling
+lore
+eventful
+arteriole
+disentangle
+cured
+Fenton
+avoidable
+drains
+detectably
+husky
+impelling
+undoes
+evened
+squeezes
+destroyer
+rudeness
+beaner
+boorish
+Everhart
+encompass
+mushrooms
+Alison
+externally
+pellagra
+cult
+creek
+Huffman
+Majorca
+governing
+gadfly
+reassigned
+intentness
+craziness
+psychic
+squabbled
+burlesque
+capped
+extracted
+DiMaggio
+exclamation
+subdirectory
+fangs
+buyer
+pithing
+transistorizing
+nonbiodegradable
+dislocate
+monochromatic
+batting
+postcondition
+catalog
+Remus
+devices
+bike
+qualify
+detained
+commended
+civilize
+Elmhurst
+anesthetizing
+deaf
+Brigham
+title
+coarse
+combinations
+grayness
+innumerable
+Caroline
+fatty
+eastbound
+inexperienced
+hoarder
+scotch
+passport
+strategic
+gated
+flog
+Pipestone
+Dar
+Corcoran
+flyers
+competitions
+suppliers
+skips
+institutes
+troop
+connective
+denies
+polka
+observations
+askers
+homeless
+Anna
+subdirectories
+decaying
+outwitting
+Harpy
+crazed
+suffocate
+provers
+technically
+Franklinizations
+considered
+tinnily
+uninterruptedly
+whistled
+automate
+gutting
+surreptitious
+Choctaw
+cooks
+millivolt
+counterpoise
+Gothicism
+feminine
+metaphysically
+sanding
+contributorily
+receivers
+adjourn
+straggled
+druggists
+thanking
+ostrich
+hopelessness
+Eurydice
+excitation
+presumes
+imaginable
+concoct
+peering
+Phelps
+ferociousness
+sentences
+unlocks
+engrossing
+Ruth
+tying
+exclaimers
+synergy
+Huey
+merging
+judges
+Shylock
+Miltonism
+hen
+honeybee
+towers
+dilutes
+numerals
+democracy
+Ibero-
+invalids
+behavior
+accruing
+relics
+rackets
+Fischbein
+phony
+cross
+cleanup
+conspirator
+label
+university
+cleansed
+ballgown
+starlet
+aqueous
+portrayal
+despising
+distort
+palmed
+faced
+silverware
+assessor
+spiders
+artificially
+reminiscence
+Mexican
+obnoxious
+fragile
+apprehensible
+births
+garages
+panty
+anteater
+displacement
+drovers
+patenting
+far
+shrieks
+aligning
+pragmatism
+fevers
+reexamines
+occupancies
+sweats
+modulators
+demand
+Madeira
+Viennese
+chillier
+wildcats
+gentle
+Angles
+accuracies
+toggle
+Mendelssohn
+behaviorally
+Rochford
+mirror
+Modula
+clobbering
+chronography
+Eskimoizeds
+British
+pitfalls
+verify
+scatter
+Aztecan
+acuity
+sinking
+beasts
+Witt
+physicists
+folksong
+strokes
+crowder
+merry
+cadenced
+alimony
+principled
+golfing
+undiscovered
+irritates
+patriots
+rooms
+towering
+displease
+photosensitive
+inking
+gainers
+leaning
+hydrant
+preserve
+blinded
+interactions
+Barry
+whiteness
+pastimes
+Edenization
+Muscat
+assassinated
+labeled
+glacial
+implied
+bibliographies
+Buchanan
+forgivably
+innuendo
+den
+submarines
+mouthful
+expiring
+unfulfilled
+precession
+nullified
+affects
+Cynthia
+Chablis
+betterments
+advertising
+rubies
+southwest
+superstitious
+tabernacle
+silk
+handsomest
+Persian
+analog
+complex
+Taoist
+suspend
+relegated
+awesome
+Bruxelles
+imprecisely
+televise
+braking
+true
+disappointing
+navally
+circus
+beetles
+trumps
+fourscore
+Blackfoots
+Grady
+quiets
+floundered
+profundity
+Garrisonian
+Strauss
+cemented
+contrition
+mutations
+exhibits
+tits
+mate
+arches
+Moll
+ropers
+bombast
+difficultly
+adsorption
+definiteness
+cultivation
+heals
+Heusen
+target
+cited
+congresswoman
+Katherine
+titter
+aspire
+Mardis
+Nadia
+estimating
+stuck
+fifteenth
+Colombo
+survey
+staffing
+obtain
+loaded
+slaughtered
+lights
+circumference
+dull
+weekly
+wetness
+visualized
+Tannenbaum
+moribund
+demultiplex
+lockings
+thugs
+unnerves
+abut
+Chippewa
+stratifications
+signaled
+Italianizes
+algorithmic
+paranoid
+camping
+signifying
+Patrice
+search
+Angeles
+semblance
+taxed
+Beatrice
+retrace
+lockout
+grammatic
+helmsman
+uniform
+hamming
+disobedience
+captivated
+transferals
+cartographer
+aims
+Pakistani
+burglarized
+saucepans
+lacerating
+corny
+megabytes
+chancellor
+bulk
+commits
+meson
+deputies
+northeaster
+dipole
+machining
+therefore
+Telefunken
+salvaging
+Corinthianizes
+restlessly
+bromides
+generalized
+mishaps
+quelling
+spiritual
+beguiles
+Trobriand
+fleeing
+Armour
+chin
+provers
+aeronautic
+voltage
+sash
+anaerobic
+simultaneous
+accumulating
+Medusan
+shouted
+freakish
+index
+commercially
+mistiness
+endpoint
+straight
+flurried
+denotative
+coming
+commencements
+gentleman
+gifted
+Shanghais
+sportswriting
+sloping
+navies
+leaflet
+shooter
+Joplin
+babies
+subdivision
+burstiness
+belted
+assails
+admiring
+swaying
+Goldstine
+fitting
+Norwalk
+weakening
+analogy
+deludes
+cokes
+Clayton
+exhausts
+causality
+sating
+icon
+throttles
+communicants
+dehydrate
+priceless
+publicly
+incidentals
+commonplace
+mumbles
+furthermore
+cautioned
+parametrized
+registration
+sadly
+positioning
+babysitting
+eternal
+hoarder
+congregates
+rains
+workers
+sags
+unplug
+garage
+boulder
+hollowly
+specifics
+Teresa
+Winsett
+convenient
+buckboards
+amenities
+resplendent
+priding
+configurations
+untidiness
+Brice
+sews
+participated
+Simon
+certificates
+Fitzpatrick
+Evanston
+misted
+textures
+save
+count
+rightful
+chaperone
+Lizzy
+clenched
+effortlessly
+accessed
+beaters
+Hornblower
+vests
+indulgences
+infallibly
+unwilling
+excrete
+spools
+crunches
+overestimating
+ineffective
+humiliation
+sophomore
+star
+rifles
+dialysis
+arriving
+indulge
+clockers
+languages
+Antarctica
+percentage
+ceiling
+specification
+regimented
+ciphers
+pictures
+serpents
+allot
+realized
+mayoral
+opaquely
+hostess
+fiftieth
+incorrectly
+decomposition
+stranglings
+mixture
+electroencephalography
+similarities
+charges
+freest
+Greenberg
+tinting
+expelled
+warm
+smoothed
+deductions
+Romano
+bitterroot
+corset
+securing
+environing
+cute
+Crays
+heiress
+inform
+avenge
+universals
+Kinsey
+ravines
+bestseller
+equilibrium
+extents
+relatively
+pressure
+critiques
+befouled
+rightfully
+mechanizing
+Latinizes
+timesharing
+Aden
+embassies
+males
+shapelessly
+genres
+mastering
+Newtonian
+finishers
+abates
+teem
+kiting
+stodgy
+scalps
+feed
+guitars
+airships
+store
+denounces
+Pyle
+Saxony
+serializations
+Peruvian
+taxonomically
+kingdom
+stint
+Sault
+faithful
+Ganymede
+tidiness
+gainful
+contrary
+Tipperary
+tropics
+theorizers
+renew
+already
+terminal
+Hegelian
+hypothesizer
+warningly
+journalizing
+nested
+Lars
+saplings
+foothill
+labeled
+imperiously
+reporters
+furnishings
+precipitable
+discounts
+excises
+Stalin
+despot
+ripeness
+Arabia
+unruly
+mournfulness
+boom
+slaughter
+Sabine
+handy
+rural
+organizer
+shipyard
+civics
+inaccuracy
+rules
+juveniles
+comprised
+investigations
+stabilizes
+seminaries
+Hunter
+sporty
+test
+weasels
+CERN
+tempering
+afore
+Galatean
+techniques
+error
+veranda
+severely
+Cassites
+forthcoming
+guides
+vanish
+lied
+sawtooth
+fated
+gradually
+widens
+preclude
+Jobrel
+hooker
+rainstorm
+disconnects
+cruelty
+exponentials
+affective
+arteries
+Crosby
+acquaint
+evenhandedly
+percentage
+disobedience
+humility
+gleaning
+petted
+bloater
+minion
+marginal
+apiary
+measures
+precaution
+repelled
+primary
+coverings
+Artemia
+navigate
+spatial
+Gurkha
+meanwhile
+Melinda
+Butterfield
+Aldrich
+previewing
+glut
+unaffected
+inmate
+mineral
+impending
+meditation
+ideas
+miniaturizes
+lewdly
+title
+youthfulness
+creak
+Chippewa
+clamored
+freezes
+forgivably
+reduce
+McGovern
+Nazis
+epistle
+socializes
+conceptions
+Kevin
+uncovering
+chews
+appendixes
+appendixes
+appendixes
+appendixes
+appendixes
+appendixes
+raining
+infest
+compartment
+minting
+ducks
+roped
+waltz
+Lillian
+repressions
+chillingly
+noncritical
+lithograph
+spongers
+parenthood
+posed
+instruments
+filial
+fixedly
+relives
+Pandora
+watering
+ungrateful
+secures
+chastisers
+icon
+reuniting
+imagining
+abiding
+omnisciently
+Britannic
+scholastics
+mechanics
+humidly
+masterpiece
+however
+Mendelian
+jarred
+scolds
+infatuate
+willed
+joyfully
+Microsoft
+fibrosities
+Baltimorean
+equestrian
+Goodrich
+apish
+Adlerian
+Tropez
+nouns
+distracting
+mutton
+bridgeable
+stickers
+transcontinental
+amateurish
+Gandhian
+stratified
+chamberlains
+creditably
+philosophic
+ores
+Carleton
+tape
+afloat
+goodness
+welcoming
+Pinsky
+halting
+bibliography
+decoding
+variance
+allowed
+dire
+dub
+poisoning
+Iraqis
+heaving
+population
+bomb
+Majorca
+Gershwins
+explorers
+libretto
+occurred
+Lagos
+rats
+bankruptcies
+crying
+unexpected
+accessed
+colorful
+versatility
+cosy
+Darius
+mastering
+Asiaticizations
+offerers
+uncles
+sleepwalk
+Ernestine
+checksumming
+stopped
+sicker
+Italianization
+alphabetic
+pharmaceutic
+creator
+chess
+charcoal
+Epiphany
+bulldozes
+Pygmalion
+caressing
+Palestine
+regimented
+scars
+realest
+diffusing
+clubroom
+Blythe
+ahead
+reviver
+retransmitting
+landslide
+Eiffel
+absentee
+aye
+forked
+Peruvianizes
+clerked
+tutor
+boulevard
+shuttered
+quotes
+Caltech
+Mossberg
+kept
+roundly
+features
+imaginable
+controller
+racial
+uprisings
+narrowed
+cannot
+vest
+famine
+sugars
+exterminated
+belays
+Hodges
+translatable
+duality
+recording
+rouses
+poison
+attitude
+dusted
+encompasses
+presentation
+Kantian
+imprecision
+saving
+maternal
+hewed
+kerosene
+Cubans
+photographers
+nymph
+bedlam
+north
+Schoenberg
+botany
+curs
+solidification
+inheritresses
+stiller
+t1
+suite
+ransomer
+Willy
+Rena
+Seattle
+relaxes
+exclaim
+exclaim
+implicated
+distinguish
+assayed
+homeowner
+and
+stealth
+coinciding
+founder
+environing
+jewelry
+lemons
+brokenness
+bedpost
+assurers
+annoyers
+affixed
+warbling
+seriously
+boasted
+Chantilly
+Iranizes
+violinist
+extramarital
+spates
+cloakroom
+gazer
+hand
+tucked
+gems
+clinker
+refiner
+callus
+leopards
+comfortingly
+generically
+getters
+sexually
+spear
+serums
+Italianization
+attendants
+spies
+Anthony
+planar
+cupped
+cleanser
+commuters
+honeysuckle
+orphanage
+skies
+crushers
+Puritan
+squeezer
+bruises
+bonfire
+Colombo
+nondecreasing
+DROP TABLE t1;
+ALTER TABLE t2 RENAME t1
+#;
+DROP TABLE t1;
+CREATE TABLE t1 (
+Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
+Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
+) ENGINE = CSV;
+INSERT INTO t1 VALUES (9410,9412);
+select period from t1;
+period
+9410
+drop table if exists t1,t2,t3,t4;
+Warnings:
+Note 1051 Unknown table 't2'
+Note 1051 Unknown table 't3'
+Note 1051 Unknown table 't4'
diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result
new file mode 100644
index 00000000000..9b9fcbccbe0
--- /dev/null
+++ b/mysql-test/r/ctype_big5.result
@@ -0,0 +1,58 @@
+drop table if exists t1;
+SET @test_character_set= 'big5';
+SET @test_collation= 'big5_chinese_ci';
+SET @safe_character_set_server= @@character_set_server;
+SET @safe_collation_server= @@collation_server;
+SET character_set_server= @test_character_set;
+SET collation_server= @test_collation;
+CREATE DATABASE d1;
+USE d1;
+CREATE TABLE t1 (c CHAR(10), KEY(c));
+SHOW FULL COLUMNS FROM t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+c char(10) big5_chinese_ci YES MUL NULL
+INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
+SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
+want3results
+aaa
+aaaa
+aaaaa
+DROP TABLE t1;
+CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
+SHOW FULL COLUMNS FROM t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+c1 varchar(15) big5_chinese_ci YES MUL NULL
+INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
+SELECT c1 as want3results from t1 where c1 like 'l%';
+want3results
+location
+loberge
+lotre
+SELECT c1 as want3results from t1 where c1 like 'lo%';
+want3results
+location
+loberge
+lotre
+SELECT c1 as want1result from t1 where c1 like 'loc%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'loca%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'locat%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'locati%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'locatio%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'location%';
+want1result
+location
+DROP TABLE t1;
+DROP DATABASE d1;
+USE test;
+SET character_set_server= @safe_character_set_server;
+SET collation_server= @safe_collation_server;
diff --git a/mysql-test/r/ctype_collate.result b/mysql-test/r/ctype_collate.result
new file mode 100644
index 00000000000..d4a8beda185
--- /dev/null
+++ b/mysql-test/r/ctype_collate.result
@@ -0,0 +1,584 @@
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+CREATE TABLE t1 (
+latin1_f CHAR(32) CHARACTER SET latin1 NOT NULL
+);
+CREATE TABLE t2 (
+latin1_f CHAR(32) CHARACTER SET latin1 COLLATE koi8r_general_ci NOT NULL
+);
+ERROR 42000: COLLATION 'koi8r_general_ci' is not valid for CHARACTER SET 'latin1'
+CREATE TABLE t2 (
+latin1_f CHAR(32) CHARACTER SET latin1 COLLATE some_non_existing_col NOT NULL
+);
+ERROR HY000: Unknown collation: 'some_non_existing_col'
+INSERT INTO t1 (latin1_f) VALUES (_latin1'A');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'a');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'AD');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'ad');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'AE');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'ae');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'AF');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'af');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'Ä');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'ä');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'Å');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'å');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'B');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'b');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'U');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'u');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'UE');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'ue');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'Ü');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'ü');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'SS');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'ss');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'ß');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'Y');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'y');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'Z');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'z');
+SELECT latin1_f FROM t1 ORDER BY latin1_f;
+latin1_f
+A
+a
+AD
+ad
+ae
+AE
+AF
+af
+b
+B
+SS
+ss
+u
+U
+UE
+ue
+Y
+y
+Z
+z
+SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE latin1_swedish_ci;
+latin1_f
+A
+a
+AD
+ad
+ae
+AE
+AF
+af
+b
+B
+SS
+ss
+u
+U
+UE
+ue
+Y
+y
+Z
+z
+SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE latin1_german2_ci;
+latin1_f
+A
+a
+AD
+ad
+ae
+AE
+af
+AF
+b
+B
+ss
+SS
+U
+u
+ue
+UE
+Y
+y
+Z
+z
+SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE latin1_general_ci;
+latin1_f
+A
+a
+AD
+ad
+AE
+ae
+af
+AF
+b
+B
+ss
+SS
+U
+u
+UE
+ue
+Y
+y
+Z
+z
+SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE latin1_bin;
+latin1_f
+A
+AD
+AE
+AF
+B
+SS
+U
+UE
+Y
+Z
+a
+ad
+ae
+af
+b
+ss
+u
+ue
+y
+z
+SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE koi8r_general_ci;
+ERROR 42000: COLLATION 'koi8r_general_ci' is not valid for CHARACTER SET 'latin1'
+SELECT latin1_f COLLATE latin1_swedish_ci AS latin1_f_as FROM t1 ORDER BY latin1_f_as;
+latin1_f_as
+A
+a
+AD
+ad
+ae
+AE
+AF
+af
+b
+B
+SS
+ss
+u
+U
+UE
+ue
+Y
+y
+Z
+z
+SELECT latin1_f COLLATE latin1_german2_ci AS latin1_f_as FROM t1 ORDER BY latin1_f_as;
+latin1_f_as
+A
+a
+AD
+ad
+ae
+AE
+af
+AF
+b
+B
+ss
+SS
+U
+u
+ue
+UE
+Y
+y
+Z
+z
+SELECT latin1_f COLLATE latin1_general_ci AS latin1_f_as FROM t1 ORDER BY latin1_f_as;
+latin1_f_as
+A
+a
+AD
+ad
+AE
+ae
+af
+AF
+b
+B
+ss
+SS
+U
+u
+UE
+ue
+Y
+y
+Z
+z
+SELECT latin1_f COLLATE latin1_bin AS latin1_f_as FROM t1 ORDER BY latin1_f_as;
+latin1_f_as
+A
+AD
+AE
+AF
+B
+SS
+U
+UE
+Y
+Z
+a
+ad
+ae
+af
+b
+ss
+u
+ue
+y
+z
+SELECT latin1_f COLLATE koi8r_general_ci AS latin1_f_as FROM t1 ORDER BY latin1_f_as;
+ERROR 42000: COLLATION 'koi8r_general_ci' is not valid for CHARACTER SET 'latin1'
+SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f;
+latin1_f count(*)
+A 2
+AD 2
+AE 2
+AF 2
+B 2
+SS 2
+U 2
+UE 2
+Ü 4
+Z 2
+Å 2
+Ä 2
+ß 1
+SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE latin1_swedish_ci;
+latin1_f count(*)
+A 2
+AD 2
+AE 2
+AF 2
+B 2
+SS 2
+U 2
+UE 2
+Ü 4
+Z 2
+Å 2
+Ä 2
+ß 1
+SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE latin1_german2_ci;
+latin1_f count(*)
+A 4
+AD 2
+AE 4
+AF 2
+B 2
+SS 3
+U 2
+UE 4
+Y 2
+Z 2
+SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE latin1_general_ci;
+latin1_f count(*)
+A 2
+AD 2
+AE 2
+AF 2
+Ä 2
+Å 2
+B 2
+SS 2
+ß 1
+U 2
+UE 2
+Ü 2
+Y 2
+Z 2
+SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE latin1_bin;
+latin1_f count(*)
+A 1
+AD 1
+AE 1
+AF 1
+B 1
+SS 1
+U 1
+UE 1
+Y 1
+Z 1
+a 1
+ad 1
+ae 1
+af 1
+b 1
+ss 1
+u 1
+ue 1
+y 1
+z 1
+Ä 1
+Å 1
+Ü 1
+ß 1
+ä 1
+å 1
+ü 1
+SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE koi8r_general_ci;
+ERROR 42000: COLLATION 'koi8r_general_ci' is not valid for CHARACTER SET 'latin1'
+SELECT DISTINCT latin1_f FROM t1;
+latin1_f
+A
+AD
+AE
+AF
+B
+U
+UE
+SS
+Z
+SELECT DISTINCT latin1_f COLLATE latin1_swedish_ci FROM t1;
+latin1_f COLLATE latin1_swedish_ci
+A
+AD
+AE
+AF
+B
+U
+UE
+SS
+Z
+SELECT DISTINCT latin1_f COLLATE latin1_german2_ci FROM t1;
+latin1_f COLLATE latin1_german2_ci
+A
+AD
+AE
+AF
+B
+U
+UE
+SS
+Y
+Z
+SELECT DISTINCT latin1_f COLLATE latin1_general_ci FROM t1;
+latin1_f COLLATE latin1_general_ci
+A
+AD
+AE
+AF
+B
+U
+UE
+SS
+Y
+Z
+SELECT DISTINCT latin1_f COLLATE latin1_bin FROM t1;
+latin1_f COLLATE latin1_bin
+A
+a
+AD
+ad
+AE
+ae
+AF
+af
+B
+b
+U
+u
+UE
+ue
+SS
+ss
+Y
+y
+Z
+z
+SELECT DISTINCT latin1_f COLLATE koi8r FROM t1;
+ERROR HY000: Unknown collation: 'koi8r'
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `latin1_f` char(32) NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW FIELDS FROM t1;
+Field Type Null Key Default Extra
+latin1_f char(32)
+ALTER TABLE t1 CHANGE latin1_f
+latin1_f CHAR(32) CHARACTER SET latin1 COLLATE latin1_bin;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `latin1_f` char(32) character set latin1 collate latin1_bin default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW FIELDS FROM t1;
+Field Type Null Key Default Extra
+latin1_f char(32) YES NULL
+ALTER TABLE t1 CHARACTER SET latin1 COLLATE latin1_bin;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `latin1_f` char(32) collate latin1_bin default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin
+SHOW FIELDS FROM t1;
+Field Type Null Key Default Extra
+latin1_f char(32) YES NULL
+SET CHARACTER SET 'latin1';
+SHOW VARIABLES LIKE 'character_set_client';
+Variable_name Value
+character_set_client latin1
+SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
+charset('a') collation('a') coercibility('a') 'a'='A'
+latin1 latin1_swedish_ci 3 1
+explain extended SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
+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 charset(_latin1'a') AS `charset('a')`,collation(_latin1'a') AS `collation('a')`,coercibility(_latin1'a') AS `coercibility('a')`,(_latin1'a' = _latin1'A') AS `'a'='A'`
+SET CHARACTER SET koi8r;
+SHOW VARIABLES LIKE 'collation_client';
+Variable_name Value
+SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
+charset('a') collation('a') coercibility('a') 'a'='A'
+latin1 latin1_swedish_ci 3 1
+SET CHARACTER SET 'DEFAULT';
+ERROR 42000: Unknown character set: 'DEFAULT'
+DROP TABLE t1;
+CREATE TABLE t1
+(s1 CHAR(5) COLLATE latin1_german1_ci,
+s2 CHAR(5) COLLATE latin1_swedish_ci);
+SELECT * FROM t1 WHERE s1 = s2;
+ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '='
+DROP TABLE t1;
+SET NAMES latin1;
+CREATE TABLE t1
+(s1 char(10) COLLATE latin1_german1_ci,
+s2 char(10) COLLATE latin1_swedish_ci,
+KEY(s1),
+KEY(s2));
+INSERT INTO t1 VALUES ('a','a');
+INSERT INTO t1 VALUES ('b','b');
+INSERT INTO t1 VALUES ('c','c');
+INSERT INTO t1 VALUES ('d','d');
+INSERT INTO t1 VALUES ('e','e');
+INSERT INTO t1 VALUES ('f','f');
+INSERT INTO t1 VALUES ('g','g');
+INSERT INTO t1 VALUES ('h','h');
+INSERT INTO t1 VALUES ('i','i');
+INSERT INTO t1 VALUES ('j','j');
+EXPLAIN SELECT * FROM t1 WHERE s1='a';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref s1 s1 11 const 1 Using where
+EXPLAIN SELECT * FROM t1 WHERE s2='a';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref s2 s2 11 const 1 Using where
+EXPLAIN SELECT * FROM t1 WHERE s1='a' COLLATE latin1_german1_ci;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref s1 s1 11 const 1 Using where
+EXPLAIN SELECT * FROM t1 WHERE s2='a' COLLATE latin1_german1_ci;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
+EXPLAIN SELECT * FROM t1 WHERE s1 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range s1 s1 11 NULL 2 Using where
+EXPLAIN SELECT * FROM t1 WHERE s2 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
+EXPLAIN SELECT * FROM t1 WHERE s1 IN ('a','b' COLLATE latin1_german1_ci);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range s1 s1 11 NULL 2 Using where
+EXPLAIN SELECT * FROM t1 WHERE s2 IN ('a','b' COLLATE latin1_german1_ci);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
+EXPLAIN SELECT * FROM t1 WHERE s1 LIKE 'a' COLLATE latin1_german1_ci;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range s1 s1 11 NULL 1 Using where
+EXPLAIN SELECT * FROM t1 WHERE s2 LIKE 'a' COLLATE latin1_german1_ci;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
+DROP TABLE t1;
diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result
index a1f860e1f83..3793e962d40 100644
--- a/mysql-test/r/ctype_cp1251.result
+++ b/mysql-test/r/ctype_cp1251.result
@@ -1,4 +1,5 @@
drop table if exists t1;
+SET NAMES cp1251;
create table t1 (a varchar(10) not null);
insert into t1 values ("a"),("ab"),("abc");
select * from t1;
@@ -22,3 +23,34 @@ a
b
c
drop table t1;
+create table t1 (a char(15) binary, b binary(15));
+insert into t1 values ('aaa','bbb'),('AAA','BBB');
+select upper(a),upper(b) from t1;
+upper(a) upper(b)
+AAA bbb
+AAA BBB
+select lower(a),lower(b) from t1;
+lower(a) lower(b)
+aaa bbb
+aaa BBB
+select * from t1 where upper(a)='AAA';
+a b
+aaa bbb
+AAA BBB
+select * from t1 where lower(a)='aaa';
+a b
+aaa bbb
+AAA BBB
+select * from t1 where upper(b)='BBB';
+a b
+AAA BBB
+select * from t1 where lower(b)='bbb';
+a b
+aaa bbb
+select charset(a), charset(b), charset(binary 'ccc') from t1 limit 1;
+charset(a) charset(b) charset(binary 'ccc')
+cp1251 binary binary
+select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1;
+collation(a) collation(b) collation(binary 'ccc')
+cp1251_bin binary binary
+drop table t1;
diff --git a/mysql-test/r/ctype_create.result b/mysql-test/r/ctype_create.result
new file mode 100644
index 00000000000..63bae33c6e1
--- /dev/null
+++ b/mysql-test/r/ctype_create.result
@@ -0,0 +1,74 @@
+SET @@character_set_server=latin5;
+CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET cp1251;
+USE mysqltest1;
+CREATE DATABASE mysqltest2;
+SHOW CREATE DATABASE mysqltest1;
+Database Create Database
+mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp1251 */
+SHOW CREATE DATABASE mysqltest2;
+Database Create Database
+mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin5 */
+CREATE TABLE mysqltest2.t1 (a char(10));
+SHOW CREATE TABLE mysqltest2.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin5
+DROP TABLE mysqltest2.t1;
+ALTER DATABASE mysqltest2 DEFAULT CHARACTER SET latin7;
+CREATE TABLE mysqltest2.t1 (a char(10));
+SHOW CREATE TABLE mysqltest2.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin7
+DROP DATABASE mysqltest2;
+CREATE DATABASE mysqltest2 CHARACTER SET latin2;
+CREATE TABLE mysqltest2.t1 (a char(10));
+SHOW CREATE TABLE mysqltest2.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin2
+DROP DATABASE mysqltest2;
+USE mysqltest1;
+CREATE TABLE t1 (a char(10));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=cp1251
+DROP TABLE t1;
+CREATE TABLE t1 (a char(10)) DEFAULT CHARACTER SET latin1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (a char(10))
+DEFAULT CHARACTER SET latin1 COLLATE latin1_german1_ci;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) collate latin1_german1_ci default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci
+DROP TABLE t1;
+create table t1 (a char) character set latin1 character set latin2;
+ERROR HY000: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET latin2'
+create table t1 (a char) character set latin1 collate latin2_bin;
+ERROR 42000: COLLATION 'latin2_bin' is not valid for CHARACTER SET 'latin1'
+create database d1 default character set latin1 character set latin2;
+ERROR HY000: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET latin2'
+create database d1 default character set latin1 collate latin2_bin;
+ERROR 42000: COLLATION 'latin2_bin' is not valid for CHARACTER SET 'latin1'
+DROP DATABASE mysqltest1;
+CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET latin7;
+use mysqltest2;
+ALTER DATABASE DEFAULT CHARACTER SET latin2;
+show create database mysqltest2;
+Database Create Database
+mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 */
+drop database mysqltest2;
+ALTER DATABASE DEFAULT CHARACTER SET latin2;
+ERROR 3D000: No database selected
diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result
new file mode 100644
index 00000000000..355f53b63a5
--- /dev/null
+++ b/mysql-test/r/ctype_latin1.result
@@ -0,0 +1,307 @@
+drop table if exists t1;
+SET NAMES latin1;
+CREATE TABLE t1 (a char(1) character set latin1);
+INSERT INTO t1 VALUES (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07);
+INSERT INTO t1 VALUES (0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+INSERT INTO t1 VALUES (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17);
+INSERT INTO t1 VALUES (0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+INSERT INTO t1 VALUES (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27);
+INSERT INTO t1 VALUES (0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+INSERT INTO t1 VALUES (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37);
+INSERT INTO t1 VALUES (0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+INSERT INTO t1 VALUES (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47);
+INSERT INTO t1 VALUES (0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+INSERT INTO t1 VALUES (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57);
+INSERT INTO t1 VALUES (0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+INSERT INTO t1 VALUES (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67);
+INSERT INTO t1 VALUES (0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+INSERT INTO t1 VALUES (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77);
+INSERT INTO t1 VALUES (0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+INSERT INTO t1 VALUES (0x80),(0x81),(0x82),(0x83),(0x84),(0x85),(0x86),(0x87);
+INSERT INTO t1 VALUES (0x88),(0x89),(0x8A),(0x8B),(0x8C),(0x8D),(0x8E),(0x8F);
+INSERT INTO t1 VALUES (0x90),(0x91),(0x92),(0x93),(0x94),(0x95),(0x96),(0x97);
+INSERT INTO t1 VALUES (0x98),(0x99),(0x9A),(0x9B),(0x9C),(0x9D),(0x9E),(0x9F);
+INSERT INTO t1 VALUES (0xA0),(0xA1),(0xA2),(0xA3),(0xA4),(0xA5),(0xA6),(0xA7);
+INSERT INTO t1 VALUES (0xA8),(0xA9),(0xAA),(0xAB),(0xAC),(0xAD),(0xAE),(0xAF);
+INSERT INTO t1 VALUES (0xB0),(0xB1),(0xB2),(0xB3),(0xB4),(0xB5),(0xB6),(0xB7);
+INSERT INTO t1 VALUES (0xB8),(0xB9),(0xBA),(0xBB),(0xBC),(0xBD),(0xBE),(0xBF);
+INSERT INTO t1 VALUES (0xC0),(0xC1),(0xC2),(0xC3),(0xC4),(0xC5),(0xC6),(0xC7);
+INSERT INTO t1 VALUES (0xC8),(0xC9),(0xCA),(0xCB),(0xCC),(0xCD),(0xCE),(0xCF);
+INSERT INTO t1 VALUES (0xD0),(0xD1),(0xD2),(0xD3),(0xD4),(0xD5),(0xD6),(0xD7);
+INSERT INTO t1 VALUES (0xD8),(0xD9),(0xDA),(0xDB),(0xDC),(0xDD),(0xDE),(0xDF);
+INSERT INTO t1 VALUES (0xE0),(0xE1),(0xE2),(0xE3),(0xE4),(0xE5),(0xE6),(0xE7);
+INSERT INTO t1 VALUES (0xE8),(0xE9),(0xEA),(0xEB),(0xEC),(0xED),(0xEE),(0xEF);
+INSERT INTO t1 VALUES (0xF0),(0xF1),(0xF2),(0xF3),(0xF4),(0xF5),(0xF6),(0xF7);
+INSERT INTO t1 VALUES (0xF8),(0xF9),(0xFA),(0xFB),(0xFC),(0xFD),(0xFE),(0xFF);
+SELECT
+hex(a),
+hex(@u:=convert(a using utf8)),
+hex(@l:=convert(@u using latin1)),
+a=@l FROM t1;
+hex(a) hex(@u:=convert(a using utf8)) hex(@l:=convert(@u using latin1)) a=@l
+00 00 00 1
+01 01 01 1
+02 02 02 1
+03 03 03 1
+04 04 04 1
+05 05 05 1
+06 06 06 1
+07 07 07 1
+08 08 08 1
+09 09 09 1
+0A 0A 0A 1
+0B 0B 0B 1
+0C 0C 0C 1
+0D 0D 0D 1
+0E 0E 0E 1
+0F 0F 0F 1
+10 10 10 1
+11 11 11 1
+12 12 12 1
+13 13 13 1
+14 14 14 1
+15 15 15 1
+16 16 16 1
+17 17 17 1
+18 18 18 1
+19 19 19 1
+1A 1A 1A 1
+1B 1B 1B 1
+1C 1C 1C 1
+1D 1D 1D 1
+1E 1E 1E 1
+1F 1F 1F 1
+ 1
+21 21 21 1
+22 22 22 1
+23 23 23 1
+24 24 24 1
+25 25 25 1
+26 26 26 1
+27 27 27 1
+28 28 28 1
+29 29 29 1
+2A 2A 2A 1
+2B 2B 2B 1
+2C 2C 2C 1
+2D 2D 2D 1
+2E 2E 2E 1
+2F 2F 2F 1
+30 30 30 1
+31 31 31 1
+32 32 32 1
+33 33 33 1
+34 34 34 1
+35 35 35 1
+36 36 36 1
+37 37 37 1
+38 38 38 1
+39 39 39 1
+3A 3A 3A 1
+3B 3B 3B 1
+3C 3C 3C 1
+3D 3D 3D 1
+3E 3E 3E 1
+3F 3F 3F 1
+40 40 40 1
+41 41 41 1
+42 42 42 1
+43 43 43 1
+44 44 44 1
+45 45 45 1
+46 46 46 1
+47 47 47 1
+48 48 48 1
+49 49 49 1
+4A 4A 4A 1
+4B 4B 4B 1
+4C 4C 4C 1
+4D 4D 4D 1
+4E 4E 4E 1
+4F 4F 4F 1
+50 50 50 1
+51 51 51 1
+52 52 52 1
+53 53 53 1
+54 54 54 1
+55 55 55 1
+56 56 56 1
+57 57 57 1
+58 58 58 1
+59 59 59 1
+5A 5A 5A 1
+5B 5B 5B 1
+5C 5C 5C 1
+5D 5D 5D 1
+5E 5E 5E 1
+5F 5F 5F 1
+60 60 60 1
+61 61 61 1
+62 62 62 1
+63 63 63 1
+64 64 64 1
+65 65 65 1
+66 66 66 1
+67 67 67 1
+68 68 68 1
+69 69 69 1
+6A 6A 6A 1
+6B 6B 6B 1
+6C 6C 6C 1
+6D 6D 6D 1
+6E 6E 6E 1
+6F 6F 6F 1
+70 70 70 1
+71 71 71 1
+72 72 72 1
+73 73 73 1
+74 74 74 1
+75 75 75 1
+76 76 76 1
+77 77 77 1
+78 78 78 1
+79 79 79 1
+7A 7A 7A 1
+7B 7B 7B 1
+7C 7C 7C 1
+7D 7D 7D 1
+7E 7E 7E 1
+7F 7F 7F 1
+80 E282AC 80 1
+81 3F 3F 0
+82 E2809A 82 1
+83 C692 83 1
+84 E2809E 84 1
+85 E280A6 85 1
+86 E280A0 86 1
+87 E280A1 87 1
+88 CB86 88 1
+89 E280B0 89 1
+8A C5A0 8A 1
+8B E280B9 8B 1
+8C C592 8C 1
+8D 3F 3F 0
+8E C5BD 8E 1
+8F 3F 3F 0
+90 3F 3F 0
+91 E28098 91 1
+92 E28099 92 1
+93 E2809C 93 1
+94 E2809D 94 1
+95 E280A2 95 1
+96 E28093 96 1
+97 E28094 97 1
+98 CB9C 98 1
+99 E284A2 99 1
+9A C5A1 9A 1
+9B E280BA 9B 1
+9C C593 9C 1
+9D 3F 3F 0
+9E C5BE 9E 1
+9F C5B8 9F 1
+A0 C2A0 A0 1
+A1 C2A1 A1 1
+A2 C2A2 A2 1
+A3 C2A3 A3 1
+A4 C2A4 A4 1
+A5 C2A5 A5 1
+A6 C2A6 A6 1
+A7 C2A7 A7 1
+A8 C2A8 A8 1
+A9 C2A9 A9 1
+AA C2AA AA 1
+AB C2AB AB 1
+AC C2AC AC 1
+AD C2AD AD 1
+AE C2AE AE 1
+AF C2AF AF 1
+B0 C2B0 B0 1
+B1 C2B1 B1 1
+B2 C2B2 B2 1
+B3 C2B3 B3 1
+B4 C2B4 B4 1
+B5 C2B5 B5 1
+B6 C2B6 B6 1
+B7 C2B7 B7 1
+B8 C2B8 B8 1
+B9 C2B9 B9 1
+BA C2BA BA 1
+BB C2BB BB 1
+BC C2BC BC 1
+BD C2BD BD 1
+BE C2BE BE 1
+BF C2BF BF 1
+C0 C380 C0 1
+C1 C381 C1 1
+C2 C382 C2 1
+C3 C383 C3 1
+C4 C384 C4 1
+C5 C385 C5 1
+C6 C386 C6 1
+C7 C387 C7 1
+C8 C388 C8 1
+C9 C389 C9 1
+CA C38A CA 1
+CB C38B CB 1
+CC C38C CC 1
+CD C38D CD 1
+CE C38E CE 1
+CF C38F CF 1
+D0 C390 D0 1
+D1 C391 D1 1
+D2 C392 D2 1
+D3 C393 D3 1
+D4 C394 D4 1
+D5 C395 D5 1
+D6 C396 D6 1
+D7 C397 D7 1
+D8 C398 D8 1
+D9 C399 D9 1
+DA C39A DA 1
+DB C39B DB 1
+DC C39C DC 1
+DD C39D DD 1
+DE C39E DE 1
+DF C39F DF 1
+E0 C3A0 E0 1
+E1 C3A1 E1 1
+E2 C3A2 E2 1
+E3 C3A3 E3 1
+E4 C3A4 E4 1
+E5 C3A5 E5 1
+E6 C3A6 E6 1
+E7 C3A7 E7 1
+E8 C3A8 E8 1
+E9 C3A9 E9 1
+EA C3AA EA 1
+EB C3AB EB 1
+EC C3AC EC 1
+ED C3AD ED 1
+EE C3AE EE 1
+EF C3AF EF 1
+F0 C3B0 F0 1
+F1 C3B1 F1 1
+F2 C3B2 F2 1
+F3 C3B3 F3 1
+F4 C3B4 F4 1
+F5 C3B5 F5 1
+F6 C3B6 F6 1
+F7 C3B7 F7 1
+F8 C3B8 F8 1
+F9 C3B9 F9 1
+FA C3BA FA 1
+FB C3BB FB 1
+FC C3BC FC 1
+FD C3BD FD 1
+FE C3BE FE 1
+FF C3BF FF 1
+DROP TABLE t1;
+select 'a' regexp 'A' collate latin1_general_ci;
+'a' regexp 'A' collate latin1_general_ci
+1
+select 'a' regexp 'A' collate latin1_general_cs;
+'a' regexp 'A' collate latin1_general_cs
+0
+select 'a' regexp 'A' collate latin1_bin;
+'a' regexp 'A' collate latin1_bin
+0
diff --git a/mysql-test/r/ctype_latin1_de.result b/mysql-test/r/ctype_latin1_de.result
index c4bf6b5a3a9..50af5464f54 100644
--- a/mysql-test/r/ctype_latin1_de.result
+++ b/mysql-test/r/ctype_latin1_de.result
@@ -1,3 +1,8 @@
+set names latin1;
+set @@collation_connection=latin1_german2_ci;
+select @@collation_connection;
+@@collation_connection
+latin1_german2_ci
drop table if exists t1;
create table t1 (a char (20) not null, b int not null auto_increment, index (a,b));
insert into t1 (a) values ('ä'),('ac'),('ae'),('ad'),('Äc'),('aeb');
@@ -216,23 +221,30 @@ a
test
drop table t1;
create table t1 (word varchar(255) not null, word2 varchar(255) not null, index(word));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `word` varchar(255) collate latin1_german2_ci NOT NULL default '',
+ `word2` varchar(255) collate latin1_german2_ci NOT NULL default '',
+ KEY `word` (`word`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci
insert into t1 (word) values ('ss'),(0xDF),(0xE4),('ae');
update t1 set word2=word;
-select word, word=0xdf as t from t1 having t > 0;
+select word, word=binary 0xdf as t from t1 having t > 0;
word t
ß 1
select word, word=cast(0xdf AS CHAR) as t from t1 having t > 0;
word t
ss 1
ß 1
-select * from t1 where word=0xDF;
+select * from t1 where word=binary 0xDF;
word word2
ß ß
select * from t1 where word=CAST(0xDF as CHAR);
word word2
ss ss
ß ß
-select * from t1 where word2=0xDF;
+select * from t1 where word2=binary 0xDF;
word word2
ß ß
select * from t1 where word2=CAST(0xDF as CHAR);
@@ -247,7 +259,7 @@ select * from t1 where word= 0xe4 or word=CAST(0xe4 as CHAR);
word word2
ä ä
ae ae
-select * from t1 where word between 0xDF and 0xDF;
+select * from t1 where word between binary 0xDF and binary 0xDF;
word word2
ß ß
select * from t1 where word between CAST(0xDF AS CHAR) and CAST(0xDF AS CHAR);
@@ -260,14 +272,13 @@ ae ae
select * from t1 where word like 'AE';
word word2
ae ae
-select * from t1 where word like 0xDF;
+select * from t1 where word like binary 0xDF;
word word2
ß ß
select * from t1 where word like CAST(0xDF as CHAR);
word word2
ß ß
drop table t1;
-DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
autor varchar(80) NOT NULL default '',
PRIMARY KEY (autor)
@@ -282,3 +293,27 @@ Pozzi, Samuel-Jean.
Pozzo, A.
Pozzoli, Serge.
DROP TABLE t1;
+CREATE TABLE t1 (
+s1 CHAR(5) CHARACTER SET latin1 COLLATE latin1_german2_ci
+);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `s1` char(5) collate latin1_german2_ci default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci
+INSERT INTO t1 VALUES ('Ü');
+INSERT INTO t1 VALUES ('ue');
+SELECT DISTINCT s1 FROM t1;
+s1
+SELECT s1,COUNT(*) FROM t1 GROUP BY s1;
+s1 COUNT(*)
+Ü 2
+SELECT COUNT(DISTINCT s1) FROM t1;
+COUNT(DISTINCT s1)
+1
+SELECT FIELD('ue',s1), FIELD('Ü',s1), s1='ue', s1='Ü' FROM t1;
+FIELD('ue',s1) FIELD('Ü',s1) s1='ue' s1='Ü'
+1 1 1 1
+1 1 1 1
+DROP TABLE t1;
diff --git a/mysql-test/r/ctype_many.result b/mysql-test/r/ctype_many.result
new file mode 100644
index 00000000000..8bfc6e98226
--- /dev/null
+++ b/mysql-test/r/ctype_many.result
@@ -0,0 +1,1685 @@
+DROP TABLE IF EXISTS t1;
+SET CHARACTER SET latin1;
+CREATE TABLE t1 (
+comment CHAR(32) ASCII NOT NULL,
+koi8_ru_f CHAR(32) CHARACTER SET koi8r NOT NULL
+) CHARSET=latin5;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `comment` char(32) character set latin1 NOT NULL default '',
+ `koi8_ru_f` char(32) character set koi8r NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin5
+ALTER TABLE t1 CHANGE comment comment CHAR(32) CHARACTER SET latin2 NOT NULL;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `comment` char(32) character set latin2 NOT NULL default '',
+ `koi8_ru_f` char(32) character set koi8r NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin5
+ALTER TABLE t1 ADD latin5_f CHAR(32) NOT NULL;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `comment` char(32) character set latin2 NOT NULL default '',
+ `koi8_ru_f` char(32) character set koi8r NOT NULL default '',
+ `latin5_f` char(32) NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin5
+ALTER TABLE t1 DEFAULT CHARSET=latin2;
+ALTER TABLE t1 ADD latin2_f CHAR(32) NOT NULL;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `comment` char(32) NOT NULL default '',
+ `koi8_ru_f` char(32) character set koi8r NOT NULL default '',
+ `latin5_f` char(32) character set latin5 NOT NULL default '',
+ `latin2_f` char(32) NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin2
+ALTER TABLE t1 DROP latin2_f, DROP latin5_f;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `comment` char(32) NOT NULL default '',
+ `koi8_ru_f` char(32) character set koi8r NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin2
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('a','LAT SMALL A');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('b','LAT SMALL B');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('c','LAT SMALL C');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('d','LAT SMALL D');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('e','LAT SMALL E');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('f','LAT SMALL F');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('g','LAT SMALL G');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('h','LAT SMALL H');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('i','LAT SMALL I');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('j','LAT SMALL J');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('k','LAT SMALL K');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('l','LAT SMALL L');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('m','LAT SMALL M');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('n','LAT SMALL N');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('o','LAT SMALL O');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('p','LAT SMALL P');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('q','LAT SMALL Q');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('r','LAT SMALL R');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('s','LAT SMALL S');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('t','LAT SMALL T');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('u','LAT SMALL U');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('v','LAT SMALL V');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('w','LAT SMALL W');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('x','LAT SMALL X');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('y','LAT SMALL Y');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('z','LAT SMALL Z');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('A','LAT CAPIT A');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('B','LAT CAPIT B');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('C','LAT CAPIT C');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('D','LAT CAPIT D');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('E','LAT CAPIT E');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('F','LAT CAPIT F');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('G','LAT CAPIT G');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('H','LAT CAPIT H');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('I','LAT CAPIT I');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('J','LAT CAPIT J');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('K','LAT CAPIT K');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('L','LAT CAPIT L');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('M','LAT CAPIT M');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('N','LAT CAPIT N');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('O','LAT CAPIT O');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('P','LAT CAPIT P');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Q','LAT CAPIT Q');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('R','LAT CAPIT R');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('S','LAT CAPIT S');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('T','LAT CAPIT T');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('U','LAT CAPIT U');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('V','LAT CAPIT V');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('W','LAT CAPIT W');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('X','LAT CAPIT X');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Y','LAT CAPIT Y');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Z','LAT CAPIT Z');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Á','CYR SMALL A');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Â','CYR SMALL BE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'×','CYR SMALL VE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ç','CYR SMALL GE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ä','CYR SMALL DE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Å','CYR SMALL IE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'£','CYR SMALL IO');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ö','CYR SMALL ZHE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ú','CYR SMALL ZE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'É','CYR SMALL I');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ë','CYR SMALL KA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ì','CYR SMALL EL');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Í','CYR SMALL EM');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Î','CYR SMALL EN');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ï','CYR SMALL O');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ð','CYR SMALL PE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ò','CYR SMALL ER');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ó','CYR SMALL ES');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ô','CYR SMALL TE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Õ','CYR SMALL U');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Æ','CYR SMALL EF');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'È','CYR SMALL HA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ã','CYR SMALL TSE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Þ','CYR SMALL CHE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Û','CYR SMALL SHA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ý','CYR SMALL SCHA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ß','CYR SMALL HARD SIGN');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ù','CYR SMALL YERU');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ø','CYR SMALL SOFT SIGN');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ü','CYR SMALL E');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'À','CYR SMALL YU');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ñ','CYR SMALL YA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'á','CYR CAPIT A');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'â','CYR CAPIT BE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'÷','CYR CAPIT VE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ç','CYR CAPIT GE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ä','CYR CAPIT DE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'å','CYR CAPIT IE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'³','CYR CAPIT IO');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ö','CYR CAPIT ZHE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ú','CYR CAPIT ZE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'é','CYR CAPIT I');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ë','CYR CAPIT KA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ì','CYR CAPIT EL');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'í','CYR CAPIT EM');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'î','CYR CAPIT EN');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ï','CYR CAPIT O');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ð','CYR CAPIT PE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ò','CYR CAPIT ER');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ó','CYR CAPIT ES');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ô','CYR CAPIT TE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'õ','CYR CAPIT U');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'æ','CYR CAPIT EF');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'è','CYR CAPIT HA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ã','CYR CAPIT TSE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'þ','CYR CAPIT CHE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'û','CYR CAPIT SHA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ý','CYR CAPIT SCHA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ÿ','CYR CAPIT HARD SIGN');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ù','CYR CAPIT YERU');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ø','CYR CAPIT SOFT SIGN');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ü','CYR CAPIT E');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'à','CYR CAPIT YU');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ñ','CYR CAPIT YA');
+SET CHARACTER SET utf8;
+SELECT koi8_ru_f,MIN(comment),COUNT(*) FROM t1 GROUP BY 1;
+koi8_ru_f MIN(comment) COUNT(*)
+a LAT CAPIT A 2
+b LAT CAPIT B 2
+c LAT CAPIT C 2
+d LAT CAPIT D 2
+e LAT CAPIT E 2
+f LAT CAPIT F 2
+g LAT CAPIT G 2
+h LAT CAPIT H 2
+i LAT CAPIT I 2
+j LAT CAPIT J 2
+k LAT CAPIT K 2
+l LAT CAPIT L 2
+m LAT CAPIT M 2
+n LAT CAPIT N 2
+o LAT CAPIT O 2
+p LAT CAPIT P 2
+q LAT CAPIT Q 2
+r LAT CAPIT R 2
+s LAT CAPIT S 2
+t LAT CAPIT T 2
+u LAT CAPIT U 2
+v LAT CAPIT V 2
+w LAT CAPIT W 2
+x LAT CAPIT X 2
+y LAT CAPIT Y 2
+z LAT CAPIT Z 2
+а CYR CAPIT A 2
+б CYR CAPIT BE 2
+в CYR CAPIT VE 2
+г CYR CAPIT GE 2
+ÐŽ CYR CAPIT DE 2
+е CYR CAPIT IE 2
+ё CYR CAPIT IO 2
+ж CYR CAPIT ZHE 2
+з CYR CAPIT ZE 2
+О CYR CAPIT I 2
+к CYR CAPIT KA 2
+л CYR CAPIT EL 2
+Ќ CYR CAPIT EM 2
+М CYR CAPIT EN 2
+П CYR CAPIT O 2
+п CYR CAPIT PE 2
+р CYR CAPIT ER 2
+с CYR CAPIT ES 2
+т CYR CAPIT TE 2
+у CYR CAPIT U 2
+ф CYR CAPIT EF 2
+х CYR CAPIT HA 2
+ц CYR CAPIT TSE 2
+ч CYR CAPIT CHE 2
+ш CYR CAPIT SHA 2
+щ CYR CAPIT SCHA 2
+ъ CYR CAPIT HARD SIGN 2
+ы CYR CAPIT YERU 2
+ь CYR CAPIT SOFT SIGN 2
+э CYR CAPIT E 2
+ю CYR CAPIT YU 2
+я CYR CAPIT YA 2
+ALTER TABLE t1 ADD utf8_f CHAR(32) CHARACTER SET utf8 NOT NULL;
+UPDATE t1 SET utf8_f=CONVERT(koi8_ru_f USING utf8);
+SET CHARACTER SET koi8r;
+SELECT * FROM t1;
+comment koi8_ru_f utf8_f
+LAT SMALL A a a
+LAT SMALL B b b
+LAT SMALL C c c
+LAT SMALL D d d
+LAT SMALL E e e
+LAT SMALL F f f
+LAT SMALL G g g
+LAT SMALL H h h
+LAT SMALL I i i
+LAT SMALL J j j
+LAT SMALL K k k
+LAT SMALL L l l
+LAT SMALL M m m
+LAT SMALL N n n
+LAT SMALL O o o
+LAT SMALL P p p
+LAT SMALL Q q q
+LAT SMALL R r r
+LAT SMALL S s s
+LAT SMALL T t t
+LAT SMALL U u u
+LAT SMALL V v v
+LAT SMALL W w w
+LAT SMALL X x x
+LAT SMALL Y y y
+LAT SMALL Z z z
+LAT CAPIT A A A
+LAT CAPIT B B B
+LAT CAPIT C C C
+LAT CAPIT D D D
+LAT CAPIT E E E
+LAT CAPIT F F F
+LAT CAPIT G G G
+LAT CAPIT H H H
+LAT CAPIT I I I
+LAT CAPIT J J J
+LAT CAPIT K K K
+LAT CAPIT L L L
+LAT CAPIT M M M
+LAT CAPIT N N N
+LAT CAPIT O O O
+LAT CAPIT P P P
+LAT CAPIT Q Q Q
+LAT CAPIT R R R
+LAT CAPIT S S S
+LAT CAPIT T T T
+LAT CAPIT U U U
+LAT CAPIT V V V
+LAT CAPIT W W W
+LAT CAPIT X X X
+LAT CAPIT Y Y Y
+LAT CAPIT Z Z Z
+CYR SMALL A Á Á
+CYR SMALL BE Â Â
+CYR SMALL VE × ×
+CYR SMALL GE Ç Ç
+CYR SMALL DE Ä Ä
+CYR SMALL IE Å Å
+CYR SMALL IO £ £
+CYR SMALL ZHE Ö Ö
+CYR SMALL ZE Ú Ú
+CYR SMALL I É É
+CYR SMALL KA Ë Ë
+CYR SMALL EL Ì Ì
+CYR SMALL EM Í Í
+CYR SMALL EN Î Î
+CYR SMALL O Ï Ï
+CYR SMALL PE Ð Ð
+CYR SMALL ER Ò Ò
+CYR SMALL ES Ó Ó
+CYR SMALL TE Ô Ô
+CYR SMALL U Õ Õ
+CYR SMALL EF Æ Æ
+CYR SMALL HA È È
+CYR SMALL TSE Ã Ã
+CYR SMALL CHE Þ Þ
+CYR SMALL SHA Û Û
+CYR SMALL SCHA Ý Ý
+CYR SMALL HARD SIGN ß ß
+CYR SMALL YERU Ù Ù
+CYR SMALL SOFT SIGN Ø Ø
+CYR SMALL E Ü Ü
+CYR SMALL YU À À
+CYR SMALL YA Ñ Ñ
+CYR CAPIT A á á
+CYR CAPIT BE â â
+CYR CAPIT VE ÷ ÷
+CYR CAPIT GE ç ç
+CYR CAPIT DE ä ä
+CYR CAPIT IE å å
+CYR CAPIT IO ³ ³
+CYR CAPIT ZHE ö ö
+CYR CAPIT ZE ú ú
+CYR CAPIT I é é
+CYR CAPIT KA ë ë
+CYR CAPIT EL ì ì
+CYR CAPIT EM í í
+CYR CAPIT EN î î
+CYR CAPIT O ï ï
+CYR CAPIT PE ð ð
+CYR CAPIT ER ò ò
+CYR CAPIT ES ó ó
+CYR CAPIT TE ô ô
+CYR CAPIT U õ õ
+CYR CAPIT EF æ æ
+CYR CAPIT HA è è
+CYR CAPIT TSE ã ã
+CYR CAPIT CHE þ þ
+CYR CAPIT SHA û û
+CYR CAPIT SCHA ý ý
+CYR CAPIT HARD SIGN ÿ ÿ
+CYR CAPIT YERU ù ù
+CYR CAPIT SOFT SIGN ø ø
+CYR CAPIT E ü ü
+CYR CAPIT YU à à
+CYR CAPIT YA ñ ñ
+ALTER TABLE t1 ADD bin_f CHAR(32) BYTE NOT NULL;
+UPDATE t1 SET bin_f=koi8_ru_f;
+SELECT COUNT(DISTINCT bin_f),COUNT(DISTINCT koi8_ru_f),COUNT(DISTINCT utf8_f) FROM t1;
+COUNT(DISTINCT bin_f) COUNT(DISTINCT koi8_ru_f) COUNT(DISTINCT utf8_f)
+116 58 57
+SELECT koi8_ru_f,MIN(comment) FROM t1 GROUP BY 1;
+koi8_ru_f MIN(comment)
+a LAT CAPIT A
+b LAT CAPIT B
+c LAT CAPIT C
+d LAT CAPIT D
+e LAT CAPIT E
+f LAT CAPIT F
+g LAT CAPIT G
+h LAT CAPIT H
+i LAT CAPIT I
+j LAT CAPIT J
+k LAT CAPIT K
+l LAT CAPIT L
+m LAT CAPIT M
+n LAT CAPIT N
+o LAT CAPIT O
+p LAT CAPIT P
+q LAT CAPIT Q
+r LAT CAPIT R
+s LAT CAPIT S
+t LAT CAPIT T
+u LAT CAPIT U
+v LAT CAPIT V
+w LAT CAPIT W
+x LAT CAPIT X
+y LAT CAPIT Y
+z LAT CAPIT Z
+Á CYR CAPIT A
+Â CYR CAPIT BE
+× CYR CAPIT VE
+Ç CYR CAPIT GE
+Ä CYR CAPIT DE
+Å CYR CAPIT IE
+£ CYR CAPIT IO
+Ö CYR CAPIT ZHE
+Ú CYR CAPIT ZE
+É CYR CAPIT I
+Ë CYR CAPIT KA
+Ì CYR CAPIT EL
+Í CYR CAPIT EM
+Î CYR CAPIT EN
+Ï CYR CAPIT O
+Ð CYR CAPIT PE
+Ò CYR CAPIT ER
+Ó CYR CAPIT ES
+Ô CYR CAPIT TE
+Õ CYR CAPIT U
+Æ CYR CAPIT EF
+È CYR CAPIT HA
+Ã CYR CAPIT TSE
+Þ CYR CAPIT CHE
+Û CYR CAPIT SHA
+Ý CYR CAPIT SCHA
+ß CYR CAPIT HARD SIGN
+Ù CYR CAPIT YERU
+Ø CYR CAPIT SOFT SIGN
+Ü CYR CAPIT E
+À CYR CAPIT YU
+Ñ CYR CAPIT YA
+SELECT utf8_f,MIN(comment) FROM t1 GROUP BY 1;
+utf8_f MIN(comment)
+a LAT CAPIT A
+b LAT CAPIT B
+c LAT CAPIT C
+d LAT CAPIT D
+e LAT CAPIT E
+f LAT CAPIT F
+g LAT CAPIT G
+h LAT CAPIT H
+i LAT CAPIT I
+j LAT CAPIT J
+k LAT CAPIT K
+l LAT CAPIT L
+m LAT CAPIT M
+n LAT CAPIT N
+o LAT CAPIT O
+p LAT CAPIT P
+q LAT CAPIT Q
+r LAT CAPIT R
+s LAT CAPIT S
+t LAT CAPIT T
+u LAT CAPIT U
+v LAT CAPIT V
+w LAT CAPIT W
+x LAT CAPIT X
+y LAT CAPIT Y
+z LAT CAPIT Z
+Á CYR CAPIT A
+Â CYR CAPIT BE
+× CYR CAPIT VE
+Ç CYR CAPIT GE
+Ä CYR CAPIT DE
+Å CYR CAPIT IE
+Ö CYR CAPIT ZHE
+Ú CYR CAPIT ZE
+É CYR CAPIT I
+Ë CYR CAPIT KA
+Ì CYR CAPIT EL
+Í CYR CAPIT EM
+Î CYR CAPIT EN
+Ï CYR CAPIT O
+Ð CYR CAPIT PE
+Ò CYR CAPIT ER
+Ó CYR CAPIT ES
+Ô CYR CAPIT TE
+Õ CYR CAPIT U
+Æ CYR CAPIT EF
+È CYR CAPIT HA
+Ã CYR CAPIT TSE
+Þ CYR CAPIT CHE
+Û CYR CAPIT SHA
+Ý CYR CAPIT SCHA
+ß CYR CAPIT HARD SIGN
+Ù CYR CAPIT YERU
+Ø CYR CAPIT SOFT SIGN
+Ü CYR CAPIT E
+À CYR CAPIT YU
+Ñ CYR CAPIT YA
+SELECT DISTINCT koi8_ru_f FROM t1;
+koi8_ru_f
+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
+SELECT DISTINCT utf8_f FROM t1;
+utf8_f
+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
+SELECT lower(koi8_ru_f) FROM t1 ORDER BY 1 DESC;
+lower(koi8_ru_f)
+z
+z
+y
+y
+x
+x
+w
+w
+v
+v
+u
+u
+t
+t
+s
+s
+r
+r
+q
+q
+p
+p
+o
+o
+n
+n
+m
+m
+l
+l
+k
+k
+j
+j
+i
+i
+h
+h
+g
+g
+f
+f
+e
+e
+d
+d
+c
+c
+b
+b
+a
+a
+SELECT lower(utf8_f) FROM t1 ORDER BY 1 DESC;
+lower(utf8_f)
+z
+z
+y
+y
+x
+x
+w
+w
+v
+v
+u
+u
+t
+t
+s
+s
+r
+r
+q
+q
+p
+p
+o
+o
+n
+n
+m
+m
+l
+l
+k
+k
+j
+j
+i
+i
+h
+h
+g
+g
+f
+f
+e
+e
+d
+d
+c
+c
+b
+b
+a
+a
+SELECT t11.comment,t12.comment
+FROM t1 t11,t1 t12 WHERE CONVERT(t11.koi8_ru_f USING utf8)=t12.utf8_f
+ORDER BY t11.koi8_ru_f,t11.comment,t12.comment;
+comment comment
+LAT CAPIT A LAT CAPIT A
+LAT CAPIT A LAT SMALL A
+LAT SMALL A LAT CAPIT A
+LAT SMALL A LAT SMALL A
+LAT CAPIT B LAT CAPIT B
+LAT CAPIT B LAT SMALL B
+LAT SMALL B LAT CAPIT B
+LAT SMALL B LAT SMALL B
+LAT CAPIT C LAT CAPIT C
+LAT CAPIT C LAT SMALL C
+LAT SMALL C LAT CAPIT C
+LAT SMALL C LAT SMALL C
+LAT CAPIT D LAT CAPIT D
+LAT CAPIT D LAT SMALL D
+LAT SMALL D LAT CAPIT D
+LAT SMALL D LAT SMALL D
+LAT CAPIT E LAT CAPIT E
+LAT CAPIT E LAT SMALL E
+LAT SMALL E LAT CAPIT E
+LAT SMALL E LAT SMALL E
+LAT CAPIT F LAT CAPIT F
+LAT CAPIT F LAT SMALL F
+LAT SMALL F LAT CAPIT F
+LAT SMALL F LAT SMALL F
+LAT CAPIT G LAT CAPIT G
+LAT CAPIT G LAT SMALL G
+LAT SMALL G LAT CAPIT G
+LAT SMALL G LAT SMALL G
+LAT CAPIT H LAT CAPIT H
+LAT CAPIT H LAT SMALL H
+LAT SMALL H LAT CAPIT H
+LAT SMALL H LAT SMALL H
+LAT CAPIT I LAT CAPIT I
+LAT CAPIT I LAT SMALL I
+LAT SMALL I LAT CAPIT I
+LAT SMALL I LAT SMALL I
+LAT CAPIT J LAT CAPIT J
+LAT CAPIT J LAT SMALL J
+LAT SMALL J LAT CAPIT J
+LAT SMALL J LAT SMALL J
+LAT CAPIT K LAT CAPIT K
+LAT CAPIT K LAT SMALL K
+LAT SMALL K LAT CAPIT K
+LAT SMALL K LAT SMALL K
+LAT CAPIT L LAT CAPIT L
+LAT CAPIT L LAT SMALL L
+LAT SMALL L LAT CAPIT L
+LAT SMALL L LAT SMALL L
+LAT CAPIT M LAT CAPIT M
+LAT CAPIT M LAT SMALL M
+LAT SMALL M LAT CAPIT M
+LAT SMALL M LAT SMALL M
+LAT CAPIT N LAT CAPIT N
+LAT CAPIT N LAT SMALL N
+LAT SMALL N LAT CAPIT N
+LAT SMALL N LAT SMALL N
+LAT CAPIT O LAT CAPIT O
+LAT CAPIT O LAT SMALL O
+LAT SMALL O LAT CAPIT O
+LAT SMALL O LAT SMALL O
+LAT CAPIT P LAT CAPIT P
+LAT CAPIT P LAT SMALL P
+LAT SMALL P LAT CAPIT P
+LAT SMALL P LAT SMALL P
+LAT CAPIT Q LAT CAPIT Q
+LAT CAPIT Q LAT SMALL Q
+LAT SMALL Q LAT CAPIT Q
+LAT SMALL Q LAT SMALL Q
+LAT CAPIT R LAT CAPIT R
+LAT CAPIT R LAT SMALL R
+LAT SMALL R LAT CAPIT R
+LAT SMALL R LAT SMALL R
+LAT CAPIT S LAT CAPIT S
+LAT CAPIT S LAT SMALL S
+LAT SMALL S LAT CAPIT S
+LAT SMALL S LAT SMALL S
+LAT CAPIT T LAT CAPIT T
+LAT CAPIT T LAT SMALL T
+LAT SMALL T LAT CAPIT T
+LAT SMALL T LAT SMALL T
+LAT CAPIT U LAT CAPIT U
+LAT CAPIT U LAT SMALL U
+LAT SMALL U LAT CAPIT U
+LAT SMALL U LAT SMALL U
+LAT CAPIT V LAT CAPIT V
+LAT CAPIT V LAT SMALL V
+LAT SMALL V LAT CAPIT V
+LAT SMALL V LAT SMALL V
+LAT CAPIT W LAT CAPIT W
+LAT CAPIT W LAT SMALL W
+LAT SMALL W LAT CAPIT W
+LAT SMALL W LAT SMALL W
+LAT CAPIT X LAT CAPIT X
+LAT CAPIT X LAT SMALL X
+LAT SMALL X LAT CAPIT X
+LAT SMALL X LAT SMALL X
+LAT CAPIT Y LAT CAPIT Y
+LAT CAPIT Y LAT SMALL Y
+LAT SMALL Y LAT CAPIT Y
+LAT SMALL Y LAT SMALL Y
+LAT CAPIT Z LAT CAPIT Z
+LAT CAPIT Z LAT SMALL Z
+LAT SMALL Z LAT CAPIT Z
+LAT SMALL Z LAT SMALL Z
+CYR CAPIT A CYR CAPIT A
+CYR CAPIT A CYR SMALL A
+CYR SMALL A CYR CAPIT A
+CYR SMALL A CYR SMALL A
+CYR CAPIT BE CYR CAPIT BE
+CYR CAPIT BE CYR SMALL BE
+CYR SMALL BE CYR CAPIT BE
+CYR SMALL BE CYR SMALL BE
+CYR CAPIT VE CYR CAPIT VE
+CYR CAPIT VE CYR SMALL VE
+CYR SMALL VE CYR CAPIT VE
+CYR SMALL VE CYR SMALL VE
+CYR CAPIT GE CYR CAPIT GE
+CYR CAPIT GE CYR SMALL GE
+CYR SMALL GE CYR CAPIT GE
+CYR SMALL GE CYR SMALL GE
+CYR CAPIT DE CYR CAPIT DE
+CYR CAPIT DE CYR SMALL DE
+CYR SMALL DE CYR CAPIT DE
+CYR SMALL DE CYR SMALL DE
+CYR CAPIT IE CYR CAPIT IE
+CYR CAPIT IE CYR CAPIT IO
+CYR CAPIT IE CYR SMALL IE
+CYR CAPIT IE CYR SMALL IO
+CYR SMALL IE CYR CAPIT IE
+CYR SMALL IE CYR CAPIT IO
+CYR SMALL IE CYR SMALL IE
+CYR SMALL IE CYR SMALL IO
+CYR CAPIT IO CYR CAPIT IE
+CYR CAPIT IO CYR CAPIT IO
+CYR CAPIT IO CYR SMALL IE
+CYR CAPIT IO CYR SMALL IO
+CYR SMALL IO CYR CAPIT IE
+CYR SMALL IO CYR CAPIT IO
+CYR SMALL IO CYR SMALL IE
+CYR SMALL IO CYR SMALL IO
+CYR CAPIT ZHE CYR CAPIT ZHE
+CYR CAPIT ZHE CYR SMALL ZHE
+CYR SMALL ZHE CYR CAPIT ZHE
+CYR SMALL ZHE CYR SMALL ZHE
+CYR CAPIT ZE CYR CAPIT ZE
+CYR CAPIT ZE CYR SMALL ZE
+CYR SMALL ZE CYR CAPIT ZE
+CYR SMALL ZE CYR SMALL ZE
+CYR CAPIT I CYR CAPIT I
+CYR CAPIT I CYR SMALL I
+CYR SMALL I CYR CAPIT I
+CYR SMALL I CYR SMALL I
+CYR CAPIT KA CYR CAPIT KA
+CYR CAPIT KA CYR SMALL KA
+CYR SMALL KA CYR CAPIT KA
+CYR SMALL KA CYR SMALL KA
+CYR CAPIT EL CYR CAPIT EL
+CYR CAPIT EL CYR SMALL EL
+CYR SMALL EL CYR CAPIT EL
+CYR SMALL EL CYR SMALL EL
+CYR CAPIT EM CYR CAPIT EM
+CYR CAPIT EM CYR SMALL EM
+CYR SMALL EM CYR CAPIT EM
+CYR SMALL EM CYR SMALL EM
+CYR CAPIT EN CYR CAPIT EN
+CYR CAPIT EN CYR SMALL EN
+CYR SMALL EN CYR CAPIT EN
+CYR SMALL EN CYR SMALL EN
+CYR CAPIT O CYR CAPIT O
+CYR CAPIT O CYR SMALL O
+CYR SMALL O CYR CAPIT O
+CYR SMALL O CYR SMALL O
+CYR CAPIT PE CYR CAPIT PE
+CYR CAPIT PE CYR SMALL PE
+CYR SMALL PE CYR CAPIT PE
+CYR SMALL PE CYR SMALL PE
+CYR CAPIT ER CYR CAPIT ER
+CYR CAPIT ER CYR SMALL ER
+CYR SMALL ER CYR CAPIT ER
+CYR SMALL ER CYR SMALL ER
+CYR CAPIT ES CYR CAPIT ES
+CYR CAPIT ES CYR SMALL ES
+CYR SMALL ES CYR CAPIT ES
+CYR SMALL ES CYR SMALL ES
+CYR CAPIT TE CYR CAPIT TE
+CYR CAPIT TE CYR SMALL TE
+CYR SMALL TE CYR CAPIT TE
+CYR SMALL TE CYR SMALL TE
+CYR CAPIT U CYR CAPIT U
+CYR CAPIT U CYR SMALL U
+CYR SMALL U CYR CAPIT U
+CYR SMALL U CYR SMALL U
+CYR CAPIT EF CYR CAPIT EF
+CYR CAPIT EF CYR SMALL EF
+CYR SMALL EF CYR CAPIT EF
+CYR SMALL EF CYR SMALL EF
+CYR CAPIT HA CYR CAPIT HA
+CYR CAPIT HA CYR SMALL HA
+CYR SMALL HA CYR CAPIT HA
+CYR SMALL HA CYR SMALL HA
+CYR CAPIT TSE CYR CAPIT TSE
+CYR CAPIT TSE CYR SMALL TSE
+CYR SMALL TSE CYR CAPIT TSE
+CYR SMALL TSE CYR SMALL TSE
+CYR CAPIT CHE CYR CAPIT CHE
+CYR CAPIT CHE CYR SMALL CHE
+CYR SMALL CHE CYR CAPIT CHE
+CYR SMALL CHE CYR SMALL CHE
+CYR CAPIT SHA CYR CAPIT SHA
+CYR CAPIT SHA CYR SMALL SHA
+CYR SMALL SHA CYR CAPIT SHA
+CYR SMALL SHA CYR SMALL SHA
+CYR CAPIT SCHA CYR CAPIT SCHA
+CYR CAPIT SCHA CYR SMALL SCHA
+CYR SMALL SCHA CYR CAPIT SCHA
+CYR SMALL SCHA CYR SMALL SCHA
+CYR CAPIT HARD SIGN CYR CAPIT HARD SIGN
+CYR CAPIT HARD SIGN CYR SMALL HARD SIGN
+CYR SMALL HARD SIGN CYR CAPIT HARD SIGN
+CYR SMALL HARD SIGN CYR SMALL HARD SIGN
+CYR CAPIT YERU CYR CAPIT YERU
+CYR CAPIT YERU CYR SMALL YERU
+CYR SMALL YERU CYR CAPIT YERU
+CYR SMALL YERU CYR SMALL YERU
+CYR CAPIT SOFT SIGN CYR CAPIT SOFT SIGN
+CYR CAPIT SOFT SIGN CYR SMALL SOFT SIGN
+CYR SMALL SOFT SIGN CYR CAPIT SOFT SIGN
+CYR SMALL SOFT SIGN CYR SMALL SOFT SIGN
+CYR CAPIT E CYR CAPIT E
+CYR CAPIT E CYR SMALL E
+CYR SMALL E CYR CAPIT E
+CYR SMALL E CYR SMALL E
+CYR CAPIT YU CYR CAPIT YU
+CYR CAPIT YU CYR SMALL YU
+CYR SMALL YU CYR CAPIT YU
+CYR SMALL YU CYR SMALL YU
+CYR CAPIT YA CYR CAPIT YA
+CYR CAPIT YA CYR SMALL YA
+CYR SMALL YA CYR CAPIT YA
+CYR SMALL YA CYR SMALL YA
+SELECT t11.comment,t12.comment
+FROM t1 t11,t1 t12
+WHERE t11.koi8_ru_f=CONVERT(t12.utf8_f USING koi8r)
+ORDER BY t12.utf8_f,t11.comment,t12.comment;
+comment comment
+LAT CAPIT A LAT CAPIT A
+LAT CAPIT A LAT SMALL A
+LAT SMALL A LAT CAPIT A
+LAT SMALL A LAT SMALL A
+LAT CAPIT B LAT CAPIT B
+LAT CAPIT B LAT SMALL B
+LAT SMALL B LAT CAPIT B
+LAT SMALL B LAT SMALL B
+LAT CAPIT C LAT CAPIT C
+LAT CAPIT C LAT SMALL C
+LAT SMALL C LAT CAPIT C
+LAT SMALL C LAT SMALL C
+LAT CAPIT D LAT CAPIT D
+LAT CAPIT D LAT SMALL D
+LAT SMALL D LAT CAPIT D
+LAT SMALL D LAT SMALL D
+LAT CAPIT E LAT CAPIT E
+LAT CAPIT E LAT SMALL E
+LAT SMALL E LAT CAPIT E
+LAT SMALL E LAT SMALL E
+LAT CAPIT F LAT CAPIT F
+LAT CAPIT F LAT SMALL F
+LAT SMALL F LAT CAPIT F
+LAT SMALL F LAT SMALL F
+LAT CAPIT G LAT CAPIT G
+LAT CAPIT G LAT SMALL G
+LAT SMALL G LAT CAPIT G
+LAT SMALL G LAT SMALL G
+LAT CAPIT H LAT CAPIT H
+LAT CAPIT H LAT SMALL H
+LAT SMALL H LAT CAPIT H
+LAT SMALL H LAT SMALL H
+LAT CAPIT I LAT CAPIT I
+LAT CAPIT I LAT SMALL I
+LAT SMALL I LAT CAPIT I
+LAT SMALL I LAT SMALL I
+LAT CAPIT J LAT CAPIT J
+LAT CAPIT J LAT SMALL J
+LAT SMALL J LAT CAPIT J
+LAT SMALL J LAT SMALL J
+LAT CAPIT K LAT CAPIT K
+LAT CAPIT K LAT SMALL K
+LAT SMALL K LAT CAPIT K
+LAT SMALL K LAT SMALL K
+LAT CAPIT L LAT CAPIT L
+LAT CAPIT L LAT SMALL L
+LAT SMALL L LAT CAPIT L
+LAT SMALL L LAT SMALL L
+LAT CAPIT M LAT CAPIT M
+LAT CAPIT M LAT SMALL M
+LAT SMALL M LAT CAPIT M
+LAT SMALL M LAT SMALL M
+LAT CAPIT N LAT CAPIT N
+LAT CAPIT N LAT SMALL N
+LAT SMALL N LAT CAPIT N
+LAT SMALL N LAT SMALL N
+LAT CAPIT O LAT CAPIT O
+LAT CAPIT O LAT SMALL O
+LAT SMALL O LAT CAPIT O
+LAT SMALL O LAT SMALL O
+LAT CAPIT P LAT CAPIT P
+LAT CAPIT P LAT SMALL P
+LAT SMALL P LAT CAPIT P
+LAT SMALL P LAT SMALL P
+LAT CAPIT Q LAT CAPIT Q
+LAT CAPIT Q LAT SMALL Q
+LAT SMALL Q LAT CAPIT Q
+LAT SMALL Q LAT SMALL Q
+LAT CAPIT R LAT CAPIT R
+LAT CAPIT R LAT SMALL R
+LAT SMALL R LAT CAPIT R
+LAT SMALL R LAT SMALL R
+LAT CAPIT S LAT CAPIT S
+LAT CAPIT S LAT SMALL S
+LAT SMALL S LAT CAPIT S
+LAT SMALL S LAT SMALL S
+LAT CAPIT T LAT CAPIT T
+LAT CAPIT T LAT SMALL T
+LAT SMALL T LAT CAPIT T
+LAT SMALL T LAT SMALL T
+LAT CAPIT U LAT CAPIT U
+LAT CAPIT U LAT SMALL U
+LAT SMALL U LAT CAPIT U
+LAT SMALL U LAT SMALL U
+LAT CAPIT V LAT CAPIT V
+LAT CAPIT V LAT SMALL V
+LAT SMALL V LAT CAPIT V
+LAT SMALL V LAT SMALL V
+LAT CAPIT W LAT CAPIT W
+LAT CAPIT W LAT SMALL W
+LAT SMALL W LAT CAPIT W
+LAT SMALL W LAT SMALL W
+LAT CAPIT X LAT CAPIT X
+LAT CAPIT X LAT SMALL X
+LAT SMALL X LAT CAPIT X
+LAT SMALL X LAT SMALL X
+LAT CAPIT Y LAT CAPIT Y
+LAT CAPIT Y LAT SMALL Y
+LAT SMALL Y LAT CAPIT Y
+LAT SMALL Y LAT SMALL Y
+LAT CAPIT Z LAT CAPIT Z
+LAT CAPIT Z LAT SMALL Z
+LAT SMALL Z LAT CAPIT Z
+LAT SMALL Z LAT SMALL Z
+CYR CAPIT A CYR CAPIT A
+CYR CAPIT A CYR SMALL A
+CYR SMALL A CYR CAPIT A
+CYR SMALL A CYR SMALL A
+CYR CAPIT BE CYR CAPIT BE
+CYR CAPIT BE CYR SMALL BE
+CYR SMALL BE CYR CAPIT BE
+CYR SMALL BE CYR SMALL BE
+CYR CAPIT VE CYR CAPIT VE
+CYR CAPIT VE CYR SMALL VE
+CYR SMALL VE CYR CAPIT VE
+CYR SMALL VE CYR SMALL VE
+CYR CAPIT GE CYR CAPIT GE
+CYR CAPIT GE CYR SMALL GE
+CYR SMALL GE CYR CAPIT GE
+CYR SMALL GE CYR SMALL GE
+CYR CAPIT DE CYR CAPIT DE
+CYR CAPIT DE CYR SMALL DE
+CYR SMALL DE CYR CAPIT DE
+CYR SMALL DE CYR SMALL DE
+CYR CAPIT IE CYR CAPIT IE
+CYR CAPIT IE CYR SMALL IE
+CYR CAPIT IO CYR CAPIT IO
+CYR CAPIT IO CYR SMALL IO
+CYR SMALL IE CYR CAPIT IE
+CYR SMALL IE CYR SMALL IE
+CYR SMALL IO CYR CAPIT IO
+CYR SMALL IO CYR SMALL IO
+CYR CAPIT ZHE CYR CAPIT ZHE
+CYR CAPIT ZHE CYR SMALL ZHE
+CYR SMALL ZHE CYR CAPIT ZHE
+CYR SMALL ZHE CYR SMALL ZHE
+CYR CAPIT ZE CYR CAPIT ZE
+CYR CAPIT ZE CYR SMALL ZE
+CYR SMALL ZE CYR CAPIT ZE
+CYR SMALL ZE CYR SMALL ZE
+CYR CAPIT I CYR CAPIT I
+CYR CAPIT I CYR SMALL I
+CYR SMALL I CYR CAPIT I
+CYR SMALL I CYR SMALL I
+CYR CAPIT KA CYR CAPIT KA
+CYR CAPIT KA CYR SMALL KA
+CYR SMALL KA CYR CAPIT KA
+CYR SMALL KA CYR SMALL KA
+CYR CAPIT EL CYR CAPIT EL
+CYR CAPIT EL CYR SMALL EL
+CYR SMALL EL CYR CAPIT EL
+CYR SMALL EL CYR SMALL EL
+CYR CAPIT EM CYR CAPIT EM
+CYR CAPIT EM CYR SMALL EM
+CYR SMALL EM CYR CAPIT EM
+CYR SMALL EM CYR SMALL EM
+CYR CAPIT EN CYR CAPIT EN
+CYR CAPIT EN CYR SMALL EN
+CYR SMALL EN CYR CAPIT EN
+CYR SMALL EN CYR SMALL EN
+CYR CAPIT O CYR CAPIT O
+CYR CAPIT O CYR SMALL O
+CYR SMALL O CYR CAPIT O
+CYR SMALL O CYR SMALL O
+CYR CAPIT PE CYR CAPIT PE
+CYR CAPIT PE CYR SMALL PE
+CYR SMALL PE CYR CAPIT PE
+CYR SMALL PE CYR SMALL PE
+CYR CAPIT ER CYR CAPIT ER
+CYR CAPIT ER CYR SMALL ER
+CYR SMALL ER CYR CAPIT ER
+CYR SMALL ER CYR SMALL ER
+CYR CAPIT ES CYR CAPIT ES
+CYR CAPIT ES CYR SMALL ES
+CYR SMALL ES CYR CAPIT ES
+CYR SMALL ES CYR SMALL ES
+CYR CAPIT TE CYR CAPIT TE
+CYR CAPIT TE CYR SMALL TE
+CYR SMALL TE CYR CAPIT TE
+CYR SMALL TE CYR SMALL TE
+CYR CAPIT U CYR CAPIT U
+CYR CAPIT U CYR SMALL U
+CYR SMALL U CYR CAPIT U
+CYR SMALL U CYR SMALL U
+CYR CAPIT EF CYR CAPIT EF
+CYR CAPIT EF CYR SMALL EF
+CYR SMALL EF CYR CAPIT EF
+CYR SMALL EF CYR SMALL EF
+CYR CAPIT HA CYR CAPIT HA
+CYR CAPIT HA CYR SMALL HA
+CYR SMALL HA CYR CAPIT HA
+CYR SMALL HA CYR SMALL HA
+CYR CAPIT TSE CYR CAPIT TSE
+CYR CAPIT TSE CYR SMALL TSE
+CYR SMALL TSE CYR CAPIT TSE
+CYR SMALL TSE CYR SMALL TSE
+CYR CAPIT CHE CYR CAPIT CHE
+CYR CAPIT CHE CYR SMALL CHE
+CYR SMALL CHE CYR CAPIT CHE
+CYR SMALL CHE CYR SMALL CHE
+CYR CAPIT SHA CYR CAPIT SHA
+CYR CAPIT SHA CYR SMALL SHA
+CYR SMALL SHA CYR CAPIT SHA
+CYR SMALL SHA CYR SMALL SHA
+CYR CAPIT SCHA CYR CAPIT SCHA
+CYR CAPIT SCHA CYR SMALL SCHA
+CYR SMALL SCHA CYR CAPIT SCHA
+CYR SMALL SCHA CYR SMALL SCHA
+CYR CAPIT HARD SIGN CYR CAPIT HARD SIGN
+CYR CAPIT HARD SIGN CYR SMALL HARD SIGN
+CYR SMALL HARD SIGN CYR CAPIT HARD SIGN
+CYR SMALL HARD SIGN CYR SMALL HARD SIGN
+CYR CAPIT YERU CYR CAPIT YERU
+CYR CAPIT YERU CYR SMALL YERU
+CYR SMALL YERU CYR CAPIT YERU
+CYR SMALL YERU CYR SMALL YERU
+CYR CAPIT SOFT SIGN CYR CAPIT SOFT SIGN
+CYR CAPIT SOFT SIGN CYR SMALL SOFT SIGN
+CYR SMALL SOFT SIGN CYR CAPIT SOFT SIGN
+CYR SMALL SOFT SIGN CYR SMALL SOFT SIGN
+CYR CAPIT E CYR CAPIT E
+CYR CAPIT E CYR SMALL E
+CYR SMALL E CYR CAPIT E
+CYR SMALL E CYR SMALL E
+CYR CAPIT YU CYR CAPIT YU
+CYR CAPIT YU CYR SMALL YU
+CYR SMALL YU CYR CAPIT YU
+CYR SMALL YU CYR SMALL YU
+CYR CAPIT YA CYR CAPIT YA
+CYR CAPIT YA CYR SMALL YA
+CYR SMALL YA CYR CAPIT YA
+CYR SMALL YA CYR SMALL YA
+SET CHARACTER SET utf8;
+ALTER TABLE t1 ADD ucs2_f CHAR(32) CHARACTER SET ucs2;
+ALTER TABLE t1 CHANGE ucs2_f ucs2_f CHAR(32) UNICODE NOT NULL;
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0391,'GREEK CAPIT ALPHA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0392,'GREEK CAPIT BETA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0393,'GREEK CAPIT GAMMA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0394,'GREEK CAPIT DELTA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0395,'GREEK CAPIT EPSILON');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B1,'GREEK SMALL ALPHA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B2,'GREEK SMALL BETA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B3,'GREEK SMALL GAMMA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B4,'GREEK SMALL DELTA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B5,'GREEK SMALL EPSILON');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0531,'ARMENIAN CAPIT AYB');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0532,'ARMENIAN CAPIT BEN');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0533,'ARMENIAN CAPIT GIM');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0534,'ARMENIAN CAPIT DA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0535,'ARMENIAN CAPIT ECH');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0536,'ARMENIAN CAPIT ZA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0561,'ARMENIAN SMALL YAB');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0562,'ARMENIAN SMALL BEN');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0563,'ARMENIAN SMALL GIM');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0564,'ARMENIAN SMALL DA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0565,'ARMENIAN SMALL ECH');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0566,'ARMENIAN SMALL ZA');
+ALTER TABLE t1 ADD armscii8_f CHAR(32) CHARACTER SET armscii8 NOT NULL;
+ALTER TABLE t1 ADD greek_f CHAR(32) CHARACTER SET greek NOT NULL;
+UPDATE t1 SET greek_f=CONVERT(ucs2_f USING greek) WHERE comment LIKE _latin2'GRE%';
+UPDATE t1 SET armscii8_f=CONVERT(ucs2_f USING armscii8) WHERE comment LIKE _latin2'ARM%';
+UPDATE t1 SET utf8_f=CONVERT(ucs2_f USING utf8) WHERE utf8_f=_utf8'';
+UPDATE t1 SET ucs2_f=CONVERT(utf8_f USING ucs2) WHERE ucs2_f=_ucs2'';
+SELECT * FROM t1;
+comment koi8_ru_f utf8_f bin_f ucs2_f armscii8_f greek_f
+LAT SMALL A a a a a
+LAT SMALL B b b b b
+LAT SMALL C c c c c
+LAT SMALL D d d d d
+LAT SMALL E e e e e
+LAT SMALL F f f f f
+LAT SMALL G g g g g
+LAT SMALL H h h h h
+LAT SMALL I i i i i
+LAT SMALL J j j j j
+LAT SMALL K k k k k
+LAT SMALL L l l l l
+LAT SMALL M m m m m
+LAT SMALL N n n n n
+LAT SMALL O o o o o
+LAT SMALL P p p p p
+LAT SMALL Q q q q q
+LAT SMALL R r r r r
+LAT SMALL S s s s s
+LAT SMALL T t t t t
+LAT SMALL U u u u u
+LAT SMALL V v v v v
+LAT SMALL W w w w w
+LAT SMALL X x x x x
+LAT SMALL Y y y y y
+LAT SMALL Z z z z z
+LAT CAPIT A A A A A
+LAT CAPIT B B B B B
+LAT CAPIT C C C C C
+LAT CAPIT D D D D D
+LAT CAPIT E E E E E
+LAT CAPIT F F F F F
+LAT CAPIT G G G G G
+LAT CAPIT H H H H H
+LAT CAPIT I I I I I
+LAT CAPIT J J J J J
+LAT CAPIT K K K K K
+LAT CAPIT L L L L L
+LAT CAPIT M M M M M
+LAT CAPIT N N N N N
+LAT CAPIT O O O O O
+LAT CAPIT P P P P P
+LAT CAPIT Q Q Q Q Q
+LAT CAPIT R R R R R
+LAT CAPIT S S S S S
+LAT CAPIT T T T T T
+LAT CAPIT U U U U U
+LAT CAPIT V V V V V
+LAT CAPIT W W W W W
+LAT CAPIT X X X X X
+LAT CAPIT Y Y Y Y Y
+LAT CAPIT Z Z Z Z Z
+CYR SMALL A а а Á а
+CYR SMALL BE б б  б
+CYR SMALL VE в в × Ð²
+CYR SMALL GE г г Ç Ð³
+CYR SMALL DE ÐŽ ÐŽ Ä ÐŽ
+CYR SMALL IE е е Šе
+CYR SMALL IO ё ё £ ё
+CYR SMALL ZHE ж ж Ö Ð¶
+CYR SMALL ZE з з Ú Ð·
+CYR SMALL I О О É Ðž
+CYR SMALL KA к к Ë Ðº
+CYR SMALL EL л л Ì Ð»
+CYR SMALL EM ÐŒ ÐŒ Í ÐŒ
+CYR SMALL EN М М ΠМ
+CYR SMALL O П П Ï ÐŸ
+CYR SMALL PE п п Рп
+CYR SMALL ER р р Ò Ñ€
+CYR SMALL ES с с Ó Ñ
+CYR SMALL TE т т Ô Ñ‚
+CYR SMALL U у у Õ Ñƒ
+CYR SMALL EF ф ф Æ Ñ„
+CYR SMALL HA х х È Ñ…
+CYR SMALL TSE ц ц à ц
+CYR SMALL CHE ч ч Þ Ñ‡
+CYR SMALL SHA ш ш Û Ñˆ
+CYR SMALL SCHA щ щ Ý Ñ‰
+CYR SMALL HARD SIGN ъ ъ ß ÑŠ
+CYR SMALL YERU ы ы ٠ы
+CYR SMALL SOFT SIGN ь ь Ø ÑŒ
+CYR SMALL E э э Ü Ñ
+CYR SMALL YU ю ю À ю
+CYR SMALL YA я я Ñ Ñ
+CYR CAPIT A А А á А
+CYR CAPIT BE Б Б â Б
+CYR CAPIT VE В В ÷ В
+CYR CAPIT GE Г Г ç Г
+CYR CAPIT DE Д Д ä Д
+CYR CAPIT IE Е Е å Е
+CYR CAPIT IO Ё Ё ³ Ё
+CYR CAPIT ZHE Ж Ж ö Ж
+CYR CAPIT ZE З З ú З
+CYR CAPIT I И И é И
+CYR CAPIT KA К К ë К
+CYR CAPIT EL Л Л ì Л
+CYR CAPIT EM М М í М
+CYR CAPIT EN Н Н î Н
+CYR CAPIT O О О ï О
+CYR CAPIT PE П П ð П
+CYR CAPIT ER Р Р ò Р
+CYR CAPIT ES С С ó С
+CYR CAPIT TE Т Т ô Т
+CYR CAPIT U У У õ У
+CYR CAPIT EF Ѐ Ѐ æ Ѐ
+CYR CAPIT HA Ð¥ Ð¥ è Ð¥
+CYR CAPIT TSE Њ Њ ã Њ
+CYR CAPIT CHE Ч Ч þ Ч
+CYR CAPIT SHA К К û К
+CYR CAPIT SCHA Щ Щ ý Щ
+CYR CAPIT HARD SIGN Ъ Ъ ÿ Ъ
+CYR CAPIT YERU Ы Ы ù Ы
+CYR CAPIT SOFT SIGN Ь Ь ø Ь
+CYR CAPIT E Э Э ü Э
+CYR CAPIT YU Ю Ю à Ю
+CYR CAPIT YA Я Я ñ Я
+GREEK CAPIT ALPHA Α Α Α
+GREEK CAPIT BETA Β Β Β
+GREEK CAPIT GAMMA Γ Γ Γ
+GREEK CAPIT DELTA Δ Δ Δ
+GREEK CAPIT EPSILON Ε Ε Ε
+GREEK SMALL ALPHA α α α
+GREEK SMALL BETA β β β
+GREEK SMALL GAMMA γ γ γ
+GREEK SMALL DELTA ÎŽ ÎŽ ÎŽ
+GREEK SMALL EPSILON ε ε ε
+ARMENIAN CAPIT AYB Ô± Ô± Ô±
+ARMENIAN CAPIT BEN Ô² Ô² Ô²
+ARMENIAN CAPIT GIM Ô³ Ô³ Ô³
+ARMENIAN CAPIT DA ÔŽ ÔŽ ÔŽ
+ARMENIAN CAPIT ECH Ôµ Ôµ Ôµ
+ARMENIAN CAPIT ZA Ô¶ Ô¶ Ô¶
+ARMENIAN SMALL YAB Õ¡ Õ¡ Õ¡
+ARMENIAN SMALL BEN Õ¢ Õ¢ Õ¢
+ARMENIAN SMALL GIM Õ£ Õ£ Õ£
+ARMENIAN SMALL DA Õ€ Õ€ Õ€
+ARMENIAN SMALL ECH Õ¥ Õ¥ Õ¥
+ARMENIAN SMALL ZA ÕŠ ÕŠ ÕŠ
+SET CHARACTER SET 'binary';
+SELECT * FROM t1;
+comment koi8_ru_f utf8_f bin_f ucs2_f armscii8_f greek_f
+LAT SMALL A a a a
+LAT SMALL B b b b
+LAT SMALL C c c c
+LAT SMALL D d d d
+LAT SMALL E e e e
+LAT SMALL F f f f
+LAT SMALL G g g g
+LAT SMALL H h h h
+LAT SMALL I i i i
+LAT SMALL J j j j
+LAT SMALL K k k k
+LAT SMALL L l l l
+LAT SMALL M m m m
+LAT SMALL N n n n
+LAT SMALL O o o o
+LAT SMALL P p p p
+LAT SMALL Q q q q
+LAT SMALL R r r r
+LAT SMALL S s s s
+LAT SMALL T t t t
+LAT SMALL U u u u
+LAT SMALL V v v v
+LAT SMALL W w w w
+LAT SMALL X x x x
+LAT SMALL Y y y y
+LAT SMALL Z z z z
+LAT CAPIT A A A A
+LAT CAPIT B B B B
+LAT CAPIT C C C C
+LAT CAPIT D D D D
+LAT CAPIT E E E E
+LAT CAPIT F F F F
+LAT CAPIT G G G G
+LAT CAPIT H H H H
+LAT CAPIT I I I I
+LAT CAPIT J J J J
+LAT CAPIT K K K K
+LAT CAPIT L L L L
+LAT CAPIT M M M M
+LAT CAPIT N N N N
+LAT CAPIT O O O O
+LAT CAPIT P P P P
+LAT CAPIT Q Q Q Q
+LAT CAPIT R R R R
+LAT CAPIT S S S S
+LAT CAPIT T T T T
+LAT CAPIT U U U U
+LAT CAPIT V V V V
+LAT CAPIT W W W W
+LAT CAPIT X X X X
+LAT CAPIT Y Y Y Y
+LAT CAPIT Z Z Z Z
+CYR SMALL A Á а Á 0
+CYR SMALL BE  б  1
+CYR SMALL VE × Ð² × 2
+CYR SMALL GE Ç Ð³ Ç 3
+CYR SMALL DE Ä ÐŽ Ä 4
+CYR SMALL IE Šе Š5
+CYR SMALL IO £ ё £ Q
+CYR SMALL ZHE Ö Ð¶ Ö 6
+CYR SMALL ZE Ú Ð· Ú 7
+CYR SMALL I É Ðž É 8
+CYR SMALL KA Ë Ðº Ë :
+CYR SMALL EL Ì Ð» Ì ;
+CYR SMALL EM Í ÐŒ Í <
+CYR SMALL EN ΠМ Π=
+CYR SMALL O Ï ÐŸ Ï >
+CYR SMALL PE Рп Р?
+CYR SMALL ER Ò Ñ€ Ò @
+CYR SMALL ES Ó Ñ Ó A
+CYR SMALL TE Ô Ñ‚ Ô B
+CYR SMALL U Õ Ñƒ Õ C
+CYR SMALL EF Æ Ñ„ Æ D
+CYR SMALL HA È Ñ… È E
+CYR SMALL TSE à ц à F
+CYR SMALL CHE Þ Ñ‡ Þ G
+CYR SMALL SHA Û Ñˆ Û H
+CYR SMALL SCHA Ý Ñ‰ Ý I
+CYR SMALL HARD SIGN ß ÑŠ ß J
+CYR SMALL YERU ٠ы ٠K
+CYR SMALL SOFT SIGN Ø ÑŒ Ø L
+CYR SMALL E Ü Ñ Ü M
+CYR SMALL YU À ю À N
+CYR SMALL YA Ñ Ñ Ñ O
+CYR CAPIT A á А á 
+CYR CAPIT BE â Б â 
+CYR CAPIT VE ÷ В ÷ 
+CYR CAPIT GE ç Г ç 
+CYR CAPIT DE ä Д ä 
+CYR CAPIT IE å Е å 
+CYR CAPIT IO ³ Ё ³ 
+CYR CAPIT ZHE ö Ж ö 
+CYR CAPIT ZE ú З ú 
+CYR CAPIT I é И é 
+CYR CAPIT KA ë К ë 
+CYR CAPIT EL ì Л ì 
+CYR CAPIT EM í М í 
+CYR CAPIT EN î Н î 
+CYR CAPIT O ï О ï 
+CYR CAPIT PE ð П ð 
+CYR CAPIT ER ò Р ò 
+CYR CAPIT ES ó С ó !
+CYR CAPIT TE ô Т ô "
+CYR CAPIT U õ У õ #
+CYR CAPIT EF æ Ѐ æ $
+CYR CAPIT HA è Ð¥ è %
+CYR CAPIT TSE ã Њ ã &
+CYR CAPIT CHE þ Ч þ '
+CYR CAPIT SHA û К û (
+CYR CAPIT SCHA ý Щ ý )
+CYR CAPIT HARD SIGN ÿ Ъ ÿ *
+CYR CAPIT YERU ù Ы ù +
+CYR CAPIT SOFT SIGN ø Ь ø ,
+CYR CAPIT E ü Э ü -
+CYR CAPIT YU à Ю à .
+CYR CAPIT YA ñ Я ñ /
+GREEK CAPIT ALPHA Α ‘ Á
+GREEK CAPIT BETA Β ’ Â
+GREEK CAPIT GAMMA Γ “ Ã
+GREEK CAPIT DELTA Δ ” Ä
+GREEK CAPIT EPSILON Ε • Å
+GREEK SMALL ALPHA α ± á
+GREEK SMALL BETA β ² â
+GREEK SMALL GAMMA γ ³ ã
+GREEK SMALL DELTA ÎŽ Ž ä
+GREEK SMALL EPSILON ε µ å
+ARMENIAN CAPIT AYB Ô± 1 ²
+ARMENIAN CAPIT BEN Ô² 2 Ž
+ARMENIAN CAPIT GIM Ô³ 3 ¶
+ARMENIAN CAPIT DA ÔŽ 4 ž
+ARMENIAN CAPIT ECH Ôµ 5 º
+ARMENIAN CAPIT ZA Ô¶ 6 Œ
+ARMENIAN SMALL YAB Õ¡ a ³
+ARMENIAN SMALL BEN Õ¢ b µ
+ARMENIAN SMALL GIM Õ£ c ·
+ARMENIAN SMALL DA Õ€ d ¹
+ARMENIAN SMALL ECH Õ¥ e »
+ARMENIAN SMALL ZA ÕŠ f œ
+SELECT min(comment),count(*) FROM t1 GROUP BY ucs2_f;
+min(comment) count(*)
+LAT CAPIT A 2
+LAT CAPIT B 2
+LAT CAPIT C 2
+LAT CAPIT D 2
+LAT CAPIT E 2
+LAT CAPIT F 2
+LAT CAPIT G 2
+LAT CAPIT H 2
+LAT CAPIT I 2
+LAT CAPIT J 2
+LAT CAPIT K 2
+LAT CAPIT L 2
+LAT CAPIT M 2
+LAT CAPIT N 2
+LAT CAPIT O 2
+LAT CAPIT P 2
+LAT CAPIT Q 2
+LAT CAPIT R 2
+LAT CAPIT S 2
+LAT CAPIT T 2
+LAT CAPIT U 2
+LAT CAPIT V 2
+LAT CAPIT W 2
+LAT CAPIT X 2
+LAT CAPIT Y 2
+LAT CAPIT Z 2
+GREEK CAPIT ALPHA 2
+GREEK CAPIT BETA 2
+GREEK CAPIT GAMMA 2
+GREEK CAPIT DELTA 2
+GREEK CAPIT EPSILON 2
+CYR CAPIT A 2
+CYR CAPIT BE 2
+CYR CAPIT VE 2
+CYR CAPIT GE 2
+CYR CAPIT DE 2
+CYR CAPIT IE 4
+CYR CAPIT ZHE 2
+CYR CAPIT ZE 2
+CYR CAPIT I 2
+CYR CAPIT KA 2
+CYR CAPIT EL 2
+CYR CAPIT EM 2
+CYR CAPIT EN 2
+CYR CAPIT O 2
+CYR CAPIT PE 2
+CYR CAPIT ER 2
+CYR CAPIT ES 2
+CYR CAPIT TE 2
+CYR CAPIT U 2
+CYR CAPIT EF 2
+CYR CAPIT HA 2
+CYR CAPIT TSE 2
+CYR CAPIT CHE 2
+CYR CAPIT SHA 2
+CYR CAPIT SCHA 2
+CYR CAPIT HARD SIGN 2
+CYR CAPIT YERU 2
+CYR CAPIT SOFT SIGN 2
+CYR CAPIT E 2
+CYR CAPIT YU 2
+CYR CAPIT YA 2
+ARMENIAN CAPIT AYB 2
+ARMENIAN CAPIT BEN 2
+ARMENIAN CAPIT GIM 2
+ARMENIAN CAPIT DA 2
+ARMENIAN CAPIT ECH 2
+ARMENIAN CAPIT ZA 2
+DROP TABLE t1;
diff --git a/mysql-test/r/ctype_mb.result b/mysql-test/r/ctype_mb.result
new file mode 100644
index 00000000000..5e273b3c800
--- /dev/null
+++ b/mysql-test/r/ctype_mb.result
@@ -0,0 +1,57 @@
+drop table if exists t1;
+CREATE TABLE t1 SELECT _utf8'test' as c1, _utf8'тест' as c2;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` char(4) character set utf8 NOT NULL default '',
+ `c2` char(4) character set utf8 NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DELETE FROM t1;
+ALTER TABLE t1 ADD c3 CHAR(4) CHARACTER SET utf8;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` char(4) character set utf8 NOT NULL default '',
+ `c2` char(4) character set utf8 NOT NULL default '',
+ `c3` char(4) character set utf8 default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('aaaabbbbccccdddd','aaaabbbbccccdddd','aaaabbbbccccdddd');
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+SELECT * FROM t1;
+c1 c2 c3
+aaaa aaaa aaaa
+DROP TABLE t1;
+CREATE TABLE t1 (a CHAR(4) CHARACTER SET utf8, KEY key_a(a(3)));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(4) character set utf8 default NULL,
+ KEY `key_a` (`a`(3))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW KEYS FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 key_a 1 a A NULL 9 NULL YES BTREE
+ALTER TABLE t1 CHANGE a a CHAR(4);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(4) default NULL,
+ KEY `key_a` (`a`(3))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW KEYS FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 key_a 1 a A NULL 3 NULL YES BTREE
+ALTER TABLE t1 CHANGE a a CHAR(4) CHARACTER SET utf8;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(4) character set utf8 default NULL,
+ KEY `key_a` (`a`(3))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW KEYS FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 key_a 1 a A NULL 9 NULL YES BTREE
+DROP TABLE t1;
diff --git a/mysql-test/r/ctype_recoding.result b/mysql-test/r/ctype_recoding.result
new file mode 100644
index 00000000000..1c75988fd21
--- /dev/null
+++ b/mysql-test/r/ctype_recoding.result
@@ -0,0 +1,242 @@
+SET CHARACTER SET koi8r;
+DROP TABLE IF EXISTS ÔÁÂÌÉÃÁ, t1, t2;
+SET CHARACTER SET koi8r;
+CREATE TABLE t1 (a CHAR(10) CHARACTER SET cp1251) SELECT _koi8r'ÐÒÏÂÁ' AS a;
+CREATE TABLE t2 (a CHAR(10) CHARACTER SET utf8);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) character set cp1251 default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT a FROM t1;
+a
+ÐÒÏÂÁ
+SELECT HEX(a) FROM t1;
+HEX(a)
+EFF0EEE1E0
+INSERT t2 SELECT * FROM t1;
+SELECT HEX(a) FROM t2;
+HEX(a)
+D0BFD180D0BED0B1D0B0
+DROP TABLE t1, t2;
+CREATE TABLE t1 (description text character set cp1250 NOT NULL);
+INSERT INTO t1 (description) VALUES (_latin2'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddde');
+SELECT description FROM t1;
+description
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddde
+DROP TABLE t1;
+CREATE TABLE t1 (a TEXT CHARACTER SET cp1251) SELECT _koi8r'ÐÒÏÂÁ' AS a;
+CREATE TABLE t2 (a TEXT CHARACTER SET utf8);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` text character set cp1251
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT HEX(a) FROM t1;
+HEX(a)
+EFF0EEE1E0
+INSERT t2 SELECT * FROM t1;
+SELECT HEX(a) FROM t2;
+HEX(a)
+D0BFD180D0BED0B1D0B0
+DROP TABLE t1, t2;
+CREATE TABLE `ÔÁÂÌÉÃÁ`
+(
+ÐÏÌÅ CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT "ËÏÍÍÅÎÔÁÒÉÊ ÐÏÌÑ"
+) COMMENT "ËÏÍÍÅÎÔÁÒÉÊ ÔÁÂÌÉÃÙ";
+SHOW TABLES;
+Tables_in_test
+ÔÁÂÌÉÃÁ
+SHOW CREATE TABLE ÔÁÂÌÉÃÁ;
+Table Create Table
+ÔÁÂÌÉÃÁ CREATE TABLE `ÔÁÂÌÉÃÁ` (
+ `ÐÏÌÅ` char(32) character set koi8r NOT NULL default '' COMMENT 'ËÏÍÍÅÎÔÁÒÉÊ ÐÏÌÑ'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='ËÏÍÍÅÎÔÁÒÉÊ ÔÁÂÌÉÃÙ'
+SHOW FIELDS FROM ÔÁÂÌÉÃÁ;
+Field Type Null Key Default Extra
+ÐÏÌÅ char(32)
+SET CHARACTER SET cp1251;
+SHOW TABLES;
+Tables_in_test
+òàáëèöà
+SHOW CREATE TABLE òàáëèöà;
+Table Create Table
+òàáëèöà CREATE TABLE `òàáëèöà` (
+ `ïîëå` char(32) character set koi8r NOT NULL default '' COMMENT 'êîììåíòàðèé ïîëÿ'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='êîììåíòàðèé òàáëèöû'
+SHOW FIELDS FROM òàáëèöà;
+Field Type Null Key Default Extra
+ïîëå char(32)
+SET CHARACTER SET utf8;
+SHOW TABLES;
+Tables_in_test
+таблОца
+SHOW CREATE TABLE таблОца;
+Table Create Table
+таблОца CREATE TABLE `таблОца` (
+ `пПле` char(32) character set koi8r NOT NULL default '' COMMENT 'кПЌЌеМтарОй пПля'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='кПЌЌеМтарОй таблОцы'
+SHOW FIELDS FROM таблОца;
+Field Type Null Key Default Extra
+пПле char(32)
+SET CHARACTER SET koi8r;
+DROP TABLE ÔÁÂÌÉÃÁ;
+SET CHARACTER SET default;
+SET NAMES UTF8;
+CREATE TABLE t1 (t text) DEFAULT CHARSET UTF8;
+INSERT INTO t1 (t) VALUES ('x');
+SELECT 1 FROM t1 WHERE CONCAT(_latin1'x') = t;
+1
+1
+DROP TABLE t1;
+SET CHARACTER SET koi8r;
+CREATE DATABASE ÔÅÓÔ;
+USE ÔÅÓÔ;
+SHOW TABLES;
+Tables_in_ÔÅÓÔ
+SHOW TABLES IN ÔÅÓÔ;
+Tables_in_ÔÅÓÔ
+SET CHARACTER SET cp1251;
+SHOW TABLES;
+Tables_in_òåñò
+SHOW TABLES IN òåñò;
+Tables_in_òåñò
+SET CHARACTER SET koi8r;
+DROP DATABASE ÔÅÓÔ;
+SET NAMES koi8r;
+SELECT hex('ÔÅÓÔ');
+hex('ÔÅÓÔ')
+D4C5D3D4
+SET character_set_connection=cp1251;
+SELECT hex('ÔÅÓÔ');
+hex('ÔÅÓÔ')
+F2E5F1F2
+USE test;
+SET NAMES binary;
+CREATE TABLE `тест` (`тест` int);
+SHOW CREATE TABLE `тест`;
+Table Create Table
+тест CREATE TABLE `тест` (
+ `тест` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SET NAMES utf8;
+SHOW CREATE TABLE `тест`;
+Table Create Table
+тест CREATE TABLE `тест` (
+ `тест` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE `тест`;
+SET NAMES binary;
+SET character_set_connection=utf8;
+SELECT 'тест' as s;
+s
+тест
+SET NAMES utf8;
+SET character_set_connection=binary;
+SELECT 'тест' as s;
+s
+тест
+SET NAMES latin1;
+CREATE TABLE t1 (`ä` CHAR(128) DEFAULT 'ä', `ä1` ENUM('ä1','ä2') DEFAULT 'ä2');
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `ä` char(128) default 'ä',
+ `ä1` enum('ä1','ä2') default 'ä2'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW COLUMNS FROM t1;
+Field Type Null Key Default Extra
+ä char(128) YES ä
+ä1 enum('ä1','ä2') YES ä2
+SET NAMES binary;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `À` char(128) default 'À',
+ `À1` enum('À1','À2') default 'À2'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW COLUMNS FROM t1;
+Field Type Null Key Default Extra
+À char(128) YES À
+À1 enum('À1','À2') YES À2
+DROP TABLE t1;
+SET NAMES binary;
+CREATE TABLE `goodÐÌÏÈÏ` (a int);
+ERROR HY000: Invalid utf8 character string: 'ÐÌÏÈÏ'
+SET NAMES utf8;
+CREATE TABLE `goodÐÌÏÈÏ` (a int);
+ERROR HY000: Invalid utf8 character string: 'ÐÌÏÈÏ` (a int)'
+set names latin1;
+create table t1 (a char(10) character set koi8r, b text character set koi8r);
+insert into t1 values ('test','test');
+insert into t1 values ('ÊÃÕË','ÊÃÕË');
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'b' at row 1
+drop table t1;
+set names koi8r;
+create table t1 (a char(10) character set cp1251);
+insert into t1 values (_koi8r'×ÁÓÑ');
+select * from t1 where a=_koi8r'×ÁÓÑ';
+a
+×ÁÓÑ
+select * from t1 where a=concat(_koi8r'×ÁÓÑ');
+ERROR HY000: Illegal mix of collations (cp1251_general_ci,IMPLICIT) and (koi8r_general_ci,COERCIBLE) for operation '='
+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 koi8r;
+create table t1 (c1 char(10) character set cp1251);
+insert into t1 values ('ß');
+select c1 from t1 where c1 between 'ß' and 'ß';
+c1
+select ifnull(c1,'ß'), ifnull(null,c1) from t1;
+ifnull(c1,'ß') ifnull(null,c1)
+ß ß
+select if(1,c1,'ö'), if(0,c1,'ö') from t1;
+if(1,c1,'ö') if(0,c1,'ö')
+ß ö
+select coalesce('ö',c1), coalesce(null,c1) from t1;
+coalesce('ö',c1) coalesce(null,c1)
+ö ß
+select least(c1,'ö'), greatest(c1,'ö') from t1;
+least(c1,'ö') greatest(c1,'ö')
+ö ß
+select locate(c1,'ß'), locate('ß',c1) from t1;
+locate(c1,'ß') locate('ß',c1)
+1 1
+select field(c1,'ß'),field('ß',c1) from t1;
+field(c1,'ß') field('ß',c1)
+1 1
+select concat(c1,'ö'), concat('ö',c1) from t1;
+concat(c1,'ö') concat('ö',c1)
+ßö öß
+select concat_ws(c1,'ö','ß'), concat_ws('ö',c1,'ß') from t1;
+concat_ws(c1,'ö','ß') concat_ws('ö',c1,'ß')
+ößß ßöß
+select replace(c1,'ß','ö'), replace('ß',c1,'ö') from t1;
+replace(c1,'ß','ö') replace('ß',c1,'ö')
+ö ö
+select substring_index(c1,'öößß',2) from t1;
+substring_index(c1,'öößß',2)
+select elt(1,c1,'ö'),elt(1,'ö',c1) from t1;
+elt(1,c1,'ö') elt(1,'ö',c1)
+ß ö
+select make_set(3,c1,'ö'), make_set(3,'ö',c1) from t1;
+make_set(3,c1,'ö') make_set(3,'ö',c1)
+ß,ö ö,ß
+select insert(c1,1,2,'ö'),insert('ö',1,2,c1) from t1;
+insert(c1,1,2,'ö') insert('ö',1,2,c1)
+ö ß
+select trim(c1 from 'ß'),trim('ß' from c1) from t1;
+trim(c1 from 'ß') trim('ß' from c1)
+
+select lpad(c1,3,'ö'), lpad('ö',3,c1) from t1;
+lpad(c1,3,'ö') lpad('ö',3,c1)
+ööß ßßö
+select rpad(c1,3,'ö'), rpad('ö',3,c1) from t1;
+rpad(c1,3,'ö') rpad('ö',3,c1)
+ßöö ößß
diff --git a/mysql-test/r/ctype_sjis.result b/mysql-test/r/ctype_sjis.result
new file mode 100644
index 00000000000..944fa0602a9
--- /dev/null
+++ b/mysql-test/r/ctype_sjis.result
@@ -0,0 +1,73 @@
+drop table if exists t1;
+set names sjis;
+select 'a' like 'a';
+'a' like 'a'
+1
+select 'A' like 'a';
+'A' like 'a'
+1
+select 'A' like 'a' collate sjis_bin;
+'A' like 'a' collate sjis_bin
+0
+set @sjis1= _sjis 0xa1a2a3a4a5a6a7a8a9aaabacadaeaf;
+set @sjis2= _sjis 0xb0b1b2b3b4b5b6b7b8b9babbbcbdbebf;
+set @sjis3= _sjis 0xc0c1c2c3c4c5c6c7c8c9cacbcccdcecf;
+set @sjis4= _sjis 0xd0d1d2d3d4d5d6d7d8d9dadbdcdddedf;
+set @utf81= CONVERT(@sjis1 USING utf8);
+set @utf82= CONVERT(@sjis2 USING utf8);
+set @utf83= CONVERT(@sjis3 USING utf8);
+set @utf84= CONVERT(@sjis4 USING utf8);
+select hex(@utf81);
+hex(@utf81)
+EFBDA1EFBDA2EFBDA3EFBDA4EFBDA5EFBDA6EFBDA7EFBDA8EFBDA9EFBDAAEFBDABEFBDACEFBDADEFBDAEEFBDAF
+select hex(@utf82);
+hex(@utf82)
+EFBDB0EFBDB1EFBDB2EFBDB3EFBDB4EFBDB5EFBDB6EFBDB7EFBDB8EFBDB9EFBDBAEFBDBBEFBDBCEFBDBDEFBDBEEFBDBF
+select hex(@utf83);
+hex(@utf83)
+EFBE80EFBE81EFBE82EFBE83EFBE84EFBE85EFBE86EFBE87EFBE88EFBE89EFBE8AEFBE8BEFBE8CEFBE8DEFBE8EEFBE8F
+select hex(@utf84);
+hex(@utf84)
+EFBE90EFBE91EFBE92EFBE93EFBE94EFBE95EFBE96EFBE97EFBE98EFBE99EFBE9AEFBE9BEFBE9CEFBE9DEFBE9EEFBE9F
+select hex(CONVERT(@utf81 USING sjis));
+hex(CONVERT(@utf81 USING sjis))
+A1A2A3A4A5A6A7A8A9AAABACADAEAF
+select hex(CONVERT(@utf82 USING sjis));
+hex(CONVERT(@utf82 USING sjis))
+B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF
+select hex(CONVERT(@utf83 USING sjis));
+hex(CONVERT(@utf83 USING sjis))
+C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF
+select hex(CONVERT(@utf84 USING sjis));
+hex(CONVERT(@utf84 USING sjis))
+D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF
+create table t1 (a char(10) character set sjis);
+insert into t1 values (0x878A);
+select hex(a) from t1;
+hex(a)
+878A
+drop table t1;
+create table t1(c enum(0x9353,0x9373) character set sjis);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` enum('“S','“s') character set sjis default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values (0x9353);
+insert into t1 values (0x9373);
+select hex(c) from t1;
+hex(c)
+9353
+9373
+drop table t1;
+SET NAMES sjis;
+CREATE TABLE t1 (
+c char(16) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=sjis;
+insert into t1 values(0xb1),(0xb2),(0xb3);
+select hex(c) from t1;
+hex(c)
+B1
+B2
+B3
+drop table t1;
diff --git a/mysql-test/r/ctype_tis620.result b/mysql-test/r/ctype_tis620.result
index 811609d4ba9..fa99c2d1318 100644
--- a/mysql-test/r/ctype_tis620.result
+++ b/mysql-test/r/ctype_tis620.result
@@ -1,9 +1,129 @@
drop table if exists t1;
+SET @pl0= _tis620 0x000102030405060708090A0B0C0D0E0F;
+SET @pl1= _tis620 0x101112131415161718191A1B1C1D1E1F;
+SET @pl2= _tis620 0x202122232425262728292A2B2C2D2E2F;
+SET @pl3= _tis620 0x303132333435363738393A3B3C3D3E3F;
+SET @pl4= _tis620 0x404142434445464748494A4B4C4D4E4F;
+SET @pl5= _tis620 0x505152535455565758595A5B5C5D5E5F;
+SET @pl6= _tis620 0x606162636465666768696A6B6C6D6E6F;
+SET @pl7= _tis620 0x707172737475767778797A7B7C7D7E7F;
+SET @pl8= _tis620 0x808182838485868788898A8B8C8D8E8F;
+SET @pl9= _tis620 0x909192939495969798999A9B9C9D9E9F;
+SET @plA= _tis620 0xA0A1A2A3A4A5A6A7A8A9AAABACADAEAF;
+SET @plB= _tis620 0xB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF;
+SET @plC= _tis620 0xC0C1C2C3C4C5C6C7C8C9CACBCCCDCECF;
+SET @plD= _tis620 0xD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF;
+SET @plE= _tis620 0xE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF;
+SET @plF= _tis620 0xF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF;
+SELECT hex(@u0:=convert(@pl0 using utf8));
+hex(@u0:=convert(@pl0 using utf8))
+000102030405060708090A0B0C0D0E0F
+SELECT hex(@u1:=convert(@pl1 using utf8));
+hex(@u1:=convert(@pl1 using utf8))
+101112131415161718191A1B1C1D1E1F
+SELECT hex(@u2:=convert(@pl2 using utf8));
+hex(@u2:=convert(@pl2 using utf8))
+202122232425262728292A2B2C2D2E2F
+SELECT hex(@u3:=convert(@pl3 using utf8));
+hex(@u3:=convert(@pl3 using utf8))
+303132333435363738393A3B3C3D3E3F
+SELECT hex(@u4:=convert(@pl4 using utf8));
+hex(@u4:=convert(@pl4 using utf8))
+404142434445464748494A4B4C4D4E4F
+SELECT hex(@u5:=convert(@pl5 using utf8));
+hex(@u5:=convert(@pl5 using utf8))
+505152535455565758595A5B5C5D5E5F
+SELECT hex(@u6:=convert(@pl6 using utf8));
+hex(@u6:=convert(@pl6 using utf8))
+606162636465666768696A6B6C6D6E6F
+SELECT hex(@u7:=convert(@pl7 using utf8));
+hex(@u7:=convert(@pl7 using utf8))
+707172737475767778797A7B7C7D7E7F
+SELECT hex(@u8:=convert(@pl8 using utf8));
+hex(@u8:=convert(@pl8 using utf8))
+C280C281C282C283C284C285C286C287C288C289C28AC28BC28CC28DC28EC28F
+SELECT hex(@u9:=convert(@pl9 using utf8));
+hex(@u9:=convert(@pl9 using utf8))
+C290C291C292C293C294C295C296C297C298C299C29AC29BC29CC29DC29EC29F
+SELECT hex(@uA:=convert(@plA using utf8));
+hex(@uA:=convert(@plA using utf8))
+EFBFBDE0B881E0B882E0B883E0B884E0B885E0B886E0B887E0B888E0B889E0B88AE0B88BE0B88CE0B88DE0B88EE0B88F
+SELECT hex(@uB:=convert(@plB using utf8));
+hex(@uB:=convert(@plB using utf8))
+E0B890E0B891E0B892E0B893E0B894E0B895E0B896E0B897E0B898E0B899E0B89AE0B89BE0B89CE0B89DE0B89EE0B89F
+SELECT hex(@uC:=convert(@plC using utf8));
+hex(@uC:=convert(@plC using utf8))
+E0B8A0E0B8A1E0B8A2E0B8A3E0B8A4E0B8A5E0B8A6E0B8A7E0B8A8E0B8A9E0B8AAE0B8ABE0B8ACE0B8ADE0B8AEE0B8AF
+SELECT hex(@uD:=convert(@plD using utf8));
+hex(@uD:=convert(@plD using utf8))
+E0B8B0E0B8B1E0B8B2E0B8B3E0B8B4E0B8B5E0B8B6E0B8B7E0B8B8E0B8B9E0B8BAEFBFBDEFBFBDEFBFBDEFBFBDE0B8BF
+SELECT hex(@uE:=convert(@plE using utf8));
+hex(@uE:=convert(@plE using utf8))
+E0B980E0B981E0B982E0B983E0B984E0B985E0B986E0B987E0B988E0B989E0B98AE0B98BE0B98CE0B98DE0B98EE0B98F
+SELECT hex(@uF:=convert(@plF using utf8));
+hex(@uF:=convert(@plF using utf8))
+E0B990E0B991E0B992E0B993E0B994E0B995E0B996E0B997E0B998E0B999E0B99AE0B99BEFBFBDEFBFBDEFBFBDEFBFBD
+SELECT hex(convert(@u0 USING tis620));
+hex(convert(@u0 USING tis620))
+000102030405060708090A0B0C0D0E0F
+SELECT hex(convert(@u1 USING tis620));
+hex(convert(@u1 USING tis620))
+101112131415161718191A1B1C1D1E1F
+SELECT hex(convert(@u2 USING tis620));
+hex(convert(@u2 USING tis620))
+202122232425262728292A2B2C2D2E2F
+SELECT hex(convert(@u3 USING tis620));
+hex(convert(@u3 USING tis620))
+303132333435363738393A3B3C3D3E3F
+SELECT hex(convert(@u4 USING tis620));
+hex(convert(@u4 USING tis620))
+404142434445464748494A4B4C4D4E4F
+SELECT hex(convert(@u5 USING tis620));
+hex(convert(@u5 USING tis620))
+505152535455565758595A5B5C5D5E5F
+SELECT hex(convert(@u6 USING tis620));
+hex(convert(@u6 USING tis620))
+606162636465666768696A6B6C6D6E6F
+SELECT hex(convert(@u7 USING tis620));
+hex(convert(@u7 USING tis620))
+707172737475767778797A7B7C7D7E7F
+SELECT hex(convert(@u8 USING tis620));
+hex(convert(@u8 USING tis620))
+808182838485868788898A8B8C8D8E8F
+SELECT hex(convert(@u9 USING tis620));
+hex(convert(@u9 USING tis620))
+909192939495969798999A9B9C9D9E9F
+SELECT hex(convert(@uA USING tis620));
+hex(convert(@uA USING tis620))
+FFA1A2A3A4A5A6A7A8A9AAABACADAEAF
+SELECT hex(convert(@uB USING tis620));
+hex(convert(@uB USING tis620))
+B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF
+SELECT hex(convert(@uC USING tis620));
+hex(convert(@uC USING tis620))
+C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF
+SELECT hex(convert(@uD USING tis620));
+hex(convert(@uD USING tis620))
+D0D1D2D3D4D5D6D7D8D9DAFFFFFFFFDF
+SELECT hex(convert(@uE USING tis620));
+hex(convert(@uE USING tis620))
+E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF
+SELECT hex(convert(@uF USING tis620));
+hex(convert(@uF USING tis620))
+F0F1F2F3F4F5F6F7F8F9FAFBFFFFFFFF
+SET NAMES tis620;
CREATE TABLE t1 (
recid int(11) NOT NULL auto_increment,
dyninfo text,
PRIMARY KEY (recid)
-) ENGINE=MyISAM;
+) ENGINE=MyISAM CHARACTER SET tis620;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `recid` int(11) NOT NULL auto_increment,
+ `dyninfo` text,
+ PRIMARY KEY (`recid`)
+) ENGINE=MyISAM DEFAULT CHARSET=tis620
INSERT INTO t1 VALUES (1,'color=\"STB,NPG\"\r\nengine=\"J30A13\"\r\nframe=\"MRHCG1640YP4\"\r\ngrade=\"V6\"\r\nmodel=\"ACCORD\"\r\nmodelcode=\"CG164YEN\"\r\ntype=\"VT6\"\r\n');
INSERT INTO t1 VALUES (2,'color=\"HTM,NPG,DEG,RGS\"\r\nengine=\"F23A5YP1\"\r\nframe=\"MRHCF8640YP3\"\r\ngrade=\"EXi AT\"\r\nmodel=\"ACCORD\"\r\nmodelcode=\"CF864YE\"\r\ntype=\"EXA\"\r\n');
SELECT DISTINCT
@@ -16,3 +136,2804 @@ FROM t1
HAVING year != '' ORDER BY year;
year
DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1
+(
+name varchar(50) NOT NULL default '',
+excelorder int(11) NOT NULL default '0',
+neworder int(11) NOT NULL default '0'
+) ENGINE=MyISAM DEFAULT CHARSET=tis620;
+INSERT INTO `t1` VALUES ('+45 BRETT',4,1),('+55 BRETT',5,2),('+56 BRETT',6,3),('-.55 BRETT',2,4),('-45 BRETT',8,5),('-55 BRETT',13,6),('.-55 BRETT',3,7),('.55 BRETT',1,8),('45 BRETT',7,9),('5 5 BRETT3',9,10),('5 5 BRETT2',10,11),('5 5 BRETT1',11,12),('5-5 BRETT',14,13),('55 BRETT',12,14),('55+ BRETT',17,15),('55- BRETT',15,16),('55. BRETT',16,17),('Ã.µË­Ô§ ŸÍãš',1630,1630),('ÂÃç€ì',1599,1599),('ÃÁÂìšÃÃÂì',1638,1638),('àÁàšÍÃìÍØµÊÒË¡ÃÃÁä·Â (1989)',1583,1583),('àÁâ·ÃʻԹ¹Ôè§',1586,1586),('àÃÇѵ',1706,1706),('àÂ繚ԵÃ',1623,1623),('àÂ繚Եµì',1622,1622),('àÁÉÂÒ',1591,1591),('àÁÉÔ³Õ',1592,1592),('áÁé¹ÁÒµÃ',1595,1595),('àÂÒÇàÃÈ',1627,1627),('àÂÒÇÀÒ',1626,1626),('àÂÒÇÅѡɳì',1628,1628),('àÂÒÇŽÕ',1624,1624),('àÂÒÇŸÒ',1625,1625),('àÃÔ§ÃÐÇÕ',1708,1708),('àÃÔ§Ä·žÔì',1709,1709),('àÃÔ§·ÔÇÒ',1707,1707),('ÀÃÒŽÃ',1496,1496),('àâ­Ò',1702,1702),('âç§Ò¹àËÅç¡¡ÃØ§à·ŸÏ',1712,1712),('âÚ¹ì»ÃÐàÊÃÔ°',1713,1713),('àóÙ',1703,1703),('àÁŽÔ€ÃÒ¿·ì',1584,1584),('àÁµµÒ',1585,1585),('áÁ··ÕàÃÕÂÅ¡ÃØê» šÓ¡ÑŽ',1594,1594),('àÁžÒ',1587,1587),('àÁžÕ',1590,1590),('àÁžÒÇÕ',1588,1588),('âžԹ',1629,1629),('àÁžÔ¹Õ',1589,1589),('Áâ¹',1553,1553),('Á⹪',1554,1554),('àßៀ à·ÃŽŽÔé§',1704,1704),('áßៀ €Í¹ÊµÃÑ€ªÑè¹',1711,1711),('àßៀ€Í¹ÊµÃÑ€ªÑè¹',1705,1705),('àÃ×ͧÂÈ',1710,1710),('àÁ×ͧ·Í§',1593,1593),('ÁÂØÃÕ',1555,1555),('áÇÇÇÔÀÒ',1952,1952),('áÇÇÇŽÕ',1951,1951),('àÇèÂà©Ô¹ÍÔ¹ŽÑÊàµÃÕ¹',1949,1949),('àÇÍÃìâ¡é ·ÃҹʻÍÃìµ',1950,1950),('ÀÇÔ¹',1497,1497),('Ãǧ·Í§',1639,1639),('ÁÐÅÔÇÑÅÂì',1560,1560),('ÃеÃÕ',1643,1643),('ÃПԹ·Ãì',1644,1644),('ÃП՟Ã',1645,1645),('ÃП՟Ãó',1646,1646),('ÃП՟Å',1647,1647),('àËÁÇŽÕ',2452,2452),('âÊÃÊ',2438,2438),('àÈÃɰžÃ',2050,2050),('àÈÃɰŸ§Éì',2051,2051),('âÊÃÑš',2439,2439),('ÁËÀÑ®',1558,1558),('àÊÁÒ',2410,2410),('àÊÃÕ',2413,2413),('âÊÀÒ',2432,2432),('âÊÀÕ',2435,2435),('àÊÃÔÁÈÑ¡ŽÔì',2412,2412),('àÊÃÔÁäªÂ€éÒ¡ÃÐŽÒÉ',2411,2411),('àËÃÕ­',2455,2455),('âÊÀÒŸÃó',2434,2434),('âÊÀÒŸš¹Õ',2433,2433),('âÊÚԵ',2436,2436),('âÊÀ³',2431,2431),('âÈÃŽÒ',2052,2052),('âÊÃŽÒ',2437,2437),('àËÁ×͹¢ÇÑ­',2453,2453),('àËÁ×͹Ÿ¹Í',2454,2454),('àÊÇÂ',2414,2414),('áÊǧ',2430,2430),('Áéǹáµé',1557,1557),('ÃÊÊØ€¹žì',1641,1641),('âÊÌÊ',2440,2440),('ÃÈÑ¡ŽÔì',1640,1640),('ÁËÒÃÒª',1559,1559),('àÊÒÇÅѡɳì',2420,2420),('àÊÒÇ€¹žì',2415,2415),('àÊÒdzÕ',2416,2416),('àÊÒdzÕÂì',2417,2417),('àÊÒǹÕÂì',2419,2419),('àÊÒǹԵÂì',2418,2418),('áËÅÁ·Í§ÊË¡ÒÃ',2456,2456),('àÊ¡ÊÃÃ',2405,2405),('àÊ¡ÊÃÀì',2406,2406),('áʧÃÐÇÕ',2424,2424),('Âè§àΧÇѲ¹Ò¡ÒßÔÁŸì',1598,1598),('áʧàŽ×͹',2422,2422),('áʧªÑÂ',2421,2421),('áʧ·Í§',2423,2423),('àʶÕÂÃ',2407,2407),('áʹÃÑ¡',2428,2428),('áʹÂÒ¡Ã',2427,2427),('áʹÀŸ',2426,2426),('àʹËì',2408,2408),('áÊ¹ÊØ¢',2429,2429),('àʹÕÂì',2409,2409),('áʹ·ÇÕà·ç¡«ìä·Åì',2425,2425),('àÍ.àš.ŸÅÒÊ·ì',2676,2676),('âÍàÃÕÂÅ·ÍÅ ¿ØéŽ',2716,2716),('áÍÃì«Õ à¿Ã· ¿ÍÃìàÇÔŽàµÍÃì',2712,2712),('áÍÃìŸÕàŸÔÅÍÔ¹àµÍÃì๪Ñè¹á¹Å',2713,2713),('ÃÍÂÑÅàÍ繚Ôà¹ÕÂÃÔè§',1642,1642),('àÍàªÕÂàÊÃÔÁ¡ÔšÅÔÊ«Ôè§',2687,2687),('àÍçÁ .«Õ.ŸÕÅÔÊ«Ôè§',2690,2690),('àÍçÁ «Õ ÍÐâ¡Ãà€ÁÕ€ÍÅ',2691,2691),('àÍçÁ.àÍçÁ.«Õ.â»ÅÔàÁÍÃì',2693,2693),('àÍçÁ.«Õ.ŸÕ. ÅÔÊ«Ôè§',2692,2692),('àÍçÁ«ÕÊÂÒÁ âÅšÕʵԀÊì',2694,2694),('âÍÇÍÐËÅÑèŸÒÃì·à«ç¹àµÍÃì',2717,2717),('àÍç¡«Õà«ÅàŹ¿ÍÃìÁ',2678,2678),('àÍçª àÍçÁ «Õ â»ÅÕàÁÍÃì',2684,2684),('àÍçª.àÍçÁ.«Õ.â»ÅÔàÁÍÃì',2685,2685),('àÍçª.àÍçÁ.«Õ.â»ÅÕàÁÍÃì (ºš¡.)',2686,2686),('àÍç¹ ŽÕ à€ (»ÃÐà·Èä·Â)',2688,2688),('àÍÊ àÍÊ à€ ¡Å¡ÒÃ',2697,2697),('àÍÊ àš ŸÅÒÊ·ì á͹Žì ៀ',2695,2695),('àÍÊ ŸÕ Ê᡹',2696,2696),('àÍÊ.àÍçÁ.ÇÕ ÊË¡ÒÃ',2701,2701),('àÍÊ.àÍÊ.à€ ¡Å¡ÒÃ',2702,2702),('àÍÊ.àÍÊ.à€.¡Å¡ÒÃ',2703,2703),('àÍÊ.àÍÊ.ÍÔ¹¡Íµ ÍÅÙÁÔà¹ÕÂÁ1999',2704,2704),('àÍÊ.à€.ÍÕ.',2698,2698),('àÍÊ.«Õ.ŸÕ.ៀ',2699,2699),('àÍÊ.ŸÕ.¹ÔµµÔé§',2700,2700),('áÍÊષŸÅÑÊ',2715,2715),('àÍÊÇÕ¹Ô··Ñ¹ŸÃÔ«ÔªÑè¹',2705,2705),('áÍÅ¿èÒ â»Ãà«Ê«Ôè§',2714,2714),('àÍ¡ÃÒª',2679,2679),('àÍ¡ÃÔ¹·Ãì',2680,2680),('àÍ¡ÊÔ·žÔì',2681,2681),('àÍ¡ÍÃö',2683,2683),('à͡͹ѹµì',2682,2682),('àÍ¡ªÑÂ',2677,2677),('àΧàšÃÔ­ªÑ ¡ÃØê» ÍÔ¹ŽÑÊàµÃÕÂÅ',2725,2725),('ÂÍŽàŸªÃ',1600,1600),('á͹¹Ò',2709,2709),('á͹¹ÒÃÕ',2710,2710),('áͺºÕà€ÃÊ·ì(»ÃÐà·Èä·Â)',2711,2711),('àÍ¿ ÍÕ «Ô€ÅÔ€ (¡Ãاෟ)',2689,2689),('àÍ×éÍÁŸÃ',2707,2707),('àÍ×éÍÍÒÃÕ',2708,2708),('àÍ×é͟ѹžØì',2706,2706),('ÃÑÈÁÕ',1674,1674),('ÃÑÈÁÕÀÑÊÊÃ',1675,1675),('ÀÑÊÇÃó',1511,1511),('ÀÑÊÅÔ¹',1510,1510),('ÁÑÅÅÔ¡Ò',1564,1564),('ÃÑ¡ÈÑ¡ŽÔì',1649,1649),('ÃÑ¡ÉÔµÀÑ·Ã',1650,1650),('ÀÑ¡ŽÕ',1498,1498),('ÃÑ¡ŽÕ',1648,1648),('ÀÑ€šÔÃÒ',1499,1499),('ÃѧÊÃÀì',1651,1651),('ÃѧÊѹµì',1652,1652),('ÃѧÊÔÁÒ',1653,1653),('Áѧ¡Ãä·ÂʵÕźÒÃì',1561,1561),('ÃѪà¡ÅéÒ',1654,1654),('ÃѪ®Ò',1655,1655),('ÃѪ®ÒŸÃ',1656,1656),('ÃѪŽÒ',1657,1657),('ÃѪ¹Õ',1658,1658),('ÃѪ¹Õ¡Ã',1659,1659),('ÃѪ¹ÕŸÃ',1660,1660),('ÃÑ°ÊØŽÒ',1662,1662),('ÃѰŸ§Éì',1661,1661),('Àѳ±ÔÃÒ',1500,1500),('Áѳ±¹Ò',1562,1562),('ÃѵÔÂÒ',1672,1672),('ÃѵÔÂÒÀóì',1673,1673),('Ãѵ³Ò',1663,1663),('ÃѵµÔÂÒ',1665,1665),('ÃѵµªÑÂ',1664,1664),('Ãѵ¹Àóì',1667,1667),('Ãѵ¹Á³Õ',1668,1668),('Ãѵ¹Ò',1669,1669),('Ãѵ¹ÒÀóì',1671,1671),('Ãѵ¹ÒŸÃ',1670,1670),('Ãѵ¹ªÑÂ',1666,1666),('ÀÑ·ÃÀÃ',1505,1505),('ÀÑ·ÃÃѧÊÕ',1506,1506),('ÀÑ·ÃÒÀóì',1508,1508),('ÀÑ·ÃÔ¹·Ãì',1509,1509),('ÀÑ·ÃÄŽÕ',1507,1507),('Àѷ÷ÔÃÒ',1501,1501),('ÀѷßÃ',1503,1503),('ÀѷßÅ',1504,1504),('Àѷß§Èì',1502,1502),('ÁÑ·¹Ò',1563,1563),('Âѹ áÍÅ à€âÂÊ',1601,1601),('ÃÒàÁÈÃì',1681,1681),('ÁÒÃÔÉÒ',1572,1572),('ÃÒÂÕ¹',1682,1682),('ÃÒહ',1678,1678),('ÀÒÃŽÕ',1521,1521),('ÀÔÃŽÕ',1531,1531),('ÁÒ⹪³ì',1570,1570),('ÁÒâ¹·',1571,1571),('ÀÒÇÔ³Õ',1524,1524),('ÀÒÇÔ¹',1525,1525),('ÀÒÇÔ¹Õ',1526,1526),('ÀÒǹÒ',1522,1522),('ÀÒǟѹž¹ì',1523,1523),('ÀÒÉÔµÒ',1527,1527),('ÂÔè§ÇÃó',1602,1602),('ÁÔÅàŹà¹ÕèÂÁ âÍ.àÍ 2000',1578,1578),('ÁÒÅÑÂ',1573,1573),('ÁÒÅÕ',1575,1575),('ÁÒÅÕÇÃó',1576,1576),('ÁÒÅÔ¹Õ',1574,1574),('ÀÒ¡Ã',1512,1512),('ÀÒ€ÀÙÁÔ',1513,1513),('ÀÔšÔµÃÒ',1528,1528),('ÁÒªÍÃì¡ÇÒ¹',1565,1565),('ÃҪѹÂì',1676,1676),('ÃÒªÒÍÙªÔâ¹',1677,1677),('ÀÔ­â­',1530,1530),('ÀÔ­­ŸÑ¡µÃì',1529,1529),('ÀÒ³Õ',1514,1514),('ÁÒ³Õ',1566,1566),('ÃÒ³Õ',1679,1679),('ÀÒ³Ø',1515,1515),('ÀÒ³ØÇÃó',1517,1517),('Àҳ؟Å',1516,1516),('ÃÒµÃÕ',1680,1680),('ÁÔµ·ÔÃÒ',1577,1577),('ÁÒ¹Ð',1568,1568),('ÁÒ¹ÔµÂì',1569,1569),('ÁÒ¹Ÿ',1567,1567),('ÀÒ¹ØÇѲ¹ì',1518,1518),('ÀÒ¹ØÇѵÃ',1519,1519),('ÀÒŸÃ',1520,1520),('ÁÕŸÅ',1579,1579),('ÀÙÃÔÇÃò¡ì',1535,1535),('ÀÙÁÔ°Ò¹',1533,1533),('ÀÙÃÔŸ§Èì',1534,1534),('ÂÙà¹Õè¹á¡êÊá͹ŽìàÅÁÔ€ÑÅÊì',1621,1621),('ÀÙàºÈ',1532,1532),('ÃÙàºÕÂÍØµÊÒË¡ÃÃÁ',1701,1701),('ÁÙËÐÁÐŽ×ÍàÃÐ',1582,1582),('ÀÙÉÔµ',1536,1536),('ÂÙ¹ÔÅÕàÇÍÃì ä·Â âÎÅŽÔé§Êì',1618,1618),('ÂÙ¹ÔÅÕàÇÍÃìä·Â âÎÅŽÔé§Êì',1619,1619),('ÂÙ¹Õ€ ÍÍÃì€ÔŽ',1620,1620),('âÅËСԚʵÕÅ',1744,1744),('àÅÍÊÃÀì',1739,1739),('àÅÍÈÑ¡ŽÔì',1738,1738),('àÅÍÊØ¢',1740,1740),('àÅͪÑÂ',1737,1737),('àÅÔÈÈÑ¡ŽÔì',1742,1742),('àÅÔÈÊÒÁÒö âžÒ',1743,1743),('àÅÔȪÑÂ',1741,1741),('ÁÅÄŽÕ',1556,1556),('â¡àÁÈ',206,206),('â¡àÇȹì',211,211),('à¡ÃÕ§§ÍÔ¹àµÍÃì๪Ñè¹á¹Å',179,179),('à¡ÃÕ§ÈÑ¡ŽÔì',180,180),('à¡ÃÕ§ä¡Ã',177,177),('à¡ÃÕ§ªÑÂ',178,178),('à¡ÃÔ¡',174,174),('à¡ÃÔ¡ä¡Ã',175,175),('à¡ÃÔ¡Ÿ§Éì',176,176),('Á¡Ãҹѹ·ì',1537,1537),('â¡Áşѹžì',205,205),('â¡ÇÔ·',208,208),('â¡ÇÔ·Âì',209,209),('â¡ÇÔ¹',210,210),('à¡çšŸÔÃØ³',170,170),('à¡ÉÁ',190,190),('à¡ÊÃ',196,195),('à¡ÉÁÊѹµì',191,191),('à¡ÊÃì',195,196),('à¡ÈÃÒ',182,182),('à¡ÉÃÒ',192,192),('à¡ÉÃÕ',193,193),('à¡ÈÃÔ¹·Ãì',183,183),('á¡éÇ',203,203),('á¡éÇãš',204,204),('à¡ÈÇÅÕ',184,184),('à¡ÈÈÔÃÔ',185,185),('à¡ÈÊØŽÒ',186,186),('à¡ÉÕÂÃ',194,194),('à¡ÈÔ¹Õ',187,187),('â¡ÊÔ¹·Ãì',213,213),('â¡ÈÅ',212,212),('à¡È¡ØÅÀÒ',181,181),('à¡É³Õ',188,188),('à¡ÉŽÒ',189,189),('à¡ÕÂõÔ',197,197),('à¡ÕÂõÔÊÇÑÊŽÔì',201,201),('à¡ÕÂõÔÈÑ¡ŽÔì',200,200),('à¡ÕÂõԻÀÒ',198,198),('à¡ÕÂõԟ§Éì',199,199),('â¡ÅºÍÅ €Í¹à¹ç€ªÑè¹Êì',207,207),('ࡪÒ',171,171),('ࡳԡÒ',172,172),('ࡵØÁ³Õ',173,173),('à¡×éÍ¡ÙÅ',202,202),('á¢ä¢',235,235),('à€ ÊËÒÂÍÔÁà»ê¡«ì',262,262),('à€.«Õ.ŸÕ. áÁªªÕ¹à¹ÍÃÕè',263,263),('â€Ãà¹Ê (ä·ÂᏎì)',270,270),('à€Ã×ÍÇÑÅÂì',267,267),('á€ÐšéÍÂ',269,269),('à€·Õ·ÕÅÔÊ«Ôè§',264,264),('à€¹ áÁç¡«ì (»ÃÐà·Èä·Â)',266,266),('à€¹ áÁ¡«ì (»ÃÐà·Èä·Â)',265,265),('္¹Ù ÍÔ¹àµÍÃìà·ÃŽ',268,268),('âŠÉÔµ',271,271),('Â§ÂØ·ž',1597,1597),('à§Ô¹·Ø¹à¡ÕÂõԹҀԹ',274,274),('Á§¡Ø®Ãѵ¹ì',1538,1538),('Á§€Å',1539,1539),('Á§€Å¡Òûѡ',1540,1540),('àšÃÕ§',409,409),('àšÃÔ­',407,407),('àšÃÔ­ªÑÂËÁéÍá»Å§ä¿¿éÒ',408,408),('ášèÁ',414,414),('ãšÊÇÇÀì',415,415),('àšéÒŸÃÐÂÒÁÒÃì€',411,411),('àšÉ®Ò',410,410),('àšÕÂÁšÔµ',413,413),('àšÔÁªÑÂ',412,412),('àšµ¹ì',401,401),('àš¹',402,402),('àš¹à¹ÍÃÑÅ乫ì (»ÃÐà·Èä·Â)',405,405),('àš¹ÇÔ·Âì',406,406),('Ú¹Ò',1631,1631),('àš¹šÔÃÒ',403,403),('àš¹µì³Ã§€ì',404,404),('â©ÁÊØŽÒ',436,436),('â©ÁÅŽÒ',435,435),('à©Ô¹',434,434),('à©ÅÔÁ',428,428),('à©ÅÕÂÇ',433,433),('à©ÅÔÁ¢ÇÑ­',429,429),('à©ÅÔÁªÑÂ',430,430),('à©ÅÔÁªÒµÔ',431,431),('à©ÅÔÁŸÑ¹žØì',432,432),('àªÉ°Ò',555,555),('àªÍÃÔè§-ŸÅÒÇ á͹ÔÁÑÅ àÎéŪ',556,556),('àªÍÃÔè§-ŸÅÒÇá͹ÔÁÑÅàÎçÅž',557,557),('àªÕ§àΧ¡ÒêèÒ§',563,563),('àªÒÇÅÔµ',559,559),('àªÒǹҭ',558,558),('àªÕèÂǪҭ ÍÔ¹ŽÑÊ·ÃÕè (1989)',564,564),('àªÕèÂǪҭÍÔ¹ŽÑÊ·ÃÕ (1989)',565,565),('àªÕèÂǪҭÍÔ¹ŽÑÊ·ÃÕè (1989)',566,566),('àªÕèÂǪҭÍÔ¹ŽÑÊ·ÃÕè(1989)',567,567),('àªÔŽÈÑ¡ŽÔì',562,562),('àªÔŽšÔµµì',560,560),('àªÔŽªÑÂ',561,561),('⪀',568,568),('⪀ªÑÂ',569,569),('ય°¡Ã',554,554),('⪵Ô',570,570),('⪵ÔÃÊ',571,571),('⪵ÔÇØž',572,572),('à«ÕÂÁà¡ÕÂÇ',589,589),('à«ÒÐ',588,588),('óç€ì',1632,1632),('Á³à±ÕÂÃ',1546,1546),('Á³ÕÃѵ¹ì',1547,1547),('Á³°ÔŽÒ',1541,1541),('Á³±Ò',1545,1545),('Á³±ÅÕ',1544,1544),('Á³±¹ì¡Ò­š¹ì',1542,1542),('Á³±¹Ôš',1543,1543),('âŽÁ',708,708),('àŽÍЀÇÍÅÔµäÇÃì',705,705),('ÃŽÒ',1633,1633),('àŽª',703,703),('àŽªÒ',704,704),('àŽ×͹àŸç­',707,707),('àŽ×͹¹ÀÒ',706,706),('àµçÁàŽª',720,720),('ãµé à«é§ «Ñ¹',723,723),('àµ×͹ãš',721,721),('àµ×͹µÒ',722,722),('à¶ÅÔ§ÈÑ¡ŽÔì',734,734),('à·ÇÒ',802,802),('à·ÇÕ',803,803),('à·ÔŽä·',804,804),('à·Ÿ',799,799),('à·ŸÄ·žÔì',801,801),('à·ŸŸÔºÙÅ',800,800),('Á¹ÑÊ',1550,1550),('Á¹ÑÊÇÕ',1551,1551),('à¹ÒÇÃѵ¹ì',1043,1043),('ùԮ°Ò',1634,1634),('Á¹Ù­',1552,1552),('Á¹µÃÕ',1549,1549),('๵ÎÒÇ',1042,1042),('Á¹µìªÑÂ',1548,1548),('àºç­ÇÃó',1117,1117),('àºç·à·ÍÃì äÅ¿ì',1118,1118),('ອšÁÒ',1114,1114),('ອšÇÃó',1116,1116),('ອšÅÑ¡É³ì ŸÃÔé¹µÔé§',1115,1115),('ອšŸÃ',1113,1113),('à»ÃÁ',1265,1265),('à»ÃÁÈÃÕ',1268,1268),('à»ÃÁÊÔ·žÔì',1269,1269),('à»ÃÁÄŽÕ',1267,1267),('à»ÃÁ»ÃÐÀÒ',1266,1266),('à»à»ÍÃìÅÔ¿',1264,1264),('à»ÕèÂÁÊØ¢',1270,1270),('á»Å¹âÁ·Ô¿',1271,1271),('àŒÔ§',1291,1291),('àŒŽçš',1290,1290),('áŸÃÇ',1475,1475),('áŸÃÇÒ',1476,1476),('àŸÃÔÁàÁ¹¹Ôª ÍâÃáÁµÔê¡Êì ŸÕ·ÕÍÕ ÅÔÁÔàµçŽ',1468,1468),('àŸç§ ¿Ù ËÅÔ¹',1456,1456),('àŸçªÃì',1457,1457),('àŸç­ÈÃÕ',1467,1467),('àŸç­šÑ¹·Ãì',1461,1461),('àŸç­·ÔŸÂì',1462,1462),('àŸç­¹ÀÒ',1463,1463),('àŸç­»ÃÐÀÒ',1464,1464),('àŸç­Œ¡Ò',1465,1465),('àŸç­ŸÔäÅ',1466,1466),('ßÕÀÑ·Ã',1637,1637),('àŸÕ§ŸÃ',1471,1471),('ß՟Ã',1635,1635),('ß՟Ѳ¹ì',1636,1636),('àŸÅԹĎÕ',1470,1470),('àŸÅÔ¹šÔµµì',1469,1469),('àŸªÃÃѵ¹ì',1458,1458),('àŸªÃÔ¹·Ãì',1460,1460),('àŸªÃÅŽÒ',1459,1459),('៎ŽÔé§ (ä·ÂᏎì)',1472,1472),('៎ŽÔé§(ä·ÂᏎì)',1473,1473),('៹ŽéÒ à»à»ÍÃì €ÒÃìµÑ¹Ê',1474,1474),('á¿ÃìàÇÂì ÍÔ¹àµÍÃì๪Ñè¹á¹Å',1495,1495),('á¿Ã§€ì',1494,1494),('Ã×è¹ÇÃÒËì',1683,1683),('ÂØÀÒÀóì',1615,1615),('ÂØÀÒŸÃ',1614,1614),('ÂØÇÃÕ',1617,1617),('ÂØÇŽÕ',1616,1616),('ÃØËйÒ',1700,1700),('ÃØé§',1684,1684),('ÃØè§âÚ¹ì',1693,1693),('ÃØè§âڹ좹Êè§',1694,1694),('ÃØè§àÃ×ͧ',1692,1692),('ÃØè§ÃÑÈÁÕ',1691,1691),('ÃØè§ÃѪ¹Õ',1689,1689),('ÃØè§Ãѵ¹ì',1690,1690),('ÃØè§àŸªÃ',1688,1688),('ÃØè§ÇÔ·Âì',1696,1696),('ÃØè§ÍÃØ³',1697,1697),('ÃØé§ÅÒÇÃó',1695,1695),('ÃØè§·ÔÇÒ',1686,1686),('ÃØè§·ÔŸÂì',1685,1685),('ÃØè§¹ÀÒ',1687,1687),('ÁØ¢',1580,1580),('ÂØ€ÅŸÃ',1603,1603),('ÃØšÒ',1698,1698),('ÃØšÒÀÒ',1699,1699),('ÂØŽÒ',1604,1604),('ÁØ·ÔµÒ',1581,1581),('ÂØ·žÂ§',1607,1607),('ÂØ·ž¹Ò',1605,1605),('ÂØ·ž¹ÒÇÕ',1606,1606),('ÂØžÒÁÒµÂì',1608,1608),('ÂØ¹â¡Ð',1609,1609),('ÂØŸÒ',1610,1610),('ÂØŸÒÇŽÕ',1612,1612),('ÂØŸÔ¹',1613,1613),('ÂØŸÒŸÃ',1611,1611),('ÇÃÃѪ',1792,1792),('ÇÃÁÅ',1768,1768),('ÇÃóÀóì',1785,1785),('ÇÃóÀÒ',1786,1786),('ÇÃóÀŸ',1784,1784),('ÇÃóàŸç­',1783,1783),('ÇÃóǎÕ',1787,1787),('ÇÃóÈÔÃÔ',1788,1788),('ÇÃóìŽÕ',1773,1774),('ÇÃóÒ',1789,1789),('ÇÃóÕ',1790,1790),('ÇÃóšÔµ',1770,1770),('ÇÃóªÑÂ',1771,1771),('ÇÃó±¹Ò',1772,1772),('ÇÃóŽÕ',1774,1773),('ÇÃó·¹Ò',1775,1775),('ÇÃó·¹Õ',1776,1776),('ÇÃóžÁÅ',1778,1778),('ÇÃóž³Õ',1777,1777),('ÇÃó¹ÀÒ',1779,1779),('ÇÃó¹ÒÃÕ',1780,1780),('ÇÃóŸÃ',1781,1781),('ÇÃóŸÒ',1782,1782),('ÇÃà·Ÿ',1762,1762),('ÇÃÞ¹Ò',1791,1791),('ÇÃÂØ·žì',1769,1769),('ÇÃÇÃó',1794,1794),('ÇÃÇÃÞ¹ì',1795,1795),('ÇÃÇѲ¹ì',1796,1796),('ÇÃÇÔÀÒ',1797,1797),('ÇÃÑ­žÃ',1798,1798),('ÇÃÒ',1799,1799),('ÇÃÒÀóì',1803,1803),('ÇÃÒÃѵ¹ì',1804,1804),('ÇÃÔÁÒ',1810,1810),('ÇÃÕÇÃó',1812,1812),('ÇÃÒÇØ²Ô',1806,1806),('ÇÃÒÇØž',1807,1807),('ÇÃÔÈÃÒ',1811,1811),('ÇÃÒÅѡɳì',1805,1805),('ÇÃÒ§Ãѵ¹ì',1801,1801),('ÇÃÒ§€³Ò',1800,1800),('ÇÃÔ¹·Ãì',1808,1808),('ÇÃÔ¹žÃ',1809,1809),('ÇÃÒŸÃ',1802,1802),('ÇÃÅѡɳì',1793,1793),('ÇáÒÃ',1758,1758),('ÇêÑÂ',1759,1759),('ÇêҵÔ',1760,1760),('ÇÃŽÔɰì',1761,1761),('ÇÞѹÂì',1763,1763),('Çùت',1764,1764),('ÇßÅ',1767,1767),('Çß§Éì',1765,1765),('Çßš¹ì',1766,1766),('ÇÃØ³',1813,1813),('Çèͧ',1819,1819),('ÇÊѹµì',1817,1817),('ÇÈÔ³Ò',1815,1815),('ÇÈÔ¹',1816,1816),('ÇÊØ',1818,1818),('CHEE KUNG FOOK',18,18),('CHEN CHIA YI',19,19),('CHI WAI DAVIT',20,20),('ÇÑʹÑÂ',1843,1843),('ÇÑÈŸÅ',1842,1842),('ÇÑÅÅÀ',1839,1839),('ÇÑÅÅÀÒ',1840,1840),('ÇÑÅÅÒÀÒ',1841,1841),('ÇѪÃÐ',1822,1822),('ÇѪÃÑ­­Ò',1823,1823),('ÇѪÃÕ',1825,1825),('ÇѪÃÔ¹·Ãì',1824,1824),('ÇѪáÃ',1820,1820),('ÇѪßÅ',1821,1821),('ÇѲ¹Ð',1826,1826),('ÇѲ¹Ò',1827,1827),('ÇѹÃѪŽÒ',1836,1836),('Çѹà©ÅÔÁ',1828,1828),('ÇѹàŸç­',1835,1835),('ÇѹÇÔÊÒ¢ì',1837,1837),('ÇѹʶÒ',1838,1838),('ÇѹªÑÂ',1829,1829),('ÇѹªÒµÔ',1830,1830),('ÇѹŽÕ',1831,1831),('Çѹ·¹Ò',1832,1832),('Çѹ·¹Õ',1833,1833),('Çѹ·¹ÕÂì',1834,1834),('ÇÕ àÍÊ à¹à¹ÍÃÑÅ à€Á',1916,1916),('ÇÔÃÁÅ',1886,1886),('ÇÔâÚ¹ì',1889,1889),('ÇÕÃ⪵Ô',1921,1921),('ÇÕÃàŽª',1922,1922),('ÇÕÃÂØ·Âì',1925,1925),('ÇÕÃÇÃó',1926,1926),('ÇÕÃÐ',1929,1929),('ÇÕÃÐàŽª',1933,1933),('ÇÕÃÐÂØ·žì',1936,1936),('ÇÕÃÐÇÃó',1937,1937),('ÇÕÃÐÇѲ¹ì',1938,1938),('ÇÕÃÐÈÑ¡ŽÔì',1939,1939),('ÇÕÃЪÑÂ',1930,1930),('ÇÕÃЪÒÂ',1932,1932),('ÇÕÃЪҵÔ',1931,1931),('ÇÕÃПÅ',1935,1935),('ÇÕÃП§Éì',1934,1934),('ÇÕÃÈÑ¡ŽÔì',1927,1927),('ÇÕÃÊÔ·žÔì',1928,1928),('ÇÔÃѪ',1887,1887),('ÇÔÃѵ¹ì',1888,1888),('ÇÒÃÕ',1849,1849),('ÇÔÀÒ',1875,1875),('ÇÕÃÒÀóì',1940,1940),('ÇÔÀÒÃѵ¹ì',1879,1879),('ÇÔÀÒÊ',1881,1881),('ÇÔÀÒɳÕÂì',1880,1880),('ÇÔÀҡóì',1876,1876),('ÇÔÀÒ€',1877,1877),('ÇÒÃÔª',1848,1848),('ÇÔÀÒŸÃó',1878,1878),('ÇÔÀÙÉÔµ',1882,1882),('ÇÔÁÅ',1883,1883),('ÇÔÁÅÇÃó',1885,1885),('ÇÔÁÅŸÃ',1884,1884),('ÇÔàªÉ°',1863,1863),('ÇÕêÑÂ',1920,1920),('ÇÔàªÕÂÃ',1864,1864),('ÇÕßÅ',1924,1924),('ÇÕß§Èì',1923,1923),('ÇÒÃØ³Õ',1850,1850),('ÇÔÇ',1901,1901),('ÇÔÇÃÞ¹ì',1902,1902),('ÇÔÇѲ¹ì',1903,1903),('ÇÔÇѲ¹ìªÑÂ',1904,1904),('ÇÔÉÃØš¹ì',1910,1910),('ÇÔÈÃØµ',1906,1906),('ÇÔÈÔÉ®ì',1908,1908),('ÇÔÈÔɰì',1909,1909),('ÇÔÈÒÅ',1907,1907),('ÇÔÊÔ°ÈÑ¡ŽÔì',1911,1911),('ÇÔÊÔ·žÔì',1912,1912),('ÇÔÊÙµ',1915,1915),('ÇÒʹÒ',1851,1851),('ÇÔȹÕ',1905,1905),('ÇÔÊØ·žÔ',1914,1913),('ÇÔÊØ·žÔì',1913,1914),('ÇÔÅÇѳÂì',1890,1890),('ÇÔÅÒÇÃó',1891,1891),('ÇÔÅÒÇÑÅÂì',1893,1893),('ÇÔÅÒÇѳÂì',1892,1892),('ÇÔÅÒÊÔ¹Õ',1894,1894),('ÇÔÅÔµ',1895,1895),('ÇÔäÅ',1896,1896),('ÇÔäÅÃѵ¹ì',1898,1898),('ÇÔäÅÇÃó',1900,1900),('ÇÔäÅÅѡɳì',1899,1899),('ÇÔäÅŸÃ',1897,1897),('ÇÔ€Á',1853,1853),('ÇÔ€µÍÃÕè âŸÃà¡Ã·',1852,1852),('ÇÔšÔÃÒ',1856,1856),('ÇÔšÒóì',1854,1854),('ÇÔšÔµÃ',1855,1855),('ÇÔªÑÂ',1859,1859),('ÇÔªÒ­',1860,1860),('ÇÔªÔµ',1861,1861),('ÇÔªªÒ',1857,1857),('ÇÔª­ÐÃØš',1858,1858),('ÇԪ؎Ò',1862,1862),('ÇÕ«èÒ (2000)',1917,1917),('ÇÔ­­ØŽÒ',1865,1865),('ÇÔ±ÙÅÂì',1866,1866),('ÇÒ³Õ',1844,1844),('ÇÕ³Ò',1918,1918),('ÇÔ·ÂÒ',1868,1868),('ÇÔ·ÇÑÊ',1869,1869),('ÇÒ·Ôµ',1845,1845),('ÇÒ·Ô¹',1846,1846),('ÇÒ·Ô¹ÕÂì',1847,1847),('ÇÔ·ÙÃ',1870,1870),('ÇÔ·žÇѪ',1867,1867),('ÇÔ¹ÊÃÀì',1871,1871),('ÇÔ¹ÑÂ',1872,1872),('ÇÕ¹ÑÊ',1919,1919),('ÇÔ¹Ôš',1873,1873),('ÇÔºÙÅÂì',1874,1874),('ÇÅÑŸÃ',1814,1814),('ǧàŽ×͹',1745,1745),('ǧÈìÇÒµ',1749,1749),('ǧÈìÊØÀÒ',1750,1750),('ǧÈì䟱ÙÃÂì¡Ãç» º',1746,1746),('ǧÈì䟱ÙÃÂì¡ÃÙê»',1748,1748),('ǧÈì䟱ÙÃÂì¡ÃØê»',1747,1747),('ÇšÕÃѵ¹ì',1751,1751),('ǪÔÃÒÀÒ',1752,1752),('ǹÑʹѹ·ì',1754,1754),('ǹѪŸÃ',1753,1753),('ǹÒ',1755,1755),('ǹԪ',1756,1756),('ǹԎÒ',1757,1757),('ÇØ²ÔÃѵ¹ì',1948,1948),('ÇØ²Ô¡Ã',1941,1941),('ÇØ²ÔªÑÂ',1942,1942),('ÇØ²Ô¹ÑÂ',1944,1944),('ÇØ²Ô¹Ñ¹·ì',1943,1943),('ÇØ²ÔŸÅ',1947,1947),('ÇØ²ÔŸ§Èì',1945,1945),('ÇØ²ÔŸš¹ì',1946,1946),('Ê ÍÒŽ',2054,2054),('Ê.͹ѹµìàÍ繚Ôà¹ÕÂÃÔè§ á͹€Í¹ÊµÃÑ€ªÑè¹',2055,2055),('ÊÁ',2078,2078),('ÊÁÃ',2113,2113),('ÊÃÃàÊÃÔ°­',2142,2142),('ÊÁâÀª¹ì',2108,2108),('ÊÁâÁ·',2111,2111),('ÊÁÂÈ',2112,2112),('ÊÁÃÑ¡Éì',2114,2114),('ÊÁÁÒö',2109,2109),('ÊÁÁÒȹì',2110,2110),('ÊÁà¡ÕÂõÔ',2080,2080),('ÊÁãš',2088,2088),('ÊÁ⪀',2093,2093),('ÊÁàŽª',2095,2095),('ÊÁÀŸ',2107,2107),('ÈÃÇÑÅÂì',1959,1959),('ÊÁǧÉì',2119,2119),('ÊÁÈÃÕ',2120,2120),('ÊÁËÁÒÂ',2126,2126),('ÊÁËÇѧ',2127,2127),('ÊÁÈÑ¡ŽÔì',2121,2121),('ÊÁÈÔÃÔ',2122,2122),('ÊÁË­Ô§',2125,2125),('ÊÁÊØ¢',2123,2123),('ÊÁÊØ¹ÕÂì',2124,2124),('ÊÁÑÂ',2128,2128),('ÈÃÑ­­Ò',1960,1960),('ÊÃÑ­­Ò',2143,2143),('ÈÃѳÂì',1962,1962),('ÈÃѳŸÃ',1961,1961),('ÊÂÒÁ',2133,2133),('ÊÂÒÁàÁŠÕâŸÅÕàÁÍÃì',2139,2139),('ÊÂÒÁÂÙ¹Ôâ«Å',2140,2140),('ÈÃÕÃѵ¹ì',1977,1977),('ÈÃÕÀÒ',1976,1976),('ÈÃÒÁÒÈ',1963,1963),('ÈÂÒÁÅ',1957,1957),('ÊÂÒÁäŽà€ÕÂÇ',2136,2136),('ÊÂÒÁ€Í¹àÇàÂÍÃì',2134,2134),('ÊÂÒÁªÑÂâŸÅÕàÁÍÃì',2135,2135),('ÊÂÒÁ¹ÔÊÊѹ ÍÍâµéâÁºÔÅ',2137,2137),('ÊÂÒÁŸÃà·ÃŽà«ç¹àµÍÃì',2138,2138),('ÈÃÕàŸç­',1975,1975),('ÊÃÒÂØž',2146,2146),('ÈÃÕÇÑš¹Ò',1978,1978),('ÈÃÕÇѲ¹Ò',1979,1979),('ÈÃÕÇÔ¡Ò',1980,1980),('ÈÃÒÇØ²Ô',1964,1964),('ÊÃÒÇØ²Ô',2147,2147),('ÈÃÒÇØž',1965,1965),('ÊÃÒÇØž',2148,2148),('ÈÃÕÊÁÃ\nÈÃÕÊÁÃ',1984,1983),('ÈÃÕÊÁÃ',1983,1984),('ÈÃÕÈÑ¡ŽÔì',1981,1981),('ÈÃÕÊ¡ØÅ',1982,1982),('ÈÃÕÊØÇÃó€Í¹àÇàÂÍÃìàºÅ·ì á͹Žì ÃѺàºÍÃì',1985,1985),('ÈÃÕÍÓŸÅÍØµÊÒË¡ÃÃÁ',1987,1987),('ÈÃÕ͹§€ì',1986,1986),('ÊÃÒ¡Ã',2144,2144),('ÈÃ՚ѹ·Ãì',1967,1967),('ÈÃ՚ѹ·ÃÒ',1968,1968),('ÊÃÒ­šÔµ',2145,2145),('ÈÃշͧà¹ÁàŸÅ·',1969,1969),('ÈÃÕ·Í§ÍØµÊÒË¡ÃÃÁ«ÑŸŸÅÒÂ',1970,1970),('ÊÁÔ·žÔ',2131,2130),('ÊÁÔ·žÔì',2130,2131),('ÊÁÒ¹',2129,2129),('ËÃÔ¹',2446,2446),('ÊÃÔ¹ÃÒ',2149,2149),('ÈÃÕ¹ÇÅ',1971,1971),('ÈÃÔ¹·Ãì',1966,1966),('ÈÃÕ»ÃÐÀÒ',1973,1973),('ÈÃÕ»ÃÐäŸ',1972,1972),('ÈÃÕŸ§Éì',1974,1974),('ÈÁÅÇÃó',1956,1956),('ÊÁÅѡɳì',2118,2118),('ÊàÅ€·ì¿ÍÃìÁà¿ÍÃì¹ÔàšÍÃìáÅкصÃ',2152,2152),('ÊÁÄŽÕ',2115,2115),('ÊÁÄ·ÑÂ',2117,2117),('ÊÁÄ·žÔì',2116,2116),('ÊÁ¡ÁÅ',2079,2079),('ÊÁ€ÇÃ',2081,2081),('ÊÁ€ÔŽ',2082,2082),('ÊÁšÔµ',2083,2083),('ÊÁšÔµÃ',2086,2085),('ÊÁšÔµÃì',2085,2086),('ÊÁšÔµµì',2084,2084),('ÊÁšÔ¹µ¹Ò',2087,2087),('ÈêÑÂ',1958,1958),('ÊÁªÑÂ',2089,2089),('ÊÁªÒÂ',2092,2092),('ÊÁªÒ­',2090,2090),('ÊÁªÒµÔ',2091,2091),('ÊÁŽÕ',2094,2094),('Êáµ¹ŽÒÃìŽ ªÒÃìàµÍÃì (»ÃÐà·Èä·Â)',2066,2066),('ÊÁ·Ã§',2096,2096),('ÊÁ¹Ö¡',2097,2097),('ÊÁºÑµÔ',2098,2098),('ÊÁºÙóì',2100,2100),('ÊÁºØ­',2099,2099),('Êà»ç€ àŽç¹ µÑÅ áź',2076,2076),('ÊÁ»Í§',2101,2101),('Ê໫€ÍÁ',2077,2077),('ÊÁŸÃ',2104,2104),('ÊÁŸÔÈ',2106,2106),('ÊÁŸÅ',2105,2105),('ÊÁŸ§Éì',2102,2102),('ÊÁŸš¹ì',2103,2103),('ÊÂØÁŸÃ',2141,2141),('ÊÃØš',2150,2150),('ÊÁتªÅ',2132,2132),('ÊÇÑÊŽÔì',2154,2154),('ÊÇÕâÚ¹ì',2155,2155),('ÊÇÕÇÃó',2156,2156),('ËÇÒ¹',2448,2448),('ÊÇÅѡɳì',2153,2153),('Êзé͹',2161,2161),('ÈÈÁÅ',1989,1989),('ÊËà¡ÕÂõÔâÅËÐà¡ÕÂõÔ',2158,2158),('ÈÈÔ',1990,1990),('ÈÈÔÀÒ',1993,1993),('ÈÈÔÁÒ',1994,1994),('ÈÈÔÇÔÁÅ',1995,1995),('ÈÈÔÉÒ',1996,1996),('ÈÈÔžÃ',1991,1991),('ÈÈÔŸÃ',1992,1992),('ÊÊԟѹžØì',2157,2157),('Êè§àÊÃÔÁ',2062,2062),('Êè§ÈÃÕ',2061,2061),('ÊËŸÅ',2159,2159),('ËÍÁšÑ¹·Ãì',2449,2449),('ÊÍÒŽ',2160,2160),('ÊÑÁÄ·žÔì',2170,2170),('ÊÑÁŸÑ¹žì',2169,2169),('ËÑÊÂÒ',2451,2451),('ËÑʹÕ',2450,2450),('ÈÑ¡ÃÔ¹·Ãì',2003,2003),('ÈÑ¡ŽÒ',1997,1997),('ÈÑ¡ŽÔì',1998,1998),('ÈÑ¡ŽÔìàªÇ§',2000,2000),('ÈÑ¡ŽÔìÇÔºÙÅÂì',2002,2002),('ÈÑ¡ŽÔìªÑÂ',1999,1999),('ÈÑ¡ŽÔìŽÒ',2001,2001),('ÊѧÇÒÅÂì',2162,2162),('ÊÑšŸ§Éì',2163,2163),('ÊÑ­ªÑÂ',2165,2165),('ÊÑ­ª¹Ò',2164,2164),('ÊÑ­­Ò',2166,2166),('ÈѹʹÕÂì',2004,2004),('ÊѹµÔ',2167,2167),('ÊѹµÔªÑÂ',2168,2168),('ÊÒÂãš',2176,2176),('ÈÔâÚ¹ì',2030,2030),('ÊÒâÚ¹ì',2188,2188),('ÊÔâÚ¹ì',2228,2228),('ÊÒâê',2189,2189),('ÊÒ¹µì',2181,2181),('ÊÒÁÀŸ',2174,2174),('ÊÓÃÇÁ',2195,2195),('ÊÓÃÇÂ',2196,2196),('ÊÒÂÊÁÃ',2183,2183),('ÈÔÃÉÒ',2007,2007),('ÊÒÂÊØ³Õ',2184,2184),('ÊÒÂÊØ¹ÕÂì',2185,2185),('ÊÒÂѳ',2186,2186),('ÊÒÂѳËì',2187,2187),('ÈÔÃÔ',2009,2009),('ÈÔÃÔÃÑš¹ì',2024,2024),('ÈÔÃÔÃѵ¹ì',2025,2025),('ÊÔÃÔÃѵ¹ì',2223,2223),('ÈÔÁÒÃÕ',2006,2006),('ÈÔÃÔÁÒ',2023,2023),('ÊÔÃÔÁÒ',2222,2222),('ÈÔÃÔâ©Á',2012,2012),('ÊÔÃÔàŽª',2214,2214),('ÊÒÁÒö',2175,2175),('ÈÔÃÔàŸç­',2022,2022),('ÈÔÃÔÇÃó',2027,2027),('ÊÔÃÔÇÃó',2225,2225),('ÊÔÃÔÇѲ¡ì',2226,2226),('ÈÔÃÔÇѲ¹ì',2028,2028),('ÊÔÃÔÇѲ¹Ò',2227,2227),('ÈÔÃÔÈÑ¡ŽÔì',2029,2029),('ÈÔÃÔÅѡɳì',2026,2026),('ÊÔÃÔÅѡɳì',2224,2224),('ÈÔÃÔ¡ØÅ',2010,2010),('ÈÔÃԚѹ·Ãì',2011,2011),('ÈÔÃÔªÑÂ',2013,2013),('ÊÔÃÔªÑÂ',2213,2213),('ÊÓÃÒ­',2197,2197),('ÈÔÃÔ·Ñȹì',2014,2014),('ÈÔÃÔžÃ',2015,2015),('ÊÔÃÔ¹Ãѵ¹ì',2216,2216),('ÈÔÃÔ¹Òö',2017,2017),('ÈÔÃÔ¹­Ò',2016,2016),('ÊÔÃÔ¹ŸÃ',2215,2215),('ÈÔÃԹت',2018,2018),('ÊÔÃÔ»ÃÐÀÒ',2217,2217),('ÈÔÃÒŸÃ',2008,2008),('ÈÔÃÔŸÃ',2020,2020),('ÊÔÃÔŸÃ',2219,2219),('ÈÔÃÔŸÃó',2021,2021),('ÊÔÃÔŸÃó',2220,2220),('ÊÔÃԟѹžì',2221,2221),('ÈÔÃÔŸ§Éì',2019,2019),('ÊÔÃÔŸ§Éì',2218,2218),('ÊÒÂÅÁ',2182,2182),('ÊÒÂä¿¿éÒä·Â-ÂÒ«Ò¡Ô',2180,2180),('ÊÒªÅ',2177,2177),('ÊÓà¹Õ§',2194,2194),('ÊÒ¹·Õ',2178,2178),('ÊÒœ¹',2179,2179),('ÈÔÇÒÀóì',2036,2036),('ÊÕÇÔ¡Ò',2231,2231),('ÊÒÇÔµÃÕ',2192,2192),('ÈÔÇÒŸÃ',2035,2035),('ÊÔÇÅÕ',2229,2229),('ÈÔÇŸÃ',2033,2033),('ÈÔÇŸÅ',2034,2034),('ÈÔÅÒ',2032,2032),('ÊÒÅÕ',2190,2190),('ÊÓÅÕ',2199,2199),('ÊÒÅÕè',2191,2191),('ÈÔÅ»ªÑÂ',2031,2031),('ÊÓÄ·žÔì',2198,2198),('ÊÒ€Ã',2171,2171),('ÊÔ§Ëì',2200,2200),('ÊÔ§ËìŸÅ',2201,2201),('ÊÔ§ËÒ',2202,2202),('ÊԵҹѹ',2203,2203),('ÊÔµÒŸÃ',2204,2204),('ÊÔ·žÒ',2205,2205),('ÊÔ·žÔàŽª',2208,2208),('ÊÔ·žÔì',2206,2206),('ÊÔ·žÔªÑÂ',2207,2207),('ÊÔ·žÔŸÃ',2209,2209),('ÊÔ·žÔŸÃó',2210,2210),('ÊÔ·žÔŸÅ',2211,2211),('ÊÒžÔµ',2172,2172),('ÊÕ¹ÇÅ',2230,2230),('Êӹѡ¹âºÒÂáÅÐጹ¡ÃاෟÁËÒ¹€Ã',2193,2193),('ÊÒ¹ÔµÂì',2173,2173),('ÈÒ¹µÔᏎì',2005,2005),('ÊÔ¹·ÇÕ',2212,2212),('ÊÅÑ¡šÔµÃ',2151,2151),('ÈÅÔÉÒ',1988,1988),('ËÄ·Â',2447,2447),('Ê¡ÒÇÃѵ¹ì',2057,2057),('Ê¡ÅÃѵ¹ì',2056,2056),('È¡ÅÇÃó',1954,1954),('˧',2441,2441),('ʧǹ',2060,2060),('ʧèÒ',2064,2064),('ʧю',2063,2063),('ʧ¡ÃÒ¹µì',2059,2059),('ʧ¡Ã³ì',2058,2058),('ÈšÕ',1955,1955),('ʎѺŸÔ³',2065,2065),('ʶÔÃÂÒ',2068,2068),('ʶҟÃ',2067,2067),('Ë·ÑÂ',2442,2442),('Ë·ÑÂÃѵ¹ì',2444,2444),('Ë·Ñ·ԟÂì',2443,2443),('ʹãš',2069,2069),('ʹͧ',2073,2073),('ʹÑè¹',2074,2074),('ʹԎÒ',2075,2075),('˹Öè§Ä·ÑÂ',2445,2445),('ʹ·ÂÒ',2070,2070),('ʹžÂÒ',2072,2072),('ʹžŸ',2071,2071),('ÈØÀÃ',2042,2042),('ÈØÀÃѵ¹ì',2043,2043),('ÈØÀÃÒÀóì',2044,2044),('ÊØÀÁÒÊ',2329,2329),('ÈØÀÁÔµÃ',2041,2041),('ÊØÃàªÉ°ì',2353,2353),('ÊØÀ⪀',2328,2328),('ÊØÃàŽª',2354,2354),('ÊØàÁž',2348,2348),('ÊØàÁžÕ¡ì',2349,2349),('ÉØÀÁ¹',2053,2053),('ÈØÀÇѲ¹ì',2046,2046),('ÈØÀÇÔ·Âì',2047,2047),('ÈØÀÈÑ¡ŽÔì',2048,2048),('ÊØÃÈÑ¡ŽÔì',2360,2360),('ÊØÃÊÔ·žÔì',2361,2361),('ÊØÀÑ€',2330,2330),('ÊØÃѪ¹Õ¡Ã',2362,2362),('ÊØÀѵÃÒ',2331,2331),('ÊØÃѵÂÒ',2367,2367),('ÊØÃѵ¹ÇŽÕ',2365,2364),('ÊØÃѵ¹ì',2363,2363),('ÊØÃѵ¹ìÇŽÕ',2364,2365),('ÊØÃѵ¹Ò',2366,2366),('ÊØÀÑ·ÃÒ',2332,2332),('ÊØÀÒ',2333,2333),('ÊØÀÒÀóì',2338,2338),('ÊØÃÕÂì',2381,2381),('ÊØÃÕÂìŸÃ',2382,2382),('ÊØÃÕÃѵ¹ì',2383,2383),('ÊØÃÔÂѹ',2375,2375),('ÊØÃÔÂѹµì',2376,2376),('ÊØÃÔÂÒ',2377,2377),('ÊØÃÕÁÒÈ',2380,2380),('ÊØÃÔ§Èì',2371,2371),('ÊØÀÒÃŽÕ',2339,2339),('ÊØÃÔ¹',2372,2372),('ÊØÃÔ¹µì',2373,2373),('ÊØÃÔŸ§Èì',2374,2374),('ÊØÀÒÇŽÕ',2340,2340),('ÈØÀÔÊÃÒ',2049,2049),('ÊØÁÒÊÕ',2345,2345),('ÊØÁÒÅÕ',2344,2344),('ÊØÃÒ§€¹Ò',2368,2368),('ÊØÃÔªÑÂ',2369,2369),('ÊØÀÔ­­Ò',2341,2341),('ÊØÀÒ³Õ',2334,2334),('ÊØÁÔµÃ',2346,2346),('ÊØÁÔµÃÒ',2347,2347),('ÊØÃÕžÒŸÃ',2378,2378),('ÊØÃÔ¹·Ãì',2370,2370),('ÊØÀÒŸ',2335,2335),('ÊØÀÒŸÃ',2336,2336),('ÊØÃÕŸÃ',2379,2379),('ÊØÀÒŸÃó',2337,2337),('ÈØÀÅѡɳì',2045,2045),('ÈØÀ¡Ã',2037,2037),('ÈØÀ¡Ôš',2038,2038),('ÊØÀ¡Ôš',2326,2326),('ÊØÃ¡Ôš',2350,2350),('ÈØÀªÑÂ',2039,2039),('ÊØÃªÑÂ',2351,2351),('ÊØÀªÒ',2327,2327),('ÊØÃªÒµÔ',2352,2352),('ÊØÃ·Ô¹',2355,2355),('ÊØà·Ÿ',2289,2289),('ÊØÁ¹Ò',2343,2343),('ÊØà¹µÃ',2307,2307),('ÊØÁ¹µì',2342,2342),('ÈØÀŸÃ',2040,2040),('ÊØÃŸÑ¹žì',2358,2358),('ÊØÃŸÑ¹žØì',2359,2359),('ÊØÃŸÅ',2357,2357),('ÊØÃŸ§Éì',2356,2356),('ÊØÇÃó',2386,2386),('ÊØÇÃóÒ',2388,2388),('ÊØÇÃóÕ',2389,2389),('ÊØÇÃóÕÂì',2390,2390),('ÊØÇÃóªÑÂ',2387,2387),('ÊØÇÃѵ¹ì',2391,2391),('ÊØÇÀÑ·Ãì',2385,2385),('ÊØÇѲ¹ì',2392,2392),('ÊØÇѲ¹ìªÑÂ',2393,2393),('ÊØÇѲ¹Ò',2394,2394),('ÊØÇѵªÑÂ',2395,2395),('ÊØÇÔÃѪ',2402,2402),('ÊØÇÒÃÕ',2396,2396),('ÊØÇÔÁÅ',2401,2401),('ÊØÇÔªÑÂ',2397,2397),('ÊØÇÔªÒ',2398,2398),('ÊØÇÔŽÒ',2399,2399),('ÊØÇÔ·Âì',2400,2400),('ÊØËÑʪÒ',2404,2404),('ÊØÊÔÃÔ',2403,2403),('ÊØÅÑŽŽÒ',2384,2384),('ÊØ¡ÃÕ',2232,2232),('ÊØ¡Ñ­­Ò',2233,2233),('ÊØ¡Ôš',2235,2235),('ÊØ¡ÔµÔì',2236,2236),('ÊØ¡ÕµÔì',2237,2237),('ÊØ¡Ò¹ŽÒ',2234,2234),('ÊØ¡ØÁÒ',2238,2238),('ÊØ¢',2239,2239),('ÊØ¢ÊÇÑÊŽÔì¡Å¡ÒÃ',2242,2242),('ÊØ¢Êѹµì',2243,2243),('ÊØ¢ÄŽÕ',2241,2241),('ÊØ¢ªÒÂ',2240,2240),('ÊØ¢ØÁ',2244,2244),('ÊØ€¹žì',2245,2245),('ÊØ€¹žÒ',2246,2246),('ÊØšÒÃÕ',2247,2247),('ÊØšÔµ',2248,2248),('ÊØšÔµÃÒ',2250,2250),('ÊØšÔµµÒ',2249,2249),('ÊØšÔ¹ŽÒ',2251,2251),('ÊØšÔ¹µì',2252,2252),('ÊØšÔ¹µ¹ì',2253,2253),('ÊØªÑÂ',2255,2255),('ÊØªÒÂ',2258,2258),('ÊØªÒÊÔ¹Õ',2259,2259),('ÊØªÒŽÒ',2256,2256),('ÊØªÔµ',2260,2260),('ÊØªÒµÔ',2257,2257),('ÊØªÔ¹',2261,2261),('ÊØªÅ',2254,2254),('ÊØ±ÒÁÒÈ',2262,2262),('ÊØ³Õ',2263,2263),('ÊØŽÊÇÒ·',2265,2265),('ÊØŽÊ§Ç¹',2264,2264),('ÊØŽÒ',2266,2266),('ÊØŽÒÃѵ¹ì',2270,2270),('ÊØŽÒÀÒ',2269,2269),('ÊØŽÒÃÒ',2271,2271),('ÊØŽÕàŸé¹·ìà«ç¹àµÍÃì',2272,2272),('ÊØŽÒªÅÕ',2267,2267),('ÊØŽÒŸÃ',2268,2268),('ÊØ·ÃÕ',2282,2282),('ÊØ·ÑÈ',2283,2283),('ÊØ·Ñȹì',2284,2284),('ÊØ·ÔÈÒ',2288,2288),('ÊØ·ÔµÂì',2285,2285),('ÊØ·Ô¹',2286,2286),('ÊØ·ÔŸÒ',2287,2287),('ÊØ·žÔÇѲ¹ì',2280,2280),('ÊØ·žÔÈÑ¡ŽÔì',2281,2281),('ÊØ·žÔ쟧Éì',2278,2278),('ÊØ·žÔ¡Òš',2274,2274),('ÊØ·žÔªÑÂ',2275,2275),('ÊØ·žÒ·ÔŸÂì',2273,2273),('ÊØ·žÔ¹Ñ¹·ì',2276,2276),('ÊØ·žÔ¹Õ',2277,2277),('ÊØ·žÔŸÃó',2279,2279),('ÊØžÕ',2294,2294),('ÊØžÕÃì',2295,2295),('ÊØžÕÃÒ',2296,2296),('ÊØžÔÈÑ¡ŽÔì',2293,2293),('ÊØžÔŽÒ',2292,2292),('ÊØžÒ·ÔŸÂì',2290,2290),('ÊØžÒ¹ÔžÔ',2291,2291),('ÊØ¹Ñ··Õ',2299,2299),('ÊØ¹Ñ¹·ì',2300,2300),('ÊØ¹Ñ¹·Ò',2301,2301),('ÊØ¹ÕÂì',2306,2306),('ÊØ¹ÔÈÒ',2303,2303),('ÊØ¹ÔÉÒ',2304,2304),('ÊØ¹ÔÊÒ',2305,2305),('ÊØ¹ÔµÒ',2302,2302),('ÊØ¹·Ã',2297,2297),('ÊØ¹·ÃÕ',2298,2298),('ÊØ»ÃÐÇÕ³ì',2309,2309),('ÊØ»ÃÐŽÔɰì',2308,2308),('ÊØ»ÃÕÃÐŽÒ',2312,2312),('ÊØ»ÃÕÂÒ',2311,2311),('ÊØ»ÃÒ³Õ',2310,2310),('ÊØ»Ñ­­Ò',2313,2313),('ÊØŸÃ',2316,2316),('ÊØŸÃÃÉÒ',2318,2318),('ÊØŸÃóÕ',2317,2317),('ÊØŸÑ²¹ì',2320,2320),('ÊØŸÑµÃÒ',2321,2321),('ÊØŸÕÃìªÑÂ',2325,2325),('ÊØŸÔÈ',2324,2324),('ÊØŸÔª­ìª­Ò',2322,2322),('ÊØŸÔ¹',2323,2323),('ÊØŸÅ',2319,2319),('ÊØŸšÁÒÅÂì',2315,2315),('ÊØŸš¹ì',2314,2314),('GEORGE',21,21),('Í.àšÃÔ­ÎÒÃìŽáÇÃì',2457,2457),('ÍÁÃÃѵ¹ì',2515,2515),('ÍÁÃà·Ÿ',2514,2514),('ÍÁÃÈÑ¡ŽÔì',2516,2516),('ÍÁÃÊÔÃÔ',2517,2517),('ÍÃÀÑ·Ãì',2534,2534),('ÍÁÃÒÅѡɳì',2518,2518),('ÍÃÊÂì',2535,2535),('ÍÁêÑÂ',2513,2513),('ÍÃóŸ',2536,2536),('ÍÃöÊÔ·žÔì',2540,2540),('ÍÃöŸÃ',2538,2538),('ÍÃöŸÅ',2539,2539),('ÍÃöŸ¹žì',2537,2537),('ÍÃ๵Ã',2530,2530),('ÍÃÇÃó',2542,2542),('ÍÃÇÔ· ÍÔ¹àµÍÃì๪Ñè¹á¹Å',2543,2543),('ÍÃÈÁ',2544,2544),('ÍÃÈÃÕ',2545,2545),('ÍÃÊÒ',2546,2546),('ÍÃèÒÁÈÃÕ',2551,2551),('ÍÃ͹§€ì',2547,2547),('ÍÃÍØÁÒ',2548,2548),('ÍÃÑ­',2549,2549),('ÍÃÑ­­Ò',2550,2550),('ÍÀѹµÃÕÊì',2496,2496),('ÍÀÔÃÑ¡Éì',2507,2507),('ÍÃÔÂÒ',2555,2555),('ÍÃÔÂÒÀóì',2556,2556),('ÍÀÔÀÒŽÒ',2505,2505),('ÍÀÔવ',2501,2501),('ÍÀÔÃŽÕ',2506,2506),('ÍÀÔàŽª',2503,2503),('ÍÀÔÇѲ¹ì',2508,2508),('ÍÀÔÇѹ·ì',2509,2509),('ÍÀÔÊÃ',2511,2511),('ÍÃÔÈÃÒ',2557,2557),('ÍÃÔÊÃÒ',2558,2558),('ÍÀÔÈÑ¡ŽÔì',2510,2510),('ÍÃÔÊÒ',2559,2559),('ÍÀÔÊÔ·žÔì',2512,2512),('ÍÀÔªÑÂ',2497,2497),('ÍÃÔªÑÂ',2552,2552),('ÍÀÔªÒ µÔ',2498,2498),('ÍÀÔªÒµ',2499,2499),('ÍÀÔªÒµÔ',2500,2500),('ÍÀÔ­­Ò',2502,2502),('ÍÁÔµÒ',2519,2519),('ÍÀԹѹ·ì',2504,2504),('ÍÃÔ¹ª¹Ò',2553,2553),('ÍÁÔ¹µÒ',2520,2520),('ÍÃÔ¹·ÁÒ',2554,2554),('ÍÃÄŽÕ',2541,2541),('ÍÚÔÃÒ',2522,2522),('ÍêÃ',2523,2523),('ÍêسËì',2524,2524),('Íóѭªì',2525,2525),('Íâ³·ÂÒ',2459,2459),('Í÷ÑÂ',2526,2526),('Í÷ԪÒ',2527,2527),('ÍùԵÂì',2528,2528),('Í⹪Ò',2495,2495),('Íùت',2529,2529),('ÍßÃó',2531,2531),('ÍßԹ',2532,2532),('ÍßԹ·Ãì',2533,2533),('ÍÃØ³',2560,2560),('ÍÃØ³Ãѵ¹ì',2561,2561),('ÍÃØ³ÃØè§',2562,2562),('ÍÃØ³ÈÃÕ',2563,2563),('ÍÃØ³Õ',2564,2564),('ÍÂØžÂѹ',2521,2521),('ÍǪÑÂ',2567,2567),('ÍÐÅÒ¹',2574,2574),('ÍЀÙà·ç€·ì',2573,2573),('ÍéÍ·ԟÂì',2571,2571),('ÍéÒÂÍÔé§',2612,2612),('ÍÍâµàÁªÑè¹à«ÍÃìÇÔÊ',2570,2570),('ÍÍÊ·ì ÍÍÂÊì',2572,2572),('ÎÍÊ·ì ÍÍÂÅì',2723,2723),('ÍÍ€µéÒ àÁÁâÁàÃÕÂÅ',2568,2568),('ÍÍ€µéÒàÁÁâÁàÃÕÂÅ',2569,2569),('ÍÑÁäŸÇÃó',2594,2594),('ÍÑÁŸÃ',2592,2592),('ÍÑÁŸÃó',2593,2593),('ÍÑ€ÃàŽª',2575,2575),('ÍÑ€ÃÇÔ·Âì',2578,2578),('ÍÑ€ÃÇÔ¹·ì',2579,2579),('ÍÑ€ÃÒ',2580,2580),('Íрßњ¹ì',2577,2577),('Íрß¹žì',2576,2576),('ÍѧʹÒ',2581,2581),('ÍÑš©ÃÒ',2582,2582),('ÍѪÂÒ',2583,2583),('ÍÑ­ªÅÕ',2587,2587),('ÍÑ­ª³ÒŸÃ',2584,2584),('ÍÑ­ªŽÒ',2585,2585),('ÍÑ­ª¹Ò',2586,2586),('ÍÑ­ªØÅÕ',2588,2588),('ÍÑ®ÉÁÒ',2589,2589),('ÍѹÊÃÕÂì',2590,2590),('ÍÑ»ÊÃ',2591,2591),('ÍÒÃÂѹ',2616,2616),('ÍÒÃÂÒ',2617,2617),('ÍÔÁâ¡éáŸç€ €ÍÃì»ÍÃìàêÑè¹',2641,2641),('ÍÒÀóì',2606,2606),('ÍÒÃÁ³ì',2615,2615),('ÍÒÃì«Õ ¹ÔµáÇÃì',2613,2613),('ÍÒÃì«Ø»à»ÍÃì⫹ԀŸÔ€ÍÑŸÊì',2614,2614),('ÍÒÃÑ¡Éì',2618,2618),('ÍÒÀÒ',2607,2607),('ÍÒÃÕ',2621,2621),('ÍÓÀÒ',2633,2633),('ÍÒÀÒÀóì',2611,2611),('ÍÒÃÕÂì',2622,2622),('ÍÒÃÕÂì àÊÁÒ©ÔÁ (ä·Âູ¡Ñ¹',2623,2623),('ÍÒÃÕÃѵ¹ì',2624,2624),('ÍÒÃÔÂÒ',2620,2620),('ÍÒÃÕÇÃó',2625,2625),('ÍÒÀÒ¡Ã',2608,2608),('ÍÒÀÒ³Õ',2609,2609),('ÍÒÀÒŸÃ',2610,2610),('ÍÒÃÒŸÃ',2619,2619),('ÍÔÈÃÒ',2642,2642),('ÍÔê¡«èÒ ÍÔ¹àµÍÃì๪Ñè¹á¹Åàš¹à¹ÃÑÅ à«ÅÅì',2634,2634),('ÍÓäŸ',2632,2632),('ÍÒ€Á',2595,2595),('ÍÔ§Ë·ÑÂ',2635,2635),('ÍÒš³Ã§€ì',2596,2596),('ÍÒ«ÒÎÕ-ä·Â ÍÑÅÅÍÂ',2597,2597),('ÍҳѹÂì',2598,2598),('ÍÒ·Ô¡Ã',2599,2599),('ÍÕ·Õ«Õ',2643,2643),('ÍÒ·Ôµ',2600,2600),('ÍÔ·žÔŸÅ',2636,2636),('ÍÔ¹àµÍÃìàÇç·(»ÃÐà·Èä·Â)',2638,2638),('ÍÓ¹ÇÂ',2626,2626),('Íҹю',2603,2603),('ÍҹѹµÂÒ',2604,2604),('ÍÓ¹Òš',2627,2627),('ÍԹ䫷ìà€Á',2637,2637),('ÍÔ¹·ÔÃÒ',2639,2639),('ÍÒ¹¹·ì',2601,2601),('ÍÒ¹Ÿ',2602,2602),('ÍÒ¹ØÀÒŸ',2605,2605),('ÍÔŸ',2640,2640),('ÍÓŸÃ',2628,2628),('ÍÓŸÃó',2629,2629),('Íӟѹžì',2631,2631),('ÍÓŸÅ',2630,2630),('ÎÙàÇÍÃìÍØµÊÒË¡ÃÃÁ(»ÃÐà·Èä·Â)',2724,2724),('Íŧ¡Ã³ì',2566,2566),('Íŧ¡µ',2565,2565),('ͧÍÒš',2458,2458),('ÍŽÔàá',2460,2460),('ÍŽÔÈÃ',2461,2461),('ÍŽÔÈÑ¡ŽÔì',2462,2462),('ÍŽØÅ',2463,2463),('ÍŽØÅÂìàŽª',2465,2465),('ÍŽØÅŸÑ²¹ì',2464,2464),('͵Թت',2466,2466),('͵ԟÃ',2467,2467),('ͶԪÒ',2468,2468),('ÍžÔ»ŸÅ',2469,2469),('͹ÇѪ',2473,2473),('͹ѭ­Ò',2474,2474),('͹ѹµÈÑ¡ŽÔì',2476,2476),('͹ѹµì',2475,2475),('͹§€ìÇÃó',2471,2471),('͹§€ì¹Ò®',2470,2470),('͹¹·ì',2472,2472),('͹ØÃÑÉì',2491,2491),('͹ØÃÑ¡Éì',2489,2489),('͹ØÃѵ¹ì',2490,2490),('͹ØÇѲ¹ì',2492,2492),('͹ØÊóì',2494,2494),('͹ØÈÑ¡ŽÔì',2493,2493),('͹ءԵÔ',2477,2477),('͹ءÙÅ',2478,2478),('͹تÒ',2479,2479),('͹تԵ',2480,2480),('͹؎Ò',2481,2481),('͹صÃ',2483,2483),('͹صµÃÒ',2482,2482),('͹طԵÒ',2484,2484),('͹؟Ã',2487,2487),('͹؟ѹžì',2488,2488),('͹؟§Èì',2485,2485),('͹؟§Éì',2486,2486),('ÍØÁÒ',2665,2665),('ÍØÃÕÂì',2667,2667),('ÍØÁÒŸÃ',2666,2666),('ÍØà·¹·Ãì',2660,2660),('ÍØÉÒ',2673,2673),('ÍØÊÒËì',2674,2674),('ÍØè§á€Ð',2644,2644),('ÍØÉ³Õ',2672,2672),('ÍØè¹ãš',2661,2661),('ÍØÌÒÃ',2675,2675),('ÍØäÃ',2668,2668),('ÍØäÃÃѵ¹ì',2670,2670),('ÍØäÃÇÃó',2671,2671),('ÍØäßÃ',2669,2669),('ÍØ³ÒÇŽÕ',2645,2645),('ÍØŽÁ',2646,2646),('ÍØŽÃ',2654,2654),('ÍØŽÁàÁŽÔ€ÍÅ ÍÔ€ÇÔ»àÁé¹',2650,2650),('ÍØŽÁÇßѹžì',2652,2652),('ÍØŽÁÈÑ¡ŽÔì',2653,2653),('ÍØŽÁÅѡɳì',2651,2651),('ÍØŽÁŸÃ',2648,2648),('ÍØŽÁŸÑ¹žì',2649,2649),('ÍØŽÁŸ§Èì',2647,2647),('ÍØµâÁ·Âì',2655,2655),('ÍØµÊÒË¡ÃÃÁŒéÒà€Å×ͺŸÅÒʵԡä·Â',2656,2656),('ÍØ·ÑÂ',2657,2657),('ÍØ·ÑÂÇÃó',2658,2658),('ÍØ·ØÁŸÃ',2659,2659),('ÍØºÅ',2662,2662),('ÍØºÅÇÃó',2664,2664),('ÍØºÅŸÃó',2663,2663),('KAWAIJIT',22,22),('KAWALJIT',23,23),('KOJI',24,24),('LOUIS',25,25),('PETER',26,26),('SHERMAN',27,27),('TAN',28,28),('Willem Arnold',29,29),('WONG',30,30),('WU',31,31),('ÅÐÁèÍÁ',1718,1718),('ÅÐàÍÕÂŽ',1721,1721),('ÅÐÁÑÂ',1719,1719),('ÅÐÍͧŽÒÇ',1720,1720),('ÅÑ¡ÉÁÕ',1724,1724),('ÅѡɳÒ',1723,1723),('ÅÑ¡¢³Ò',1722,1722),('ÅÑ­ª¹Ò',1725,1725),('ÅÑŽŽÒ',1726,1726),('ÅÑŽŽÒÇÃó',1727,1727),('ÅÑŽŽÒÇÑÅÂì',1728,1728),('ÅÑ·žÈÑ¡ŽÔì',1729,1729),('ÅÔÁ',1734,1734),('ÅÒÇѳÂì',1730,1730),('ÅÔÅÒÀóì',1735,1735),('ÅÓäÂ',1732,1732),('ÅÓäŸ',1731,1731),('ÅÔ¹ŽÒÇÃó',1733,1733),('ÅÅÔŽÒ',1716,1716),('ÅÅÔµÒ',1717,1717),('Å×ͪÑÂ',1736,1736),('äÁµÃÕ',1596,1596),('äÇ·Ô¹',1953,1953),('äÍ.àÍÊ.äÍ.ÍÔ¹àµÍÃì๪Ñè¹á¹Å',2721,2721),('äÍ.«Õ.«Õ.ÍÔ¹àµÍÃì๪Ñè¹á¹Å (ÁËÒª¹)',2718,2718),('äÍ.·Õ.áÍŽìÇÒ¹« à·€ šÓ¡ÑŽ',2719,2719),('äÍ.·Õ.á͹ŽìÇÒ¹« à·€ šÓ¡ÑŽ',2720,2720),('äÍÂàÃÈ',2722,2722),('ä¡Ãà·Ÿ',215,215),('ä¡Ã€Ó',214,214),('ä¡ÃžÇѪ',216,216),('äªÂÃѵ¹ì',575,575),('äªÂÁ§€Å',574,574),('äªÂÒ',576,576),('äªÂ¹Ñ¹·¹ì',573,573),('äŽÍСÅêÒÊ',709,709),('äµÃç€ì',726,726),('äµÃà·Ÿ',725,725),('äµÃ·È',724,724),('ä·Â',805,805),('ä·Â €Í¹Êì á͹Žì ºÔÅŽÔé§',806,806),('ä·Â ŽÕ à͹ ·Õ àŸ¹·ì',807,807),('ä·Â-àÍà«Õ ŸÕ.ÍÕ.äŸéŸì',824,808),('ä·ÂàÇÅ€Í¹ÍØµÊÒ¡ÃÃÁ',821,822),('ä·ÂÂÙà¹Õ¹€ÇÍÅÅÔµÕé',820,821),('ä·Âà¡ÃÕ§ÊÔè§·Í',808,809),('ä·Âà€ÁÕÀѳ±ì',810,811),('ä·Âà«çÅ·ÃÑÅà€ÁÕ ª¹)',813,814),('ä·Âà«ç¹·ÃÑÅ à€ÁÕ ª¹)',811,812),('ä·Âà«ç¹·ÃÑÅà€ÁÕ',812,813),('ä·ÂàŸÔèÁŸÅÒʵԡ',819,820),('ä·ÂÍÔ¹àµÍÃì ÍÐâÃàÁµÔ¡Êì',823,824),('ä·ÂÍÔ¹àµÍÃì €ÍµµÍ¹¡Ò÷Í',822,823),('ä·Â€Òà«ÎÔ¹',809,810),('ä·ÂŽÕà͹·ÕàŸ¹·ì',814,815),('ä·Âµ§¹ÔµµÔé§',815,816),('ä·ÂžÒ¹Õà€ÁÕ',817,818),('ä·Âž¹ÒŸÒ³ÔªÂì',816,817),('ä·ÂŸÃçÍ¡«ì',818,819),('Ä·žÔì',1714,1714),('Ä·žÔªÑÂ',1715,1715),('䌷',1292,1292),('äŸàÃÒÐ',1485,1485),('äŸâÚ¹ì',1486,1486),('äŸÃÊÔ·žÔì',1481,1481),('äŸÃʳ±ì',1480,1480),('äŸÃѪ',1482,1482),('äŸÃѵ¹ì',1483,1483),('äŸÃÔ¹·Ãì',1484,1484),('äŸÃÄ·žÔì',1479,1479),('äŸÇÑÅÂì',1488,1488),('äŸÈÔÃÔ',1490,1490),('äŸÈÒÅ',1489,1489),('äŸÊÔ°',1491,1491),('äŸÅÔ¹',1487,1487),('䟱ÙÃÂì',1477,1477),('䟺ÙÅÂì',1478,1478),('¡.µÃÕ·ÔŸÂì €Í¹«ÑÅáµ¹·ì',32,32),('¡ÃíԡÒÃì',65,65),('¡ÃóԡÒ',66,66),('¡ÃóԡÒÃì',67,67),('¡ÃÇÔ·Âì',69,69),('¡ÃÇÅÑÂ',68,68),('¡ÃК¡ä·ÂÍÒ«ÒÎÕ',72,72),('¡Ãͧá¡éÇ',70,70),('¡Ãͧ·ÔŸÂì',71,71),('¡ÃÕ±Ò',73,73),('¡ÁÅ',49,49),('¡ÁÅÃѪµì',55,55),('¡ÁÅÃѵ¹ì',56,56),('¡ÁÅÁÒÅÂì',54,54),('¡ÁÅÇÃó',57,57),('¡ÁũѵÃ',50,50),('¡ÁÅ·ÔŸÂì',51,51),('¡ÁÅŸÃ',52,52),('¡ÁÅŸÃó',53,53),('¡Ã¡ÁÅ',60,60),('¡Ã¡¹¡',58,58),('¡Ã¡ŸÃ',59,59),('¡ÃªÑÂ',61,61),('¡Ã³ì',62,62),('¡Ã¹Ñ¹·ì',63,63),('¡Ã»ÃÕÂÒ',64,64),('¡ÃاෟŒÅÔµàËÅç¡',74,74),('¡Ãاä·ÂÍØ»¡Ã³ì',76,76),('¡Ãاä·Â€ÒÃìàÃé¹·ì ÍÔ¹àµÍÃì๪Ñè¹á¹Å',75,75),('¡ÃسÒ',77,77),('¡ÇÕ',93,93),('¡ÉÁÒ',94,94),('¡èÍà¡ÕÂõÔ',98,98),('¡ÊÔÇѹ',97,97),('¡ÉÔª­ì',95,95),('¡ÉÔŽÔÈ',96,96),('¡Íºá¡éÇ',100,100),('¡ÍºÅÒÀ',102,102),('¡Íº¡ØÅ',99,99),('¡ÍººØ­',101,101),('¡Ñ ÅÂÒ',103,103),('¡ÑÁ»¹Ò¶',117,117),('¡ÑÁ»¹Ò·',118,118),('¡ÑÅÂÒ',119,119),('¡ÑÅÂÒÃѵ¹ì',121,121),('¡ÑÅÂÒ³Õ',120,120),('¡Ñ­ªŸÃ',104,104),('¡Ñ­­ÀÑ€',105,105),('¡Ñ­­ìÇÃÒ',106,106),('¡Ñ­­ÒÁÒÈ',107,107),('¡Ñ­­ÒÇÕÃì',108,108),('¡Ñ³°Ô¡Ò',110,110),('¡Ñ³°ªÒ',109,109),('¡Ñ³·ÔÁÒ',111,111),('¡Ñ¹ÂÒÃѵ¹ì',116,116),('¡Ñ¹µì',112,112),('¡Ñ¹µÔ¡Ã',113,113),('¡Ñ¹žÔÁÒ',115,115),('¡Ñ¹žÔªÒ',114,114),('¡ÒÃÇÔÍÃ',128,128),('¡ÒÂÊÔ·žÔì',127,127),('¡Óá˧',134,134),('¡ÔÁÅÑé§',157,157),('¡ÕõÔ',158,158),('¡ÒÃØ³Õ',129,129),('¡ÒÈÔ',130,130),('¡Ôè§¡Ò­š¹ì',135,135),('¡ÓäÃ',133,133),('¡ÔšÇÃó',137,137),('¡ÔšµÔÂÒ',136,136),('¡Ò­š¹ÇÃó',122,122),('¡Ò­š¹Ò',123,123),('¡ÔµÔ¡Ã',153,153),('¡ÔµÔ¡Ã³ì',154,154),('¡ÔµÔ¡Ñ­­Ò',155,155),('¡ÔµÔªÒ­',156,156),('¡ÔµµÔ',138,138),('¡ÔµµÔÃѵ¹ì',150,150),('¡ÔµµÔÁÒ',148,148),('¡ÔµµÔÂÒ',149,149),('¡ÔµµÔÇѲ¹ì',151,151),('¡ÔµµÔÈÑ¡ŽÔì',152,152),('¡ÔµµÔ¡Ñ¹µì',139,139),('¡ÔµµÔªÑÂ',140,140),('¡ÔµµÔ­Ò',141,141),('¡ÔµµÔ¹Ñ¹·ì',142,142),('¡ÔµµÔŸÑ²¹ì',146,146),('¡ÔµµÔŸÑ¹žì',147,147),('¡ÔµµÔŸÅ',145,145),('¡ÔµµÔŸ§Èì',143,143),('¡ÔµµÔŸ§Éì',144,144),('¡ÓžÃ',131,131),('¡Ò¹ŽÒ',124,124),('¡Ò¹µì',125,125),('¡Ò¹µìÃÇÕ',126,126),('¡ÓŸÅ',132,132),('¡ÙêŽÇÔÅ ÍÔ¹ŽÑʵÃÕé',169,169),('¡ÄÉ®Ò',84,84),('¡ÄÉ®Õ',85,85),('¡Äɮ՟Ã',86,86),('¡ÄɳÐ',89,89),('¡ÄɳÒ',90,90),('¡ÄɳÕ',91,91),('¡ÄɳŸÅ',88,88),('¡ÄɳŸš¹ì',87,87),('¡ÄÉŽÒ',92,92),('¡ÄÈŸÃó',83,83),('¡ÄªÇÃó',78,78),('¡ÄµÂÒ',80,80),('¡ÄµÔÂÒ',82,82),('¡ÄµÔ¡Ò¹·ì',81,81),('¡ÄµºŸÔž',79,79),('¡ªÁÅ',35,35),('¡ª¡Ã',33,33),('¡ªŸÃ',34,34),('¡µÑ­­Ù',36,36),('¡¹ÔɰÒ',48,48),('¡¹¡',37,37),('¡¹¡Ãѵ¹ì',43,43),('¡¹¡ÇÃó',45,45),('¡¹¡ÈÃÕ',46,46),('¡¹¡Ò­š¹ì',47,47),('¡¹¡Ä·žÔì',44,44),('¡¹¡¡Ò­š¹ì',38,38),('¡¹¡ªÑÂ',39,39),('¡¹¡¹ÔÀÒ',40,40),('¡¹¡¹Øª',41,41),('¡¹¡ŸÃ',42,42),('¡ØÁØ·ŸÑ¹žì',159,159),('¡ØéÂà«é§ ÍÔÁ»ÍÃìµ á͹Žì àÍç¡«ì»ÍÃìµ',160,160),('¡ØËÅÒº',168,168),('¡ØÊØÁÒ',167,167),('¡ØÅÂÒ',163,163),('¡ØÅÇŽÕ',165,165),('¡ØÅÈÔÃÔ',166,166),('¡ØÅÅŽÒ',164,164),('¡ØÅ¹Ñ¹·ì',161,161),('¡ØÅ¹ÒÃÕ',162,162),('¢ÇÑ­àÁ×èͧ',228,228),('¢ÇÑ­àÃ×͹',231,231),('¢ÇÑ­ãš',223,223),('¢ÇÑ­àŽ×͹',225,225),('¢ÇÑ­àŸçªÃ',227,227),('¢ÇÑ­ÃØé§',230,230),('¢ÇÑ­ÂØŸÒ',229,229),('¢ÇÑ­ªÑÂ',224,224),('¢ÇÑ­µÒ',226,226),('¢éÒÇÍÔèÁ·ÔŸÂì',233,233),('¢ÑµµÔÂÒ³Õ',232,232),('¢šÃ',217,217),('¢šÃà¡ÕÂõÔ',218,218),('¢šÃÈÃÕ',219,219),('¢šÃÈÑ¡ŽÔì',220,220),('¢¹Ôɰì',221,221),('¢¹ÔɰÒ',222,222),('¢Ø¹·Í§',234,234),('€ÁàŸçªÃ',249,249),('€ÃÒ¿·ìàŽÍÐàºÊ·ì',250,250),('€Á¡ÃÔª',247,247),('€ÁšÑ¡Ã',248,248),('€àª¹·Ãì',238,238),('€à³È',244,244),('€à¹Âì',246,246),('€ÍÊÁÔ€ €Í¹€ÍÃìŽ €ÍÃì»ÍàêÑè¹',251,251),('€ÔÁ§€ì',257,257),('€Óá˧',256,256),('€ÒÃìâ»Ãà¿ÊªÑè¹á¹Å',253,253),('€Óó',255,255),('€ÒÇÒ€Ô¹',254,254),('€Ò«ÙâÍÐ',252,252),('€ÙèºØ­',260,260),('€Ù»Ò¹Ò',261,261),('€§àŽª',237,237),('€§¡ÄÈ',236,236),('€³ÒÇØ²Ô',240,240),('€³ÔÈÃ',241,241),('€³ÔÊÃ',242,242),('€³Ò¡Ã',239,239),('€³ØµÁì',243,243),('€žÒ',245,245),('€Ø³Ò¡Ã',258,258),('€Ø³Õ·Ã',259,259),('§ÒÁàŸç­',273,273),('§ÒÁ¹Ôš',272,272),('šàÃ',298,298),('šÃÃÂÒ',285,285),('šàÃÈÑ¡ŽÔì',299,299),('šÃÇÃÞ¹ì',287,287),('šÃÇŸÃ',286,286),('šÃÑʪÑÂ',290,290),('šÃÑÊŸÅ',291,291),('šÃÑÅ',289,289),('šÃÑ­',288,288),('šÃÔÂÒ',294,294),('šÃÔÂÒÀóì',295,295),('šÃÔ¹·Ãì',292,292),('šÃÔ¹žÃ',293,293),('šÃÙ­',297,297),('šÃØžÔŽÒ',296,296),('šÍÁ¢ÇÑ­ãš',300,300),('šÑ¡ÃÇÒÅ',304,304),('šÑ¡Ãѵ¹ì',305,305),('šÑ¡ÃÕ',307,307),('šÑ¡ÃÔ¹·Ãì',306,306),('šÑ¡Ã¡Äɳì',302,302),('šÑ¡Ã¡Äª',301,301),('šÑ¡ÃŸÑ¹žì',303,303),('šÑ¡ÉÇѯ',308,308),('šÑŽËÒ§Ò¹ÎÔÇáÁ¹àÍ繚Ôà¹ÕÂÃÔè§',309,309),('šÑµÃŽÒÇ',310,310),('šÑ¹šÔÃÒ',311,311),('šÑ¹·Ã',314,314),('šÑ¹·ÃìÃѵ¹ì',321,321),('šÑ¹·ÃìàšéÒ',315,315),('šÑ¹·ÃìàŸç­',320,320),('šÑ¹·ÃìÇÔÁÅ',322,322),('šÑ¹·ÃìÇÔäÅ',323,323),('šÑ¹·ÃìÊØŽÒ',324,324),('šÑ¹·Ãì·ÔŸÂì',316,316),('šÑ¹·ÃìžÔÀÒ',317,317),('šÑ¹·Ãì¹ÀÒ',318,318),('šÑ¹·ÃìŸÃ',319,319),('šÑ¹·ÔÀÒ',326,326),('šÑ¹·ÔÁÒ',327,327),('šÑ¹·ÔÃÒ',329,329),('šÑ¹·ÔÁÒÀóì',328,328),('šÑ¹·Ô¡Ò',325,325),('šÑ¹··Õ',312,312),('šÑ¹·¹Ò',313,313),('šÔÃÀÑ·Ã',361,361),('šÔÃÀÒ',362,362),('šÓàÃÔ­',344,344),('šÔÃÇÃó',363,363),('šÔÃÇѲ¹ì',364,364),('šÔÃÐÀÒ',369,369),('šÕÃÐÇѲ¹ì',386,386),('šÔÃÐÈÑ¡ŽÔì',370,370),('šÕÃйѹ·ì',385,385),('šÔÃПÃ',367,367),('šÔÃПÃó',368,368),('šÔÃÈÑ¡ŽÔì',365,365),('šÕÃÈÑ¡ŽÔì',384,384),('šÔÃÊØŽÒ',366,366),('šÕâÍà·€¹Ô€ (ä·ÂᏎì)',388,388),('šÓÃÑÊ',343,343),('šÔÃѪŽÒ',371,371),('šÔÃѰµÔì',372,372),('šÔÃÒÀóì',376,376),('šÒÃÕÃѵ¹ì',333,333),('šÔÃÒÀÒ',377,377),('šÔÃÒÂØ',378,378),('šÔÃÒÇÃó',379,379),('šÔÃÒÇÑÅÂì',380,380),('šÔÃÒÇØ²Ô',381,381),('šÔÃÒ€Á',373,373),('šÔÃҹت',374,374),('šÔÃÒŸÃ',375,375),('šÔßÃ',359,359),('šÕßÃó',383,383),('šÔßѹžì',360,360),('šÒÃØÃѵ¹ì',338,338),('šÒÃØÇÃó',339,339),('šÒÃØ³Õ',334,334),('šÒÃØ³ÕÂì',335,335),('šÒÃØ¹Ñ¹',336,336),('šÒÃØºØµÃ',337,337),('šÕÍÕ á€»»ÔµÍÅ (»ÃÐà·Èä·Â)',387,387),('šÓÅͧ',345,345),('šÔ³³ì',346,346),('šÔµÃÒ',354,354),('šÔµÃÒÀóì',355,355),('šÔµÃÅŽÒ',353,353),('šÔµµÁÒÊ',349,349),('šÔµµì',347,347),('šÔµµì¹ÔÉÒ',348,348),('šÔµµÒ',350,350),('šÔµµÔ',351,351),('šÔµµÔ¹¹Ñ¹·ì',352,352),('šÒµØÃ§€ì',331,331),('šÒµØÃ¹µì',332,332),('šÒµØŸÃ',330,330),('šÕ·Õ«Õ ·Ã§ŸÑ¹žì)',382,382),('šÓ¹§',340,340),('šÓ¹§€ì',341,341),('šÔ¹ŽÒ',356,356),('šÔ¹µìšØ±Ò',357,357),('šÔ¹µ¹Ò',358,358),('šÓ»Õ',342,342),('š§ÃÑ¡',277,277),('š§ÃÑ¡Éì',278,278),('š§Åѡɳì',279,279),('š§¡Å',275,275),('š§¡Å³Õ',276,276),('šµØÃ§€ì',283,283),('šµØÄ·žÔì',284,284),('šµØŸÃ',280,280),('šµØŸÑ¹žì',282,282),('šµØŸÅ',281,281),('šØÃÕÃѵ¹ì',395,395),('šØÌÒ',397,397),('šØÌÒÀóì',398,398),('šØÌÒÀÒ',399,399),('šØÌÒÅѡɳì',400,400),('šØÅÅŽÒ',396,396),('šØ±ÒÃѵ¹ì',393,393),('šØ±ÒÁÒÈ',391,391),('šØ±ÒÁÒÊ',392,392),('šØ±ÒÇÃó',394,394),('šØ±Ò·ÔŸÂì',389,389),('šØ±ÒŸÑ¹žì',390,390),('©ÇÕÇÃó',419,419),('©Íé͹',420,420),('©ÑµÃÀóì',422,422),('©ÑµÃÈÔÃÔ',423,423),('©ÑµÃªÑÂ',421,421),('©Ñ¹·Ãѵ¹ì',425,425),('©Ñ¹·¹Ò',424,424),('©ÅÇÂ',416,416),('©Åͧ',417,417),('©ÅÒŽ',418,418),('©×èÍ šÔé¹ ÎÑéÇ',426,426),('©×èÍšÔé¹ÎÑéÇ',427,427),('ª.ÊÂÒÁšÑ¡ÃÂÒ¹àŽç¡àÅè¹',437,437),('ªÁ',450,450),('ªÁÀÑÊÊÃ',454,454),('ªÁÀٹت',455,455),('ªÁÑŸÃ',456,456),('ªÃÑÊÃÒ',463,463),('ªÃѪÊÃÒ',461,461),('ªÃѶšÑ¹·Ãì',462,462),('ªÂÒÀóì',460,460),('ªÃÔ¹Ãѵ¹ì',465,465),('ªÃÔ¹·Ãì',464,464),('ªÂÒŸÅ',459,459),('ªÂ¹',458,458),('ªÁŸÙ¹Øª',452,452),('ªÁŸÙ¹Ø·',453,453),('ªÁŸÅ',451,451),('ªÇÔÈÒ',479,479),('ªÇÅÔµ',478,478),('ªÇ¹',475,475),('ªÇ¹ªÁ',476,476),('ªÇ¹ŸÔÈ',477,477),('ªÐÍé͹',485,485),('ªÐ¹ÔÅ',484,484),('ªèÍ',480,480),('ªèÍÍÑ­ªÑ­',483,483),('ªèͩѵÃ',481,481),('ªèÍ·ÔŸÂì',482,482),('ªÑÂÂÐ',509,509),('ªÑÂÂÈ',508,508),('ªÑÂÃѵ¹ì',511,511),('ªÑÂÀÑ·Ã',505,505),('ªÑÂÁ§€Å',506,506),('ªÑ§³ì',507,507),('ªÑÂàšÃÔ­ãªèËÅÕʵÕÅ',496,496),('ªÑÂÂØ·ž',510,510),('ªÑÂÇѲ¹ì',512,512),('ªÑÂÊÔ·žÔì',513,513),('ªÑÂÊÔ¹žØì',514,514),('ªÑªҭ',498,498),('ªÑª¹Ð',497,497),('ªÑ³ç€ì',499,499),('ªÑžÇѲ¹ì',500,500),('ªÑ¹ѹ·ì',502,502),('ªÑ¹€Ã',501,501),('ªÑŸÃ',503,503),('ªÑŸÅ',504,504),('ªÑªÀÑÊÊÃ',489,489),('ªÑªÀ³',488,488),('ªÑªÁ³±ì',490,490),('ªÑªÁ¹±ì',491,491),('ªÑªÇÒÅÂì',493,492),('ªÑªÇÒÅìÂ',492,493),('ªÑªªÑÂ',486,486),('ªÑª®Ò',487,487),('ªÑ­ÉÒ',495,495),('ªÑ­­Ò',494,494),('ªÒÂ',524,524),('ªÒÇѳÂì',526,526),('ªÕÇÒŸÃ',534,534),('ªÒÅÕ',525,525),('ªÒ­',515,515),('ªÒ­ÂØ·ž',518,518),('ªÒ­ÈÑ¡ŽÔì',519,519),('ªÒ­ªÑÂ',516,516),('ªÒ­³Ã§€ì',517,517),('ªÔŽª¹¡',529,529),('ªÒµÃÕ',520,520),('ªÒµÔªÒÂ',521,521),('ªÒ¹',522,522),('ªÔ¹',530,530),('ªÔ¹Ãѵ¹ì',532,532),('ªÔ¹ÇѲ¹ì',533,533),('ªÓ¹Ô',528,528),('ªÓ¹Ò­',527,527),('ªÒ¹¹·ì',523,523),('ªÔ¹ŸÑ¹žì',531,531),('ªÙà¡ÉÁ',544,544),('ªÙà¡ÕÂõÔ',545,545),('ªÙÈÑ¡ŽÔì',553,553),('ªÙšÔµ',546,546),('ªÙšÔµµì',547,547),('ªÙªÑÂ',548,548),('ªÙªÒµÔ',549,549),('ªÙªÕŸ',550,550),('ªÙŸ§Èì',551,551),('ªÙŸ§Éì',552,552),('ªÅÍ',468,468),('ªÅÍÁ',469,469),('ªÅÒ¡Ã',470,470),('ªÅÔ¡Ò',471,471),('ªÅÔŽÒ',472,472),('ªÅÔµ',473,473),('ªÅÔµÒ',474,474),('ªÅžÕ',467,467),('ªÅžÔªÒ',466,466),('ªäÁŸÃ',457,457),('ª®ÒÃѪ',438,438),('ªŽÒ¡Ã',439,439),('ª¹ÁìÊØÇÃó',442,442),('ª¹Ð',443,443),('ª¹Ð⪵Ô',444,444),('ª¹Ñ­­Ò',445,445),('ª¹Ñ°',446,446),('ª¹Ñ¹Àóì',447,447),('ª¹ÒÀÒ',448,448),('ª¹ÔŽÒ',449,449),('ª¹¹Ñ¹·ì',440,440),('ª¹¹ÔÈÒ',441,441),('ª×蹚Եµì',535,535),('ªØÁÊÒÂ',542,542),('ªØÁÈÔÃÔ',541,541),('ªØÁŸÃ',539,539),('ªØÁŸÅ',540,540),('ªØÅÕŸÃ',543,543),('ªØŽÒŸÃ',536,536),('ªØµÔÁÒ',538,538),('ªØµÔ¡Ò­š¹ì',537,537),('«è͹¡ÅÔè¹',577,577),('«Õ àÍç¹ äÍ',580,580),('«Õ ŽÕ àÍçÁ àÍç¹àµÍÃìäŸÃÊì',581,581),('«Õ.ÇÕ.àÍÊ.ÍÔ¹ŽÑʵÃÕé',584,584),('«Õ.ŽÕ.ÍØµÊÒË¡ÃÃÁ',582,582),('«Õ.·Õ.à·àÅ€ÍÁ',583,583),('«ÕàÍç¹äÍàÍ繚Ôà¹ÕÂÃÔè§«ÑŸŸÅÒÂ',586,586),('«Òâµéâ€à¡ÕÂÇ ¡Ãاෟ',578,578),('«Ô¡»éÒ (»ÃÐà·Èä·Â)',579,579),('«ÕŽÕ ÍØµÊÒË¡ÃÃÁ',585,585),('«Ù',587,587),('­Ò³ÀÑ€',590,590),('­Õ¹ÀÒ',591,591),('¯Ç§¡ÁÅ',592,592),('°ÔµÔÃѪµì',605,605),('°ÔµÔÃѵ¹ì',606,606),('°ÔµÔÁÒ',604,604),('°ÔµÔàžÕÂÃ',600,600),('°ÔµÔ¡Ò¹µì',598,598),('°ÔµÔ³Ñ°',599,599),('°ÔµÔ¹Ñ¹·ì',601,601),('°ÔµÔŸÃ',603,603),('°ÔµÔŸ§Èì',602,602),('°Ôµ¡Ò¹µì',597,597),('°Ò¹Ñ¹·ì',593,593),('°Ò¹ÔÊÃ',595,595),('°Ò¹ÔµÂì',594,594),('°Ò»¹ÇÔ·Âì',596,596),('±ÔÁÀì¹Øª',607,607),('³ÀÑ·Ã',609,609),('³Àѷáóì',610,610),('³Ã§ÃÑ¡Éì',617,617),('³Ã§ÈÑ¡ŽÔì',619,619),('³Ã§Ä·žÔì',618,618),('³Ã§€ì',611,611),('³Ã§€ìÇÔ·Âì',615,615),('³Ã§€ìÈÑ¡ŽÔì',616,616),('³Ã§€ìÄ·žÔì',614,614),('³Ã§€ìªÑÂ',612,612),('³Ã§€ìŸÑªÃì',613,613),('³Ë·ÑÂ',620,620),('³ÑªªÒ',621,621),('³Ñ­­Ò',622,622),('³Ñ®°ÁÑÂ',623,623),('³Ñ®°ÇÃó',624,624),('³Ñ¯ŸÅ',625,625),('³Ñ°',626,626),('³Ñ°ÁÒ',645,645),('³Ñ°ÂÒ',646,646),('³Ñ°ÀÙÁÔ',643,643),('³Ñ°Á¹',644,644),('³Ñ°ÇÃÕÂì',647,647),('³Ñ°ÇѪÃì',648,648),('³Ñ°ÇѲ¹ì',649,649),('³Ñ°ÇѵÔ',650,650),('³Ñ°ÇزÔ',651,651),('³Ñ°ÊÃÑ­',653,653),('³Ñ°ÈÑ¡Âì',652,652),('³Ñ°Ë·ÑÂ',654,654),('³Ñ°Ô¡Ò',655,655),('³Ñ°¡Ã³ÔÈÒ',627,627),('³Ñ°¡Ò¹µì',629,629),('³Ñ°¡ÄµÒ',628,628),('³Ñ°¢šÃ',630,630),('³Ñ°ªÒ',632,632),('³Ñ°ª¹Ñ­',631,631),('³Ñ°°Ò',633,633),('³Ñ°µÂÒ',634,634),('³Ñ°¹Ñ¹·ì',636,636),('³Ñ°¹¹·ì',635,635),('³Ñ°»¡Ã³ì',637,637),('³Ñ°ŸÃ',641,641),('³Ñ°ŸÅ',642,642),('³Ñ°Ÿ§Èì',638,638),('³Ñ°Ÿ§Éì',639,639),('³Ñ°Ÿš¹ì',640,640),('³Õç€ì',657,657),('³ÔªÒ¡Ã',656,656),('³žÔµÒ',608,608),('³Øªª¹Ò',658,658),('ŽÃÃ쪹Õ',661,661),('ŽÃسÕ',662,662),('ŽÇ§Ãѵ¹ì',674,674),('ŽÇ§ãš',667,667),('ŽÇ§àŽ×͹',669,669),('ŽÇ§Á¹·Ãì',673,673),('ŽÇ§Ë·ÑÂ',675,675),('ŽÇ§¡ÁÅ',665,665),('ŽÇ§šÑ¹·Ãì',666,666),('ŽÇ§ŽÒÇ',668,668),('ŽÇ§¹ÀÒ',670,670),('ŽÇ§ºÅ',671,671),('ŽÇ§ŸÃ',672,672),('ŽÍ¡äÁé',676,676),('ŽÕ.ºÕ.äŽÁ͹Žì (»ÃÐà·Èä·Â)',695,695),('ŽÔàá',692,692),('ŽÒÃÒÃѵ¹ì',680,680),('ŽÒÃÒÇÃó',681,681),('ŽÒÃÔ¡Ò',682,682),('ŽÒÃÔ³Õ',683,683),('ŽÒÃÔ¹',684,684),('ŽÒÃÒ¹ÕÅì',679,679),('ŽÓç',689,689),('ŽÓç€ì',690,690),('ŽÒóÕ',677,677),('ŽÒùÕÂì',678,678),('ŽÓà¹Ô¹',688,688),('ŽÒÃØ³Õ',685,685),('ŽÒÇÃÕ',687,687),('ŽÒÇ»ÃСÒÂ',686,686),('ŽÓËÃÔ',691,691),('ŽÔÈ¡ØÅ',693,693),('ŽÔʷѵ',694,694),('ŽÅÄŽÕ',663,663),('ŽÅÄ·ÑÂ',664,664),('޹ÑÂ',659,659),('Ž¹ØŸÅ',660,660),('ŽØÊÔµ',701,701),('ŽØÊÔµà€ÁÕÀѳ±ì',702,702),('ŽØÉ®Õ',698,698),('ިɳÕ',699,699),('ŽØÉŽÕ',700,700),('ŽØÅÂìŸÑ²¹ì',697,697),('ŽØÅŸÅ',696,696),('µÐÇѹ',712,712),('µÐÅèÍÁÊÔ¹ŸÅÒʵԡ',711,711),('µè͚ѡÃ',710,710),('µÑè§šÑè§ËÅÍŽä¿',713,713),('µÒà¿çŽ',714,714),('µØê',715,715),('µØéÁ',717,717),('µØëÂ',718,718),('µØê¡µÒ',716,716),('µØÅÒÅѡɳì',719,719),('¶ÇÑÅ',729,729),('¶ÇÑÅÂì',730,730),('¶ÇÔÅ',731,731),('¶ÒÇÃ',733,733),('¶Ò³ØŸ§Èì',732,732),('¶¹ÍÁÈÑ¡ŽÔì',727,727),('¶¹ÔµŸÅ',728,728),('·ÃÃȹÕÂì',745,745),('·ÃÑŸÂì¶ÒÇÀéÒÇÑÊŽØ',746,746),('·Ã§',737,737),('·Ã§ÇزÔ',741,741),('·Ã§ÈÃÕ',742,742),('·Ã§ÈÑ¡ŽÔì',743,743),('·Ã§ÈÔÃÔ',744,744),('·Ã§ªÑ»Ñè¹·Í',738,738),('·Ã§žÃÃÁ',739,739),('·Ã§ŸÅ',740,740),('·ÇÕ',748,748),('·ÇÕÇѲ¹ì',752,752),('·ÇÕÈÃÕ',753,753),('·ÇÕÈÑ¡ŽÔì',754,754),('·ÇÔª',747,747),('·ÇÕªÑÂ',749,749),('·ÇÕ»',750,750),('·ÇÕŸÃ',751,751),('·èÒ·ÃÒÂášé§ÇѲ¹Ò',773,773),('·ÈŸÃ',755,755),('·ÈŸÅ',756,756),('·Í§ãº',759,759),('·Í§ÊØ¢',763,763),('·Í§ÍÔ¹·Ãì',764,764),('·Í§¢ÒÇ',757,757),('·Í§€Ó',758,758),('·Í§»Ò¹',760,760),('·Í§ŸÑ¹žì',761,761),('·Í§ŸÑ¹žØì',762,762),('·ÑÈÇÃó',772,772),('·ÑȹÇÃó',768,768),('·ÑȹÕÂì',770,770),('·ÑȹÕÂÒ',771,771),('·Ñȹ՟Ã',769,769),('·Ñ¡ÉÁ³¹ì',765,765),('·ÑŽŽÒÇ',766,766),('·Ñº·ÔÁ',767,767),('·Õ «Õ ŸÕ ÍÔ¹ŽÑÊ·ÃÕé',791,791),('·Õ.àÍÊ.äÇÃì€Ñ· á͹Žì áÁªªÕ¹ŸÒÃì·',794,794),('·Õ.äÍ.·Õ.ÍÔ¹àµÍÃì๪Ñè¹á¹Å',795,795),('·Õ.«Õ.«Õ.ŸÃçÍŸàŸÍÃìµÕé',792,792),('·Õ.«Õ.ŸÕ.ÍÔ¹ŽÑÊ·ÃÕé',793,793),('·ÕâÍàÍ âŽ¿à€Á ÍÔ¹ŽÃÑʵÕé',796,796),('·ÔÇÒ',789,789),('·ÔÈŸÅ',790,790),('·ÔŠÑÁŸÃ',774,774),('·Ô¹á€¹ ÍÔ¹ŽÑÊ·ÃÕ',775,775),('·ÔŸÂìÇÃó',778,778),('·ÔŸÂìÇÃØ³',779,779),('·ÔŸÂìÇÑÅÂì',780,780),('·ÔŸÂìÇÒÃÕ',781,781),('·ÔŸÂìÇÔÁÅ',782,782),('·ÔŸÂìÇŽÕ',777,777),('·ÔŸÂìŸÒŸÃ',776,776),('·ÔŸÇÃó',783,783),('·ÔŸÇÑÅÂì',784,784),('·ÔŸÇÔÁÅ',785,785),('·ÔŸÊØŽÒ',786,786),('·ÔŸÒÇÃó',788,788),('·ÔŸÒ¡Ã',787,787),('·ÙÃ',798,798),('·ÙÁÔ¹Ô·Êì ºÔ«Ôà¹Ê',797,797),('·¹§ÈÑ¡ŽÔì',735,735),('·¹Ø',736,736),('žÃÃÁÈÒʵÃì',861,861),('žÃÃÁ¹Ù­',860,860),('žà¹È',857,857),('žà¹ÈÃì',858,858),('žÁ¹Ñ¹·ì',859,859),('žÇÑÅÃѵ¹ì',865,865),('žÇѪ',863,863),('žÇѪªÑÂ',864,864),('žÑªÇѲ¹ì',869,869),('žÑªÇŽÕ',868,868),('žÑª¡Ã',866,866),('žÑªŸÅ',867,867),('žÑ­ÃŽÒ',877,877),('žÑ­ª¹¡',870,870),('žÑ­­žÃ',871,871),('žÑ­­ŸÑ²¹ì',872,872),('žÑ­³ÔªÒ',873,873),('žÑ­¹Ñ¹·ì',874,874),('žÑ­ŸÃ',875,875),('žÑ­ŸÔÊÔ·žÔì',876,876),('žÕÃÀÑ·Ãì',896,896),('žÕÃÀÒŸ',897,897),('žÕÃÇѲ¹ì',898,898),('žÕÃÐ',901,901),('žÕÃÐÇѲ¹ì',904,904),('žÕÃЪÑÂ',902,902),('žÕÃПÅ',903,903),('žÕÃÈÑ¡ŽÔì',899,899),('žÕÃÈÒ¹µÔŸÑ¹žì',900,900),('žÒÃÒ',883,883),('žÒÃÔ¹Õ',884,884),('žÓçÃѵ¹ì',886,886),('žÓç€ì',885,885),('žÕêÑÂ',890,890),('žÒ÷ԟÂì',882,882),('žÕùت',891,891),('žÕßѲ¹ì',895,895),('žÕßÅ',894,894),('žÕß§Èì',892,892),('žÕß§Éì',893,893),('žÒ¡Ã',878,878),('žÒŽÒ',879,879),('žÔŽÒÃѵ¹ì',887,887),('žÔµÔ¹Ñ¹·ì',888,888),('žÒ¹Õ',881,881),('žÔ¹Õ¡Ò­š¹ì',889,889),('žÒ¹Ô¹·Ãì',880,880),('žÄµ',862,862),('ž§äªÂ',826,826),('ž§ªÑÂ',825,825),('ž³Ñ°',827,827),('ž¹âÚ¹ì',834,834),('ž¹ÃѪ',832,832),('ž¹Ãѵ¹ì',833,833),('ž¹ÇѲ¹ì',836,836),('ž¹Çѹ',837,837),('ž¹ÇÔµµ',838,838),('ž¹ÇÔ·Âì',839,839),('ž¹ÇŽÕ',835,835),('ž¹ÐÃѪµì',841,841),('ž¹ÊÔ·žÔì',840,840),('ž¹ÑÊ',846,846),('ž¹ÑªžÔŽÒ',842,842),('ž¹Ñ­­Ò',843,843),('ž¹Ñ¹µì',844,844),('ž¹Ñ¹·ì',845,845),('ž¹Ò',847,847),('ž¹ÒÀóì',850,850),('ž¹ÒÃÑ¡Éì',852,852),('ž¹ÒÀÒ',851,851),('ž¹ÒÇѪÃì',853,853),('ž¹ÔɰÒ',855,855),('ž¹Ò€ÒÃÂÙâÍºÕ Ãѵ¹ÊÔ¹ ÊÒ¢ÒËÑÇËÁÒ¡',849,849),('ž¹Ò€ÒÃ¡ÃØ§ÈÃÕÍÂØžÂÒ º',848,848),('ž¹ÔŽÒ',854,854),('ž¹Ù',856,856),('ž¹¡Ã',828,828),('ž¹¡Äµ',829,829),('ž¹ŸÃ',830,830),('ž¹ŸÅ',831,831),('¹ à¿ÃÔÁàÁ¹¹Ôª ÍâÃáÁµÔê¡Êì ŸÕ·ÕÍÕ ÅÔÁÔàµç',906,906),('¹ ŸŽÅ',905,905),('¹àÃÈ',946,946),('¹ÃÀÑ·Ãì',939,939),('¹âõÁì',947,947),('¹ÀÇÃó',929,929),('¹ÀÑÊÊÃ',930,930),('¹ÀÑÊÊØÇÃó',931,931),('¹ÀÒ',932,932),('¹ÃÒ',940,940),('¹ÃÕ',945,945),('¹ÀÒÂØ·žì',934,934),('¹ÀÒÇÃó',935,935),('¹ÃÔÈ',943,943),('¹ÃÔɰ',944,944),('¹ÀÔ¹·Ã',936,936),('¹ÃÔ¹·Ãì',941,941),('¹ÃÔ¹·ÃìàŽª',942,942),('¹ÀÒŸÃ',933,933),('¹ÃªÑÂ',937,937),('¹ÀŽÅ',928,928),('¹ÃŸÅ',938,938),('¹ÇÃѵ¹ì',956,956),('¹ÇÅÅÐÍÍ',960,960),('¹ÇŚѹ·Ãì',957,957),('¹ÇÅ©ÇÕ',958,958),('¹ÇÅŸÃ',959,959),('¹Ç¡Ã³ì',954,954),('¹ÇŸÅ',955,955),('¹éÓÁѹ€ÒÅà·ê¡«ì',992,992),('¹éÓàŸªÃ',991,991),('¹éÓÍéÍÂ',994,994),('¹éÓ·ÔŸÂì',988,988),('¹éÓœ¹',989,989),('¹Ñ¹Ò',980,980),('¹Ñ­ªÅÒ',961,961),('¹Ñ¯ŸÃ',962,962),('¹Ñ±ŸÃ',963,963),('¹Ñ·ª¹¡',964,964),('¹Ñ·žÁ¹',965,965),('¹Ñ¹ªÑÂ',966,966),('¹Ñ¹·Ãѵ¹ì',973,973),('¹Ñ¹·ÁÒÊ',972,972),('¹Ñ¹·ÇÃó',975,975),('¹Ñ¹·Ç§Éì',974,974),('¹Ñ¹·ÈÑ¡ŽÔì',976,976),('¹Ñ¹·Ò',977,977),('¹Ñ¹·ÔÂÒ',979,979),('¹Ñ¹·Ô¡Ò¹µì',978,978),('¹Ñ¹·ªÑÂ',967,967),('¹Ñ¹·¹ì',968,968),('¹Ñ¹·¹Ò',969,969),('¹Ñ¹·ŸÃ',970,970),('¹Ñ¹·ŸÅ',971,971),('¹ÒÁ',983,983),('¹ÔÂÁ',1016,1016),('¹ÔÃÁÅ',1017,1017),('¹ÔÃѹŽÃ',1018,1018),('¹ÒÃÕ',985,985),('¹ÔÀÒ',1015,1015),('¹ÒÃÕÃѵ¹ì',986,986),('¹ÔÃÒÇÃóì',1019,1019),('¹ÒÃÔ¹·Ãì',984,984),('¹ÔâźÅ',1024,1024),('¹Ôà«Ð',998,998),('¹ÓÃØè§ä·Â ¡ÒÃìàÁ¹·ì',993,993),('¹ÔÃØš¹ì',1020,1020),('¹ÔÃØµµì',1021,1021),('¹ÔÇૹšÙÃÕèŸÃÔé¹µÔé§á͹Žì ៀ࡚šÔé§',1025,1025),('¹ÔÇѲ¹ì',1026,1026),('¹ÔÇѵÃì',1027,1027),('¹ÔÇѵÔ',1028,1028),('¹ÔÇÒµ',1029,1029),('¹ÒÇÔ¹Õ',987,987),('¹ÔÈÃÒ',1030,1030),('¹ÔÊÒ',1033,1033),('¹ÔÈÒªÅ',1031,1031),('¹ÔÈÒŸÃ',1032,1032),('¹ÔÅÀÒ',1022,1022),('¹ÔÅØºÅ',1023,1023),('¹Ô¡Éì',995,995),('¹Ô€Á',996,996),('¹ÔªÃªÕŸ',997,997),('¹Ò¯Êǧ',981,981),('¹ÔŽ',999,999),('¹ÔŽÒ',1000,1000),('¹ÔµÂì',1001,1001),('¹ÒµÂÒ',982,982),('¹ÔµÂÒ',1002,1002),('¹ÔµÔ',1003,1003),('¹ÕµÔ',1034,1034),('¹ÔµÔÁÒ',1005,1005),('¹ÔµÔŸ§Éì',1004,1004),('¹Ô·ÃÒ',1006,1006),('¹Ô·Ñȹì',1007,1007),('¹Ô·ÑȹÕÂì',1008,1008),('¹ÔžÔÇŽÕ',1009,1009),('¹Ô»»Í¹àŸ¹µì(»ÃÐà·Èä·Â)',1010,1010),('¹ÔŸÑ·žÒ',1013,1013),('¹ÔŸÑ¹',1014,1014),('¹ÓŸÅ',990,990),('¹ÔŸÅ',1012,1012),('¹ÔŸ¹žì',1011,1011),('¹ÅŸÃó',953,953),('¹ÄÁÒ³',952,952),('¹ÄÁÅ',951,951),('¹Ä³Õ',948,948),('¹ÄŽÕ',949,949),('¹Ä·žÔì',950,950),('¹€Ã',907,907),('¹€Ã»°Á Î͹ŽéÒ€ÒÃìÊì (1994)',908,908),('¹§Åѡɳì',911,911),('¹§ª¹¡',909,909),('¹§¹Øª',910,910),('¹·',912,912),('¹·Õ',914,914),('¹·Ô¹',913,913),('¹¹·ÈÑ¡ŽÔì',915,915),('¹ŸÃѵ¹ì',924,924),('¹ŸÁÒÈ',923,923),('¹Ÿà¡éÒ',916,916),('¹ŸÇÃó',926,926),('¹ŸÒŸÃ',927,927),('¹ŸÄÔ·žÔì',925,925),('¹ŸŽÅ',917,917),('¹ŸŽÅÂì',918,918),('¹Ÿ·Ñµ',919,919),('¹ŸŸÃ',921,921),('¹ŸŸÅ',922,922),('¹ŸŸ§€ì',920,920),('¹ØÈÃÒ',1039,1039),('¹ØÊÃÒ',1041,1041),('¹ØÊºÒ',1040,1040),('¹ØªÂÒ',1037,1037),('¹ØªÃÕ',1038,1038),('¹ØªšÃÔ¹·Ãì',1035,1035),('¹Øª¹Ò¶',1036,1036),('ºÃç',1050,1050),('ºÃÃàšÔŽ',1049,1049),('ºÃÃÊÒÃ',1051,1051),('ºÃÚ§',1047,1047),('ºÃÚº',1048,1048),('ºÃÔÇÃõ',1052,1052),('ºÇêÑÂ',1053,1053),('ºÑ§ÍÃ',1054,1054),('ºÑ­ªÒ',1055,1055),('ºÑ­­ÑµÔ',1056,1056),('ºÑ³±Ôµ',1057,1057),('ºÑ³±ÔµÂì',1058,1058),('ºÑµÃ¡ÃاÈÃÕÍÂØžÂÒ',1060,1060),('ºÑµÃ¡Ãاä·Â',1059,1059),('ºÑ¹Å×ÍÈÑ¡ŽÔì',1061,1061),('ºÕ á͹Žì «Õ ŸÙÅÒÊ¡Õé',1067,1067),('ºÕ ÇÒ €ÍÃìâŸàêÑè¹ šÓ¡ÑŽ',1066,1066),('ºÕ.àÍç¹.ºÃÒàŽÍÃì',1068,1068),('ºÕ.àÍÊ.äÍ.àËÅç¡¡èÍÊÃéÒ§',1069,1069),('ºÓÃØ§ä·Â',1064,1064),('ºÔǵÕéៀ',1065,1065),('ºÒ§¡Í¡ªÕ·àÁç··ÑÅ',1062,1062),('ºÒ¹ªéÍÂ',1063,1063),('ºÙê·Êì (»ÃÐà·Èä·Â)',1111,1111),('ºÙê·ÊìáÁ¹Ùá¿€àšÍÃìÃÔè§ (»ÃÐà·Èä·Â)',1112,1112),('º§¡ª',1044,1044),('º§¡µÃѵ¹ì',1045,1045),('º«ì ÍÔ¹â¿Ãì à«ÍÃìÇÔÊ',1046,1046),('ºØÃÑ­ªÅÕ',1101,1101),('ºØÃÔ¹·Ãì',1102,1102),('ºØÈÃÒ',1103,1103),('ºØÉÂÒ',1108,1108),('ºØÉÃÒÀóì',1109,1109),('ºØÈÃÔ¹·Ãì',1105,1105),('ºØÈÃÒŸÃ',1104,1104),('ºØËÅÑè¹',1110,1110),('ºØÉ¡Ã',1106,1106),('ºØÉºÒ',1107,1107),('ºØ­àÂÕèÂÁ',1085,1085),('ºØ­ÃèÇÁ',1086,1086),('ºØ­áʧ',1098,1098),('ºØ­ÃÑ¡',1087,1087),('ºØ­Âѧ',1084,1084),('ºØ­ÁÕ',1083,1083),('ºØ­àÅÔÈ',1090,1090),('ºØ­à¡ÕÂõÔ',1070,1070),('ºØ­àªÔŽ',1075,1075),('ºØ­ÈÃÕ',1091,1091),('ºØ­Êè§',1093,1093),('ºØ­ÈÔÃÔ ŽÕÇÔÅÍ»àÁ¹·ì',1092,1092),('ºØ­ÊÔ¹',1095,1095),('ºØ­Ê¹Í§',1094,1094),('ºØ­Ê׺',1096,1096),('ºØ­ÊØ¢',1097,1097),('ºØ­ÅѺ',1088,1088),('ºØ­Å×Í',1089,1089),('ºØ­€§',1071,1071),('ºØ­ªèÇÂ',1072,1072),('ºØ­ªÑÂ',1073,1073),('ºØ­ªØº',1074,1074),('ºØ­«é͹',1076,1076),('ºØ­·ÃÑŸÂì',1077,1077),('ºØ­·ÇÕ',1078,1078),('ºØ­·Í§',1079,1079),('ºØ­žÃÃÁ',1080,1080),('ºØ­»ÃÐÊÔ·žÔì',1081,1081),('ºØ­Ÿ§Éì',1082,1082),('ºØ³±Ôµ',1099,1099),('ºØ»ŒÒ',1100,1100),('»ÃÐ⪹ì',1179,1179),('»ÃÐàÇÈ',1186,1186),('»ÃÐÁÇÅ',1171,1171),('»ÃÐàÊÃÔ°',1193,1193),('»ÃÐÁÑŸÃ',1172,1172),('»ÃÐÀÑÊ',1163,1163),('»ÃÐÀÑÊÃì',1164,1164),('»ÃÐÀÑÊÃÒŸÃ',1165,1165),('»ÃÐÀÑÊÊÃ',1166,1166),('»ÃÐÀÒÀóì',1169,1169),('»ÃÐÀÒÊ',1170,1170),('»ÃÐÂÔ¹',1175,1175),('»ÃÐÀÒŸÃ',1167,1167),('»ÃÐÀÒŸÃó',1168,1168),('»ÃÐÂÙÃ',1177,1177),('»ÃÐÂÙÃÈÃÕ',1178,1178),('»ÃÐÁÙÅ',1173,1173),('»ÃЧ€ì',1174,1174),('»ÃÐà·×ͧ',1156,1156),('»ÃÐÂØ·ž',1176,1176),('»ÃÐÇѵÃ',1180,1180),('»ÃÐÇѵÔ',1181,1181),('»ÃÐÇÕ³Ò',1185,1185),('»ÃÐÇÔµÃ',1182,1182),('»ÃÐÇÔ·',1183,1183),('»ÃÐÇÔ·Âì',1184,1184),('»ÃÐÊÒÃ',1190,1190),('»ÃÐÊÒ·',1188,1188),('»ÃÐÊÔ·žÔì',1191,1191),('»ÃÐÊÒ¹',1189,1189),('»ÃÐʧ€ì',1187,1187),('»ÃÐÊ׺',1192,1192),('»ÃÐäŸ',1162,1162),('»ÃСͺ',1138,1138),('»ÃСÒÈ',1139,1139),('»ÃСÒÈÔµ',1140,1140),('»ÃСԚ',1141,1141),('»ÃСԵ',1142,1142),('»ÃЀͧ',1143,1143),('»ÃКǺ',1145,1145),('»ÃКѡÉì',1146,1146),('»ÃКԵÃ',1147,1147),('»ÃК§šÔµ',1144,1144),('»ÃЪÒ',1148,1148),('»ÃЪԵ',1149,1149),('»ÃЪØÁŸÃ',1150,1150),('»Ãгµ',1151,1151),('»ÃÐŽÔɰì',1152,1152),('»ÃзѺãš',1153,1153),('»Ãзջ',1154,1154),('»ÃзØÁ·ÔŸÂì',1155,1155),('»ÃПѲ¹ì',1160,1160),('»ÃПѹžì',1161,1161),('»ÃПķžÔì',1159,1159),('»ÃПš¹ì',1157,1157),('»ÃП¹žì',1158,1158),('»ÀÑÊÊÃ',1132,1132),('»ÃѪ­Ò',1194,1194),('»ÃÒâÁ·Âì',1200,1200),('»ÃÕÂÒÀóì',1213,1213),('»ÃÔÂÒÇÃó',1208,1208),('»ÃÒö¹Ò',1201,1201),('»ÀÒÇÃÔ¹·ì',1135,1135),('»ÀÒÇÕ',1136,1136),('»ÀÒÇŽÕ',1134,1134),('»ÃÔȹÒ',1209,1209),('»ÃÔȹÕ',1210,1210),('»ÃÒ¡ÒÃ',1195,1195),('»ÃÒ§³Õ',1196,1196),('»ÃÕªÒ',1211,1211),('»ÃÒª­ì',1197,1197),('»ÃÕ­Ò',1212,1212),('»ÃÔ­­ì',1202,1202),('»ÃÔ­­Ò',1203,1203),('»ÃÔ­ŽÒ',1204,1204),('»ÃÒ³Õ',1198,1198),('»ÃÒ³ÕÂì',1199,1199),('»ÃÔ³ŽÒ',1205,1205),('»ÀÒ³Ø',1133,1133),('»ÃÔ·ÑÈ',1206,1206),('»ÃÔ¹ŽÒ',1207,1207),('»ÂصÒ',1137,1137),('»ÇÕ³ÃѪ',1214,1214),('»ÇÕ³Ò',1215,1215),('»Êѹµì',1216,1216),('»Êѹ¹ì',1217,1217),('»Í§ÀŸ',1218,1218),('»Ñ­šÃÑÈÁÔì',1219,1219),('»Ñ­­Ò',1220,1220),('»Ñ­­ÒŸÃ',1221,1221),('»Ñ­­ÒŸÅ',1222,1222),('»Ñ³ÃÊÕ',1223,1223),('»Ñ·Á',1224,1224),('»Ñ·ÁÒ',1225,1225),('»Ñ·ÁÒÇŽÕ',1226,1226),('»ÔÂÃѵ¹ì',1246,1246),('»ÔÂÁÒÀóì',1245,1245),('»ÔÂÇÃó',1247,1247),('»ÔÂÇѲ¹ì',1248,1248),('»ÔÂÐ',1250,1250),('»ÔÂÐÁÒÈ',1259,1259),('»ÔÂÐÈÑ¡ŽÔì',1260,1260),('»ÔÂЪÑÂ',1251,1251),('»ÔÂйѹ·ì',1253,1253),('»ÔÂй¹·ì',1252,1252),('»ÔÂйت',1254,1254),('»ÔÂПÃ',1256,1256),('»ÔÂПѹžì',1257,1257),('»ÔÂПѹžØì',1258,1258),('»ÔÂП§Èì',1255,1255),('»ÔÂÈÑ¡ŽÔì',1249,1249),('»ÒÃÔªÒµ',1230,1230),('»ÒÃÔªÒµÔ',1231,1231),('»ÒÃÕ³Ò',1233,1233),('»ÔÂÒŸÃ',1261,1261),('»ÒÃԟѹžì',1232,1232),('»Ô¡ҭš¹ì',1239,1239),('»Ô¹ѹ·ì',1240,1240),('»Ô¹ү',1241,1241),('»ÔŸÃ',1244,1244),('»ÔŸ§Èì',1242,1242),('»ÔŸ§Éì',1243,1243),('»Ôè¹ÁÒ⹪',1238,1238),('»Ôè¹Á³Õ',1237,1237),('»Ò˹ѹ',1234,1234),('»ÔÅѹ­Ò',1262,1262),('»Ò³ÔÊÃÒ',1227,1227),('»ÔµÔ',1235,1235),('»ÔµÔÇѪÃì',1236,1236),('»Ò¹',1228,1228),('»Ò¹àŸªÃ',1229,1229),('»¡Ã³ì',1119,1119),('»®ÔÁÒ',1120,1120),('»¯ÔÁÒ',1123,1123),('»¯Ô­­Ò',1121,1121),('»¯ÔŸÅ',1122,1122),('»°ÁÇѲ¹ì',1124,1124),('»³ÔŽÒ',1126,1126),('»³ÔµÒ',1127,1127),('»³ªÑÂ',1125,1125),('»·ØÁ',1128,1128),('»·ØÁÒ',1130,1130),('»·ØÁŸÃ',1129,1129),('»¹ÑŽŽÒ',1131,1131),('»Ø³³ÂÒ',1263,1263),('ŒàŽÔÁ',1277,1277),('ŒèͧÈÃÕ',1279,1279),('ŒèͧŸÃó',1278,1278),('Œè͹»ÃÐÀÒ',1280,1280),('ŒèÒ¡ÒÀÅѧ¡Í§¡ÅÒ§Êӹѡ»ÅÑŽ¡ÃاෟÁËÒ¹€Ã',1285,1285),('ŒéÒ¢¹Ë¹ÙªÔ¹àΧ',1281,1281),('ŒéÒ¢¹Ë¹Ù«Ô¹àΧ',1282,1282),('ŒéҢع˹٫ԹàΧ',1283,1283),('ŒèÒ¹¿éÒ àÍ繚Ôà¹ÕÂÃÔè§',1284,1284),('ŒÒÊØ¢',1286,1286),('ŒÙéãË­èàÅç¡',1289,1289),('ŒÙéàŒŽçš',1288,1288),('Œ¡Ò¡Ãͧ',1272,1272),('Œ¡ÒŸÃó',1273,1273),('Œ§',1274,1274),('Œš§šÔµµì',1275,1275),('ŒŽØ§ÈÑ¡ŽÔì',1276,1276),('ŒØÊŽÕ',1287,1287),('œèÒ¡ÒÀÅѧ¡Í§¡ÅÒ§ Êӹѡ»ÅÑŽ¡ÃاෟÁËÒ¹€Ã',1293,1293),('ŸÃ',1319,1319),('ŸÃÁ§€Åà¿ÍÃì¹ÔàšÍÃì',1338,1338),('ŸÃóÃÒ³ì',1344,1344),('ŸÃóÊóì',1345,1345),('ŸÃóÕ',1347,1347),('ŸÃóԡÒ',1346,1346),('ŸÃó·ÔÀÒ',1339,1339),('ŸÃó¹ÔÀÒ',1340,1340),('ŸÃó»ÃÐäŸÇŽÕ',1341,1341),('ŸÃóŸÃÃÉ',1342,1342),('ŸÃóŸÔÁÅ',1343,1343),('ŸÃà·Ÿ',1326,1326),('ŸÃÞԎÒ',1348,1348),('ŸÃàŸç­',1337,1337),('ŸÃÇÔÁÅ',1349,1349),('ŸÃÇÔäÅ',1350,1350),('ŸÃÐÃÒÁ 3 Î͹ŽéÒ€ÒÃìÊì',1360,1360),('ŸÃÐÃÒÁ 3 €ÒÃìà«ç¹àµÍÃì',1359,1359),('ŸÃлÃÐᎧ Î͹ŽéÒ€ÒÃìÊì',1357,1357),('ŸÃлÃÐᎧ Î͹ŽéÒ€ÒÃìÊì šÓ¡ÑŽ',1358,1358),('ŸÃÊÃǧ',1353,1353),('ŸÃËÁŸÑ²¹ì',1355,1355),('ŸÃÊÇÃÀì',1354,1354),('ŸÃéÍÁªÑÂ',1356,1356),('ŸÃÈÑ¡ŽÔì',1351,1351),('ŸÃÈÔÃÔ',1352,1352),('ŸÃÕàÁÕÂÃìà€ÁÔ€ÑÅ á͹ŽìŸÅÒʵԡ',1362,1362),('ŸÃÕàÁÕÂÃìÍÔ¹àµÍÃìÅÔ««Ôè§',1363,1363),('ŸÃÔéÁàŸÃÒ',1361,1361),('ŸÃ¡ÇÕ',1320,1320),('ŸÃšÔµµì',1321,1321),('ŸÃªÑÂ',1322,1322),('ŸÃ·ÔÀÒ',1325,1325),('ŸÃ·ÔŸÂì',1323,1323),('ŸÃ·ÔŸÒ',1324,1324),('ŸÃ¹ÀÒ',1328,1328),('ŸÃ¹ÔµÔ¿ÔÅìÁá͹ŽìÇÕŽÕâÍ',1329,1329),('ŸÂ¹µì',1317,1317),('ŸÃ¹·Õ',1327,1327),('ŸÃŸÃó',1332,1332),('ŸÃŸÔÁÅ',1335,1335),('ŸÃŸÔäÅ',1336,1336),('ŸÃŸÅ',1333,1333),('ŸÃŸÅÒ§ÒÁ',1334,1334),('ŸÃŸ§Éì',1330,1330),('ŸÃŸ¹Ò',1331,1331),('ŸÂا',1318,1318),('ŸÇ§Ãѵ¹ì',1372,1372),('ŸÇ§àŸç­',1371,1371),('ŸÇ§·Í§',1370,1370),('ŸÈÔ¹',1373,1373),('ŸÊØà¡µÔì',1374,1374),('ŸÑÊŸÃ',1391,1391),('ŸÑÅÅÀ',1390,1390),('ŸÑªÃ',1376,1376),('ŸÑªÃÇäÅ',1377,1377),('ŸÑªÃÒ',1378,1378),('ŸÑªÃÕ',1382,1382),('ŸÑªÃÒÀóì',1379,1379),('ŸÑªÃÕÀóì',1384,1384),('ŸÑªÃÒÀÒ',1380,1380),('ŸÑªÃÔ¹·Ãì',1381,1381),('ŸÑªÃÕŸÃ',1383,1383),('ŸÑª¹Õ',1375,1375),('ŸÑ²·ÇÕ',1385,1385),('ŸÑ²¹Ð',1387,1387),('ŸÑ²¹ªÑÂ',1386,1386),('ŸÑ²Ÿ§Éì',1388,1388),('ŸÑ·žìžÕÃÒ',1389,1389),('ŸÔ ÈÁÑÂ',1397,1397),('ŸÕ.àÍÊ.šÕ ÅÔÊ«Ôè§',1439,1439),('ŸÕ.àÍÊ.ŸÅÒʵԡºÃÒàŽÍÃì á͹Žì«Ñ¹',1440,1440),('ŸÕ.àÍÊ.ŸÅÒʵԡºÃÒàŽÍÃìá͹Žì«Ñ¹',1441,1441),('ŸÕ.«Õ.àºÊ·ì €ÃÕàÍ·',1438,1438),('ŸÔÃÁÂì',1430,1430),('ŸÔÁÀÒ',1428,1428),('ŸÕÃÇØ²Ô',1446,1446),('ŸÕÃÐ',1448,1448),('ŸÕÃÐÈÑ¡ŽÔì',1451,1451),('ŸÕÃПÅ',1450,1450),('ŸÕÃП§Èì',1449,1449),('ŸÕÃÈÔÅ»ì',1447,1447),('ŸÒÃҡ͹ÍÔ¹â¿à·€',1396,1396),('ŸÔÁÅ',1429,1429),('ŸÔàªÉ°',1409,1408),('ŸÔàªÉ°ì',1408,1409),('ŸÔય',1406,1406),('ŸÔય°ì',1407,1407),('ŸÒâµà€ÁÕÍØµÊÒË¡ÃÃÁ',1394,1394),('ŸÕ÷ѵ',1444,1444),('ŸÔà·Ÿ',1415,1415),('ŸÔÀŸ',1420,1420),('ŸÔÁŸìÀóì',1425,1425),('ŸÔÁŸìÀÑ€',1426,1426),('ŸÔÁŸìãš',1421,1421),('ŸÔÁŸìÇÔÁÅ',1427,1427),('ŸÔÁŸìª¹¡',1422,1422),('ŸÔÁŸì»ÃПÃó',1423,1423),('ŸÔÁŸìŸÃ',1424,1424),('ŸÕßѲ¹ì',1445,1445),('ŸÔÃØ³',1431,1431),('ŸÔÊÁÑÂ',1434,1434),('ŸÔÈÔɰì',1432,1432),('ŸÔÊÔɰì',1437,1437),('ŸÔÊÔ°',1435,1435),('ŸÔÊÔ·žÔì',1436,1436),('ŸÔɳØ',1433,1433),('ŸÔšÔµÃÒ',1398,1398),('ŸÔªÂÒ',1401,1401),('ŸÔªÑÂ',1402,1402),('ŸÔªÑÂÇѲ¹ì',1403,1403),('ŸÔªÔµ',1404,1404),('ŸÔªÔµŸÅ',1405,1405),('ŸÔª­ì',1399,1399),('ŸÔªŽÒ',1400,1400),('ŸÔ±ÙÃÂì',1410,1410),('ŸÒ³Õ',1393,1393),('ŸÒ³ÔªÂì',1392,1392),('ŸÔ³ªØŽÒ',1411,1411),('ŸÔ³¹ÀÒ',1412,1412),('ŸÔ·ÂÒ',1413,1413),('ŸÔ·Ñ¡Éì',1414,1414),('ŸÔžÒ¹¡Ã',1416,1416),('ŸÕ¹Ô¡«ì àÍç¡«ìàŸÃÊ',1442,1442),('ŸÕ¹Ô¡«ìàÍç¡«ìàŸÃÊ',1443,1443),('ŸÒ¹·Í§',1395,1395),('ŸÔ¹¹ÔÀÒ',1417,1417),('ŸÔºÙÅÂì',1418,1418),('ŸÔŸÑ²¹ì',1419,1419),('ŸÙŷͧŸÃçÍŸàŸÍÃìµÕé_',1454,1454),('ŸÙÅŒÅ',1455,1455),('ŸÙ¹ÈÑ¡ŽÔì',1453,1453),('ŸÙ¹ŸÑ¹žì',1452,1452),('ŸÅà·Ÿ',1366,1366),('ŸÅÊÔ·žÔì',1369,1369),('ŸÅ¡Äɳì',1364,1364),('ŸÅªÑÂ',1365,1365),('ŸÅŸÑªÃì',1367,1367),('ŸÅŸÑ²¹ì',1368,1368),('Ÿ§ÈìÀÑ€',1300,1300),('Ÿ§Èìà¡ÕÂõÔ',1294,1294),('Ÿ§Èìà·Ÿ',1296,1296),('Ÿ§Éìà·Ÿ',1302,1302),('Ÿ§ÉìÈÑ¡ŽÔì',1304,1304),('Ÿ§ÉìÊѹµì',1305,1305),('Ÿ§ÈìÊØà¡ÉÁ',1301,1301),('Ÿ§Éì͹ѹµì',1306,1306),('Ÿ§ÈìªÒÂ',1295,1295),('Ÿ§ÉìŸÃ',1303,1303),('Ÿ§ÈìŸÑ¹žì',1298,1298),('Ÿ§ÈìŸÔŸÑ²¹ì',1299,1299),('Ÿ§ÈžÃ',1297,1297),('ŸšÁÒÅÂì',1312,1312),('ŸšÁÒ¹',1311,1311),('Ÿš¹ì',1307,1307),('Ÿš¹Ò',1308,1308),('Ÿš¹ÕÂì',1310,1310),('Ÿš¹Òö',1309,1309),('Ÿ¹Á',1313,1313),('Ÿ¹ÁªÑÂ',1314,1314),('Ÿ¹ÒÊѹ±ì',1315,1315),('Ÿ¹ÔŽÒ',1316,1316),('¿Õ¹Ô¡«ì àÍç¡«ìàŸÃÊ',1493,1493),('¿ÅØÊÊÔ¡à€Á',1492,1492);
+SELECT name FROM t1 ORDER BY name;
+name
++45 BRETT
++55 BRETT
++56 BRETT
+-.55 BRETT
+-45 BRETT
+-55 BRETT
+.-55 BRETT
+.55 BRETT
+45 BRETT
+5 5 BRETT3
+5 5 BRETT2
+5 5 BRETT1
+5-5 BRETT
+55 BRETT
+55+ BRETT
+55- BRETT
+55. BRETT
+CHEE KUNG FOOK
+CHEN CHIA YI
+CHI WAI DAVIT
+GEORGE
+KAWAIJIT
+KAWALJIT
+KOJI
+LOUIS
+PETER
+SHERMAN
+TAN
+Willem Arnold
+WONG
+WU
+¡.µÃÕ·ÔŸÂì €Í¹«ÑÅáµ¹·ì
+¡ª¡Ã
+¡ªŸÃ
+¡ªÁÅ
+¡µÑ­­Ù
+¡¹¡
+¡¹¡¡Ò­š¹ì
+¡¹¡ªÑÂ
+¡¹¡¹ÔÀÒ
+¡¹¡¹Øª
+¡¹¡ŸÃ
+¡¹¡Ãѵ¹ì
+¡¹¡Ä·žÔì
+¡¹¡ÇÃó
+¡¹¡ÈÃÕ
+¡¹¡Ò­š¹ì
+¡¹ÔɰÒ
+¡ÁÅ
+¡ÁũѵÃ
+¡ÁÅ·ÔŸÂì
+¡ÁÅŸÃ
+¡ÁÅŸÃó
+¡ÁÅÁÒÅÂì
+¡ÁÅÃѪµì
+¡ÁÅÃѵ¹ì
+¡ÁÅÇÃó
+¡Ã¡¹¡
+¡Ã¡ŸÃ
+¡Ã¡ÁÅ
+¡ÃªÑÂ
+¡Ã³ì
+¡Ã¹Ñ¹·ì
+¡Ã»ÃÕÂÒ
+¡ÃíԡÒÃì
+¡ÃóԡÒ
+¡ÃóԡÒÃì
+¡ÃÇÅÑÂ
+¡ÃÇÔ·Âì
+¡Ãͧá¡éÇ
+¡Ãͧ·ÔŸÂì
+¡ÃК¡ä·ÂÍÒ«ÒÎÕ
+¡ÃÕ±Ò
+¡ÃاෟŒÅÔµàËÅç¡
+¡Ãاä·Â€ÒÃìàÃé¹·ì ÍÔ¹àµÍÃì๪Ñè¹á¹Å
+¡Ãاä·ÂÍØ»¡Ã³ì
+¡ÃسÒ
+¡ÄªÇÃó
+¡ÄµºŸÔž
+¡ÄµÂÒ
+¡ÄµÔ¡Ò¹·ì
+¡ÄµÔÂÒ
+¡ÄÈŸÃó
+¡ÄÉ®Ò
+¡ÄÉ®Õ
+¡Äɮ՟Ã
+¡ÄɳŸš¹ì
+¡ÄɳŸÅ
+¡ÄɳÐ
+¡ÄɳÒ
+¡ÄɳÕ
+¡ÄÉŽÒ
+¡ÇÕ
+¡ÉÁÒ
+¡ÉÔª­ì
+¡ÉÔŽÔÈ
+¡ÊÔÇѹ
+¡èÍà¡ÕÂõÔ
+¡Íº¡ØÅ
+¡Íºá¡éÇ
+¡ÍººØ­
+¡ÍºÅÒÀ
+¡Ñ ÅÂÒ
+¡Ñ­ªŸÃ
+¡Ñ­­ÀÑ€
+¡Ñ­­ìÇÃÒ
+¡Ñ­­ÒÁÒÈ
+¡Ñ­­ÒÇÕÃì
+¡Ñ³°ªÒ
+¡Ñ³°Ô¡Ò
+¡Ñ³·ÔÁÒ
+¡Ñ¹µì
+¡Ñ¹µÔ¡Ã
+¡Ñ¹žÔªÒ
+¡Ñ¹žÔÁÒ
+¡Ñ¹ÂÒÃѵ¹ì
+¡ÑÁ»¹Ò¶
+¡ÑÁ»¹Ò·
+¡ÑÅÂÒ
+¡ÑÅÂÒ³Õ
+¡ÑÅÂÒÃѵ¹ì
+¡Ò­š¹ÇÃó
+¡Ò­š¹Ò
+¡Ò¹ŽÒ
+¡Ò¹µì
+¡Ò¹µìÃÇÕ
+¡ÒÂÊÔ·žÔì
+¡ÒÃÇÔÍÃ
+¡ÒÃØ³Õ
+¡ÒÈÔ
+¡ÓžÃ
+¡ÓŸÅ
+¡ÓäÃ
+¡Óá˧
+¡Ôè§¡Ò­š¹ì
+¡ÔšµÔÂÒ
+¡ÔšÇÃó
+¡ÔµµÔ
+¡ÔµµÔ¡Ñ¹µì
+¡ÔµµÔªÑÂ
+¡ÔµµÔ­Ò
+¡ÔµµÔ¹Ñ¹·ì
+¡ÔµµÔŸ§Èì
+¡ÔµµÔŸ§Éì
+¡ÔµµÔŸÅ
+¡ÔµµÔŸÑ²¹ì
+¡ÔµµÔŸÑ¹žì
+¡ÔµµÔÁÒ
+¡ÔµµÔÂÒ
+¡ÔµµÔÃѵ¹ì
+¡ÔµµÔÇѲ¹ì
+¡ÔµµÔÈÑ¡ŽÔì
+¡ÔµÔ¡Ã
+¡ÔµÔ¡Ã³ì
+¡ÔµÔ¡Ñ­­Ò
+¡ÔµÔªÒ­
+¡ÔÁÅÑé§
+¡ÕõÔ
+¡ØÁØ·ŸÑ¹žì
+¡ØéÂà«é§ ÍÔÁ»ÍÃìµ á͹Žì àÍç¡«ì»ÍÃìµ
+¡ØÅ¹Ñ¹·ì
+¡ØÅ¹ÒÃÕ
+¡ØÅÂÒ
+¡ØÅÅŽÒ
+¡ØÅÇŽÕ
+¡ØÅÈÔÃÔ
+¡ØÊØÁÒ
+¡ØËÅÒº
+¡ÙêŽÇÔÅ ÍÔ¹ŽÑʵÃÕé
+à¡çšŸÔÃØ³
+ࡪÒ
+ࡳԡÒ
+ࡵØÁ³Õ
+à¡ÃÔ¡
+à¡ÃÔ¡ä¡Ã
+à¡ÃÔ¡Ÿ§Éì
+à¡ÃÕ§ä¡Ã
+à¡ÃÕ§ªÑÂ
+à¡ÃÕ§§ÍÔ¹àµÍÃì๪Ñè¹á¹Å
+à¡ÃÕ§ÈÑ¡ŽÔì
+à¡È¡ØÅÀÒ
+à¡ÈÃÒ
+à¡ÈÃÔ¹·Ãì
+à¡ÈÇÅÕ
+à¡ÈÈÔÃÔ
+à¡ÈÊØŽÒ
+à¡ÈÔ¹Õ
+à¡É³Õ
+à¡ÉŽÒ
+à¡ÉÁ
+à¡ÉÁÊѹµì
+à¡ÉÃÒ
+à¡ÉÃÕ
+à¡ÉÕÂÃ
+à¡ÊÃ
+à¡ÊÃì
+à¡ÕÂõÔ
+à¡ÕÂõԻÀÒ
+à¡ÕÂõԟ§Éì
+à¡ÕÂõÔÈÑ¡ŽÔì
+à¡ÕÂõÔÊÇÑÊŽÔì
+à¡×éÍ¡ÙÅ
+á¡éÇ
+á¡éÇãš
+â¡Áşѹžì
+â¡àÁÈ
+â¡ÅºÍÅ €Í¹à¹ç€ªÑè¹Êì
+â¡ÇÔ·
+â¡ÇÔ·Âì
+â¡ÇÔ¹
+â¡àÇȹì
+â¡ÈÅ
+â¡ÊÔ¹·Ãì
+ä¡Ã€Ó
+ä¡Ãà·Ÿ
+ä¡ÃžÇѪ
+¢šÃ
+¢šÃà¡ÕÂõÔ
+¢šÃÈÃÕ
+¢šÃÈÑ¡ŽÔì
+¢¹Ôɰì
+¢¹ÔɰÒ
+¢ÇÑ­ãš
+¢ÇÑ­ªÑÂ
+¢ÇÑ­àŽ×͹
+¢ÇÑ­µÒ
+¢ÇÑ­àŸçªÃ
+¢ÇÑ­àÁ×èͧ
+¢ÇÑ­ÂØŸÒ
+¢ÇÑ­ÃØé§
+¢ÇÑ­àÃ×͹
+¢ÑµµÔÂÒ³Õ
+¢éÒÇÍÔèÁ·ÔŸÂì
+¢Ø¹·Í§
+á¢ä¢
+€§¡ÄÈ
+€§àŽª
+€àª¹·Ãì
+€³Ò¡Ã
+€³ÒÇØ²Ô
+€³ÔÈÃ
+€³ÔÊÃ
+€³ØµÁì
+€à³È
+€žÒ
+€à¹Âì
+€Á¡ÃÔª
+€ÁšÑ¡Ã
+€ÁàŸçªÃ
+€ÃÒ¿·ìàŽÍÐàºÊ·ì
+€ÍÊÁÔ€ €Í¹€ÍÃìŽ €ÍÃì»ÍàêÑè¹
+€Ò«ÙâÍÐ
+€ÒÃìâ»Ãà¿ÊªÑè¹á¹Å
+€ÒÇÒ€Ô¹
+€Óó
+€Óá˧
+€ÔÁ§€ì
+€Ø³Ò¡Ã
+€Ø³Õ·Ã
+€ÙèºØ­
+€Ù»Ò¹Ò
+à€ ÊËÒÂÍÔÁà»ê¡«ì
+à€.«Õ.ŸÕ. áÁªªÕ¹à¹ÍÃÕè
+à€·Õ·ÕÅÔÊ«Ôè§
+à€¹ áÁ¡«ì (»ÃÐà·Èä·Â)
+à€¹ áÁç¡«ì (»ÃÐà·Èä·Â)
+à€Ã×ÍÇÑÅÂì
+္¹Ù ÍÔ¹àµÍÃìà·ÃŽ
+á€ÐšéÍÂ
+â€Ãà¹Ê (ä·ÂᏎì)
+âŠÉÔµ
+§ÒÁ¹Ôš
+§ÒÁàŸç­
+à§Ô¹·Ø¹à¡ÕÂõԹҀԹ
+š§¡Å
+š§¡Å³Õ
+š§ÃÑ¡
+š§ÃÑ¡Éì
+š§Åѡɳì
+šµØŸÃ
+šµØŸÅ
+šµØŸÑ¹žì
+šµØÃ§€ì
+šµØÄ·žÔì
+šÃÃÂÒ
+šÃÇŸÃ
+šÃÇÃÞ¹ì
+šÃÑ­
+šÃÑÅ
+šÃÑʪÑÂ
+šÃÑÊŸÅ
+šÃÔ¹·Ãì
+šÃÔ¹žÃ
+šÃÔÂÒ
+šÃÔÂÒÀóì
+šÃØžÔŽÒ
+šÃÙ­
+šàÃ
+šàÃÈÑ¡ŽÔì
+šÍÁ¢ÇÑ­ãš
+šÑ¡Ã¡Äª
+šÑ¡Ã¡Äɳì
+šÑ¡ÃŸÑ¹žì
+šÑ¡ÃÇÒÅ
+šÑ¡Ãѵ¹ì
+šÑ¡ÃÔ¹·Ãì
+šÑ¡ÃÕ
+šÑ¡ÉÇѯ
+šÑŽËÒ§Ò¹ÎÔÇáÁ¹àÍ繚Ôà¹ÕÂÃÔè§
+šÑµÃŽÒÇ
+šÑ¹šÔÃÒ
+šÑ¹··Õ
+šÑ¹·¹Ò
+šÑ¹·Ã
+šÑ¹·ÃìàšéÒ
+šÑ¹·Ãì·ÔŸÂì
+šÑ¹·ÃìžÔÀÒ
+šÑ¹·Ãì¹ÀÒ
+šÑ¹·ÃìŸÃ
+šÑ¹·ÃìàŸç­
+šÑ¹·ÃìÃѵ¹ì
+šÑ¹·ÃìÇÔÁÅ
+šÑ¹·ÃìÇÔäÅ
+šÑ¹·ÃìÊØŽÒ
+šÑ¹·Ô¡Ò
+šÑ¹·ÔÀÒ
+šÑ¹·ÔÁÒ
+šÑ¹·ÔÁÒÀóì
+šÑ¹·ÔÃÒ
+šÒµØŸÃ
+šÒµØÃ§€ì
+šÒµØÃ¹µì
+šÒÃÕÃѵ¹ì
+šÒÃØ³Õ
+šÒÃØ³ÕÂì
+šÒÃØ¹Ñ¹
+šÒÃØºØµÃ
+šÒÃØÃѵ¹ì
+šÒÃØÇÃó
+šÓ¹§
+šÓ¹§€ì
+šÓ»Õ
+šÓÃÑÊ
+šÓàÃÔ­
+šÓÅͧ
+šÔ³³ì
+šÔµµì
+šÔµµì¹ÔÉÒ
+šÔµµÁÒÊ
+šÔµµÒ
+šÔµµÔ
+šÔµµÔ¹¹Ñ¹·ì
+šÔµÃÅŽÒ
+šÔµÃÒ
+šÔµÃÒÀóì
+šÔ¹ŽÒ
+šÔ¹µìšØ±Ò
+šÔ¹µ¹Ò
+šÔßÃ
+šÔßѹžì
+šÔÃÀÑ·Ã
+šÔÃÀÒ
+šÔÃÇÃó
+šÔÃÇѲ¹ì
+šÔÃÈÑ¡ŽÔì
+šÔÃÊØŽÒ
+šÔÃПÃ
+šÔÃПÃó
+šÔÃÐÀÒ
+šÔÃÐÈÑ¡ŽÔì
+šÔÃѪŽÒ
+šÔÃѰµÔì
+šÔÃÒ€Á
+šÔÃҹت
+šÔÃÒŸÃ
+šÔÃÒÀóì
+šÔÃÒÀÒ
+šÔÃÒÂØ
+šÔÃÒÇÃó
+šÔÃÒÇÑÅÂì
+šÔÃÒÇØ²Ô
+šÕ·Õ«Õ ·Ã§ŸÑ¹žì)
+šÕßÃó
+šÕÃÈÑ¡ŽÔì
+šÕÃйѹ·ì
+šÕÃÐÇѲ¹ì
+šÕÍÕ á€»»ÔµÍÅ (»ÃÐà·Èä·Â)
+šÕâÍà·€¹Ô€ (ä·ÂᏎì)
+šØ±Ò·ÔŸÂì
+šØ±ÒŸÑ¹žì
+šØ±ÒÁÒÈ
+šØ±ÒÁÒÊ
+šØ±ÒÃѵ¹ì
+šØ±ÒÇÃó
+šØÃÕÃѵ¹ì
+šØÅÅŽÒ
+šØÌÒ
+šØÌÒÀóì
+šØÌÒÀÒ
+šØÌÒÅѡɳì
+àšµ¹ì
+àš¹
+àš¹šÔÃÒ
+àš¹µì³Ã§€ì
+àš¹à¹ÍÃÑÅ乫ì (»ÃÐà·Èä·Â)
+àš¹ÇÔ·Âì
+àšÃÔ­
+àšÃÔ­ªÑÂËÁéÍá»Å§ä¿¿éÒ
+àšÃÕ§
+àšÉ®Ò
+àšéÒŸÃÐÂÒÁÒÃì€
+àšÔÁªÑÂ
+àšÕÂÁšÔµ
+ášèÁ
+ãšÊÇÇÀì
+©ÅÇÂ
+©Åͧ
+©ÅÒŽ
+©ÇÕÇÃó
+©Íé͹
+©ÑµÃªÑÂ
+©ÑµÃÀóì
+©ÑµÃÈÔÃÔ
+©Ñ¹·¹Ò
+©Ñ¹·Ãѵ¹ì
+©×èÍ šÔé¹ ÎÑéÇ
+©×èÍšÔé¹ÎÑéÇ
+à©ÅÔÁ
+à©ÅÔÁ¢ÇÑ­
+à©ÅÔÁªÑÂ
+à©ÅÔÁªÒµÔ
+à©ÅÔÁŸÑ¹žØì
+à©ÅÕÂÇ
+à©Ô¹
+â©ÁÅŽÒ
+â©ÁÊØŽÒ
+ª.ÊÂÒÁšÑ¡ÃÂÒ¹àŽç¡àÅè¹
+ª®ÒÃѪ
+ªŽÒ¡Ã
+ª¹¹Ñ¹·ì
+ª¹¹ÔÈÒ
+ª¹ÁìÊØÇÃó
+ª¹Ð
+ª¹Ð⪵Ô
+ª¹Ñ­­Ò
+ª¹Ñ°
+ª¹Ñ¹Àóì
+ª¹ÒÀÒ
+ª¹ÔŽÒ
+ªÁ
+ªÁŸÅ
+ªÁŸÙ¹Øª
+ªÁŸÙ¹Ø·
+ªÁÀÑÊÊÃ
+ªÁÀٹت
+ªÁÑŸÃ
+ªäÁŸÃ
+ªÂ¹
+ªÂÒŸÅ
+ªÂÒÀóì
+ªÃѪÊÃÒ
+ªÃѶšÑ¹·Ãì
+ªÃÑÊÃÒ
+ªÃÔ¹·Ãì
+ªÃÔ¹Ãѵ¹ì
+ªÅžÔªÒ
+ªÅžÕ
+ªÅÍ
+ªÅÍÁ
+ªÅÒ¡Ã
+ªÅÔ¡Ò
+ªÅÔŽÒ
+ªÅÔµ
+ªÅÔµÒ
+ªÇ¹
+ªÇ¹ªÁ
+ªÇ¹ŸÔÈ
+ªÇÅÔµ
+ªÇÔÈÒ
+ªèÍ
+ªèͩѵÃ
+ªèÍ·ÔŸÂì
+ªèÍÍÑ­ªÑ­
+ªÐ¹ÔÅ
+ªÐÍé͹
+ªÑªªÑÂ
+ªÑª®Ò
+ªÑªÀ³
+ªÑªÀÑÊÊÃ
+ªÑªÁ³±ì
+ªÑªÁ¹±ì
+ªÑªÇÒÅÂì
+ªÑªÇÒÅìÂ
+ªÑ­­Ò
+ªÑ­ÉÒ
+ªÑÂàšÃÔ­ãªèËÅÕʵÕÅ
+ªÑª¹Ð
+ªÑªҭ
+ªÑ³ç€ì
+ªÑžÇѲ¹ì
+ªÑ¹€Ã
+ªÑ¹ѹ·ì
+ªÑŸÃ
+ªÑŸÅ
+ªÑÂÀÑ·Ã
+ªÑÂÁ§€Å
+ªÑ§³ì
+ªÑÂÂÈ
+ªÑÂÂÐ
+ªÑÂÂØ·ž
+ªÑÂÃѵ¹ì
+ªÑÂÇѲ¹ì
+ªÑÂÊÔ·žÔì
+ªÑÂÊÔ¹žØì
+ªÒ­
+ªÒ­ªÑÂ
+ªÒ­³Ã§€ì
+ªÒ­ÂØ·ž
+ªÒ­ÈÑ¡ŽÔì
+ªÒµÃÕ
+ªÒµÔªÒÂ
+ªÒ¹
+ªÒ¹¹·ì
+ªÒÂ
+ªÒÅÕ
+ªÒÇѳÂì
+ªÓ¹Ò­
+ªÓ¹Ô
+ªÔŽª¹¡
+ªÔ¹
+ªÔ¹ŸÑ¹žì
+ªÔ¹Ãѵ¹ì
+ªÔ¹ÇѲ¹ì
+ªÕÇÒŸÃ
+ª×蹚Եµì
+ªØŽÒŸÃ
+ªØµÔ¡Ò­š¹ì
+ªØµÔÁÒ
+ªØÁŸÃ
+ªØÁŸÅ
+ªØÁÈÔÃÔ
+ªØÁÊÒÂ
+ªØÅÕŸÃ
+ªÙà¡ÉÁ
+ªÙà¡ÕÂõÔ
+ªÙšÔµ
+ªÙšÔµµì
+ªÙªÑÂ
+ªÙªÒµÔ
+ªÙªÕŸ
+ªÙŸ§Èì
+ªÙŸ§Éì
+ªÙÈÑ¡ŽÔì
+ય°¡Ã
+àªÉ°Ò
+àªÍÃÔè§-ŸÅÒÇ á͹ÔÁÑÅ àÎéŪ
+àªÍÃÔè§-ŸÅÒÇá͹ÔÁÑÅàÎçÅž
+àªÒǹҭ
+àªÒÇÅÔµ
+àªÔŽšÔµµì
+àªÔŽªÑÂ
+àªÔŽÈÑ¡ŽÔì
+àªÕ§àΧ¡ÒêèÒ§
+àªÕèÂǪҭ ÍÔ¹ŽÑÊ·ÃÕè (1989)
+àªÕèÂǪҭÍÔ¹ŽÑÊ·ÃÕè (1989)
+àªÕèÂǪҭÍÔ¹ŽÑÊ·ÃÕ (1989)
+àªÕèÂǪҭÍÔ¹ŽÑÊ·ÃÕè(1989)
+⪀
+⪀ªÑÂ
+⪵Ô
+⪵ÔÃÊ
+⪵ÔÇØž
+äªÂ¹Ñ¹·¹ì
+äªÂÁ§€Å
+äªÂÃѵ¹ì
+äªÂÒ
+«è͹¡ÅÔè¹
+«Òâµéâ€à¡ÕÂÇ ¡Ãاෟ
+«Ô¡»éÒ (»ÃÐà·Èä·Â)
+«Õ àÍç¹ äÍ
+«Õ ŽÕ àÍçÁ àÍç¹àµÍÃìäŸÃÊì
+«Õ.ŽÕ.ÍØµÊÒË¡ÃÃÁ
+«Õ.·Õ.à·àÅ€ÍÁ
+«Õ.ÇÕ.àÍÊ.ÍÔ¹ŽÑʵÃÕé
+«ÕŽÕ ÍØµÊÒË¡ÃÃÁ
+«ÕàÍç¹äÍàÍ繚Ôà¹ÕÂÃÔè§«ÑŸŸÅÒÂ
+«Ù
+à«ÒÐ
+à«ÕÂÁà¡ÕÂÇ
+­Ò³ÀÑ€
+­Õ¹ÀÒ
+¯Ç§¡ÁÅ
+°Ò¹Ñ¹·ì
+°Ò¹ÔµÂì
+°Ò¹ÔÊÃ
+°Ò»¹ÇÔ·Âì
+°Ôµ¡Ò¹µì
+°ÔµÔ¡Ò¹µì
+°ÔµÔ³Ñ°
+°ÔµÔàžÕÂÃ
+°ÔµÔ¹Ñ¹·ì
+°ÔµÔŸ§Èì
+°ÔµÔŸÃ
+°ÔµÔÁÒ
+°ÔµÔÃѪµì
+°ÔµÔÃѵ¹ì
+±ÔÁÀì¹Øª
+³žÔµÒ
+³ÀÑ·Ã
+³Àѷáóì
+³Ã§€ì
+³Ã§€ìªÑÂ
+³Ã§€ìŸÑªÃì
+³Ã§€ìÄ·žÔì
+³Ã§€ìÇÔ·Âì
+³Ã§€ìÈÑ¡ŽÔì
+³Ã§ÃÑ¡Éì
+³Ã§Ä·žÔì
+³Ã§ÈÑ¡ŽÔì
+³Ë·ÑÂ
+³ÑªªÒ
+³Ñ­­Ò
+³Ñ®°ÁÑÂ
+³Ñ®°ÇÃó
+³Ñ¯ŸÅ
+³Ñ°
+³Ñ°¡Ã³ÔÈÒ
+³Ñ°¡ÄµÒ
+³Ñ°¡Ò¹µì
+³Ñ°¢šÃ
+³Ñ°ª¹Ñ­
+³Ñ°ªÒ
+³Ñ°°Ò
+³Ñ°µÂÒ
+³Ñ°¹¹·ì
+³Ñ°¹Ñ¹·ì
+³Ñ°»¡Ã³ì
+³Ñ°Ÿ§Èì
+³Ñ°Ÿ§Éì
+³Ñ°Ÿš¹ì
+³Ñ°ŸÃ
+³Ñ°ŸÅ
+³Ñ°ÀÙÁÔ
+³Ñ°Á¹
+³Ñ°ÁÒ
+³Ñ°ÂÒ
+³Ñ°ÇÃÕÂì
+³Ñ°ÇѪÃì
+³Ñ°ÇѲ¹ì
+³Ñ°ÇѵÔ
+³Ñ°ÇزÔ
+³Ñ°ÈÑ¡Âì
+³Ñ°ÊÃÑ­
+³Ñ°Ë·ÑÂ
+³Ñ°Ô¡Ò
+³ÔªÒ¡Ã
+³Õç€ì
+³Øªª¹Ò
+޹ÑÂ
+Ž¹ØŸÅ
+ŽÃÃ쪹Õ
+ŽÃسÕ
+ŽÅÄŽÕ
+ŽÅÄ·ÑÂ
+ŽÇ§¡ÁÅ
+ŽÇ§šÑ¹·Ãì
+ŽÇ§ãš
+ŽÇ§ŽÒÇ
+ŽÇ§àŽ×͹
+ŽÇ§¹ÀÒ
+ŽÇ§ºÅ
+ŽÇ§ŸÃ
+ŽÇ§Á¹·Ãì
+ŽÇ§Ãѵ¹ì
+ŽÇ§Ë·ÑÂ
+ŽÍ¡äÁé
+ŽÒóÕ
+ŽÒùÕÂì
+ŽÒÃÒ¹ÕÅì
+ŽÒÃÒÃѵ¹ì
+ŽÒÃÒÇÃó
+ŽÒÃÔ¡Ò
+ŽÒÃÔ³Õ
+ŽÒÃÔ¹
+ŽÒÃØ³Õ
+ŽÒÇ»ÃСÒÂ
+ŽÒÇÃÕ
+ŽÓà¹Ô¹
+ŽÓç
+ŽÓç€ì
+ŽÓËÃÔ
+ŽÔàá
+ŽÔÈ¡ØÅ
+ŽÔʷѵ
+ŽÕ.ºÕ.äŽÁ͹Žì (»ÃÐà·Èä·Â)
+ŽØÅŸÅ
+ŽØÅÂìŸÑ²¹ì
+ŽØÉ®Õ
+ިɳÕ
+ŽØÉŽÕ
+ŽØÊÔµ
+ŽØÊÔµà€ÁÕÀѳ±ì
+àŽª
+àŽªÒ
+àŽÍЀÇÍÅÔµäÇÃì
+àŽ×͹¹ÀÒ
+àŽ×͹àŸç­
+âŽÁ
+äŽÍСÅêÒÊ
+µè͚ѡÃ
+µÐÅèÍÁÊÔ¹ŸÅÒʵԡ
+µÐÇѹ
+µÑè§šÑè§ËÅÍŽä¿
+µÒà¿çŽ
+µØê
+µØê¡µÒ
+µØéÁ
+µØëÂ
+µØÅÒÅѡɳì
+àµçÁàŽª
+àµ×͹ãš
+àµ×͹µÒ
+ãµé à«é§ «Ñ¹
+äµÃ·È
+äµÃà·Ÿ
+äµÃç€ì
+¶¹ÍÁÈÑ¡ŽÔì
+¶¹ÔµŸÅ
+¶ÇÑÅ
+¶ÇÑÅÂì
+¶ÇÔÅ
+¶Ò³ØŸ§Èì
+¶ÒÇÃ
+à¶ÅÔ§ÈÑ¡ŽÔì
+·¹§ÈÑ¡ŽÔì
+·¹Ø
+·Ã§
+·Ã§ªÑ»Ñè¹·Í
+·Ã§žÃÃÁ
+·Ã§ŸÅ
+·Ã§ÇزÔ
+·Ã§ÈÃÕ
+·Ã§ÈÑ¡ŽÔì
+·Ã§ÈÔÃÔ
+·ÃÃȹÕÂì
+·ÃÑŸÂì¶ÒÇÀéÒÇÑÊŽØ
+·ÇÔª
+·ÇÕ
+·ÇÕªÑÂ
+·ÇÕ»
+·ÇÕŸÃ
+·ÇÕÇѲ¹ì
+·ÇÕÈÃÕ
+·ÇÕÈÑ¡ŽÔì
+·ÈŸÃ
+·ÈŸÅ
+·Í§¢ÒÇ
+·Í§€Ó
+·Í§ãº
+·Í§»Ò¹
+·Í§ŸÑ¹žì
+·Í§ŸÑ¹žØì
+·Í§ÊØ¢
+·Í§ÍÔ¹·Ãì
+·Ñ¡ÉÁ³¹ì
+·ÑŽŽÒÇ
+·Ñº·ÔÁ
+·ÑȹÇÃó
+·Ñȹ՟Ã
+·ÑȹÕÂì
+·ÑȹÕÂÒ
+·ÑÈÇÃó
+·èÒ·ÃÒÂášé§ÇѲ¹Ò
+·ÔŠÑÁŸÃ
+·Ô¹á€¹ ÍÔ¹ŽÑÊ·ÃÕ
+·ÔŸÂìŸÒŸÃ
+·ÔŸÂìÇŽÕ
+·ÔŸÂìÇÃó
+·ÔŸÂìÇÃØ³
+·ÔŸÂìÇÑÅÂì
+·ÔŸÂìÇÒÃÕ
+·ÔŸÂìÇÔÁÅ
+·ÔŸÇÃó
+·ÔŸÇÑÅÂì
+·ÔŸÇÔÁÅ
+·ÔŸÊØŽÒ
+·ÔŸÒ¡Ã
+·ÔŸÒÇÃó
+·ÔÇÒ
+·ÔÈŸÅ
+·Õ «Õ ŸÕ ÍÔ¹ŽÑÊ·ÃÕé
+·Õ.«Õ.«Õ.ŸÃçÍŸàŸÍÃìµÕé
+·Õ.«Õ.ŸÕ.ÍÔ¹ŽÑÊ·ÃÕé
+·Õ.àÍÊ.äÇÃì€Ñ· á͹Žì áÁªªÕ¹ŸÒÃì·
+·Õ.äÍ.·Õ.ÍÔ¹àµÍÃì๪Ñè¹á¹Å
+·ÕâÍàÍ âŽ¿à€Á ÍÔ¹ŽÃÑʵÕé
+·ÙÁÔ¹Ô·Êì ºÔ«Ôà¹Ê
+·ÙÃ
+à·Ÿ
+à·ŸŸÔºÙÅ
+à·ŸÄ·žÔì
+à·ÇÒ
+à·ÇÕ
+à·ÔŽä·
+ä·Â
+ä·Â €Í¹Êì á͹Žì ºÔÅŽÔé§
+ä·Â ŽÕ à͹ ·Õ àŸ¹·ì
+ä·Â-àÍà«Õ ŸÕ.ÍÕ.äŸéŸì
+ä·Âà¡ÃÕ§ÊÔè§·Í
+ä·Â€Òà«ÎÔ¹
+ä·Âà€ÁÕÀѳ±ì
+ä·Âà«ç¹·ÃÑÅ à€ÁÕ ª¹)
+ä·Âà«ç¹·ÃÑÅà€ÁÕ
+ä·Âà«çÅ·ÃÑÅà€ÁÕ ª¹)
+ä·ÂŽÕà͹·ÕàŸ¹·ì
+ä·Âµ§¹ÔµµÔé§
+ä·Âž¹ÒŸÒ³ÔªÂì
+ä·ÂžÒ¹Õà€ÁÕ
+ä·ÂŸÃçÍ¡«ì
+ä·ÂàŸÔèÁŸÅÒʵԡ
+ä·ÂÂÙà¹Õ¹€ÇÍÅÅÔµÕé
+ä·ÂàÇÅ€Í¹ÍØµÊÒ¡ÃÃÁ
+ä·ÂÍÔ¹àµÍÃì €ÍµµÍ¹¡Ò÷Í
+ä·ÂÍÔ¹àµÍÃì ÍÐâÃàÁµÔ¡Êì
+ž§ªÑÂ
+ž§äªÂ
+ž³Ñ°
+ž¹¡Ã
+ž¹¡Äµ
+ž¹ŸÃ
+ž¹ŸÅ
+ž¹ÃѪ
+ž¹Ãѵ¹ì
+ž¹âÚ¹ì
+ž¹ÇŽÕ
+ž¹ÇѲ¹ì
+ž¹Çѹ
+ž¹ÇÔµµ
+ž¹ÇÔ·Âì
+ž¹ÊÔ·žÔì
+ž¹ÐÃѪµì
+ž¹ÑªžÔŽÒ
+ž¹Ñ­­Ò
+ž¹Ñ¹µì
+ž¹Ñ¹·ì
+ž¹ÑÊ
+ž¹Ò
+ž¹Ò€ÒÃ¡ÃØ§ÈÃÕÍÂØžÂÒ º
+ž¹Ò€ÒÃÂÙâÍºÕ Ãѵ¹ÊÔ¹ ÊÒ¢ÒËÑÇËÁÒ¡
+ž¹ÒÀóì
+ž¹ÒÀÒ
+ž¹ÒÃÑ¡Éì
+ž¹ÒÇѪÃì
+ž¹ÔŽÒ
+ž¹ÔɰÒ
+ž¹Ù
+žà¹È
+žà¹ÈÃì
+žÁ¹Ñ¹·ì
+žÃÃÁ¹Ù­
+žÃÃÁÈÒʵÃì
+žÄµ
+žÇѪ
+žÇѪªÑÂ
+žÇÑÅÃѵ¹ì
+žÑª¡Ã
+žÑªŸÅ
+žÑªÇŽÕ
+žÑªÇѲ¹ì
+žÑ­ª¹¡
+žÑ­­žÃ
+žÑ­­ŸÑ²¹ì
+žÑ­³ÔªÒ
+žÑ­¹Ñ¹·ì
+žÑ­ŸÃ
+žÑ­ŸÔÊÔ·žÔì
+žÑ­ÃŽÒ
+žÒ¡Ã
+žÒŽÒ
+žÒ¹Ô¹·Ãì
+žÒ¹Õ
+žÒ÷ԟÂì
+žÒÃÒ
+žÒÃÔ¹Õ
+žÓç€ì
+žÓçÃѵ¹ì
+žÔŽÒÃѵ¹ì
+žÔµÔ¹Ñ¹·ì
+žÔ¹Õ¡Ò­š¹ì
+žÕêÑÂ
+žÕùت
+žÕß§Èì
+žÕß§Éì
+žÕßÅ
+žÕßѲ¹ì
+žÕÃÀÑ·Ãì
+žÕÃÀÒŸ
+žÕÃÇѲ¹ì
+žÕÃÈÑ¡ŽÔì
+žÕÃÈÒ¹µÔŸÑ¹žì
+žÕÃÐ
+žÕÃЪÑÂ
+žÕÃПÅ
+žÕÃÐÇѲ¹ì
+¹ ŸŽÅ
+¹ à¿ÃÔÁàÁ¹¹Ôª ÍâÃáÁµÔê¡Êì ŸÕ·ÕÍÕ ÅÔÁÔàµç
+¹€Ã
+¹€Ã»°Á Î͹ŽéÒ€ÒÃìÊì (1994)
+¹§ª¹¡
+¹§¹Øª
+¹§Åѡɳì
+¹·
+¹·Ô¹
+¹·Õ
+¹¹·ÈÑ¡ŽÔì
+¹Ÿà¡éÒ
+¹ŸŽÅ
+¹ŸŽÅÂì
+¹Ÿ·Ñµ
+¹ŸŸ§€ì
+¹ŸŸÃ
+¹ŸŸÅ
+¹ŸÁÒÈ
+¹ŸÃѵ¹ì
+¹ŸÄÔ·žÔì
+¹ŸÇÃó
+¹ŸÒŸÃ
+¹ÀŽÅ
+¹ÀÇÃó
+¹ÀÑÊÊÃ
+¹ÀÑÊÊØÇÃó
+¹ÀÒ
+¹ÀÒŸÃ
+¹ÀÒÂØ·žì
+¹ÀÒÇÃó
+¹ÀÔ¹·Ã
+¹ÃªÑÂ
+¹ÃŸÅ
+¹ÃÀÑ·Ãì
+¹ÃÒ
+¹ÃÔ¹·Ãì
+¹ÃÔ¹·ÃìàŽª
+¹ÃÔÈ
+¹ÃÔɰ
+¹ÃÕ
+¹àÃÈ
+¹âõÁì
+¹Ä³Õ
+¹ÄŽÕ
+¹Ä·žÔì
+¹ÄÁÅ
+¹ÄÁÒ³
+¹ÅŸÃó
+¹Ç¡Ã³ì
+¹ÇŸÅ
+¹ÇÃѵ¹ì
+¹ÇŚѹ·Ãì
+¹ÇÅ©ÇÕ
+¹ÇÅŸÃ
+¹ÇÅÅÐÍÍ
+¹Ñ­ªÅÒ
+¹Ñ¯ŸÃ
+¹Ñ±ŸÃ
+¹Ñ·ª¹¡
+¹Ñ·žÁ¹
+¹Ñ¹ªÑÂ
+¹Ñ¹·ªÑÂ
+¹Ñ¹·¹ì
+¹Ñ¹·¹Ò
+¹Ñ¹·ŸÃ
+¹Ñ¹·ŸÅ
+¹Ñ¹·ÁÒÊ
+¹Ñ¹·Ãѵ¹ì
+¹Ñ¹·Ç§Éì
+¹Ñ¹·ÇÃó
+¹Ñ¹·ÈÑ¡ŽÔì
+¹Ñ¹·Ò
+¹Ñ¹·Ô¡Ò¹µì
+¹Ñ¹·ÔÂÒ
+¹Ñ¹Ò
+¹Ò¯Êǧ
+¹ÒµÂÒ
+¹ÒÁ
+¹ÒÃÔ¹·Ãì
+¹ÒÃÕ
+¹ÒÃÕÃѵ¹ì
+¹ÒÇÔ¹Õ
+¹éÓ·ÔŸÂì
+¹éÓœ¹
+¹ÓŸÅ
+¹éÓàŸªÃ
+¹éÓÁѹ€ÒÅà·ê¡«ì
+¹ÓÃØè§ä·Â ¡ÒÃìàÁ¹·ì
+¹éÓÍéÍÂ
+¹Ô¡Éì
+¹Ô€Á
+¹ÔªÃªÕŸ
+¹Ôà«Ð
+¹ÔŽ
+¹ÔŽÒ
+¹ÔµÂì
+¹ÔµÂÒ
+¹ÔµÔ
+¹ÔµÔŸ§Éì
+¹ÔµÔÁÒ
+¹Ô·ÃÒ
+¹Ô·Ñȹì
+¹Ô·ÑȹÕÂì
+¹ÔžÔÇŽÕ
+¹Ô»»Í¹àŸ¹µì(»ÃÐà·Èä·Â)
+¹ÔŸ¹žì
+¹ÔŸÅ
+¹ÔŸÑ·žÒ
+¹ÔŸÑ¹
+¹ÔÀÒ
+¹ÔÂÁ
+¹ÔÃÁÅ
+¹ÔÃѹŽÃ
+¹ÔÃÒÇÃóì
+¹ÔÃØš¹ì
+¹ÔÃØµµì
+¹ÔÅÀÒ
+¹ÔÅØºÅ
+¹ÔâźÅ
+¹ÔÇૹšÙÃÕèŸÃÔé¹µÔé§á͹Žì ៀ࡚šÔé§
+¹ÔÇѲ¹ì
+¹ÔÇѵÃì
+¹ÔÇѵÔ
+¹ÔÇÒµ
+¹ÔÈÃÒ
+¹ÔÈÒªÅ
+¹ÔÈÒŸÃ
+¹ÔÊÒ
+¹ÕµÔ
+¹ØªšÃÔ¹·Ãì
+¹Øª¹Ò¶
+¹ØªÂÒ
+¹ØªÃÕ
+¹ØÈÃÒ
+¹ØÊºÒ
+¹ØÊÃÒ
+๵ÎÒÇ
+à¹ÒÇÃѵ¹ì
+º§¡ª
+º§¡µÃѵ¹ì
+º«ì ÍÔ¹â¿Ãì à«ÍÃìÇÔÊ
+ºÃÚ§
+ºÃÚº
+ºÃÃàšÔŽ
+ºÃç
+ºÃÃÊÒÃ
+ºÃÔÇÃõ
+ºÇêÑÂ
+ºÑ§ÍÃ
+ºÑ­ªÒ
+ºÑ­­ÑµÔ
+ºÑ³±Ôµ
+ºÑ³±ÔµÂì
+ºÑµÃ¡Ãاä·Â
+ºÑµÃ¡ÃاÈÃÕÍÂØžÂÒ
+ºÑ¹Å×ÍÈÑ¡ŽÔì
+ºÒ§¡Í¡ªÕ·àÁç··ÑÅ
+ºÒ¹ªéÍÂ
+ºÓÃØ§ä·Â
+ºÔǵÕéៀ
+ºÕ ÇÒ €ÍÃìâŸàêÑè¹ šÓ¡ÑŽ
+ºÕ á͹Žì «Õ ŸÙÅÒÊ¡Õé
+ºÕ.àÍç¹.ºÃÒàŽÍÃì
+ºÕ.àÍÊ.äÍ.àËÅç¡¡èÍÊÃéÒ§
+ºØ­à¡ÕÂõÔ
+ºØ­€§
+ºØ­ªèÇÂ
+ºØ­ªÑÂ
+ºØ­ªØº
+ºØ­àªÔŽ
+ºØ­«é͹
+ºØ­·ÃÑŸÂì
+ºØ­·ÇÕ
+ºØ­·Í§
+ºØ­žÃÃÁ
+ºØ­»ÃÐÊÔ·žÔì
+ºØ­Ÿ§Éì
+ºØ­ÁÕ
+ºØ­Âѧ
+ºØ­àÂÕèÂÁ
+ºØ­ÃèÇÁ
+ºØ­ÃÑ¡
+ºØ­ÅѺ
+ºØ­Å×Í
+ºØ­àÅÔÈ
+ºØ­ÈÃÕ
+ºØ­ÈÔÃÔ ŽÕÇÔÅÍ»àÁ¹·ì
+ºØ­Êè§
+ºØ­Ê¹Í§
+ºØ­ÊÔ¹
+ºØ­Ê׺
+ºØ­ÊØ¢
+ºØ­áʧ
+ºØ³±Ôµ
+ºØ»ŒÒ
+ºØÃÑ­ªÅÕ
+ºØÃÔ¹·Ãì
+ºØÈÃÒ
+ºØÈÃÒŸÃ
+ºØÈÃÔ¹·Ãì
+ºØÉ¡Ã
+ºØÉºÒ
+ºØÉÂÒ
+ºØÉÃÒÀóì
+ºØËÅÑè¹
+ºÙê·Êì (»ÃÐà·Èä·Â)
+ºÙê·ÊìáÁ¹Ùá¿€àšÍÃìÃÔè§ (»ÃÐà·Èä·Â)
+ອšŸÃ
+ອšÁÒ
+ອšÅÑ¡É³ì ŸÃÔé¹µÔé§
+ອšÇÃó
+àºç­ÇÃó
+àºç·à·ÍÃì äÅ¿ì
+»¡Ã³ì
+»®ÔÁÒ
+»¯Ô­­Ò
+»¯ÔŸÅ
+»¯ÔÁÒ
+»°ÁÇѲ¹ì
+»³ªÑÂ
+»³ÔŽÒ
+»³ÔµÒ
+»·ØÁ
+»·ØÁŸÃ
+»·ØÁÒ
+»¹ÑŽŽÒ
+»ÀÑÊÊÃ
+»ÀÒ³Ø
+»ÀÒÇŽÕ
+»ÀÒÇÃÔ¹·ì
+»ÀÒÇÕ
+»ÂصÒ
+»ÃСͺ
+»ÃСÒÈ
+»ÃСÒÈÔµ
+»ÃСԚ
+»ÃСԵ
+»ÃЀͧ
+»ÃК§šÔµ
+»ÃКǺ
+»ÃКѡÉì
+»ÃКԵÃ
+»ÃЪÒ
+»ÃЪԵ
+»ÃЪØÁŸÃ
+»Ãгµ
+»ÃÐŽÔɰì
+»ÃзѺãš
+»Ãзջ
+»ÃзØÁ·ÔŸÂì
+»ÃÐà·×ͧ
+»ÃПš¹ì
+»ÃП¹žì
+»ÃПķžÔì
+»ÃПѲ¹ì
+»ÃПѹžì
+»ÃÐäŸ
+»ÃÐÀÑÊ
+»ÃÐÀÑÊÃì
+»ÃÐÀÑÊÃÒŸÃ
+»ÃÐÀÑÊÊÃ
+»ÃÐÀÒŸÃ
+»ÃÐÀÒŸÃó
+»ÃÐÀÒÀóì
+»ÃÐÀÒÊ
+»ÃÐÁÇÅ
+»ÃÐÁÑŸÃ
+»ÃÐÁÙÅ
+»ÃЧ€ì
+»ÃÐÂÔ¹
+»ÃÐÂØ·ž
+»ÃÐÂÙÃ
+»ÃÐÂÙÃÈÃÕ
+»ÃÐ⪹ì
+»ÃÐÇѵÃ
+»ÃÐÇѵÔ
+»ÃÐÇÔµÃ
+»ÃÐÇÔ·
+»ÃÐÇÔ·Âì
+»ÃÐÇÕ³Ò
+»ÃÐàÇÈ
+»ÃÐʧ€ì
+»ÃÐÊÒ·
+»ÃÐÊÒ¹
+»ÃÐÊÒÃ
+»ÃÐÊÔ·žÔì
+»ÃÐÊ׺
+»ÃÐàÊÃÔ°
+»ÃѪ­Ò
+»ÃÒ¡ÒÃ
+»ÃÒ§³Õ
+»ÃÒª­ì
+»ÃÒ³Õ
+»ÃÒ³ÕÂì
+»ÃÒâÁ·Âì
+»ÃÒö¹Ò
+»ÃÔ­­ì
+»ÃÔ­­Ò
+»ÃÔ­ŽÒ
+»ÃÔ³ŽÒ
+»ÃÔ·ÑÈ
+»ÃÔ¹ŽÒ
+»ÃÔÂÒÇÃó
+»ÃÔȹÒ
+»ÃÔȹÕ
+»ÃÕªÒ
+»ÃÕ­Ò
+»ÃÕÂÒÀóì
+»ÇÕ³ÃѪ
+»ÇÕ³Ò
+»Êѹµì
+»Êѹ¹ì
+»Í§ÀŸ
+»Ñ­šÃÑÈÁÔì
+»Ñ­­Ò
+»Ñ­­ÒŸÃ
+»Ñ­­ÒŸÅ
+»Ñ³ÃÊÕ
+»Ñ·Á
+»Ñ·ÁÒ
+»Ñ·ÁÒÇŽÕ
+»Ò³ÔÊÃÒ
+»Ò¹
+»Ò¹àŸªÃ
+»ÒÃÔªÒµ
+»ÒÃÔªÒµÔ
+»ÒÃԟѹžì
+»ÒÃÕ³Ò
+»Ò˹ѹ
+»ÔµÔ
+»ÔµÔÇѪÃì
+»Ôè¹Á³Õ
+»Ôè¹ÁÒ⹪
+»Ô¡ҭš¹ì
+»Ô¹ѹ·ì
+»Ô¹ү
+»ÔŸ§Èì
+»ÔŸ§Éì
+»ÔŸÃ
+»ÔÂÁÒÀóì
+»ÔÂÃѵ¹ì
+»ÔÂÇÃó
+»ÔÂÇѲ¹ì
+»ÔÂÈÑ¡ŽÔì
+»ÔÂÐ
+»ÔÂЪÑÂ
+»ÔÂй¹·ì
+»ÔÂйѹ·ì
+»ÔÂйت
+»ÔÂП§Èì
+»ÔÂПÃ
+»ÔÂПѹžì
+»ÔÂПѹžØì
+»ÔÂÐÁÒÈ
+»ÔÂÐÈÑ¡ŽÔì
+»ÔÂÒŸÃ
+»ÔÅѹ­Ò
+»Ø³³ÂÒ
+à»à»ÍÃìÅÔ¿
+à»ÃÁ
+à»ÃÁ»ÃÐÀÒ
+à»ÃÁÄŽÕ
+à»ÃÁÈÃÕ
+à»ÃÁÊÔ·žÔì
+à»ÕèÂÁÊØ¢
+á»Å¹âÁ·Ô¿
+Œ¡Ò¡Ãͧ
+Œ¡ÒŸÃó
+Τ
+Œš§šÔµµì
+ŒŽØ§ÈÑ¡ŽÔì
+ŒàŽÔÁ
+ŒèͧŸÃó
+ŒèͧÈÃÕ
+Œè͹»ÃÐÀÒ
+ŒéÒ¢¹Ë¹ÙªÔ¹àΧ
+ŒéÒ¢¹Ë¹Ù«Ô¹àΧ
+ŒéҢع˹٫ԹàΧ
+ŒèÒ¹¿éÒ àÍ繚Ôà¹ÕÂÃÔè§
+ŒèÒ¡ÒÀÅѧ¡Í§¡ÅÒ§Êӹѡ»ÅÑŽ¡ÃاෟÁËÒ¹€Ã
+ŒÒÊØ¢
+ŒØÊŽÕ
+ŒÙéàŒŽçš
+ŒÙéãË­èàÅç¡
+àŒŽçš
+àŒÔ§
+䌷
+œèÒ¡ÒÀÅѧ¡Í§¡ÅÒ§ Êӹѡ»ÅÑŽ¡ÃاෟÁËÒ¹€Ã
+Ÿ§Èìà¡ÕÂõÔ
+Ÿ§ÈìªÒÂ
+Ÿ§Èìà·Ÿ
+Ÿ§ÈžÃ
+Ÿ§ÈìŸÑ¹žì
+Ÿ§ÈìŸÔŸÑ²¹ì
+Ÿ§ÈìÀÑ€
+Ÿ§ÈìÊØà¡ÉÁ
+Ÿ§Éìà·Ÿ
+Ÿ§ÉìŸÃ
+Ÿ§ÉìÈÑ¡ŽÔì
+Ÿ§ÉìÊѹµì
+Ÿ§Éì͹ѹµì
+Ÿš¹ì
+Ÿš¹Ò
+Ÿš¹Òö
+Ÿš¹ÕÂì
+ŸšÁÒ¹
+ŸšÁÒÅÂì
+Ÿ¹Á
+Ÿ¹ÁªÑÂ
+Ÿ¹ÒÊѹ±ì
+Ÿ¹ÔŽÒ
+ŸÂ¹µì
+ŸÂا
+ŸÃ
+ŸÃ¡ÇÕ
+ŸÃšÔµµì
+ŸÃªÑÂ
+ŸÃ·ÔŸÂì
+ŸÃ·ÔŸÒ
+ŸÃ·ÔÀÒ
+ŸÃà·Ÿ
+ŸÃ¹·Õ
+ŸÃ¹ÀÒ
+ŸÃ¹ÔµÔ¿ÔÅìÁá͹ŽìÇÕŽÕâÍ
+ŸÃŸ§Éì
+ŸÃŸ¹Ò
+ŸÃŸÃó
+ŸÃŸÅ
+ŸÃŸÅÒ§ÒÁ
+ŸÃŸÔÁÅ
+ŸÃŸÔäÅ
+ŸÃàŸç­
+ŸÃÁ§€Åà¿ÍÃì¹ÔàšÍÃì
+ŸÃó·ÔÀÒ
+ŸÃó¹ÔÀÒ
+ŸÃó»ÃÐäŸÇŽÕ
+ŸÃóŸÃÃÉ
+ŸÃóŸÔÁÅ
+ŸÃóÃÒ³ì
+ŸÃóÊóì
+ŸÃóԡÒ
+ŸÃóÕ
+ŸÃÞԎÒ
+ŸÃÇÔÁÅ
+ŸÃÇÔäÅ
+ŸÃÈÑ¡ŽÔì
+ŸÃÈÔÃÔ
+ŸÃÊÃǧ
+ŸÃÊÇÃÀì
+ŸÃËÁŸÑ²¹ì
+ŸÃéÍÁªÑÂ
+ŸÃлÃÐᎧ Î͹ŽéÒ€ÒÃìÊì
+ŸÃлÃÐᎧ Î͹ŽéÒ€ÒÃìÊì šÓ¡ÑŽ
+ŸÃÐÃÒÁ 3 €ÒÃìà«ç¹àµÍÃì
+ŸÃÐÃÒÁ 3 Î͹ŽéÒ€ÒÃìÊì
+ŸÃÔéÁàŸÃÒ
+ŸÃÕàÁÕÂÃìà€ÁÔ€ÑÅ á͹ŽìŸÅÒʵԡ
+ŸÃÕàÁÕÂÃìÍÔ¹àµÍÃìÅÔ««Ôè§
+ŸÅ¡Äɳì
+ŸÅªÑÂ
+ŸÅà·Ÿ
+ŸÅŸÑªÃì
+ŸÅŸÑ²¹ì
+ŸÅÊÔ·žÔì
+ŸÇ§·Í§
+ŸÇ§àŸç­
+ŸÇ§Ãѵ¹ì
+ŸÈÔ¹
+ŸÊØà¡µÔì
+ŸÑª¹Õ
+ŸÑªÃ
+ŸÑªÃÇäÅ
+ŸÑªÃÒ
+ŸÑªÃÒÀóì
+ŸÑªÃÒÀÒ
+ŸÑªÃÔ¹·Ãì
+ŸÑªÃÕ
+ŸÑªÃÕŸÃ
+ŸÑªÃÕÀóì
+ŸÑ²·ÇÕ
+ŸÑ²¹ªÑÂ
+ŸÑ²¹Ð
+ŸÑ²Ÿ§Éì
+ŸÑ·žìžÕÃÒ
+ŸÑÅÅÀ
+ŸÑÊŸÃ
+ŸÒ³ÔªÂì
+ŸÒ³Õ
+ŸÒâµà€ÁÕÍØµÊÒË¡ÃÃÁ
+ŸÒ¹·Í§
+ŸÒÃҡ͹ÍÔ¹â¿à·€
+ŸÔ ÈÁÑÂ
+ŸÔšÔµÃÒ
+ŸÔª­ì
+ŸÔªŽÒ
+ŸÔªÂÒ
+ŸÔªÑÂ
+ŸÔªÑÂÇѲ¹ì
+ŸÔªÔµ
+ŸÔªÔµŸÅ
+ŸÔય
+ŸÔય°ì
+ŸÔàªÉ°
+ŸÔàªÉ°ì
+ŸÔ±ÙÃÂì
+ŸÔ³ªØŽÒ
+ŸÔ³¹ÀÒ
+ŸÔ·ÂÒ
+ŸÔ·Ñ¡Éì
+ŸÔà·Ÿ
+ŸÔžÒ¹¡Ã
+ŸÔ¹¹ÔÀÒ
+ŸÔºÙÅÂì
+ŸÔŸÑ²¹ì
+ŸÔÀŸ
+ŸÔÁŸìãš
+ŸÔÁŸìª¹¡
+ŸÔÁŸì»ÃПÃó
+ŸÔÁŸìŸÃ
+ŸÔÁŸìÀóì
+ŸÔÁŸìÀÑ€
+ŸÔÁŸìÇÔÁÅ
+ŸÔÁÀÒ
+ŸÔÁÅ
+ŸÔÃÁÂì
+ŸÔÃØ³
+ŸÔÈÔɰì
+ŸÔɳØ
+ŸÔÊÁÑÂ
+ŸÔÊÔ°
+ŸÔÊÔ·žÔì
+ŸÔÊÔɰì
+ŸÕ.«Õ.àºÊ·ì €ÃÕàÍ·
+ŸÕ.àÍÊ.šÕ ÅÔÊ«Ôè§
+ŸÕ.àÍÊ.ŸÅÒʵԡºÃÒàŽÍÃì á͹Žì«Ñ¹
+ŸÕ.àÍÊ.ŸÅÒʵԡºÃÒàŽÍÃìá͹Žì«Ñ¹
+ŸÕ¹Ô¡«ì àÍç¡«ìàŸÃÊ
+ŸÕ¹Ô¡«ìàÍç¡«ìàŸÃÊ
+ŸÕ÷ѵ
+ŸÕßѲ¹ì
+ŸÕÃÇØ²Ô
+ŸÕÃÈÔÅ»ì
+ŸÕÃÐ
+ŸÕÃП§Èì
+ŸÕÃПÅ
+ŸÕÃÐÈÑ¡ŽÔì
+ŸÙ¹ŸÑ¹žì
+ŸÙ¹ÈÑ¡ŽÔì
+ŸÙŷͧŸÃçÍŸàŸÍÃìµÕé_
+ŸÙÅŒÅ
+àŸç§ ¿Ù ËÅÔ¹
+àŸçªÃì
+àŸªÃÃѵ¹ì
+àŸªÃÅŽÒ
+àŸªÃÔ¹·Ãì
+àŸç­šÑ¹·Ãì
+àŸç­·ÔŸÂì
+àŸç­¹ÀÒ
+àŸç­»ÃÐÀÒ
+àŸç­Œ¡Ò
+àŸç­ŸÔäÅ
+àŸç­ÈÃÕ
+àŸÃÔÁàÁ¹¹Ôª ÍâÃáÁµÔê¡Êì ŸÕ·ÕÍÕ ÅÔÁÔàµçŽ
+àŸÅÔ¹šÔµµì
+àŸÅԹĎÕ
+àŸÕ§ŸÃ
+៎ŽÔé§ (ä·ÂᏎì)
+៎ŽÔé§(ä·ÂᏎì)
+៹ŽéÒ à»à»ÍÃì €ÒÃìµÑ¹Ê
+áŸÃÇ
+áŸÃÇÒ
+䟱ÙÃÂì
+䟺ÙÅÂì
+äŸÃÄ·žÔì
+äŸÃʳ±ì
+äŸÃÊÔ·žÔì
+äŸÃѪ
+äŸÃѵ¹ì
+äŸÃÔ¹·Ãì
+äŸàÃÒÐ
+äŸâÚ¹ì
+äŸÅÔ¹
+äŸÇÑÅÂì
+äŸÈÒÅ
+äŸÈÔÃÔ
+äŸÊÔ°
+¿ÅØÊÊÔ¡à€Á
+¿Õ¹Ô¡«ì àÍç¡«ìàŸÃÊ
+á¿Ã§€ì
+á¿ÃìàÇÂì ÍÔ¹àµÍÃì๪Ñè¹á¹Å
+ÀÃÒŽÃ
+ÀÇÔ¹
+ÀÑ¡ŽÕ
+ÀÑ€šÔÃÒ
+Àѳ±ÔÃÒ
+Àѷ÷ÔÃÒ
+Àѷß§Èì
+ÀѷßÃ
+ÀѷßÅ
+ÀÑ·ÃÀÃ
+ÀÑ·ÃÃѧÊÕ
+ÀÑ·ÃÄŽÕ
+ÀÑ·ÃÒÀóì
+ÀÑ·ÃÔ¹·Ãì
+ÀÑÊÅÔ¹
+ÀÑÊÇÃó
+ÀÒ¡Ã
+ÀÒ€ÀÙÁÔ
+ÀÒ³Õ
+ÀÒ³Ø
+Àҳ؟Å
+ÀÒ³ØÇÃó
+ÀÒ¹ØÇѲ¹ì
+ÀÒ¹ØÇѵÃ
+ÀÒŸÃ
+ÀÒÃŽÕ
+ÀÒǹÒ
+ÀÒǟѹž¹ì
+ÀÒÇÔ³Õ
+ÀÒÇÔ¹
+ÀÒÇÔ¹Õ
+ÀÒÉÔµÒ
+ÀÔšÔµÃÒ
+ÀÔ­­ŸÑ¡µÃì
+ÀÔ­â­
+ÀÔÃŽÕ
+ÀÙàºÈ
+ÀÙÁÔ°Ò¹
+ÀÙÃÔŸ§Èì
+ÀÙÃÔÇÃò¡ì
+ÀÙÉÔµ
+Á¡Ãҹѹ·ì
+Á§¡Ø®Ãѵ¹ì
+Á§€Å
+Á§€Å¡Òûѡ
+Á³°ÔŽÒ
+Á³±¹ì¡Ò­š¹ì
+Á³±¹Ôš
+Á³±ÅÕ
+Á³±Ò
+Á³à±ÕÂÃ
+Á³ÕÃѵ¹ì
+Á¹µìªÑÂ
+Á¹µÃÕ
+Á¹ÑÊ
+Á¹ÑÊÇÕ
+Á¹Ù­
+Áâ¹
+Á⹪
+ÁÂØÃÕ
+ÁÅÄŽÕ
+Áéǹáµé
+ÁËÀÑ®
+ÁËÒÃÒª
+ÁÐÅÔÇÑÅÂì
+Áѧ¡Ãä·ÂʵÕźÒÃì
+Áѳ±¹Ò
+ÁÑ·¹Ò
+ÁÑÅÅÔ¡Ò
+ÁÒªÍÃì¡ÇÒ¹
+ÁÒ³Õ
+ÁÒ¹Ÿ
+ÁÒ¹Ð
+ÁÒ¹ÔµÂì
+ÁÒ⹪³ì
+ÁÒâ¹·
+ÁÒÃÔÉÒ
+ÁÒÅÑÂ
+ÁÒÅÔ¹Õ
+ÁÒÅÕ
+ÁÒÅÕÇÃó
+ÁÔµ·ÔÃÒ
+ÁÔÅàŹà¹ÕèÂÁ âÍ.àÍ 2000
+ÁÕŸÅ
+ÁØ¢
+ÁØ·ÔµÒ
+ÁÙËÐÁÐŽ×ÍàÃÐ
+àÁàšÍÃìÍØµÊÒË¡ÃÃÁä·Â (1989)
+àÁŽÔ€ÃÒ¿·ì
+àÁµµÒ
+àÁâ·ÃʻԹ¹Ôè§
+àÁžÒ
+àÁžÒÇÕ
+àÁžÔ¹Õ
+àÁžÕ
+àÁÉÂÒ
+àÁÉÔ³Õ
+àÁ×ͧ·Í§
+áÁ··ÕàÃÕÂÅ¡ÃØê» šÓ¡ÑŽ
+áÁé¹ÁÒµÃ
+äÁµÃÕ
+Â§ÂØ·ž
+Âè§àΧÇѲ¹Ò¡ÒßÔÁŸì
+ÂÃç€ì
+ÂÍŽàŸªÃ
+Âѹ áÍÅ à€âÂÊ
+ÂÔè§ÇÃó
+ÂØ€ÅŸÃ
+ÂØŽÒ
+ÂØ·ž¹Ò
+ÂØ·ž¹ÒÇÕ
+ÂØ·žÂ§
+ÂØžÒÁÒµÂì
+ÂØ¹â¡Ð
+ÂØŸÒ
+ÂØŸÒŸÃ
+ÂØŸÒÇŽÕ
+ÂØŸÔ¹
+ÂØÀÒŸÃ
+ÂØÀÒÀóì
+ÂØÇŽÕ
+ÂØÇÃÕ
+ÂÙ¹ÔÅÕàÇÍÃì ä·Â âÎÅŽÔé§Êì
+ÂÙ¹ÔÅÕàÇÍÃìä·Â âÎÅŽÔé§Êì
+ÂÙ¹Õ€ ÍÍÃì€ÔŽ
+ÂÙà¹Õè¹á¡êÊá͹ŽìàÅÁÔ€ÑÅÊì
+àÂ繚Եµì
+àÂ繚ԵÃ
+àÂÒÇŽÕ
+àÂÒÇŸÒ
+àÂÒÇÀÒ
+àÂÒÇàÃÈ
+àÂÒÇÅѡɳì
+âžԹ
+Ã.µË­Ô§ ŸÍãš
+Ú¹Ò
+óç€ì
+ÃŽÒ
+ùԮ°Ò
+ß՟Ã
+ß՟Ѳ¹ì
+ßÕÀÑ·Ã
+ÃÁÂìšÃÃÂì
+Ãǧ·Í§
+ÃÈÑ¡ŽÔì
+ÃÊÊØ€¹žì
+ÃÍÂÑÅàÍ繚Ôà¹ÕÂÃÔè§
+ÃеÃÕ
+ÃПԹ·Ãì
+ÃП՟Ã
+ÃП՟Ãó
+ÃП՟Å
+ÃÑ¡ŽÕ
+ÃÑ¡ÈÑ¡ŽÔì
+ÃÑ¡ÉÔµÀÑ·Ã
+ÃѧÊÃÀì
+ÃѧÊѹµì
+ÃѧÊÔÁÒ
+ÃѪà¡ÅéÒ
+ÃѪ®Ò
+ÃѪ®ÒŸÃ
+ÃѪŽÒ
+ÃѪ¹Õ
+ÃѪ¹Õ¡Ã
+ÃѪ¹ÕŸÃ
+ÃѰŸ§Éì
+ÃÑ°ÊØŽÒ
+Ãѵ³Ò
+ÃѵµªÑÂ
+ÃѵµÔÂÒ
+Ãѵ¹ªÑÂ
+Ãѵ¹Àóì
+Ãѵ¹Á³Õ
+Ãѵ¹Ò
+Ãѵ¹ÒŸÃ
+Ãѵ¹ÒÀóì
+ÃѵÔÂÒ
+ÃѵÔÂÒÀóì
+ÃÑÈÁÕ
+ÃÑÈÁÕÀÑÊÊÃ
+ÃҪѹÂì
+ÃÒªÒÍÙªÔâ¹
+ÃÒહ
+ÃÒ³Õ
+ÃÒµÃÕ
+ÃÒàÁÈÃì
+ÃÒÂÕ¹
+Ã×è¹ÇÃÒËì
+ÃØé§
+ÃØè§·ÔŸÂì
+ÃØè§·ÔÇÒ
+ÃØè§¹ÀÒ
+ÃØè§àŸªÃ
+ÃØè§ÃѪ¹Õ
+ÃØè§Ãѵ¹ì
+ÃØè§ÃÑÈÁÕ
+ÃØè§àÃ×ͧ
+ÃØè§âÚ¹ì
+ÃØè§âڹ좹Êè§
+ÃØé§ÅÒÇÃó
+ÃØè§ÇÔ·Âì
+ÃØè§ÍÃØ³
+ÃØšÒ
+ÃØšÒÀÒ
+ÃØËйÒ
+ÃÙàºÕÂÍØµÊÒË¡ÃÃÁ
+àâ­Ò
+àóÙ
+àßៀ à·ÃŽŽÔé§
+àßៀ€Í¹ÊµÃÑ€ªÑè¹
+àÃÇѵ
+àÃÔ§·ÔÇÒ
+àÃÔ§ÃÐÇÕ
+àÃÔ§Ä·žÔì
+àÃ×ͧÂÈ
+áßៀ €Í¹ÊµÃÑ€ªÑè¹
+âç§Ò¹àËÅç¡¡ÃØ§à·ŸÏ
+âÚ¹ì»ÃÐàÊÃÔ°
+Ä·žÔì
+Ä·žÔªÑÂ
+ÅÅÔŽÒ
+ÅÅÔµÒ
+ÅÐÁèÍÁ
+ÅÐÁÑÂ
+ÅÐÍͧŽÒÇ
+ÅÐàÍÕÂŽ
+ÅÑ¡¢³Ò
+ÅѡɳÒ
+ÅÑ¡ÉÁÕ
+ÅÑ­ª¹Ò
+ÅÑŽŽÒ
+ÅÑŽŽÒÇÃó
+ÅÑŽŽÒÇÑÅÂì
+ÅÑ·žÈÑ¡ŽÔì
+ÅÒÇѳÂì
+ÅÓäŸ
+ÅÓäÂ
+ÅÔ¹ŽÒÇÃó
+ÅÔÁ
+ÅÔÅÒÀóì
+Å×ͪÑÂ
+àÅͪÑÂ
+àÅÍÈÑ¡ŽÔì
+àÅÍÊÃÀì
+àÅÍÊØ¢
+àÅÔȪÑÂ
+àÅÔÈÈÑ¡ŽÔì
+àÅÔÈÊÒÁÒö âžÒ
+âÅËСԚʵÕÅ
+ǧàŽ×͹
+ǧÈì䟱ÙÃÂì¡Ãç» º
+ǧÈì䟱ÙÃÂì¡ÃØê»
+ǧÈì䟱ÙÃÂì¡ÃÙê»
+ǧÈìÇÒµ
+ǧÈìÊØÀÒ
+ÇšÕÃѵ¹ì
+ǪÔÃÒÀÒ
+ǹѪŸÃ
+ǹÑʹѹ·ì
+ǹÒ
+ǹԪ
+ǹԎÒ
+ÇáÒÃ
+ÇêÑÂ
+ÇêҵÔ
+ÇÃŽÔɰì
+ÇÃà·Ÿ
+ÇÞѹÂì
+Çùت
+Çß§Éì
+Çßš¹ì
+ÇßÅ
+ÇÃÁÅ
+ÇÃÂØ·žì
+ÇÃóšÔµ
+ÇÃóªÑÂ
+ÇÃó±¹Ò
+ÇÃóŽÕ
+ÇÃóìŽÕ
+ÇÃó·¹Ò
+ÇÃó·¹Õ
+ÇÃóž³Õ
+ÇÃóžÁÅ
+ÇÃó¹ÀÒ
+ÇÃó¹ÒÃÕ
+ÇÃóŸÃ
+ÇÃóŸÒ
+ÇÃóàŸç­
+ÇÃóÀŸ
+ÇÃóÀóì
+ÇÃóÀÒ
+ÇÃóǎÕ
+ÇÃóÈÔÃÔ
+ÇÃóÒ
+ÇÃóÕ
+ÇÃÞ¹Ò
+ÇÃÃѪ
+ÇÃÅѡɳì
+ÇÃÇÃó
+ÇÃÇÃÞ¹ì
+ÇÃÇѲ¹ì
+ÇÃÇÔÀÒ
+ÇÃÑ­žÃ
+ÇÃÒ
+ÇÃÒ§€³Ò
+ÇÃÒ§Ãѵ¹ì
+ÇÃÒŸÃ
+ÇÃÒÀóì
+ÇÃÒÃѵ¹ì
+ÇÃÒÅѡɳì
+ÇÃÒÇØ²Ô
+ÇÃÒÇØž
+ÇÃÔ¹·Ãì
+ÇÃÔ¹žÃ
+ÇÃÔÁÒ
+ÇÃÔÈÃÒ
+ÇÃÕÇÃó
+ÇÃØ³
+ÇÅÑŸÃ
+ÇÈÔ³Ò
+ÇÈÔ¹
+ÇÊѹµì
+ÇÊØ
+Çèͧ
+ÇѪáÃ
+ÇѪßÅ
+ÇѪÃÐ
+ÇѪÃÑ­­Ò
+ÇѪÃÔ¹·Ãì
+ÇѪÃÕ
+ÇѲ¹Ð
+ÇѲ¹Ò
+Çѹà©ÅÔÁ
+ÇѹªÑÂ
+ÇѹªÒµÔ
+ÇѹŽÕ
+Çѹ·¹Ò
+Çѹ·¹Õ
+Çѹ·¹ÕÂì
+ÇѹàŸç­
+ÇѹÃѪŽÒ
+ÇѹÇÔÊÒ¢ì
+ÇѹʶÒ
+ÇÑÅÅÀ
+ÇÑÅÅÀÒ
+ÇÑÅÅÒÀÒ
+ÇÑÈŸÅ
+ÇÑʹÑÂ
+ÇÒ³Õ
+ÇÒ·Ôµ
+ÇÒ·Ô¹
+ÇÒ·Ô¹ÕÂì
+ÇÒÃÔª
+ÇÒÃÕ
+ÇÒÃØ³Õ
+ÇÒʹÒ
+ÇÔ€µÍÃÕè âŸÃà¡Ã·
+ÇÔ€Á
+ÇÔšÒóì
+ÇÔšÔµÃ
+ÇÔšÔÃÒ
+ÇÔªªÒ
+ÇÔª­ÐÃØš
+ÇÔªÑÂ
+ÇÔªÒ­
+ÇÔªÔµ
+ÇԪ؎Ò
+ÇÔàªÉ°
+ÇÔàªÕÂÃ
+ÇÔ­­ØŽÒ
+ÇÔ±ÙÅÂì
+ÇÔ·žÇѪ
+ÇÔ·ÂÒ
+ÇÔ·ÇÑÊ
+ÇÔ·ÙÃ
+ÇÔ¹ÊÃÀì
+ÇÔ¹ÑÂ
+ÇÔ¹Ôš
+ÇÔºÙÅÂì
+ÇÔÀÒ
+ÇÔÀҡóì
+ÇÔÀÒ€
+ÇÔÀÒŸÃó
+ÇÔÀÒÃѵ¹ì
+ÇÔÀÒɳÕÂì
+ÇÔÀÒÊ
+ÇÔÀÙÉÔµ
+ÇÔÁÅ
+ÇÔÁÅŸÃ
+ÇÔÁÅÇÃó
+ÇÔÃÁÅ
+ÇÔÃѪ
+ÇÔÃѵ¹ì
+ÇÔâÚ¹ì
+ÇÔÅÇѳÂì
+ÇÔÅÒÇÃó
+ÇÔÅÒÇѳÂì
+ÇÔÅÒÇÑÅÂì
+ÇÔÅÒÊÔ¹Õ
+ÇÔÅÔµ
+ÇÔäÅ
+ÇÔäÅŸÃ
+ÇÔäÅÃѵ¹ì
+ÇÔäÅÅѡɳì
+ÇÔäÅÇÃó
+ÇÔÇ
+ÇÔÇÃÞ¹ì
+ÇÔÇѲ¹ì
+ÇÔÇѲ¹ìªÑÂ
+ÇÔȹÕ
+ÇÔÈÃØµ
+ÇÔÈÒÅ
+ÇÔÈÔÉ®ì
+ÇÔÈÔɰì
+ÇÔÉÃØš¹ì
+ÇÔÊÔ°ÈÑ¡ŽÔì
+ÇÔÊÔ·žÔì
+ÇÔÊØ·žÔ
+ÇÔÊØ·žÔì
+ÇÔÊÙµ
+ÇÕ àÍÊ à¹à¹ÍÃÑÅ à€Á
+ÇÕ«èÒ (2000)
+ÇÕ³Ò
+ÇÕ¹ÑÊ
+ÇÕêÑÂ
+ÇÕÃ⪵Ô
+ÇÕÃàŽª
+ÇÕß§Èì
+ÇÕßÅ
+ÇÕÃÂØ·Âì
+ÇÕÃÇÃó
+ÇÕÃÈÑ¡ŽÔì
+ÇÕÃÊÔ·žÔì
+ÇÕÃÐ
+ÇÕÃЪÑÂ
+ÇÕÃЪҵÔ
+ÇÕÃЪÒÂ
+ÇÕÃÐàŽª
+ÇÕÃП§Éì
+ÇÕÃПÅ
+ÇÕÃÐÂØ·žì
+ÇÕÃÐÇÃó
+ÇÕÃÐÇѲ¹ì
+ÇÕÃÐÈÑ¡ŽÔì
+ÇÕÃÒÀóì
+ÇØ²Ô¡Ã
+ÇØ²ÔªÑÂ
+ÇØ²Ô¹Ñ¹·ì
+ÇØ²Ô¹ÑÂ
+ÇØ²ÔŸ§Èì
+ÇØ²ÔŸš¹ì
+ÇØ²ÔŸÅ
+ÇØ²ÔÃѵ¹ì
+àÇèÂà©Ô¹ÍÔ¹ŽÑÊàµÃÕ¹
+àÇÍÃìâ¡é ·ÃҹʻÍÃìµ
+áÇÇÇŽÕ
+áÇÇÇÔÀÒ
+äÇ·Ô¹
+È¡ÅÇÃó
+ÈšÕ
+ÈÁÅÇÃó
+ÈÂÒÁÅ
+ÈêÑÂ
+ÈÃÇÑÅÂì
+ÈÃÑ­­Ò
+ÈÃѳŸÃ
+ÈÃѳÂì
+ÈÃÒÁÒÈ
+ÈÃÒÇØ²Ô
+ÈÃÒÇØž
+ÈÃÔ¹·Ãì
+ÈÃ՚ѹ·Ãì
+ÈÃ՚ѹ·ÃÒ
+ÈÃշͧà¹ÁàŸÅ·
+ÈÃÕ·Í§ÍØµÊÒË¡ÃÃÁ«ÑŸŸÅÒÂ
+ÈÃÕ¹ÇÅ
+ÈÃÕ»ÃÐäŸ
+ÈÃÕ»ÃÐÀÒ
+ÈÃÕŸ§Éì
+ÈÃÕàŸç­
+ÈÃÕÀÒ
+ÈÃÕÃѵ¹ì
+ÈÃÕÇÑš¹Ò
+ÈÃÕÇѲ¹Ò
+ÈÃÕÇÔ¡Ò
+ÈÃÕÈÑ¡ŽÔì
+ÈÃÕÊ¡ØÅ
+ÈÃÕÊÁÃ
+ÈÃÕÊÁÃ
+ÈÃÕÊÁÃ
+ÈÃÕÊØÇÃó€Í¹àÇàÂÍÃìàºÅ·ì á͹Žì ÃѺàºÍÃì
+ÈÃÕ͹§€ì
+ÈÃÕÍÓŸÅÍØµÊÒË¡ÃÃÁ
+ÈÅÔÉÒ
+ÈÈÁÅ
+ÈÈÔ
+ÈÈÔžÃ
+ÈÈÔŸÃ
+ÈÈÔÀÒ
+ÈÈÔÁÒ
+ÈÈÔÇÔÁÅ
+ÈÈÔÉÒ
+ÈÑ¡ŽÒ
+ÈÑ¡ŽÔì
+ÈÑ¡ŽÔìªÑÂ
+ÈÑ¡ŽÔìàªÇ§
+ÈÑ¡ŽÔìŽÒ
+ÈÑ¡ŽÔìÇÔºÙÅÂì
+ÈÑ¡ÃÔ¹·Ãì
+ÈѹʹÕÂì
+ÈÒ¹µÔᏎì
+ÈÔÁÒÃÕ
+ÈÔÃÉÒ
+ÈÔÃÒŸÃ
+ÈÔÃÔ
+ÈÔÃÔ¡ØÅ
+ÈÔÃԚѹ·Ãì
+ÈÔÃÔâ©Á
+ÈÔÃÔªÑÂ
+ÈÔÃÔ·Ñȹì
+ÈÔÃÔžÃ
+ÈÔÃÔ¹­Ò
+ÈÔÃÔ¹Òö
+ÈÔÃԹت
+ÈÔÃÔŸ§Éì
+ÈÔÃÔŸÃ
+ÈÔÃÔŸÃó
+ÈÔÃÔàŸç­
+ÈÔÃÔÁÒ
+ÈÔÃÔÃÑš¹ì
+ÈÔÃÔÃѵ¹ì
+ÈÔÃÔÅѡɳì
+ÈÔÃÔÇÃó
+ÈÔÃÔÇѲ¹ì
+ÈÔÃÔÈÑ¡ŽÔì
+ÈÔâÚ¹ì
+ÈÔÅ»ªÑÂ
+ÈÔÅÒ
+ÈÔÇŸÃ
+ÈÔÇŸÅ
+ÈÔÇÒŸÃ
+ÈÔÇÒÀóì
+ÈØÀ¡Ã
+ÈØÀ¡Ôš
+ÈØÀªÑÂ
+ÈØÀŸÃ
+ÈØÀÁÔµÃ
+ÈØÀÃ
+ÈØÀÃѵ¹ì
+ÈØÀÃÒÀóì
+ÈØÀÅѡɳì
+ÈØÀÇѲ¹ì
+ÈØÀÇÔ·Âì
+ÈØÀÈÑ¡ŽÔì
+ÈØÀÔÊÃÒ
+àÈÃɰžÃ
+àÈÃɰŸ§Éì
+âÈÃŽÒ
+ÉØÀÁ¹
+Ê ÍÒŽ
+Ê.͹ѹµìàÍ繚Ôà¹ÕÂÃÔè§ á͹€Í¹ÊµÃÑ€ªÑè¹
+Ê¡ÅÃѵ¹ì
+Ê¡ÒÇÃѵ¹ì
+ʧ¡Ã³ì
+ʧ¡ÃÒ¹µì
+ʧǹ
+Êè§ÈÃÕ
+Êè§àÊÃÔÁ
+ʧю
+ʧèÒ
+ʎѺŸÔ³
+Êáµ¹ŽÒÃìŽ ªÒÃìàµÍÃì (»ÃÐà·Èä·Â)
+ʶҟÃ
+ʶÔÃÂÒ
+ʹãš
+ʹ·ÂÒ
+ʹžŸ
+ʹžÂÒ
+ʹͧ
+ʹÑè¹
+ʹԎÒ
+Êà»ç€ àŽç¹ µÑÅ áź
+Ê໫€ÍÁ
+ÊÁ
+ÊÁ¡ÁÅ
+ÊÁà¡ÕÂõÔ
+ÊÁ€ÇÃ
+ÊÁ€ÔŽ
+ÊÁšÔµ
+ÊÁšÔµµì
+ÊÁšÔµÃ
+ÊÁšÔµÃì
+ÊÁšÔ¹µ¹Ò
+ÊÁãš
+ÊÁªÑÂ
+ÊÁªÒ­
+ÊÁªÒµÔ
+ÊÁªÒÂ
+ÊÁ⪀
+ÊÁŽÕ
+ÊÁàŽª
+ÊÁ·Ã§
+ÊÁ¹Ö¡
+ÊÁºÑµÔ
+ÊÁºØ­
+ÊÁºÙóì
+ÊÁ»Í§
+ÊÁŸ§Éì
+ÊÁŸš¹ì
+ÊÁŸÃ
+ÊÁŸÅ
+ÊÁŸÔÈ
+ÊÁÀŸ
+ÊÁâÀª¹ì
+ÊÁÁÒö
+ÊÁÁÒȹì
+ÊÁâÁ·
+ÊÁÂÈ
+ÊÁÃ
+ÊÁÃÑ¡Éì
+ÊÁÄŽÕ
+ÊÁÄ·žÔì
+ÊÁÄ·ÑÂ
+ÊÁÅѡɳì
+ÊÁǧÉì
+ÊÁÈÃÕ
+ÊÁÈÑ¡ŽÔì
+ÊÁÈÔÃÔ
+ÊÁÊØ¢
+ÊÁÊØ¹ÕÂì
+ÊÁË­Ô§
+ÊÁËÁÒÂ
+ÊÁËÇѧ
+ÊÁÑÂ
+ÊÁÒ¹
+ÊÁÔ·žÔ
+ÊÁÔ·žÔì
+ÊÁتªÅ
+ÊÂÒÁ
+ÊÂÒÁ€Í¹àÇàÂÍÃì
+ÊÂÒÁªÑÂâŸÅÕàÁÍÃì
+ÊÂÒÁäŽà€ÕÂÇ
+ÊÂÒÁ¹ÔÊÊѹ ÍÍâµéâÁºÔÅ
+ÊÂÒÁŸÃà·ÃŽà«ç¹àµÍÃì
+ÊÂÒÁàÁŠÕâŸÅÕàÁÍÃì
+ÊÂÒÁÂÙ¹Ôâ«Å
+ÊÂØÁŸÃ
+ÊÃÃàÊÃÔ°­
+ÊÃÑ­­Ò
+ÊÃÒ¡Ã
+ÊÃÒ­šÔµ
+ÊÃÒÂØž
+ÊÃÒÇØ²Ô
+ÊÃÒÇØž
+ÊÃÔ¹ÃÒ
+ÊÃØš
+ÊÅÑ¡šÔµÃ
+ÊàÅ€·ì¿ÍÃìÁà¿ÍÃì¹ÔàšÍÃìáÅкصÃ
+ÊÇÅѡɳì
+ÊÇÑÊŽÔì
+ÊÇÕâÚ¹ì
+ÊÇÕÇÃó
+ÊÊԟѹžØì
+ÊËà¡ÕÂõÔâÅËÐà¡ÕÂõÔ
+ÊËŸÅ
+ÊÍÒŽ
+Êзé͹
+ÊѧÇÒÅÂì
+ÊÑšŸ§Éì
+ÊÑ­ª¹Ò
+ÊÑ­ªÑÂ
+ÊÑ­­Ò
+ÊѹµÔ
+ÊѹµÔªÑÂ
+ÊÑÁŸÑ¹žì
+ÊÑÁÄ·žÔì
+ÊÒ€Ã
+ÊÒžÔµ
+ÊÒ¹ÔµÂì
+ÊÒÁÀŸ
+ÊÒÁÒö
+ÊÒÂãš
+ÊÒªÅ
+ÊÒ¹·Õ
+ÊÒœ¹
+ÊÒÂä¿¿éÒä·Â-ÂÒ«Ò¡Ô
+ÊÒ¹µì
+ÊÒÂÅÁ
+ÊÒÂÊÁÃ
+ÊÒÂÊØ³Õ
+ÊÒÂÊØ¹ÕÂì
+ÊÒÂѳ
+ÊÒÂѳËì
+ÊÒâÚ¹ì
+ÊÒâê
+ÊÒÅÕ
+ÊÒÅÕè
+ÊÒÇÔµÃÕ
+Êӹѡ¹âºÒÂáÅÐጹ¡ÃاෟÁËÒ¹€Ã
+ÊÓà¹Õ§
+ÊÓÃÇÁ
+ÊÓÃÇÂ
+ÊÓÃÒ­
+ÊÓÄ·žÔì
+ÊÓÅÕ
+ÊÔ§Ëì
+ÊÔ§ËìŸÅ
+ÊÔ§ËÒ
+ÊԵҹѹ
+ÊÔµÒŸÃ
+ÊÔ·žÒ
+ÊÔ·žÔì
+ÊÔ·žÔªÑÂ
+ÊÔ·žÔàŽª
+ÊÔ·žÔŸÃ
+ÊÔ·žÔŸÃó
+ÊÔ·žÔŸÅ
+ÊÔ¹·ÇÕ
+ÊÔÃÔªÑÂ
+ÊÔÃÔàŽª
+ÊÔÃÔ¹ŸÃ
+ÊÔÃÔ¹Ãѵ¹ì
+ÊÔÃÔ»ÃÐÀÒ
+ÊÔÃÔŸ§Éì
+ÊÔÃÔŸÃ
+ÊÔÃÔŸÃó
+ÊÔÃԟѹžì
+ÊÔÃÔÁÒ
+ÊÔÃÔÃѵ¹ì
+ÊÔÃÔÅѡɳì
+ÊÔÃÔÇÃó
+ÊÔÃÔÇѲ¡ì
+ÊÔÃÔÇѲ¹Ò
+ÊÔâÚ¹ì
+ÊÔÇÅÕ
+ÊÕ¹ÇÅ
+ÊÕÇÔ¡Ò
+ÊØ¡ÃÕ
+ÊØ¡Ñ­­Ò
+ÊØ¡Ò¹ŽÒ
+ÊØ¡Ôš
+ÊØ¡ÔµÔì
+ÊØ¡ÕµÔì
+ÊØ¡ØÁÒ
+ÊØ¢
+ÊØ¢ªÒÂ
+ÊØ¢ÄŽÕ
+ÊØ¢ÊÇÑÊŽÔì¡Å¡ÒÃ
+ÊØ¢Êѹµì
+ÊØ¢ØÁ
+ÊØ€¹žì
+ÊØ€¹žÒ
+ÊØšÒÃÕ
+ÊØšÔµ
+ÊØšÔµµÒ
+ÊØšÔµÃÒ
+ÊØšÔ¹ŽÒ
+ÊØšÔ¹µì
+ÊØšÔ¹µ¹ì
+ÊØªÅ
+ÊØªÑÂ
+ÊØªÒŽÒ
+ÊØªÒµÔ
+ÊØªÒÂ
+ÊØªÒÊÔ¹Õ
+ÊØªÔµ
+ÊØªÔ¹
+ÊØ±ÒÁÒÈ
+ÊØ³Õ
+ÊØŽÊ§Ç¹
+ÊØŽÊÇÒ·
+ÊØŽÒ
+ÊØŽÒªÅÕ
+ÊØŽÒŸÃ
+ÊØŽÒÀÒ
+ÊØŽÒÃѵ¹ì
+ÊØŽÒÃÒ
+ÊØŽÕàŸé¹·ìà«ç¹àµÍÃì
+ÊØ·žÒ·ÔŸÂì
+ÊØ·žÔ¡Òš
+ÊØ·žÔªÑÂ
+ÊØ·žÔ¹Ñ¹·ì
+ÊØ·žÔ¹Õ
+ÊØ·žÔ쟧Éì
+ÊØ·žÔŸÃó
+ÊØ·žÔÇѲ¹ì
+ÊØ·žÔÈÑ¡ŽÔì
+ÊØ·ÃÕ
+ÊØ·ÑÈ
+ÊØ·Ñȹì
+ÊØ·ÔµÂì
+ÊØ·Ô¹
+ÊØ·ÔŸÒ
+ÊØ·ÔÈÒ
+ÊØà·Ÿ
+ÊØžÒ·ÔŸÂì
+ÊØžÒ¹ÔžÔ
+ÊØžÔŽÒ
+ÊØžÔÈÑ¡ŽÔì
+ÊØžÕ
+ÊØžÕÃì
+ÊØžÕÃÒ
+ÊØ¹·Ã
+ÊØ¹·ÃÕ
+ÊØ¹Ñ··Õ
+ÊØ¹Ñ¹·ì
+ÊØ¹Ñ¹·Ò
+ÊØ¹ÔµÒ
+ÊØ¹ÔÈÒ
+ÊØ¹ÔÉÒ
+ÊØ¹ÔÊÒ
+ÊØ¹ÕÂì
+ÊØà¹µÃ
+ÊØ»ÃÐŽÔɰì
+ÊØ»ÃÐÇÕ³ì
+ÊØ»ÃÒ³Õ
+ÊØ»ÃÕÂÒ
+ÊØ»ÃÕÃÐŽÒ
+ÊØ»Ñ­­Ò
+ÊØŸš¹ì
+ÊØŸšÁÒÅÂì
+ÊØŸÃ
+ÊØŸÃóÕ
+ÊØŸÃÃÉÒ
+ÊØŸÅ
+ÊØŸÑ²¹ì
+ÊØŸÑµÃÒ
+ÊØŸÔª­ìª­Ò
+ÊØŸÔ¹
+ÊØŸÔÈ
+ÊØŸÕÃìªÑÂ
+ÊØÀ¡Ôš
+ÊØÀªÒ
+ÊØÀ⪀
+ÊØÀÁÒÊ
+ÊØÀÑ€
+ÊØÀѵÃÒ
+ÊØÀÑ·ÃÒ
+ÊØÀÒ
+ÊØÀÒ³Õ
+ÊØÀÒŸ
+ÊØÀÒŸÃ
+ÊØÀÒŸÃó
+ÊØÀÒÀóì
+ÊØÀÒÃŽÕ
+ÊØÀÒÇŽÕ
+ÊØÀÔ­­Ò
+ÊØÁ¹µì
+ÊØÁ¹Ò
+ÊØÁÒÅÕ
+ÊØÁÒÊÕ
+ÊØÁÔµÃ
+ÊØÁÔµÃÒ
+ÊØàÁž
+ÊØàÁžÕ¡ì
+ÊØÃ¡Ôš
+ÊØÃªÑÂ
+ÊØÃªÒµÔ
+ÊØÃàªÉ°ì
+ÊØÃàŽª
+ÊØÃ·Ô¹
+ÊØÃŸ§Éì
+ÊØÃŸÅ
+ÊØÃŸÑ¹žì
+ÊØÃŸÑ¹žØì
+ÊØÃÈÑ¡ŽÔì
+ÊØÃÊÔ·žÔì
+ÊØÃѪ¹Õ¡Ã
+ÊØÃѵ¹ì
+ÊØÃѵ¹ÇŽÕ
+ÊØÃѵ¹ìÇŽÕ
+ÊØÃѵ¹Ò
+ÊØÃѵÂÒ
+ÊØÃÒ§€¹Ò
+ÊØÃÔªÑÂ
+ÊØÃÔ¹·Ãì
+ÊØÃÔ§Èì
+ÊØÃÔ¹
+ÊØÃÔ¹µì
+ÊØÃÔŸ§Èì
+ÊØÃÔÂѹ
+ÊØÃÔÂѹµì
+ÊØÃÔÂÒ
+ÊØÃÕžÒŸÃ
+ÊØÃÕŸÃ
+ÊØÃÕÁÒÈ
+ÊØÃÕÂì
+ÊØÃÕÂìŸÃ
+ÊØÃÕÃѵ¹ì
+ÊØÅÑŽŽÒ
+ÊØÇÀÑ·Ãì
+ÊØÇÃó
+ÊØÇÃóªÑÂ
+ÊØÇÃóÒ
+ÊØÇÃóÕ
+ÊØÇÃóÕÂì
+ÊØÇÃѵ¹ì
+ÊØÇѲ¹ì
+ÊØÇѲ¹ìªÑÂ
+ÊØÇѲ¹Ò
+ÊØÇѵªÑÂ
+ÊØÇÒÃÕ
+ÊØÇÔªÑÂ
+ÊØÇÔªÒ
+ÊØÇÔŽÒ
+ÊØÇÔ·Âì
+ÊØÇÔÁÅ
+ÊØÇÔÃѪ
+ÊØÊÔÃÔ
+ÊØËÑʪÒ
+àÊ¡ÊÃÃ
+àÊ¡ÊÃÀì
+àʶÕÂÃ
+àʹËì
+àʹÕÂì
+àÊÁÒ
+àÊÃÔÁäªÂ€éÒ¡ÃÐŽÒÉ
+àÊÃÔÁÈÑ¡ŽÔì
+àÊÃÕ
+àÊÇÂ
+àÊÒÇ€¹žì
+àÊÒdzÕ
+àÊÒdzÕÂì
+àÊÒǹԵÂì
+àÊÒǹÕÂì
+àÊÒÇÅѡɳì
+áʧªÑÂ
+áʧàŽ×͹
+áʧ·Í§
+áʧÃÐÇÕ
+áʹ·ÇÕà·ç¡«ìä·Åì
+áʹÀŸ
+áʹÂÒ¡Ã
+áʹÃÑ¡
+áÊ¹ÊØ¢
+áÊǧ
+âÊÀ³
+âÊÀÒ
+âÊÀÒŸš¹Õ
+âÊÀÒŸÃó
+âÊÀÕ
+âÊÚԵ
+âÊÃŽÒ
+âÊÃÊ
+âÊÃÑš
+âÊÌÊ
+˧
+Ë·ÑÂ
+Ë·Ñ·ԟÂì
+Ë·ÑÂÃѵ¹ì
+˹Öè§Ä·ÑÂ
+ËÃÔ¹
+ËÄ·Â
+ËÇÒ¹
+ËÍÁšÑ¹·Ãì
+ËÑʹÕ
+ËÑÊÂÒ
+àËÁÇŽÕ
+àËÁ×͹¢ÇÑ­
+àËÁ×͹Ÿ¹Í
+àËÃÕ­
+áËÅÁ·Í§ÊË¡ÒÃ
+Í.àšÃÔ­ÎÒÃìŽáÇÃì
+ͧÍÒš
+Íâ³·ÂÒ
+ÍŽÔàá
+ÍŽÔÈÃ
+ÍŽÔÈÑ¡ŽÔì
+ÍŽØÅ
+ÍŽØÅŸÑ²¹ì
+ÍŽØÅÂìàŽª
+͵Թت
+͵ԟÃ
+ͶԪÒ
+ÍžÔ»ŸÅ
+͹§€ì¹Ò®
+͹§€ìÇÃó
+͹¹·ì
+͹ÇѪ
+͹ѭ­Ò
+͹ѹµì
+͹ѹµÈÑ¡ŽÔì
+͹ءԵÔ
+͹ءÙÅ
+͹تÒ
+͹تԵ
+͹؎Ò
+͹صµÃÒ
+͹صÃ
+͹طԵÒ
+͹؟§Èì
+͹؟§Éì
+͹؟Ã
+͹؟ѹžì
+͹ØÃÑ¡Éì
+͹ØÃѵ¹ì
+͹ØÃÑÉì
+͹ØÇѲ¹ì
+͹ØÈÑ¡ŽÔì
+͹ØÊóì
+Í⹪Ò
+ÍÀѹµÃÕÊì
+ÍÀÔªÑÂ
+ÍÀÔªÒ µÔ
+ÍÀÔªÒµ
+ÍÀÔªÒµÔ
+ÍÀÔવ
+ÍÀÔ­­Ò
+ÍÀÔàŽª
+ÍÀԹѹ·ì
+ÍÀÔÀÒŽÒ
+ÍÀÔÃŽÕ
+ÍÀÔÃÑ¡Éì
+ÍÀÔÇѲ¹ì
+ÍÀÔÇѹ·ì
+ÍÀÔÈÑ¡ŽÔì
+ÍÀÔÊÃ
+ÍÀÔÊÔ·žÔì
+ÍÁêÑÂ
+ÍÁÃà·Ÿ
+ÍÁÃÃѵ¹ì
+ÍÁÃÈÑ¡ŽÔì
+ÍÁÃÊÔÃÔ
+ÍÁÃÒÅѡɳì
+ÍÁÔµÒ
+ÍÁÔ¹µÒ
+ÍÂØžÂѹ
+ÍÚÔÃÒ
+ÍêÃ
+ÍêسËì
+Íóѭªì
+Í÷ÑÂ
+Í÷ԪÒ
+ÍùԵÂì
+Íùت
+ÍÃ๵Ã
+ÍßÃó
+ÍßԹ
+ÍßԹ·Ãì
+ÍÃÀÑ·Ãì
+ÍÃÊÂì
+ÍÃóŸ
+ÍÃöŸ¹žì
+ÍÃöŸÃ
+ÍÃöŸÅ
+ÍÃöÊÔ·žÔì
+ÍÃÄŽÕ
+ÍÃÇÃó
+ÍÃÇÔ· ÍÔ¹àµÍÃì๪Ñè¹á¹Å
+ÍÃÈÁ
+ÍÃÈÃÕ
+ÍÃÊÒ
+ÍÃ͹§€ì
+ÍÃÍØÁÒ
+ÍÃÑ­
+ÍÃÑ­­Ò
+ÍÃèÒÁÈÃÕ
+ÍÃÔªÑÂ
+ÍÃÔ¹ª¹Ò
+ÍÃÔ¹·ÁÒ
+ÍÃÔÂÒ
+ÍÃÔÂÒÀóì
+ÍÃÔÈÃÒ
+ÍÃÔÊÃÒ
+ÍÃÔÊÒ
+ÍÃØ³
+ÍÃØ³Ãѵ¹ì
+ÍÃØ³ÃØè§
+ÍÃØ³ÈÃÕ
+ÍÃØ³Õ
+Íŧ¡µ
+Íŧ¡Ã³ì
+ÍǪÑÂ
+ÍÍ€µéÒ àÁÁâÁàÃÕÂÅ
+ÍÍ€µéÒàÁÁâÁàÃÕÂÅ
+ÍÍâµàÁªÑè¹à«ÍÃìÇÔÊ
+ÍéÍ·ԟÂì
+ÍÍÊ·ì ÍÍÂÊì
+ÍЀÙà·ç€·ì
+ÍÐÅÒ¹
+ÍÑ€ÃàŽª
+Íрß¹žì
+Íрßњ¹ì
+ÍÑ€ÃÇÔ·Âì
+ÍÑ€ÃÇÔ¹·ì
+ÍÑ€ÃÒ
+ÍѧʹÒ
+ÍÑš©ÃÒ
+ÍѪÂÒ
+ÍÑ­ª³ÒŸÃ
+ÍÑ­ªŽÒ
+ÍÑ­ª¹Ò
+ÍÑ­ªÅÕ
+ÍÑ­ªØÅÕ
+ÍÑ®ÉÁÒ
+ÍѹÊÃÕÂì
+ÍÑ»ÊÃ
+ÍÑÁŸÃ
+ÍÑÁŸÃó
+ÍÑÁäŸÇÃó
+ÍÒ€Á
+ÍÒš³Ã§€ì
+ÍÒ«ÒÎÕ-ä·Â ÍÑÅÅÍÂ
+ÍҳѹÂì
+ÍÒ·Ô¡Ã
+ÍÒ·Ôµ
+ÍÒ¹¹·ì
+ÍÒ¹Ÿ
+Íҹю
+ÍҹѹµÂÒ
+ÍÒ¹ØÀÒŸ
+ÍÒÀóì
+ÍÒÀÒ
+ÍÒÀÒ¡Ã
+ÍÒÀÒ³Õ
+ÍÒÀÒŸÃ
+ÍÒÀÒÀóì
+ÍéÒÂÍÔé§
+ÍÒÃì«Õ ¹ÔµáÇÃì
+ÍÒÃì«Ø»à»ÍÃì⫹ԀŸÔ€ÍÑŸÊì
+ÍÒÃÁ³ì
+ÍÒÃÂѹ
+ÍÒÃÂÒ
+ÍÒÃÑ¡Éì
+ÍÒÃÒŸÃ
+ÍÒÃÔÂÒ
+ÍÒÃÕ
+ÍÒÃÕÂì
+ÍÒÃÕÂì àÊÁÒ©ÔÁ (ä·Âູ¡Ñ¹
+ÍÒÃÕÃѵ¹ì
+ÍÒÃÕÇÃó
+ÍÓ¹ÇÂ
+ÍÓ¹Òš
+ÍÓŸÃ
+ÍÓŸÃó
+ÍÓŸÅ
+Íӟѹžì
+ÍÓäŸ
+ÍÓÀÒ
+ÍÔê¡«èÒ ÍÔ¹àµÍÃì๪Ñè¹á¹Åàš¹à¹ÃÑÅ à«ÅÅì
+ÍÔ§Ë·ÑÂ
+ÍÔ·žÔŸÅ
+ÍԹ䫷ìà€Á
+ÍÔ¹àµÍÃìàÇç·(»ÃÐà·Èä·Â)
+ÍÔ¹·ÔÃÒ
+ÍÔŸ
+ÍÔÁâ¡éáŸç€ €ÍÃì»ÍÃìàêÑè¹
+ÍÔÈÃÒ
+ÍÕ·Õ«Õ
+ÍØè§á€Ð
+ÍØ³ÒÇŽÕ
+ÍØŽÁ
+ÍØŽÁŸ§Èì
+ÍØŽÁŸÃ
+ÍØŽÁŸÑ¹žì
+ÍØŽÁàÁŽÔ€ÍÅ ÍÔ€ÇÔ»àÁé¹
+ÍØŽÁÅѡɳì
+ÍØŽÁÇßѹžì
+ÍØŽÁÈÑ¡ŽÔì
+ÍØŽÃ
+ÍØµâÁ·Âì
+ÍØµÊÒË¡ÃÃÁŒéÒà€Å×ͺŸÅÒʵԡä·Â
+ÍØ·ÑÂ
+ÍØ·ÑÂÇÃó
+ÍØ·ØÁŸÃ
+ÍØà·¹·Ãì
+ÍØè¹ãš
+ÍØºÅ
+ÍØºÅŸÃó
+ÍØºÅÇÃó
+ÍØÁÒ
+ÍØÁÒŸÃ
+ÍØÃÕÂì
+ÍØäÃ
+ÍØäßÃ
+ÍØäÃÃѵ¹ì
+ꯊ̗̂
+ÍØÉ³Õ
+ÍØÉÒ
+ÍØÊÒËì
+ÍØÌÒÃ
+àÍ.àš.ŸÅÒÊ·ì
+àÍ¡ªÑÂ
+àÍç¡«Õà«ÅàŹ¿ÍÃìÁ
+àÍ¡ÃÒª
+àÍ¡ÃÔ¹·Ãì
+àÍ¡ÊÔ·žÔì
+à͡͹ѹµì
+àÍ¡ÍÃö
+àÍçª àÍçÁ «Õ â»ÅÕàÁÍÃì
+àÍçª.àÍçÁ.«Õ.â»ÅÔàÁÍÃì
+àÍçª.àÍçÁ.«Õ.â»ÅÕàÁÍÃì (ºš¡.)
+àÍàªÕÂàÊÃÔÁ¡ÔšÅÔÊ«Ôè§
+àÍç¹ ŽÕ à€ (»ÃÐà·Èä·Â)
+àÍ¿ ÍÕ «Ô€ÅÔ€ (¡Ãاෟ)
+àÍçÁ .«Õ.ŸÕÅÔÊ«Ôè§
+àÍçÁ «Õ ÍÐâ¡Ãà€ÁÕ€ÍÅ
+àÍçÁ.«Õ.ŸÕ. ÅÔÊ«Ôè§
+àÍçÁ.àÍçÁ.«Õ.â»ÅÔàÁÍÃì
+àÍçÁ«ÕÊÂÒÁ âÅšÕʵԀÊì
+àÍÊ àš ŸÅÒÊ·ì á͹Žì ៀ
+àÍÊ ŸÕ Ê᡹
+àÍÊ àÍÊ à€ ¡Å¡ÒÃ
+àÍÊ.à€.ÍÕ.
+àÍÊ.«Õ.ŸÕ.ៀ
+àÍÊ.ŸÕ.¹ÔµµÔé§
+àÍÊ.àÍçÁ.ÇÕ ÊË¡ÒÃ
+àÍÊ.àÍÊ.à€ ¡Å¡ÒÃ
+àÍÊ.àÍÊ.à€.¡Å¡ÒÃ
+àÍÊ.àÍÊ.ÍÔ¹¡Íµ ÍÅÙÁÔà¹ÕÂÁ1999
+àÍÊÇÕ¹Ô··Ñ¹ŸÃÔ«ÔªÑè¹
+àÍ×é͟ѹžØì
+àÍ×éÍÁŸÃ
+àÍ×éÍÍÒÃÕ
+á͹¹Ò
+á͹¹ÒÃÕ
+áͺºÕà€ÃÊ·ì(»ÃÐà·Èä·Â)
+áÍÃì«Õ à¿Ã· ¿ÍÃìàÇÔŽàµÍÃì
+áÍÃìŸÕàŸÔÅÍÔ¹àµÍÃì๪Ñè¹á¹Å
+áÍÅ¿èÒ â»Ãà«Ê«Ôè§
+áÍÊષŸÅÑÊ
+âÍàÃÕÂÅ·ÍÅ ¿ØéŽ
+âÍÇÍÐËÅÑèŸÒÃì·à«ç¹àµÍÃì
+äÍ.«Õ.«Õ.ÍÔ¹àµÍÃì๪Ñè¹á¹Å (ÁËÒª¹)
+äÍ.·Õ.áÍŽìÇÒ¹« à·€ šÓ¡ÑŽ
+äÍ.·Õ.á͹ŽìÇÒ¹« à·€ šÓ¡ÑŽ
+äÍ.àÍÊ.äÍ.ÍÔ¹àµÍÃì๪Ñè¹á¹Å
+äÍÂàÃÈ
+ÎÍÊ·ì ÍÍÂÅì
+ÎÙàÇÍÃìÍØµÊÒË¡ÃÃÁ(»ÃÐà·Èä·Â)
+àΧàšÃÔ­ªÑ ¡ÃØê» ÍÔ¹ŽÑÊàµÃÕÂÅ
+DROP TABLE t1;
+SELECT 'a' = 'a ';
+'a' = 'a '
+1
+SELECT 'a\0' < 'a';
+'a\0' < 'a'
+1
+SELECT 'a\0' < 'a ';
+'a\0' < 'a '
+1
+SELECT 'a\t' < 'a';
+'a\t' < 'a'
+1
+SELECT 'a\t' < 'a ';
+'a\t' < 'a '
+1
+CREATE TABLE t1 (a char(10) not null) CHARACTER SET tis620;
+INSERT INTO t1 VALUES ('a'),('a\0'),('a\t'),('a ');
+SELECT hex(a),STRCMP(a,'a'), STRCMP(a,'a ') FROM t1;
+hex(a) STRCMP(a,'a') STRCMP(a,'a ')
+61 0 0
+6100 -1 -1
+6109 -1 -1
+61 0 0
+DROP TABLE t1;
+CREATE TABLE t1 (
+`id` int(11) NOT NULL auto_increment,
+`url` varchar(200) NOT NULL default '',
+`name` varchar(250) NOT NULL default '',
+`type` int(11) NOT NULL default '0',
+`website` varchar(250) NOT NULL default '',
+`adddate` date NOT NULL default '0000-00-00',
+`size` varchar(20) NOT NULL default '',
+`movieid` int(11) NOT NULL default '0',
+`musicid` int(11) NOT NULL default '0',
+`star` varchar(20) NOT NULL default '',
+`download` int(11) NOT NULL default '0',
+`lastweek` int(11) NOT NULL default '0',
+`thisweek` int(11) NOT NULL default '0',
+`page` varchar(250) NOT NULL default '',
+PRIMARY KEY (`id`),
+UNIQUE KEY `url` (`url`)
+) CHARACTER SET tis620;
+INSERT INTO t1 VALUES
+(1,'http://www.siamzone.com/download/download/000001-frodo_1024.jpg','The Lord
+of the Rings
+Wallpapers',1,'http://www.lordoftherings.net','2002-01-22','',448,0,'',3805,0,0,
+'');
+INSERT INTO t1 VALUES (2,'http://www.othemovie.com/OScreenSaver1.EXE','O
+Screensaver',2,'','2002-01-22','',491,0,'',519,0,0,'');
+INSERT INTO t1 VALUES
+(3,'http://www.siamzone.com/download/download/000003-jasonx2(800x600).jpg','Jaso
+n X Wallpapers',1,'','2002-05-31','',579,0,'',1091,0,0,'');
+select * from t1 order by id;
+id url name type website adddate size movieid musicid star download lastweek thisweek page
+1 http://www.siamzone.com/download/download/000001-frodo_1024.jpg The Lord
+of the Rings
+Wallpapers 1 http://www.lordoftherings.net 2002-01-22 448 0 3805 0 0
+2 http://www.othemovie.com/OScreenSaver1.EXE O
+Screensaver 2 2002-01-22 491 0 519 0 0
+3 http://www.siamzone.com/download/download/000003-jasonx2(800x600).jpg Jaso
+n X Wallpapers 1 2002-05-31 579 0 1091 0 0
+DROP TABLE t1;
diff --git a/mysql-test/r/ctype_uca.result b/mysql-test/r/ctype_uca.result
new file mode 100644
index 00000000000..0573092e39b
--- /dev/null
+++ b/mysql-test/r/ctype_uca.result
@@ -0,0 +1,2388 @@
+DROP TABLE IF EXISTS t1;
+set names utf8;
+set collation_connection=utf8_unicode_ci;
+select 'a' = 'a', 'a' = 'a ', 'a ' = 'a';
+'a' = 'a' 'a' = 'a ' 'a ' = 'a'
+1 1 1
+select 'a\t' = 'a' , 'a\t' < 'a' , 'a\t' > 'a';
+'a\t' = 'a' 'a\t' < 'a' 'a\t' > 'a'
+0 1 0
+select 'a\t' = 'a ', 'a\t' < 'a ', 'a\t' > 'a ';
+'a\t' = 'a ' 'a\t' < 'a ' 'a\t' > 'a '
+0 1 0
+select 'a' = 'a\t', 'a' < 'a\t', 'a' > 'a\t';
+'a' = 'a\t' 'a' < 'a\t' 'a' > 'a\t'
+0 0 1
+select 'a ' = 'a\t', 'a ' < 'a\t', 'a ' > 'a\t';
+'a ' = 'a\t' 'a ' < 'a\t' 'a ' > 'a\t'
+0 0 1
+select 'a a' > 'a', 'a \t' < 'a';
+'a a' > 'a' 'a \t' < 'a'
+1 1
+select 'c' like '\_' as want0;
+want0
+0
+CREATE TABLE t (
+c char(20) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+INSERT INTO t VALUES ('a'),('ab'),('aba');
+ALTER TABLE t ADD INDEX (c);
+SELECT c FROM t WHERE c LIKE 'a%';
+c
+a
+ab
+aba
+DROP TABLE t;
+create table t1 (c1 char(10) character set utf8 collate utf8_bin);
+insert into t1 values ('A'),('a');
+insert into t1 values ('B'),('b');
+insert into t1 values ('C'),('c');
+insert into t1 values ('D'),('d');
+insert into t1 values ('E'),('e');
+insert into t1 values ('F'),('f');
+insert into t1 values ('G'),('g');
+insert into t1 values ('H'),('h');
+insert into t1 values ('I'),('i');
+insert into t1 values ('J'),('j');
+insert into t1 values ('K'),('k');
+insert into t1 values ('L'),('l');
+insert into t1 values ('M'),('m');
+insert into t1 values ('N'),('n');
+insert into t1 values ('O'),('o');
+insert into t1 values ('P'),('p');
+insert into t1 values ('Q'),('q');
+insert into t1 values ('R'),('r');
+insert into t1 values ('S'),('s');
+insert into t1 values ('T'),('t');
+insert into t1 values ('U'),('u');
+insert into t1 values ('V'),('v');
+insert into t1 values ('W'),('w');
+insert into t1 values ('X'),('x');
+insert into t1 values ('Y'),('y');
+insert into t1 values ('Z'),('z');
+insert into t1 values (_ucs2 0x00e0),(_ucs2 0x00c0);
+insert into t1 values (_ucs2 0x00e1),(_ucs2 0x00c1);
+insert into t1 values (_ucs2 0x00e2),(_ucs2 0x00c2);
+insert into t1 values (_ucs2 0x00e3),(_ucs2 0x00c3);
+insert into t1 values (_ucs2 0x00e4),(_ucs2 0x00c4);
+insert into t1 values (_ucs2 0x00e5),(_ucs2 0x00c5);
+insert into t1 values (_ucs2 0x00e6),(_ucs2 0x00c6);
+insert into t1 values (_ucs2 0x00e7),(_ucs2 0x00c7);
+insert into t1 values (_ucs2 0x00e8),(_ucs2 0x00c8);
+insert into t1 values (_ucs2 0x00e9),(_ucs2 0x00c9);
+insert into t1 values (_ucs2 0x00ea),(_ucs2 0x00ca);
+insert into t1 values (_ucs2 0x00eb),(_ucs2 0x00cb);
+insert into t1 values (_ucs2 0x00ec),(_ucs2 0x00cc);
+insert into t1 values (_ucs2 0x00ed),(_ucs2 0x00cd);
+insert into t1 values (_ucs2 0x00ee),(_ucs2 0x00ce);
+insert into t1 values (_ucs2 0x00ef),(_ucs2 0x00cf);
+insert into t1 values (_ucs2 0x00f0),(_ucs2 0x00d0);
+insert into t1 values (_ucs2 0x00f1),(_ucs2 0x00d1);
+insert into t1 values (_ucs2 0x00f2),(_ucs2 0x00d2);
+insert into t1 values (_ucs2 0x00f3),(_ucs2 0x00d3);
+insert into t1 values (_ucs2 0x00f4),(_ucs2 0x00d4);
+insert into t1 values (_ucs2 0x00f5),(_ucs2 0x00d5);
+insert into t1 values (_ucs2 0x00f6),(_ucs2 0x00d6);
+insert into t1 values (_ucs2 0x00f7),(_ucs2 0x00d7);
+insert into t1 values (_ucs2 0x00f8),(_ucs2 0x00d8);
+insert into t1 values (_ucs2 0x00f9),(_ucs2 0x00d9);
+insert into t1 values (_ucs2 0x00fa),(_ucs2 0x00da);
+insert into t1 values (_ucs2 0x00fb),(_ucs2 0x00db);
+insert into t1 values (_ucs2 0x00fc),(_ucs2 0x00dc);
+insert into t1 values (_ucs2 0x00fd),(_ucs2 0x00dd);
+insert into t1 values (_ucs2 0x00fe),(_ucs2 0x00de);
+insert into t1 values (_ucs2 0x00ff),(_ucs2 0x00df);
+insert into t1 values (_ucs2 0x0100),(_ucs2 0x0101),(_ucs2 0x0102),(_ucs2 0x0103);
+insert into t1 values (_ucs2 0x0104),(_ucs2 0x0105),(_ucs2 0x0106),(_ucs2 0x0107);
+insert into t1 values (_ucs2 0x0108),(_ucs2 0x0109),(_ucs2 0x010a),(_ucs2 0x010b);
+insert into t1 values (_ucs2 0x010c),(_ucs2 0x010d),(_ucs2 0x010e),(_ucs2 0x010f);
+insert into t1 values (_ucs2 0x0110),(_ucs2 0x0111),(_ucs2 0x0112),(_ucs2 0x0113);
+insert into t1 values (_ucs2 0x0114),(_ucs2 0x0115),(_ucs2 0x0116),(_ucs2 0x0117);
+insert into t1 values (_ucs2 0x0118),(_ucs2 0x0119),(_ucs2 0x011a),(_ucs2 0x011b);
+insert into t1 values (_ucs2 0x011c),(_ucs2 0x011d),(_ucs2 0x011e),(_ucs2 0x011f);
+insert into t1 values (_ucs2 0x0120),(_ucs2 0x0121),(_ucs2 0x0122),(_ucs2 0x0123);
+insert into t1 values (_ucs2 0x0124),(_ucs2 0x0125),(_ucs2 0x0126),(_ucs2 0x0127);
+insert into t1 values (_ucs2 0x0128),(_ucs2 0x0129),(_ucs2 0x012a),(_ucs2 0x012b);
+insert into t1 values (_ucs2 0x012c),(_ucs2 0x012d),(_ucs2 0x012e),(_ucs2 0x012f);
+insert into t1 values (_ucs2 0x0130),(_ucs2 0x0131),(_ucs2 0x0132),(_ucs2 0x0133);
+insert into t1 values (_ucs2 0x0134),(_ucs2 0x0135),(_ucs2 0x0136),(_ucs2 0x0137);
+insert into t1 values (_ucs2 0x0138),(_ucs2 0x0139),(_ucs2 0x013a),(_ucs2 0x013b);
+insert into t1 values (_ucs2 0x013c),(_ucs2 0x013d),(_ucs2 0x013e),(_ucs2 0x013f);
+insert into t1 values (_ucs2 0x0140),(_ucs2 0x0141),(_ucs2 0x0142),(_ucs2 0x0143);
+insert into t1 values (_ucs2 0x0144),(_ucs2 0x0145),(_ucs2 0x0146),(_ucs2 0x0147);
+insert into t1 values (_ucs2 0x0148),(_ucs2 0x0149),(_ucs2 0x014a),(_ucs2 0x014b);
+insert into t1 values (_ucs2 0x014c),(_ucs2 0x014d),(_ucs2 0x014e),(_ucs2 0x014f);
+insert into t1 values (_ucs2 0x0150),(_ucs2 0x0151),(_ucs2 0x0152),(_ucs2 0x0153);
+insert into t1 values (_ucs2 0x0154),(_ucs2 0x0155),(_ucs2 0x0156),(_ucs2 0x0157);
+insert into t1 values (_ucs2 0x0158),(_ucs2 0x0159),(_ucs2 0x015a),(_ucs2 0x015b);
+insert into t1 values (_ucs2 0x015c),(_ucs2 0x015d),(_ucs2 0x015e),(_ucs2 0x015f);
+insert into t1 values (_ucs2 0x0160),(_ucs2 0x0161),(_ucs2 0x0162),(_ucs2 0x0163);
+insert into t1 values (_ucs2 0x0164),(_ucs2 0x0165),(_ucs2 0x0166),(_ucs2 0x0167);
+insert into t1 values (_ucs2 0x0168),(_ucs2 0x0169),(_ucs2 0x016a),(_ucs2 0x016b);
+insert into t1 values (_ucs2 0x016c),(_ucs2 0x016d),(_ucs2 0x016e),(_ucs2 0x016f);
+insert into t1 values (_ucs2 0x0170),(_ucs2 0x0171),(_ucs2 0x0172),(_ucs2 0x0173);
+insert into t1 values (_ucs2 0x0174),(_ucs2 0x0175),(_ucs2 0x0176),(_ucs2 0x0177);
+insert into t1 values (_ucs2 0x0178),(_ucs2 0x0179),(_ucs2 0x017a),(_ucs2 0x017b);
+insert into t1 values (_ucs2 0x017c),(_ucs2 0x017d),(_ucs2 0x017e),(_ucs2 0x017f);
+insert into t1 values (_ucs2 0x0180),(_ucs2 0x0181),(_ucs2 0x0182),(_ucs2 0x0183);
+insert into t1 values (_ucs2 0x0184),(_ucs2 0x0185),(_ucs2 0x0186),(_ucs2 0x0187);
+insert into t1 values (_ucs2 0x0188),(_ucs2 0x0189),(_ucs2 0x018a),(_ucs2 0x018b);
+insert into t1 values (_ucs2 0x018c),(_ucs2 0x018d),(_ucs2 0x018e),(_ucs2 0x018f);
+insert into t1 values (_ucs2 0x0190),(_ucs2 0x0191),(_ucs2 0x0192),(_ucs2 0x0193);
+insert into t1 values (_ucs2 0x0194),(_ucs2 0x0195),(_ucs2 0x0196),(_ucs2 0x0197);
+insert into t1 values (_ucs2 0x0198),(_ucs2 0x0199),(_ucs2 0x019a),(_ucs2 0x019b);
+insert into t1 values (_ucs2 0x019c),(_ucs2 0x019d),(_ucs2 0x019e),(_ucs2 0x019f);
+insert into t1 values (_ucs2 0x01a0),(_ucs2 0x01a1),(_ucs2 0x01a2),(_ucs2 0x01a3);
+insert into t1 values (_ucs2 0x01a4),(_ucs2 0x01a5),(_ucs2 0x01a6),(_ucs2 0x01a7);
+insert into t1 values (_ucs2 0x01a8),(_ucs2 0x01a9),(_ucs2 0x01aa),(_ucs2 0x01ab);
+insert into t1 values (_ucs2 0x01ac),(_ucs2 0x01ad),(_ucs2 0x01ae),(_ucs2 0x01af);
+insert into t1 values (_ucs2 0x01b0),(_ucs2 0x01b1),(_ucs2 0x01b2),(_ucs2 0x01b3);
+insert into t1 values (_ucs2 0x01b4),(_ucs2 0x01b5),(_ucs2 0x01b6),(_ucs2 0x01b7);
+insert into t1 values (_ucs2 0x01b8),(_ucs2 0x01b9),(_ucs2 0x01ba),(_ucs2 0x01bb);
+insert into t1 values (_ucs2 0x01bc),(_ucs2 0x01bd),(_ucs2 0x01be),(_ucs2 0x01bf);
+insert into t1 values (_ucs2 0x01c0),(_ucs2 0x01c1),(_ucs2 0x01c2),(_ucs2 0x01c3);
+insert into t1 values (_ucs2 0x01c4),(_ucs2 0x01c5),(_ucs2 0x01c6),(_ucs2 0x01c7);
+insert into t1 values (_ucs2 0x01c8),(_ucs2 0x01c9),(_ucs2 0x01ca),(_ucs2 0x01cb);
+insert into t1 values (_ucs2 0x01cc),(_ucs2 0x01cd),(_ucs2 0x01ce),(_ucs2 0x01cf);
+insert into t1 values (_ucs2 0x01d0),(_ucs2 0x01d1),(_ucs2 0x01d2),(_ucs2 0x01d3);
+insert into t1 values (_ucs2 0x01d4),(_ucs2 0x01d5),(_ucs2 0x01d6),(_ucs2 0x01d7);
+insert into t1 values (_ucs2 0x01d8),(_ucs2 0x01d9),(_ucs2 0x01da),(_ucs2 0x01db);
+insert into t1 values (_ucs2 0x01dc),(_ucs2 0x01dd),(_ucs2 0x01de),(_ucs2 0x01df);
+insert into t1 values (_ucs2 0x01e0),(_ucs2 0x01e1),(_ucs2 0x01e2),(_ucs2 0x01e3);
+insert into t1 values (_ucs2 0x01e4),(_ucs2 0x01e5),(_ucs2 0x01e6),(_ucs2 0x01e7);
+insert into t1 values (_ucs2 0x01e8),(_ucs2 0x01e9),(_ucs2 0x01ea),(_ucs2 0x01eb);
+insert into t1 values (_ucs2 0x01ec),(_ucs2 0x01ed),(_ucs2 0x01ee),(_ucs2 0x01ef);
+insert into t1 values (_ucs2 0x01f0),(_ucs2 0x01f1),(_ucs2 0x01f2),(_ucs2 0x01f3);
+insert into t1 values (_ucs2 0x01f4),(_ucs2 0x01f5),(_ucs2 0x01f6),(_ucs2 0x01f7);
+insert into t1 values (_ucs2 0x01f8),(_ucs2 0x01f9),(_ucs2 0x01fa),(_ucs2 0x01fb);
+insert into t1 values (_ucs2 0x01fc),(_ucs2 0x01fd),(_ucs2 0x01fe),(_ucs2 0x01ff);
+insert into t1 values ('AA'),('Aa'),('aa'),('aA');
+insert into t1 values ('CH'),('Ch'),('ch'),('cH');
+insert into t1 values ('DZ'),('Dz'),('dz'),('dZ');
+insert into t1 values ('IJ'),('Ij'),('ij'),('iJ');
+insert into t1 values ('LJ'),('Lj'),('lj'),('lJ');
+insert into t1 values ('LL'),('Ll'),('ll'),('lL');
+insert into t1 values ('NJ'),('Nj'),('nj'),('nJ');
+insert into t1 values ('OE'),('Oe'),('oe'),('oE');
+insert into t1 values ('SS'),('Ss'),('ss'),('sS');
+insert into t1 values ('RR'),('Rr'),('rr'),('rR');
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_unicode_ci;
+group_concat(c1 order by c1)
+÷
+×
+A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,À,Ã¥,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ç ,Ç¡,Ǻ,Ç»
+AA,Aa,aA,aa
+Æ,Ê,Ç¢,Ç£,ÇŒ,Çœ
+B,b
+ƀ
+Ɓ
+Ƃ,ƃ
+C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č
+CH,Ch,cH,ch
+Ƈ,ƈ
+D,d,Ď,ď
+DZ,Dz,dZ,dz,DŽ,Dž,dž,DZ,Dz,dz
+Đ,đ
+Ɖ
+Ɗ
+Ƌ,ƌ
+Ð,ð
+E,e,È,É,Ê,Ë,Ú,é,ê,ë,Ē,ē,Ĕ,ĕ,Ė,ė,Ę,ę,Ě,ě
+Ǝ,ǝ
+Ə
+Ɛ
+F,f
+Ƒ,ƒ
+G,g,Ĝ,ĝ,Ğ,ğ,Ä ,Ä¡,Ä¢,Ä£,ÇŠ,ǧ,ÇŽ,ǵ
+Ç€,Ç¥
+Ɠ
+Ɣ
+Æ¢,Æ£
+H,h,Ä€,Ä¥
+ƕ,Ƕ
+Ċ,ħ
+I,i,Ì,Í,Î,Ï,ì,í,î,ï,Äš,Ä©,Ī,Ä«,Ĭ,Ä­,Ä®,į,İ,Ǐ,ǐ
+IJ,Ij,iJ,ij,IJ,ij
+ı
+Ɨ
+Ɩ
+J,j,Ď,ĵ,ǰ
+K,k,Ķ,ķ,ǚ,ǩ
+Ƙ,ƙ
+L,l,Ĺ,ĺ,Ļ,Č,Ĝ,ğ
+Ŀ,ŀ
+LJ,Lj,lJ,lj,LJ,Lj,lj
+LL,Ll,lL,ll
+Ł,ł
+ƚ
+ƛ
+M,m
+N,n,Ñ,ñ,Ń,ń,Ņ,ņ,Ň,ň,Çž,ǹ
+NJ,Nj,nJ,nj,NJ,Nj,nj
+Ɲ
+ƞ
+Ŋ,ŋ
+O,o,Ò,Ó,Ô,Õ,Ö,ò,ó,ÃŽ,õ,ö,Ō,ō,Ŏ,ŏ,Ő,ő,Æ ,Æ¡,Ǒ,ǒ,Ǫ,Ç«,Ǭ,Ç­
+OE,Oe,oE,oe,Œ,œ
+Ø,Þ,ÇŸ,Ç¿
+Ɔ
+Ɵ
+P,p
+Æ€,Æ¥
+Q,q
+Äž
+R,r,Ŕ,ŕ,Ŗ,ŗ,Ř,ř
+RR,Rr,rR,rr
+ÆŠ
+S,s,Ś,ś,Ŝ,ŝ,Ş,ş,Š,š,ſ
+SS,Ss,sS,ss,ß
+Æ©
+ƪ
+T,t,Å¢,Å£,Å€,Å¥
+ÆŸ
+Ŋ,ŧ
+Æ«
+Ƭ,ƭ
+Æ®
+U,u,Ù,Ú,Û,Ü,ù,ú,û,ÃŒ,Åš,Å©,Ū,Å«,Ŭ,Å­,Å®,ů,Ű,ű,Ų,ų,Ư,ư,Ǔ,ǔ,Ǖ,ǖ,Ǘ,ǘ,Ǚ,ǚ,Ǜ,ǜ
+Ɯ
+Ʊ
+V,v
+Ʋ
+W,w,Ŏ,ŵ
+X,x
+Y,y,Ý,Ü,ÿ,Ŷ,ŷ,Ş
+Ƴ,Ǝ
+Z,z,Ź,ź,Ż,Ō,Ŝ,ş
+ƍ
+Ƶ,ƶ
+Ʒ,Ǯ,ǯ
+ƞ,ƹ
+ƺ
+Þ,ß
+Æ¿,Ç·
+Æ»
+Ƨ,ƚ
+ƌ,Ɯ
+Ƅ,ƅ
+ʼn
+ǀ
+ǁ
+ǂ
+ǃ
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_icelandic_ci;
+group_concat(c1 order by c1)
+÷
+×
+A,a,À,Â,Ã,à,â,ã,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ
+AA,Aa,aA,aa
+Á,á
+Ǣ,ǣ,nj,ǜ
+B,b
+ƀ
+Ɓ
+Ƃ,ƃ
+C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č
+CH,Ch,cH,ch
+Ƈ,ƈ
+D,d,Ď,ď
+DZ,Dz,dZ,dz,DŽ,Dž,dž,DZ,Dz,dz
+Ð,ð
+Đ,đ
+Ɖ
+Ɗ
+Ƌ,ƌ
+E,e,È,Ê,Ë,Ú,ê,ë,Ē,ē,Ĕ,ĕ,Ė,ė,Ę,ę,Ě,ě
+É,é
+Ǝ,ǝ
+Ə
+Ɛ
+F,f
+Ƒ,ƒ
+G,g,Ĝ,ĝ,Ğ,ğ,Ä ,Ä¡,Ä¢,Ä£,ÇŠ,ǧ,ÇŽ,ǵ
+Ç€,Ç¥
+Ɠ
+Ɣ
+Æ¢,Æ£
+H,h,Ä€,Ä¥
+ƕ,Ƕ
+Ċ,ħ
+I,i,Ì,Î,Ï,ì,î,ï,Äš,Ä©,Ī,Ä«,Ĭ,Ä­,Ä®,į,İ,Ǐ,ǐ
+IJ,Ij,iJ,ij,IJ,ij
+Í,í
+ı
+Ɨ
+Ɩ
+J,j,Ď,ĵ,ǰ
+K,k,Ķ,ķ,ǚ,ǩ
+Ƙ,ƙ
+L,l,Ĺ,ĺ,Ļ,Č,Ĝ,ğ
+Ŀ,ŀ
+LJ,Lj,lJ,lj,LJ,Lj,lj
+LL,Ll,lL,ll
+Ł,ł
+ƚ
+ƛ
+M,m
+N,n,Ñ,ñ,Ń,ń,Ņ,ņ,Ň,ň,Çž,ǹ
+NJ,Nj,nJ,nj,NJ,Nj,nj
+Ɲ
+ƞ
+Ŋ,ŋ
+O,o,Ò,Ô,Õ,ò,ÃŽ,õ,Ō,ō,Ŏ,ŏ,Ő,ő,Æ ,Æ¡,Ǒ,ǒ,Ǫ,Ç«,Ǭ,Ç­
+OE,Oe,oE,oe,Œ,œ
+Ó,ó
+ÇŸ,Ç¿
+Ɔ
+Ɵ
+P,p
+Æ€,Æ¥
+Q,q
+Äž
+R,r,Ŕ,ŕ,Ŗ,ŗ,Ř,ř
+RR,Rr,rR,rr
+ÆŠ
+S,s,Ś,ś,Ŝ,ŝ,Ş,ş,Š,š,ſ
+SS,Ss,sS,ss,ß
+Æ©
+ƪ
+T,t,Å¢,Å£,Å€,Å¥
+ÆŸ
+Ŋ,ŧ
+Æ«
+Ƭ,ƭ
+Æ®
+U,u,Ù,Û,Ü,ù,û,ÃŒ,Åš,Å©,Ū,Å«,Ŭ,Å­,Å®,ů,Ű,ű,Ų,ų,Ư,ư,Ǔ,ǔ,Ǖ,ǖ,Ǘ,ǘ,Ǚ,ǚ,Ǜ,ǜ
+Ú,ú
+Ɯ
+Ʊ
+V,v
+Ʋ
+W,w,Ŏ,ŵ
+X,x
+Y,y,ÿ,Ŷ,ŷ,Ş
+Ý,Ü
+Ƴ,Ǝ
+Z,z,Ź,ź,Ż,Ō,Ŝ,ş
+ƍ
+Þ,ß
+Ä,Æ,À,Ê
+Ö,Ø,ö,Þ
+Å,å
+Ƶ,ƶ
+Ʒ,Ǯ,ǯ
+ƞ,ƹ
+ƺ
+Æ¿,Ç·
+Æ»
+Ƨ,ƚ
+ƌ,Ɯ
+Ƅ,ƅ
+ʼn
+ǀ
+ǁ
+ǂ
+ǃ
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_latvian_ci;
+group_concat(c1 order by c1)
+÷
+×
+A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,À,Ã¥,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ç ,Ç¡,Ǻ,Ç»
+AA,Aa,aA,aa
+Æ,Ê,Ç¢,Ç£,ÇŒ,Çœ
+B,b
+ƀ
+Ɓ
+Ƃ,ƃ
+C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ
+CH,Ch,cH,ch
+Č,č
+Ƈ,ƈ
+D,d,Ď,ď
+DZ,Dz,dZ,dz,DŽ,Dž,dž,DZ,Dz,dz
+Đ,đ
+Ɖ
+Ɗ
+Ƌ,ƌ
+Ð,ð
+E,e,È,É,Ê,Ë,Ú,é,ê,ë,Ē,ē,Ĕ,ĕ,Ė,ė,Ę,ę,Ě,ě
+Ǝ,ǝ
+Ə
+Ɛ
+F,f
+Ƒ,ƒ
+G,g,Ĝ,ĝ,Ğ,ğ,Ä ,Ä¡,ÇŠ,ǧ,ÇŽ,ǵ
+Ä¢,Ä£
+Ç€,Ç¥
+Ɠ
+Ɣ
+Æ¢,Æ£
+H,h,Ä€,Ä¥
+ƕ,Ƕ
+Ċ,ħ
+I,i,Ì,Í,Î,Ï,ì,í,î,ï,Äš,Ä©,Ī,Ä«,Ĭ,Ä­,Ä®,į,İ,Ǐ,ǐ
+IJ,Ij,iJ,ij,IJ,ij
+Y,y
+ı
+Ɨ
+Ɩ
+J,j,Ď,ĵ,ǰ
+K,k,Çš,Ç©
+Ķ,ķ
+Ƙ,ƙ
+L,l,Ĺ,ĺ,Ĝ,ğ
+Ŀ,ŀ
+LJ,Lj,lJ,lj,LJ,Lj,lj
+LL,Ll,lL,ll
+Ļ,Č
+Ł,ł
+ƚ
+ƛ
+M,m
+N,n,Ñ,ñ,Ń,ń,Ň,ň,Çž,ǹ
+NJ,Nj,nJ,nj,NJ,Nj,nj
+Ņ,ņ
+Ɲ
+ƞ
+Ŋ,ŋ
+O,o,Ò,Ó,Ô,Õ,Ö,ò,ó,ÃŽ,õ,ö,Ō,ō,Ŏ,ŏ,Ő,ő,Æ ,Æ¡,Ǒ,ǒ,Ǫ,Ç«,Ǭ,Ç­
+OE,Oe,oE,oe,Œ,œ
+Ø,Þ,ÇŸ,Ç¿
+Ɔ
+Ɵ
+P,p
+Æ€,Æ¥
+Q,q
+Äž
+R,r,Ŕ,ŕ,Ř,ř
+RR,Rr,rR,rr
+Ŗ,ŗ
+ÆŠ
+S,s,Ś,ś,Ŝ,ŝ,Ş,ş,ſ
+SS,Ss,sS,ss,ß
+Å ,Å¡
+Æ©
+ƪ
+T,t,Å¢,Å£,Å€,Å¥
+ÆŸ
+Ŋ,ŧ
+Æ«
+Ƭ,ƭ
+Æ®
+U,u,Ù,Ú,Û,Ü,ù,ú,û,ÃŒ,Åš,Å©,Ū,Å«,Ŭ,Å­,Å®,ů,Ű,ű,Ų,ų,Ư,ư,Ǔ,ǔ,Ǖ,ǖ,Ǘ,ǘ,Ǚ,ǚ,Ǜ,ǜ
+Ɯ
+Ʊ
+V,v
+Ʋ
+W,w,Ŏ,ŵ
+X,x
+Ý,Ü,ÿ,Ŷ,ŷ,Ş
+Ƴ,Ǝ
+Z,z,Ź,ź,Ż,Ō
+ƍ
+Ŝ,ş
+Ƶ,ƶ
+Ʒ,Ǯ,ǯ
+ƞ,ƹ
+ƺ
+Þ,ß
+Æ¿,Ç·
+Æ»
+Ƨ,ƚ
+ƌ,Ɯ
+Ƅ,ƅ
+ʼn
+ǀ
+ǁ
+ǂ
+ǃ
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_romanian_ci;
+group_concat(c1 order by c1)
+÷
+×
+A,a,À,Á,Ã,Ä,Å,à,á,ã,À,Ã¥,Ā,ā,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ç ,Ç¡,Ǻ,Ç»
+AA,Aa,aA,aa
+Ă,ă
+Â,â
+Æ,Ê,Ç¢,Ç£,ÇŒ,Çœ
+B,b
+ƀ
+Ɓ
+Ƃ,ƃ
+C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č
+CH,Ch,cH,ch
+Ƈ,ƈ
+D,d,Ď,ď
+DZ,Dz,dZ,dz,DŽ,Dž,dž,DZ,Dz,dz
+Đ,đ
+Ɖ
+Ɗ
+Ƌ,ƌ
+Ð,ð
+E,e,È,É,Ê,Ë,Ú,é,ê,ë,Ē,ē,Ĕ,ĕ,Ė,ė,Ę,ę,Ě,ě
+Ǝ,ǝ
+Ə
+Ɛ
+F,f
+Ƒ,ƒ
+G,g,Ĝ,ĝ,Ğ,ğ,Ä ,Ä¡,Ä¢,Ä£,ÇŠ,ǧ,ÇŽ,ǵ
+Ç€,Ç¥
+Ɠ
+Ɣ
+Æ¢,Æ£
+H,h,Ä€,Ä¥
+ƕ,Ƕ
+Ċ,ħ
+I,i,Ì,Í,Ï,ì,í,ï,Äš,Ä©,Ī,Ä«,Ĭ,Ä­,Ä®,į,İ,Ǐ,ǐ
+IJ,Ij,iJ,ij,IJ,ij
+Î,î
+ı
+Ɨ
+Ɩ
+J,j,Ď,ĵ,ǰ
+K,k,Ķ,ķ,ǚ,ǩ
+Ƙ,ƙ
+L,l,Ĺ,ĺ,Ļ,Č,Ĝ,ğ
+Ŀ,ŀ
+LJ,Lj,lJ,lj,LJ,Lj,lj
+LL,Ll,lL,ll
+Ł,ł
+ƚ
+ƛ
+M,m
+N,n,Ñ,ñ,Ń,ń,Ņ,ņ,Ň,ň,Çž,ǹ
+NJ,Nj,nJ,nj,NJ,Nj,nj
+Ɲ
+ƞ
+Ŋ,ŋ
+O,o,Ò,Ó,Ô,Õ,Ö,ò,ó,ÃŽ,õ,ö,Ō,ō,Ŏ,ŏ,Ő,ő,Æ ,Æ¡,Ǒ,ǒ,Ǫ,Ç«,Ǭ,Ç­
+OE,Oe,oE,oe,Œ,œ
+Ø,Þ,ÇŸ,Ç¿
+Ɔ
+Ɵ
+P,p
+Æ€,Æ¥
+Q,q
+Äž
+R,r,Ŕ,ŕ,Ŗ,ŗ,Ř,ř
+RR,Rr,rR,rr
+ÆŠ
+S,s,Ś,ś,Ŝ,ŝ,Š,š,ſ
+SS,Ss,sS,ss,ß
+Ş,ş
+Æ©
+ƪ
+T,t,Å€,Å¥
+ÆŸ
+Å¢,Å£
+Ŋ,ŧ
+Æ«
+Ƭ,ƭ
+Æ®
+U,u,Ù,Ú,Û,Ü,ù,ú,û,ÃŒ,Åš,Å©,Ū,Å«,Ŭ,Å­,Å®,ů,Ű,ű,Ų,ų,Ư,ư,Ǔ,ǔ,Ǖ,ǖ,Ǘ,ǘ,Ǚ,ǚ,Ǜ,ǜ
+Ɯ
+Ʊ
+V,v
+Ʋ
+W,w,Ŏ,ŵ
+X,x
+Y,y,Ý,Ü,ÿ,Ŷ,ŷ,Ş
+Ƴ,Ǝ
+Z,z,Ź,ź,Ż,Ō,Ŝ,ş
+ƍ
+Ƶ,ƶ
+Ʒ,Ǯ,ǯ
+ƞ,ƹ
+ƺ
+Þ,ß
+Æ¿,Ç·
+Æ»
+Ƨ,ƚ
+ƌ,Ɯ
+Ƅ,ƅ
+ʼn
+ǀ
+ǁ
+ǂ
+ǃ
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_slovenian_ci;
+group_concat(c1 order by c1)
+÷
+×
+A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,À,Ã¥,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ç ,Ç¡,Ǻ,Ç»
+AA,Aa,aA,aa
+Æ,Ê,Ç¢,Ç£,ÇŒ,Çœ
+B,b
+ƀ
+Ɓ
+Ƃ,ƃ
+C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ
+CH,Ch,cH,ch
+Č,č
+Ƈ,ƈ
+D,d,Ď,ď
+DZ,Dz,dZ,dz,DŽ,Dž,dž,DZ,Dz,dz
+Đ,đ
+Ɖ
+Ɗ
+Ƌ,ƌ
+Ð,ð
+E,e,È,É,Ê,Ë,Ú,é,ê,ë,Ē,ē,Ĕ,ĕ,Ė,ė,Ę,ę,Ě,ě
+Ǝ,ǝ
+Ə
+Ɛ
+F,f
+Ƒ,ƒ
+G,g,Ĝ,ĝ,Ğ,ğ,Ä ,Ä¡,Ä¢,Ä£,ÇŠ,ǧ,ÇŽ,ǵ
+Ç€,Ç¥
+Ɠ
+Ɣ
+Æ¢,Æ£
+H,h,Ä€,Ä¥
+ƕ,Ƕ
+Ċ,ħ
+I,i,Ì,Í,Î,Ï,ì,í,î,ï,Äš,Ä©,Ī,Ä«,Ĭ,Ä­,Ä®,į,İ,Ǐ,ǐ
+IJ,Ij,iJ,ij,IJ,ij
+ı
+Ɨ
+Ɩ
+J,j,Ď,ĵ,ǰ
+K,k,Ķ,ķ,ǚ,ǩ
+Ƙ,ƙ
+L,l,Ĺ,ĺ,Ļ,Č,Ĝ,ğ
+Ŀ,ŀ
+LJ,Lj,lJ,lj,LJ,Lj,lj
+LL,Ll,lL,ll
+Ł,ł
+ƚ
+ƛ
+M,m
+N,n,Ñ,ñ,Ń,ń,Ņ,ņ,Ň,ň,Çž,ǹ
+NJ,Nj,nJ,nj,NJ,Nj,nj
+Ɲ
+ƞ
+Ŋ,ŋ
+O,o,Ò,Ó,Ô,Õ,Ö,ò,ó,ÃŽ,õ,ö,Ō,ō,Ŏ,ŏ,Ő,ő,Æ ,Æ¡,Ǒ,ǒ,Ǫ,Ç«,Ǭ,Ç­
+OE,Oe,oE,oe,Œ,œ
+Ø,Þ,ÇŸ,Ç¿
+Ɔ
+Ɵ
+P,p
+Æ€,Æ¥
+Q,q
+Äž
+R,r,Ŕ,ŕ,Ŗ,ŗ,Ř,ř
+RR,Rr,rR,rr
+ÆŠ
+S,s,Ś,ś,Ŝ,ŝ,Ş,ş,ſ
+SS,Ss,sS,ss,ß
+Å ,Å¡
+Æ©
+ƪ
+T,t,Å¢,Å£,Å€,Å¥
+ÆŸ
+Ŋ,ŧ
+Æ«
+Ƭ,ƭ
+Æ®
+U,u,Ù,Ú,Û,Ü,ù,ú,û,ÃŒ,Åš,Å©,Ū,Å«,Ŭ,Å­,Å®,ů,Ű,ű,Ų,ų,Ư,ư,Ǔ,ǔ,Ǖ,ǖ,Ǘ,ǘ,Ǚ,ǚ,Ǜ,ǜ
+Ɯ
+Ʊ
+V,v
+Ʋ
+W,w,Ŏ,ŵ
+X,x
+Y,y,Ý,Ü,ÿ,Ŷ,ŷ,Ş
+Ƴ,Ǝ
+Z,z,Ź,ź,Ż,Ō
+ƍ
+Ŝ,ş
+Ƶ,ƶ
+Ʒ,Ǯ,ǯ
+ƞ,ƹ
+ƺ
+Þ,ß
+Æ¿,Ç·
+Æ»
+Ƨ,ƚ
+ƌ,Ɯ
+Ƅ,ƅ
+ʼn
+ǀ
+ǁ
+ǂ
+ǃ
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_polish_ci;
+group_concat(c1 order by c1)
+÷
+×
+A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,À,Ã¥,Ā,ā,Ă,ă,Ǎ,ǎ,Ǟ,ǟ,Ç ,Ç¡,Ǻ,Ç»
+AA,Aa,aA,aa
+Ą,ą
+Æ,Ê,Ç¢,Ç£,ÇŒ,Çœ
+B,b
+ƀ
+Ɓ
+Ƃ,ƃ
+C,c,Ç,ç,Ĉ,ĉ,Ċ,ċ,Č,č
+CH,Ch,cH,ch
+Ć,ć
+Ƈ,ƈ
+D,d,Ď,ď
+DZ,Dz,dZ,dz,DŽ,Dž,dž,DZ,Dz,dz
+Đ,đ
+Ɖ
+Ɗ
+Ƌ,ƌ
+Ð,ð
+E,e,È,É,Ê,Ë,Ú,é,ê,ë,Ē,ē,Ĕ,ĕ,Ė,ė,Ě,ě
+Ę,ę
+Ǝ,ǝ
+Ə
+Ɛ
+F,f
+Ƒ,ƒ
+G,g,Ĝ,ĝ,Ğ,ğ,Ä ,Ä¡,Ä¢,Ä£,ÇŠ,ǧ,ÇŽ,ǵ
+Ç€,Ç¥
+Ɠ
+Ɣ
+Æ¢,Æ£
+H,h,Ä€,Ä¥
+ƕ,Ƕ
+Ċ,ħ
+I,i,Ì,Í,Î,Ï,ì,í,î,ï,Äš,Ä©,Ī,Ä«,Ĭ,Ä­,Ä®,į,İ,Ǐ,ǐ
+IJ,Ij,iJ,ij,IJ,ij
+ı
+Ɨ
+Ɩ
+J,j,Ď,ĵ,ǰ
+K,k,Ķ,ķ,ǚ,ǩ
+Ƙ,ƙ
+L,l,Ĺ,ĺ,Ļ,Č,Ĝ,ğ
+Ŀ,ŀ
+LJ,Lj,lJ,lj,LJ,Lj,lj
+LL,Ll,lL,ll
+Ł,ł
+ƚ
+ƛ
+M,m
+N,n,Ñ,ñ,Ņ,ņ,Ň,ň,Çž,ǹ
+NJ,Nj,nJ,nj,NJ,Nj,nj
+Ń,ń
+Ɲ
+ƞ
+Ŋ,ŋ
+O,o,Ò,Ô,Õ,Ö,ò,ÃŽ,õ,ö,Ō,ō,Ŏ,ŏ,Ő,ő,Æ ,Æ¡,Ǒ,ǒ,Ǫ,Ç«,Ǭ,Ç­
+OE,Oe,oE,oe,Œ,œ
+Ó,ó
+Ø,Þ,ÇŸ,Ç¿
+Ɔ
+Ɵ
+P,p
+Æ€,Æ¥
+Q,q
+Äž
+R,r,Ŕ,ŕ,Ŗ,ŗ,Ř,ř
+RR,Rr,rR,rr
+ÆŠ
+S,s,Ŝ,ŝ,Ş,ş,Š,š,ſ
+SS,Ss,sS,ss,ß
+Ś,ś
+Æ©
+ƪ
+T,t,Å¢,Å£,Å€,Å¥
+ÆŸ
+Ŋ,ŧ
+Æ«
+Ƭ,ƭ
+Æ®
+U,u,Ù,Ú,Û,Ü,ù,ú,û,ÃŒ,Åš,Å©,Ū,Å«,Ŭ,Å­,Å®,ů,Ű,ű,Ų,ų,Ư,ư,Ǔ,ǔ,Ǖ,ǖ,Ǘ,ǘ,Ǚ,ǚ,Ǜ,ǜ
+Ɯ
+Ʊ
+V,v
+Ʋ
+W,w,Ŏ,ŵ
+X,x
+Y,y,Ý,Ü,ÿ,Ŷ,ŷ,Ş
+Ƴ,Ǝ
+Z,z,Ŝ,ş
+ƍ
+Ź,ź
+Ż,Ō
+Ƶ,ƶ
+Ʒ,Ǯ,ǯ
+ƞ,ƹ
+ƺ
+Þ,ß
+Æ¿,Ç·
+Æ»
+Ƨ,ƚ
+ƌ,Ɯ
+Ƅ,ƅ
+ʼn
+ǀ
+ǁ
+ǂ
+ǃ
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_estonian_ci;
+group_concat(c1 order by c1)
+÷
+×
+A,a,À,Á,Â,Ã,Å,à,á,â,ã,å,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ
+AA,Aa,aA,aa
+Æ,Ê,Ç¢,Ç£,ÇŒ,Çœ
+B,b
+ƀ
+Ɓ
+Ƃ,ƃ
+C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č
+CH,Ch,cH,ch
+Ƈ,ƈ
+D,d,Ď,ď
+DZ,Dz,dZ,dz
+DŽ,Dž,dž,DZ,Dz,dz
+Đ,đ
+Ɖ
+Ɗ
+Ƌ,ƌ
+Ð,ð
+E,e,È,É,Ê,Ë,Ú,é,ê,ë,Ē,ē,Ĕ,ĕ,Ė,ė,Ę,ę,Ě,ě
+Ǝ,ǝ
+Ə
+Ɛ
+F,f
+Ƒ,ƒ
+G,g,Ĝ,ĝ,Ğ,ğ,Ä ,Ä¡,Ä¢,Ä£,ÇŠ,ǧ,ÇŽ,ǵ
+Ç€,Ç¥
+Ɠ
+Ɣ
+Æ¢,Æ£
+H,h,Ä€,Ä¥
+ƕ,Ƕ
+Ċ,ħ
+I,i,Ì,Í,Î,Ï,ì,í,î,ï,Äš,Ä©,Ī,Ä«,Ĭ,Ä­,Ä®,į,İ,Ǐ,ǐ
+IJ,Ij,iJ,ij,IJ,ij
+ı
+Ɨ
+Ɩ
+J,j,Ď,ĵ,ǰ
+K,k,Ķ,ķ,ǚ,ǩ
+Ƙ,ƙ
+L,l,Ĺ,ĺ,Ļ,Č,Ĝ,ğ
+Ŀ,ŀ
+LJ,Lj,lJ,lj,LJ,Lj,lj
+LL,Ll,lL,ll
+Ł,ł
+ƚ
+ƛ
+M,m
+N,n,Ñ,ñ,Ń,ń,Ņ,ņ,Ň,ň,Çž,ǹ
+NJ,Nj,nJ,nj,NJ,Nj,nj
+Ɲ
+ƞ
+Ŋ,ŋ
+O,o,Ò,Ó,Ô,ò,ó,ÃŽ,Ō,ō,Ŏ,ŏ,Ő,ő,Æ ,Æ¡,Ǒ,ǒ,Ǫ,Ç«,Ǭ,Ç­
+OE,Oe,oE,oe,Œ,œ
+Ø,Þ,ÇŸ,Ç¿
+Ɔ
+Ɵ
+P,p
+Æ€,Æ¥
+Q,q
+Äž
+R,r,Ŕ,ŕ,Ŗ,ŗ,Ř,ř
+RR,Rr,rR,rr
+ÆŠ
+S,s,Ś,ś,Ŝ,ŝ,Ş,ş,ſ
+SS,Ss,sS,ss,ß
+Å ,Å¡
+Z,z
+Ŝ,ş
+Æ©
+ƪ
+T,t,Å¢,Å£,Å€,Å¥
+ÆŸ
+Ŋ,ŧ
+Æ«
+Ƭ,ƭ
+Æ®
+U,u,Ù,Ú,Û,ù,ú,û,Åš,Å©,Ū,Å«,Ŭ,Å­,Å®,ů,Ű,ű,Ų,ų,Ư,ư,Ǔ,ǔ,Ǖ,ǖ,Ǘ,ǘ,Ǚ,ǚ,Ǜ,ǜ
+Ɯ
+Ʊ
+V,v
+Ʋ
+W,w,Ŏ,ŵ
+Õ,õ
+Ä,À
+Ö,ö
+Ü,ÃŒ
+X,x
+Y,y,Ý,Ü,ÿ,Ŷ,ŷ,Ş
+Ƴ,Ǝ
+Ź,ź,Ż,Ō
+ƍ
+Ƶ,ƶ
+Ʒ,Ǯ,ǯ
+ƞ,ƹ
+ƺ
+Þ,ß
+Æ¿,Ç·
+Æ»
+Ƨ,ƚ
+ƌ,Ɯ
+Ƅ,ƅ
+ʼn
+ǀ
+ǁ
+ǂ
+ǃ
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_spanish_ci;
+group_concat(c1 order by c1)
+÷
+×
+A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,À,Ã¥,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ç ,Ç¡,Ǻ,Ç»
+AA,Aa,aA,aa
+Æ,Ê,Ç¢,Ç£,ÇŒ,Çœ
+B,b
+ƀ
+Ɓ
+Ƃ,ƃ
+C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č
+CH,Ch,cH,ch
+Ƈ,ƈ
+D,d,Ď,ď
+DZ,Dz,dZ,dz,DŽ,Dž,dž,DZ,Dz,dz
+Đ,đ
+Ɖ
+Ɗ
+Ƌ,ƌ
+Ð,ð
+E,e,È,É,Ê,Ë,Ú,é,ê,ë,Ē,ē,Ĕ,ĕ,Ė,ė,Ę,ę,Ě,ě
+Ǝ,ǝ
+Ə
+Ɛ
+F,f
+Ƒ,ƒ
+G,g,Ĝ,ĝ,Ğ,ğ,Ä ,Ä¡,Ä¢,Ä£,ÇŠ,ǧ,ÇŽ,ǵ
+Ç€,Ç¥
+Ɠ
+Ɣ
+Æ¢,Æ£
+H,h,Ä€,Ä¥
+ƕ,Ƕ
+Ċ,ħ
+I,i,Ì,Í,Î,Ï,ì,í,î,ï,Äš,Ä©,Ī,Ä«,Ĭ,Ä­,Ä®,į,İ,Ǐ,ǐ
+IJ,Ij,iJ,ij,IJ,ij
+ı
+Ɨ
+Ɩ
+J,j,Ď,ĵ,ǰ
+K,k,Ķ,ķ,ǚ,ǩ
+Ƙ,ƙ
+L,l,Ĺ,ĺ,Ļ,Č,Ĝ,ğ
+Ŀ,ŀ
+LJ,Lj,lJ,lj,LJ,Lj,lj
+LL,Ll,lL,ll
+Ł,ł
+ƚ
+ƛ
+M,m
+N,n,Ń,ń,Ņ,ņ,Ň,ň,Çž,ǹ
+NJ,Nj,nJ,nj,NJ,Nj,nj
+Ñ,ñ
+Ɲ
+ƞ
+Ŋ,ŋ
+O,o,Ò,Ó,Ô,Õ,Ö,ò,ó,ÃŽ,õ,ö,Ō,ō,Ŏ,ŏ,Ő,ő,Æ ,Æ¡,Ǒ,ǒ,Ǫ,Ç«,Ǭ,Ç­
+OE,Oe,oE,oe,Œ,œ
+Ø,Þ,ÇŸ,Ç¿
+Ɔ
+Ɵ
+P,p
+Æ€,Æ¥
+Q,q
+Äž
+R,r,Ŕ,ŕ,Ŗ,ŗ,Ř,ř
+RR,Rr,rR,rr
+ÆŠ
+S,s,Ś,ś,Ŝ,ŝ,Ş,ş,Š,š,ſ
+SS,Ss,sS,ss,ß
+Æ©
+ƪ
+T,t,Å¢,Å£,Å€,Å¥
+ÆŸ
+Ŋ,ŧ
+Æ«
+Ƭ,ƭ
+Æ®
+U,u,Ù,Ú,Û,Ü,ù,ú,û,ÃŒ,Åš,Å©,Ū,Å«,Ŭ,Å­,Å®,ů,Ű,ű,Ų,ų,Ư,ư,Ǔ,ǔ,Ǖ,ǖ,Ǘ,ǘ,Ǚ,ǚ,Ǜ,ǜ
+Ɯ
+Ʊ
+V,v
+Ʋ
+W,w,Ŏ,ŵ
+X,x
+Y,y,Ý,Ü,ÿ,Ŷ,ŷ,Ş
+Ƴ,Ǝ
+Z,z,Ź,ź,Ż,Ō,Ŝ,ş
+ƍ
+Ƶ,ƶ
+Ʒ,Ǯ,ǯ
+ƞ,ƹ
+ƺ
+Þ,ß
+Æ¿,Ç·
+Æ»
+Ƨ,ƚ
+ƌ,Ɯ
+Ƅ,ƅ
+ʼn
+ǀ
+ǁ
+ǂ
+ǃ
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_swedish_ci;
+group_concat(c1 order by c1)
+÷
+×
+A,a,À,Á,Â,Ã,à,á,â,ã,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ
+AA,Aa,aA,aa
+Ǣ,ǣ,nj,ǜ
+B,b
+ƀ
+Ɓ
+Ƃ,ƃ
+C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č
+CH,Ch,cH,ch
+Ƈ,ƈ
+D,d,Ď,ď
+DZ,Dz,dZ,dz,DŽ,Dž,dž,DZ,Dz,dz
+Đ,đ
+Ɖ
+Ɗ
+Ƌ,ƌ
+Ð,ð
+E,e,È,É,Ê,Ë,Ú,é,ê,ë,Ē,ē,Ĕ,ĕ,Ė,ė,Ę,ę,Ě,ě
+Ǝ,ǝ
+Ə
+Ɛ
+F,f
+Ƒ,ƒ
+G,g,Ĝ,ĝ,Ğ,ğ,Ä ,Ä¡,Ä¢,Ä£,ÇŠ,ǧ,ÇŽ,ǵ
+Ç€,Ç¥
+Ɠ
+Ɣ
+Æ¢,Æ£
+H,h,Ä€,Ä¥
+ƕ,Ƕ
+Ċ,ħ
+I,i,Ì,Í,Î,Ï,ì,í,î,ï,Äš,Ä©,Ī,Ä«,Ĭ,Ä­,Ä®,į,İ,Ǐ,ǐ
+IJ,Ij,iJ,ij,IJ,ij
+ı
+Ɨ
+Ɩ
+J,j,Ď,ĵ,ǰ
+K,k,Ķ,ķ,ǚ,ǩ
+Ƙ,ƙ
+L,l,Ĺ,ĺ,Ļ,Č,Ĝ,ğ
+Ŀ,ŀ
+LJ,Lj,lJ,lj,LJ,Lj,lj
+LL,Ll,lL,ll
+Ł,ł
+ƚ
+ƛ
+M,m
+N,n,Ñ,ñ,Ń,ń,Ņ,ņ,Ň,ň,Çž,ǹ
+NJ,Nj,nJ,nj,NJ,Nj,nj
+Ɲ
+ƞ
+Ŋ,ŋ
+O,o,Ò,Ó,Ô,Õ,ò,ó,ÃŽ,õ,Ō,ō,Ŏ,ŏ,Ő,ő,Æ ,Æ¡,Ǒ,ǒ,Ǫ,Ç«,Ǭ,Ç­
+OE,Oe,oE,oe,Œ,œ
+ÇŸ,Ç¿
+Ɔ
+Ɵ
+P,p
+Æ€,Æ¥
+Q,q
+Äž
+R,r,Ŕ,ŕ,Ŗ,ŗ,Ř,ř
+RR,Rr,rR,rr
+ÆŠ
+S,s,Ś,ś,Ŝ,ŝ,Ş,ş,Š,š,ſ
+SS,Ss,sS,ss,ß
+Æ©
+ƪ
+T,t,Å¢,Å£,Å€,Å¥
+ÆŸ
+Ŋ,ŧ
+Æ«
+Ƭ,ƭ
+Æ®
+U,u,Ù,Ú,Û,ù,ú,û,Åš,Å©,Ū,Å«,Ŭ,Å­,Å®,ů,Ű,ű,Ų,ų,Ư,ư,Ǔ,ǔ,Ǖ,ǖ,Ǘ,ǘ,Ǚ,ǚ,Ǜ,ǜ
+Ɯ
+Ʊ
+V,v
+Ʋ
+W,w,Ŏ,ŵ
+X,x
+Y,y,Ü,Ý,ÃŒ,Ü,ÿ,Ŷ,Å·,Åž
+Ƴ,Ǝ
+Z,z,Ź,ź,Ż,Ō,Ŝ,ş
+ƍ
+Å,å
+Ä,Æ,À,Ê
+Ö,Ø,ö,Þ
+Ƶ,ƶ
+Ʒ,Ǯ,ǯ
+ƞ,ƹ
+ƺ
+Þ,ß
+Æ¿,Ç·
+Æ»
+Ƨ,ƚ
+ƌ,Ɯ
+Ƅ,ƅ
+ʼn
+ǀ
+ǁ
+ǂ
+ǃ
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_turkish_ci;
+group_concat(c1 order by c1)
+÷
+×
+A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,À,Ã¥,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ç ,Ç¡,Ǻ,Ç»
+AA,Aa,aA,aa
+Æ,Ê,Ç¢,Ç£,ÇŒ,Çœ
+B,b
+ƀ
+Ɓ
+Ƃ,ƃ
+C,c,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č
+CH,Ch,cH,ch
+Ç,ç
+Ƈ,ƈ
+D,d,Ď,ď
+DZ,Dz,dZ,dz,DŽ,Dž,dž,DZ,Dz,dz
+Đ,đ
+Ɖ
+Ɗ
+Ƌ,ƌ
+Ð,ð
+E,e,È,É,Ê,Ë,Ú,é,ê,ë,Ē,ē,Ĕ,ĕ,Ė,ė,Ę,ę,Ě,ě
+Ǝ,ǝ
+Ə
+Ɛ
+F,f
+Ƒ,ƒ
+G,g,Ĝ,ĝ,Ä ,Ä¡,Ä¢,Ä£,ÇŠ,ǧ,ÇŽ,ǵ
+Ğ,ğ
+Ç€,Ç¥
+Ɠ
+Ɣ
+Æ¢,Æ£
+H,h,Ä€,Ä¥
+I,ı
+IJ,Ij
+ƕ,Ƕ
+Ċ,ħ
+i,Ì,Í,Î,Ï,ì,í,î,ï,Äš,Ä©,Ī,Ä«,Ĭ,Ä­,Ä®,į,İ,Ǐ,ǐ
+iJ,ij,IJ,ij
+Ɨ
+Ɩ
+J,j,Ď,ĵ,ǰ
+K,k,Ķ,ķ,ǚ,ǩ
+Ƙ,ƙ
+L,l,Ĺ,ĺ,Ļ,Č,Ĝ,ğ
+Ŀ,ŀ
+LJ,Lj,lJ,lj,LJ,Lj,lj
+LL,Ll,lL,ll
+Ł,ł
+ƚ
+ƛ
+M,m
+N,n,Ñ,ñ,Ń,ń,Ņ,ņ,Ň,ň,Çž,ǹ
+NJ,Nj,nJ,nj,NJ,Nj,nj
+Ɲ
+ƞ
+Ŋ,ŋ
+O,o,Ò,Ó,Ô,Õ,ò,ó,ÃŽ,õ,Ō,ō,Ŏ,ŏ,Ő,ő,Æ ,Æ¡,Ǒ,ǒ,Ǫ,Ç«,Ǭ,Ç­
+OE,Oe,oE,oe,Œ,œ
+Ö,ö
+Ø,Þ,ÇŸ,Ç¿
+Ɔ
+Ɵ
+P,p
+Æ€,Æ¥
+Q,q
+Äž
+R,r,Ŕ,ŕ,Ŗ,ŗ,Ř,ř
+RR,Rr,rR,rr
+ÆŠ
+S,s,Ś,ś,Ŝ,ŝ,Š,š,ſ
+SS,Ss,sS,ss,ß
+Ş,ş
+Æ©
+ƪ
+T,t,Å¢,Å£,Å€,Å¥
+ÆŸ
+Ŋ,ŧ
+Æ«
+Ƭ,ƭ
+Æ®
+U,u,Ù,Ú,Û,ù,ú,û,Åš,Å©,Ū,Å«,Ŭ,Å­,Å®,ů,Ű,ű,Ų,ų,Ư,ư,Ǔ,ǔ,Ǖ,ǖ,Ǘ,ǘ,Ǚ,ǚ,Ǜ,ǜ
+Ü,ÃŒ
+Ɯ
+Ʊ
+V,v
+Ʋ
+W,w,Ŏ,ŵ
+X,x
+Y,y,Ý,Ü,ÿ,Ŷ,ŷ,Ş
+Ƴ,Ǝ
+Z,z,Ź,ź,Ż,Ō,Ŝ,ş
+ƍ
+Ƶ,ƶ
+Ʒ,Ǯ,ǯ
+ƞ,ƹ
+ƺ
+Þ,ß
+Æ¿,Ç·
+Æ»
+Ƨ,ƚ
+ƌ,Ɯ
+Ƅ,ƅ
+ʼn
+ǀ
+ǁ
+ǂ
+ǃ
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_czech_ci;
+group_concat(c1 order by c1)
+÷
+×
+A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,À,Ã¥,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ç ,Ç¡,Ǻ,Ç»
+AA,Aa,aA,aa
+Æ,Ê,Ç¢,Ç£,ÇŒ,Çœ
+B,b
+ƀ
+Ɓ
+Ƃ,ƃ
+C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ
+cH
+Č,č
+Ƈ,ƈ
+D,d,Ď,ď
+DZ,Dz,dZ,dz,DŽ,Dž,dž,DZ,Dz,dz
+Đ,đ
+Ɖ
+Ɗ
+Ƌ,ƌ
+Ð,ð
+E,e,È,É,Ê,Ë,Ú,é,ê,ë,Ē,ē,Ĕ,ĕ,Ė,ė,Ę,ę,Ě,ě
+Ǝ,ǝ
+Ə
+Ɛ
+F,f
+Ƒ,ƒ
+G,g,Ĝ,ĝ,Ğ,ğ,Ä ,Ä¡,Ä¢,Ä£,ÇŠ,ǧ,ÇŽ,ǵ
+Ç€,Ç¥
+Ɠ
+Ɣ
+Æ¢,Æ£
+H,h,Ä€,Ä¥
+CH,Ch,ch
+ƕ,Ƕ
+Ċ,ħ
+I,i,Ì,Í,Î,Ï,ì,í,î,ï,Äš,Ä©,Ī,Ä«,Ĭ,Ä­,Ä®,į,İ,Ǐ,ǐ
+IJ,Ij,iJ,ij,IJ,ij
+ı
+Ɨ
+Ɩ
+J,j,Ď,ĵ,ǰ
+K,k,Ķ,ķ,ǚ,ǩ
+Ƙ,ƙ
+L,l,Ĺ,ĺ,Ļ,Č,Ĝ,ğ
+Ŀ,ŀ
+LJ,Lj,lJ,lj,LJ,Lj,lj
+LL,Ll,lL,ll
+Ł,ł
+ƚ
+ƛ
+M,m
+N,n,Ñ,ñ,Ń,ń,Ņ,ņ,Ň,ň,Çž,ǹ
+NJ,Nj,nJ,nj,NJ,Nj,nj
+Ɲ
+ƞ
+Ŋ,ŋ
+O,o,Ò,Ó,Ô,Õ,Ö,ò,ó,ÃŽ,õ,ö,Ō,ō,Ŏ,ŏ,Ő,ő,Æ ,Æ¡,Ǒ,ǒ,Ǫ,Ç«,Ǭ,Ç­
+OE,Oe,oE,oe,Œ,œ
+Ø,Þ,ÇŸ,Ç¿
+Ɔ
+Ɵ
+P,p
+Æ€,Æ¥
+Q,q
+Äž
+R,r,Ŕ,ŕ,Ŗ,ŗ
+RR,Rr,rR,rr
+Ř,ř
+ÆŠ
+S,s,Ś,ś,Ŝ,ŝ,Ş,ş,ſ
+SS,Ss,sS,ss,ß
+Å ,Å¡
+Æ©
+ƪ
+T,t,Å¢,Å£,Å€,Å¥
+ÆŸ
+Ŋ,ŧ
+Æ«
+Ƭ,ƭ
+Æ®
+U,u,Ù,Ú,Û,Ü,ù,ú,û,ÃŒ,Åš,Å©,Ū,Å«,Ŭ,Å­,Å®,ů,Ű,ű,Ų,ų,Ư,ư,Ǔ,ǔ,Ǖ,ǖ,Ǘ,ǘ,Ǚ,ǚ,Ǜ,ǜ
+Ɯ
+Ʊ
+V,v
+Ʋ
+W,w,Ŏ,ŵ
+X,x
+Y,y,Ý,Ü,ÿ,Ŷ,ŷ,Ş
+Ƴ,Ǝ
+Z,z,Ź,ź,Ż,Ō
+ƍ
+Ŝ,ş
+Ƶ,ƶ
+Ʒ,Ǯ,ǯ
+ƞ,ƹ
+ƺ
+Þ,ß
+Æ¿,Ç·
+Æ»
+Ƨ,ƚ
+ƌ,Ɯ
+Ƅ,ƅ
+ʼn
+ǀ
+ǁ
+ǂ
+ǃ
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_danish_ci;
+group_concat(c1 order by c1)
+÷
+×
+A,a,À,Á,Â,Ã,à,á,â,ã,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ
+aA
+Ǣ,ǣ,nj,ǜ
+B,b
+ƀ
+Ɓ
+Ƃ,ƃ
+C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č
+CH,Ch,cH,ch
+Ƈ,ƈ
+D,d,Ď,ď
+DZ,Dz,dZ,dz,DŽ,Dž,dž,DZ,Dz,dz
+Đ,đ
+Ɖ
+Ɗ
+Ƌ,ƌ
+Ð,ð
+E,e,È,É,Ê,Ë,Ú,é,ê,ë,Ē,ē,Ĕ,ĕ,Ė,ė,Ę,ę,Ě,ě
+Ǝ,ǝ
+Ə
+Ɛ
+F,f
+Ƒ,ƒ
+G,g,Ĝ,ĝ,Ğ,ğ,Ä ,Ä¡,Ä¢,Ä£,ÇŠ,ǧ,ÇŽ,ǵ
+Ç€,Ç¥
+Ɠ
+Ɣ
+Æ¢,Æ£
+H,h,Ä€,Ä¥
+ƕ,Ƕ
+Ċ,ħ
+I,i,Ì,Í,Î,Ï,ì,í,î,ï,Äš,Ä©,Ī,Ä«,Ĭ,Ä­,Ä®,į,İ,Ǐ,ǐ
+IJ,Ij,iJ,ij,IJ,ij
+ı
+Ɨ
+Ɩ
+J,j,Ď,ĵ,ǰ
+K,k,Ķ,ķ,ǚ,ǩ
+Ƙ,ƙ
+L,l,Ĺ,ĺ,Ļ,Č,Ĝ,ğ
+Ŀ,ŀ
+LJ,Lj,lJ,lj,LJ,Lj,lj
+LL,Ll,lL,ll
+Ł,ł
+ƚ
+ƛ
+M,m
+N,n,Ñ,ñ,Ń,ń,Ņ,ņ,Ň,ň,Çž,ǹ
+NJ,Nj,nJ,nj,NJ,Nj,nj
+Ɲ
+ƞ
+Ŋ,ŋ
+O,o,Ò,Ó,Ô,Õ,ò,ó,ÃŽ,õ,Ō,ō,Ŏ,ŏ,Æ ,Æ¡,Ǒ,ǒ,Ǫ,Ç«,Ǭ,Ç­
+OE,Oe,oE,oe,Œ,œ
+ÇŸ,Ç¿
+Ɔ
+Ɵ
+P,p
+Æ€,Æ¥
+Q,q
+Äž
+R,r,Ŕ,ŕ,Ŗ,ŗ,Ř,ř
+RR,Rr,rR,rr
+ÆŠ
+S,s,Ś,ś,Ŝ,ŝ,Ş,ş,Š,š,ſ
+SS,Ss,sS,ss,ß
+Æ©
+ƪ
+T,t,Å¢,Å£,Å€,Å¥
+ÆŸ
+Ŋ,ŧ
+Æ«
+Ƭ,ƭ
+Æ®
+U,u,Ù,Ú,Û,ù,ú,û,Åš,Å©,Ū,Å«,Ŭ,Å­,Å®,ů,Ų,ų,Ư,ư,Ǔ,ǔ,Ǖ,ǖ,Ǘ,ǘ,Ǚ,ǚ,Ǜ,ǜ
+Ɯ
+Ʊ
+V,v
+Ʋ
+W,w,Ŏ,ŵ
+X,x
+Y,y,Ü,Ý,ÃŒ,Ü,ÿ,Ű,ű,Ŷ,Å·,Åž
+Ƴ,Ǝ
+Z,z,Ź,ź,Ż,Ō,Ŝ,ş
+ƍ
+Ä,Æ,À,Ê
+Ö,Ø,ö,Þ,Ő,ő
+AA,Aa,aa,Å,å
+Ƶ,ƶ
+Ʒ,Ǯ,ǯ
+ƞ,ƹ
+ƺ
+Þ,ß
+Æ¿,Ç·
+Æ»
+Ƨ,ƚ
+ƌ,Ɯ
+Ƅ,ƅ
+ʼn
+ǀ
+ǁ
+ǂ
+ǃ
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_lithuanian_ci;
+group_concat(c1 order by c1)
+÷
+×
+A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,À,Ã¥,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ç ,Ç¡,Ǻ,Ç»
+AA,Aa,aA,aa
+Æ,Ê,Ç¢,Ç£,ÇŒ,Çœ
+B,b
+ƀ
+Ɓ
+Ƃ,ƃ
+C,CH,Ch,c,ch,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ
+cH
+Č,č
+Ƈ,ƈ
+D,d,Ď,ď
+DZ,Dz,dZ,dz,DŽ,Dž,dž,DZ,Dz,dz
+Đ,đ
+Ɖ
+Ɗ
+Ƌ,ƌ
+Ð,ð
+E,e,È,É,Ê,Ë,Ú,é,ê,ë,Ē,ē,Ĕ,ĕ,Ė,ė,Ę,ę,Ě,ě
+Ǝ,ǝ
+Ə
+Ɛ
+F,f
+Ƒ,ƒ
+G,g,Ĝ,ĝ,Ğ,ğ,Ä ,Ä¡,Ä¢,Ä£,ÇŠ,ǧ,ÇŽ,ǵ
+Ç€,Ç¥
+Ɠ
+Ɣ
+Æ¢,Æ£
+H,h,Ä€,Ä¥
+ƕ,Ƕ
+Ċ,ħ
+I,Y,i,y,Ì,Í,Î,Ï,ì,í,î,ï,Äš,Ä©,Ī,Ä«,Ĭ,Ä­,Ä®,į,İ,Ǐ,ǐ
+IJ,Ij,iJ,ij,IJ,ij
+ı
+Ɨ
+Ɩ
+J,j,Ď,ĵ,ǰ
+K,k,Ķ,ķ,ǚ,ǩ
+Ƙ,ƙ
+L,l,Ĺ,ĺ,Ļ,Č,Ĝ,ğ
+Ŀ,ŀ
+LJ,Lj,lJ,lj,LJ,Lj,lj
+LL,Ll,lL,ll
+Ł,ł
+ƚ
+ƛ
+M,m
+N,n,Ñ,ñ,Ń,ń,Ņ,ņ,Ň,ň,Çž,ǹ
+NJ,Nj,nJ,nj,NJ,Nj,nj
+Ɲ
+ƞ
+Ŋ,ŋ
+O,o,Ò,Ó,Ô,Õ,Ö,ò,ó,ÃŽ,õ,ö,Ō,ō,Ŏ,ŏ,Ő,ő,Æ ,Æ¡,Ǒ,ǒ,Ǫ,Ç«,Ǭ,Ç­
+OE,Oe,oE,oe,Œ,œ
+Ø,Þ,ÇŸ,Ç¿
+Ɔ
+Ɵ
+P,p
+Æ€,Æ¥
+Q,q
+Äž
+R,r,Ŕ,ŕ,Ŗ,ŗ,Ř,ř
+RR,Rr,rR,rr
+ÆŠ
+S,s,Ś,ś,Ŝ,ŝ,Ş,ş,ſ
+SS,Ss,sS,ss,ß
+Å ,Å¡
+Æ©
+ƪ
+T,t,Å¢,Å£,Å€,Å¥
+ÆŸ
+Ŋ,ŧ
+Æ«
+Ƭ,ƭ
+Æ®
+U,u,Ù,Ú,Û,Ü,ù,ú,û,ÃŒ,Åš,Å©,Ū,Å«,Ŭ,Å­,Å®,ů,Ű,ű,Ų,ų,Ư,ư,Ǔ,ǔ,Ǖ,ǖ,Ǘ,ǘ,Ǚ,ǚ,Ǜ,ǜ
+Ɯ
+Ʊ
+V,v
+Ʋ
+W,w,Ŏ,ŵ
+X,x
+Ý,Ü,ÿ,Ŷ,ŷ,Ş
+Ƴ,Ǝ
+Z,z,Ź,ź,Ż,Ō
+ƍ
+Ŝ,ş
+Ƶ,ƶ
+Ʒ,Ǯ,ǯ
+ƞ,ƹ
+ƺ
+Þ,ß
+Æ¿,Ç·
+Æ»
+Ƨ,ƚ
+ƌ,Ɯ
+Ƅ,ƅ
+ʼn
+ǀ
+ǁ
+ǂ
+ǃ
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_slovak_ci;
+group_concat(c1 order by c1)
+÷
+×
+A,a,À,Á,Â,Ã,Å,à,á,â,ã,å,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ
+AA,Aa,aA,aa
+Ä,À
+Æ,Ê,Ç¢,Ç£,ÇŒ,Çœ
+B,b
+ƀ
+Ɓ
+Ƃ,ƃ
+C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ
+cH
+Č,č
+Ƈ,ƈ
+D,d,Ď,ď
+DZ,Dz,dZ,dz,DŽ,Dž,dž,DZ,Dz,dz
+Đ,đ
+Ɖ
+Ɗ
+Ƌ,ƌ
+Ð,ð
+E,e,È,É,Ê,Ë,Ú,é,ê,ë,Ē,ē,Ĕ,ĕ,Ė,ė,Ę,ę,Ě,ě
+Ǝ,ǝ
+Ə
+Ɛ
+F,f
+Ƒ,ƒ
+G,g,Ĝ,ĝ,Ğ,ğ,Ä ,Ä¡,Ä¢,Ä£,ÇŠ,ǧ,ÇŽ,ǵ
+Ç€,Ç¥
+Ɠ
+Ɣ
+Æ¢,Æ£
+H,h,Ä€,Ä¥
+CH,Ch,ch
+ƕ,Ƕ
+Ċ,ħ
+I,i,Ì,Í,Î,Ï,ì,í,î,ï,Äš,Ä©,Ī,Ä«,Ĭ,Ä­,Ä®,į,İ,Ǐ,ǐ
+IJ,Ij,iJ,ij,IJ,ij
+ı
+Ɨ
+Ɩ
+J,j,Ď,ĵ,ǰ
+K,k,Ķ,ķ,ǚ,ǩ
+Ƙ,ƙ
+L,l,Ĺ,ĺ,Ļ,Č,Ĝ,ğ
+Ŀ,ŀ
+LJ,Lj,lJ,lj,LJ,Lj,lj
+LL,Ll,lL,ll
+Ł,ł
+ƚ
+ƛ
+M,m
+N,n,Ñ,ñ,Ń,ń,Ņ,ņ,Ň,ň,Çž,ǹ
+NJ,Nj,nJ,nj,NJ,Nj,nj
+Ɲ
+ƞ
+Ŋ,ŋ
+O,o,Ò,Ó,Õ,Ö,ò,ó,õ,ö,Ō,ō,Ŏ,ŏ,Ő,ő,Ơ,ơ,Ǒ,ǒ,Ǫ,ǫ,Ǭ,ǭ
+OE,Oe,oE,oe,Œ,œ
+Ô,ÃŽ
+Ø,Þ,ÇŸ,Ç¿
+Ɔ
+Ɵ
+P,p
+Æ€,Æ¥
+Q,q
+Äž
+R,r,Ŕ,ŕ,Ŗ,ŗ,Ř,ř
+RR,Rr,rR,rr
+ÆŠ
+S,s,Ś,ś,Ŝ,ŝ,Ş,ş,ſ
+SS,Ss,sS,ss,ß
+Å ,Å¡
+Æ©
+ƪ
+T,t,Å¢,Å£,Å€,Å¥
+ÆŸ
+Ŋ,ŧ
+Æ«
+Ƭ,ƭ
+Æ®
+U,u,Ù,Ú,Û,Ü,ù,ú,û,ÃŒ,Åš,Å©,Ū,Å«,Ŭ,Å­,Å®,ů,Ű,ű,Ų,ų,Ư,ư,Ǔ,ǔ,Ǖ,ǖ,Ǘ,ǘ,Ǚ,ǚ,Ǜ,ǜ
+Ɯ
+Ʊ
+V,v
+Ʋ
+W,w,Ŏ,ŵ
+X,x
+Y,y,Ý,Ü,ÿ,Ŷ,ŷ,Ş
+Ƴ,Ǝ
+Z,z,Ź,ź,Ż,Ō
+ƍ
+Ŝ,ş
+Ƶ,ƶ
+Ʒ,Ǯ,ǯ
+ƞ,ƹ
+ƺ
+Þ,ß
+Æ¿,Ç·
+Æ»
+Ƨ,ƚ
+ƌ,Ɯ
+Ƅ,ƅ
+ʼn
+ǀ
+ǁ
+ǂ
+ǃ
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_spanish2_ci;
+group_concat(c1 order by c1)
+÷
+×
+A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,À,Ã¥,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ç ,Ç¡,Ǻ,Ç»
+AA,Aa,aA,aa
+Æ,Ê,Ç¢,Ç£,ÇŒ,Çœ
+B,b
+ƀ
+Ɓ
+Ƃ,ƃ
+C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č
+cH
+CH,Ch,ch
+Ƈ,ƈ
+D,d,Ď,ď
+DZ,Dz,dZ,dz,DŽ,Dž,dž,DZ,Dz,dz
+Đ,đ
+Ɖ
+Ɗ
+Ƌ,ƌ
+Ð,ð
+E,e,È,É,Ê,Ë,Ú,é,ê,ë,Ē,ē,Ĕ,ĕ,Ė,ė,Ę,ę,Ě,ě
+Ǝ,ǝ
+Ə
+Ɛ
+F,f
+Ƒ,ƒ
+G,g,Ĝ,ĝ,Ğ,ğ,Ä ,Ä¡,Ä¢,Ä£,ÇŠ,ǧ,ÇŽ,ǵ
+Ç€,Ç¥
+Ɠ
+Ɣ
+Æ¢,Æ£
+H,h,Ä€,Ä¥
+ƕ,Ƕ
+Ċ,ħ
+I,i,Ì,Í,Î,Ï,ì,í,î,ï,Äš,Ä©,Ī,Ä«,Ĭ,Ä­,Ä®,į,İ,Ǐ,ǐ
+IJ,Ij,iJ,ij,IJ,ij
+ı
+Ɨ
+Ɩ
+J,j,Ď,ĵ,ǰ
+K,k,Ķ,ķ,ǚ,ǩ
+Ƙ,ƙ
+L,l,Ĺ,ĺ,Ļ,Č,Ĝ,ğ
+Ŀ,ŀ
+LJ,Lj,lJ,lj,LJ,Lj,lj
+lL
+LL,Ll,ll
+Ł,ł
+ƚ
+ƛ
+M,m
+N,n,Ń,ń,Ņ,ņ,Ň,ň,Çž,ǹ
+NJ,Nj,nJ,nj,NJ,Nj,nj
+Ñ,ñ
+Ɲ
+ƞ
+Ŋ,ŋ
+O,o,Ò,Ó,Ô,Õ,Ö,ò,ó,ÃŽ,õ,ö,Ō,ō,Ŏ,ŏ,Ő,ő,Æ ,Æ¡,Ǒ,ǒ,Ǫ,Ç«,Ǭ,Ç­
+OE,Oe,oE,oe,Œ,œ
+Ø,Þ,ÇŸ,Ç¿
+Ɔ
+Ɵ
+P,p
+Æ€,Æ¥
+Q,q
+Äž
+R,RR,Rr,r,rr,Ŕ,ŕ,Ŗ,ŗ,Ř,ř
+rR
+ÆŠ
+S,s,Ś,ś,Ŝ,ŝ,Ş,ş,Š,š,ſ
+SS,Ss,sS,ss,ß
+Æ©
+ƪ
+T,t,Å¢,Å£,Å€,Å¥
+ÆŸ
+Ŋ,ŧ
+Æ«
+Ƭ,ƭ
+Æ®
+U,u,Ù,Ú,Û,Ü,ù,ú,û,ÃŒ,Åš,Å©,Ū,Å«,Ŭ,Å­,Å®,ů,Ű,ű,Ų,ų,Ư,ư,Ǔ,ǔ,Ǖ,ǖ,Ǘ,ǘ,Ǚ,ǚ,Ǜ,ǜ
+Ɯ
+Ʊ
+V,v
+Ʋ
+W,w,Ŏ,ŵ
+X,x
+Y,y,Ý,Ü,ÿ,Ŷ,ŷ,Ş
+Ƴ,Ǝ
+Z,z,Ź,ź,Ż,Ō,Ŝ,ş
+ƍ
+Ƶ,ƶ
+Ʒ,Ǯ,ǯ
+ƞ,ƹ
+ƺ
+Þ,ß
+Æ¿,Ç·
+Æ»
+Ƨ,ƚ
+ƌ,Ɯ
+Ƅ,ƅ
+ʼn
+ǀ
+ǁ
+ǂ
+ǃ
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_roman_ci;
+group_concat(c1 order by c1)
+÷
+×
+A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,À,Ã¥,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ç ,Ç¡,Ǻ,Ç»
+AA,Aa,aA,aa
+Æ,Ê,Ç¢,Ç£,ÇŒ,Çœ
+B,b
+ƀ
+Ɓ
+Ƃ,ƃ
+C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č
+CH,Ch,cH,ch
+Ƈ,ƈ
+D,d,Ď,ď
+DZ,Dz,dZ,dz,DŽ,Dž,dž,DZ,Dz,dz
+Đ,đ
+Ɖ
+Ɗ
+Ƌ,ƌ
+Ð,ð
+E,e,È,É,Ê,Ë,Ú,é,ê,ë,Ē,ē,Ĕ,ĕ,Ė,ė,Ę,ę,Ě,ě
+Ǝ,ǝ
+Ə
+Ɛ
+F,f
+Ƒ,ƒ
+G,g,Ĝ,ĝ,Ğ,ğ,Ä ,Ä¡,Ä¢,Ä£,ÇŠ,ǧ,ÇŽ,ǵ
+Ç€,Ç¥
+Ɠ
+Ɣ
+Æ¢,Æ£
+H,h,Ä€,Ä¥
+ƕ,Ƕ
+Ċ,ħ
+I,J,i,j,Ì,Í,Î,Ï,ì,í,î,ï,Äš,Ä©,Ī,Ä«,Ĭ,Ä­,Ä®,į,İ,Ǐ,ǐ
+IJ,Ij,iJ,ij
+IJ,ij
+ı
+Ɨ
+Ɩ
+Ď,ĵ,ǰ
+K,k,Ķ,ķ,ǚ,ǩ
+Ƙ,ƙ
+L,l,Ĺ,ĺ,Ļ,Č,Ĝ,ğ
+Ŀ,ŀ
+LJ,Lj,lJ,lj
+LJ,Lj,lj
+LL,Ll,lL,ll
+Ł,ł
+ƚ
+ƛ
+M,m
+N,n,Ñ,ñ,Ń,ń,Ņ,ņ,Ň,ň,Çž,ǹ
+NJ,Nj,nJ,nj
+NJ,Nj,nj
+Ɲ
+ƞ
+Ŋ,ŋ
+O,o,Ò,Ó,Ô,Õ,Ö,ò,ó,ÃŽ,õ,ö,Ō,ō,Ŏ,ŏ,Ő,ő,Æ ,Æ¡,Ǒ,ǒ,Ǫ,Ç«,Ǭ,Ç­
+OE,Oe,oE,oe,Œ,œ
+Ø,Þ,ÇŸ,Ç¿
+Ɔ
+Ɵ
+P,p
+Æ€,Æ¥
+Q,q
+Äž
+R,r,Ŕ,ŕ,Ŗ,ŗ,Ř,ř
+RR,Rr,rR,rr
+ÆŠ
+S,s,Ś,ś,Ŝ,ŝ,Ş,ş,Š,š,ſ
+SS,Ss,sS,ss,ß
+Æ©
+ƪ
+T,t,Å¢,Å£,Å€,Å¥
+ÆŸ
+Ŋ,ŧ
+Æ«
+Ƭ,ƭ
+Æ®
+Ù,Ú,Û,Ü,ù,ú,û,ÃŒ,Åš,Å©,Ū,Å«,Ŭ,Å­,Å®,ů,Ű,ű,Ų,ų,Ư,ư,Ǔ,ǔ,Ǖ,ǖ,Ǘ,ǘ,Ǚ,ǚ,Ǜ,ǜ
+Ɯ
+Ʊ
+U,V,u,v
+Ʋ
+W,w,Ŏ,ŵ
+X,x
+Y,y,Ý,Ü,ÿ,Ŷ,ŷ,Ş
+Ƴ,Ǝ
+Z,z,Ź,ź,Ż,Ō,Ŝ,ş
+ƍ
+Ƶ,ƶ
+Ʒ,Ǯ,ǯ
+ƞ,ƹ
+ƺ
+Þ,ß
+Æ¿,Ç·
+Æ»
+Ƨ,ƚ
+ƌ,Ɯ
+Ƅ,ƅ
+ʼn
+ǀ
+ǁ
+ǂ
+ǃ
+drop table t1;
+SET NAMES utf8;
+CREATE TABLE t1 (c varchar(255) NOT NULL COLLATE utf8_general_ci, INDEX (c));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B403B11F770308 USING utf8));
+SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf8)
+COLLATE utf8_general_ci;
+c
+ΜωΎα᜷̈
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B4 USING utf8));
+SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf8)
+COLLATE utf8_general_ci ORDER BY c;
+c
+ΜωΎ
+ΜωΎα᜷̈
+DROP TABLE t1;
+CREATE TABLE t1 (c varchar(255) NOT NULL COLLATE ucs2_unicode_ci, INDEX (c));
+INSERT INTO t1 VALUES (_ucs2 0x039C03C903B403B11F770308);
+SELECT * FROM t1 WHERE c LIKE _ucs2 0x039C0025 COLLATE ucs2_unicode_ci;
+c
+ΜωΎα᜷̈
+INSERT INTO t1 VALUES (_ucs2 0x039C03C903B4);
+SELECT * FROM t1 WHERE c LIKE _ucs2 0x039C0025
+COLLATE ucs2_unicode_ci ORDER BY c;
+c
+ΜωΎ
+ΜωΎα᜷̈
+DROP TABLE t1;
+CREATE TABLE t1 (c varchar(255) NOT NULL COLLATE utf8_unicode_ci, INDEX (c));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B403B11F770308 USING utf8));
+SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf8) COLLATE utf8_unicode_ci;
+c
+ΜωΎα᜷̈
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B4 USING utf8));
+SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf8)
+COLLATE utf8_unicode_ci ORDER BY c;
+c
+ΜωΎ
+ΜωΎα᜷̈
+DROP TABLE t1;
+CREATE TABLE t1 (
+col1 CHAR(32) CHARACTER SET utf8 NOT NULL
+);
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0041004100410627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0041004100410628 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0041004100410647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0041004100410648 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0633064A0651062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D06330646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0642064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06320627062F0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062806310627064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064706450647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F062706460634062C0648064A06270646064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A06270631064A062E USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062706460642064406270628 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A0631062706460650 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627062F064806270631062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280631062706480646200C06310627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062E064806270646062F0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0648 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A062D062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0623062B064A0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0642063106270631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06AF06310641062A0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270646062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0634062E0635064A0651062A064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628062706310632 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270633062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063906A90633 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270648060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D062F0648062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628064A0633062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0648067E0646062C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06330627064406AF064A060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063306270644 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606450627064A0646062F0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A06280631064A0632 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645062C06440633 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280648062F060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628064A0646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06350641062D0627062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A0646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A9062A06270628 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x068606340645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062E06480631062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0686064706310647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06420648064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450635064506510645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06310627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0646063406270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645064A200C062F0647062F060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647063106860646062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06390645064400BB USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A9064806340634 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064706500646064A064606AF USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627062D063306270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064A062706310634062706370631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450646062A06340631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0634062F0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0633062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A064806270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647064506270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064806510644 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0634062E064A0635 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0627062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A064106270648062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D06270644062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A064106A906510631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063A064406280647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06270631062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064A06A9064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270632 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063106470628063106270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606470636062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064506340631064806370647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A063106270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0646064A0632 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064A06A9 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645062D064206510642 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0637063106270632 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064106310647064606AF USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0645062F06510646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A063106270646064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280648062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90627063106470627064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270648 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0639063106350647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064506480631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0633064A06270633064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A063106270646060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D064806320647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063906440645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F062706460634 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450642062706440627062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F064A06AF0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0648064A06980647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0646062706450647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064506480631062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628062D062B USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628063106310633064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606480634062A0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A064606470627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0622064606860647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F064806310647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064206270645062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x067E0631062F062706320645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0698062706460648064A0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0648064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06390648062A0650 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063306500631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0646064A0633064F0646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063106270633 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647064A0626062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0639064406480645200C063406310642064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280639062F0627064B USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645062F063106330647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062206410631064A06420627064A064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06270646063406AF06270647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06440646062F0646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x067E064A06480633062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647064606AF06270645064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x067E0633 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0622063A06270632 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062C064606AF USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062C064706270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F064806510645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063406470631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A9064506280631064A062C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450646062A06420644 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90631062F0646062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06470645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06310641062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220646062C0627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064506270646062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062706A9062A06280631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606380631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06480644062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06480628062706310647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606330628062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645063306270639062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0634062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06480632064A0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645062E062A06270631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06330641064A0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064606AF0644064A0633 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0642064A200C06320627062F0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280627063206AF0634062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647064506330631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220644064506270646064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270634 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220645062F0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A906270631064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x067E0631062F0627062E062A0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063906440645064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627062F0628064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D062F0651 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606280648062F060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06480644064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063906480636060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06340627064A062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064506470645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220646060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06470645063306310634 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90627064606480646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062E0627064606480627062F06AF064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06AF06310645064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280648062C0648062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062206480631062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0648 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90627064506440627064B USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064A06A9062F064A06AF0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06AF USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F064406280633062A0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280648062F0646062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450647064506270646 USING utf8));
+SELECT HEX(CONVERT(col1 USING ucs2)) FROM t1 ORDER BY col1 COLLATE utf8_persian_ci, col1 COLLATE utf8_bin;
+HEX(CONVERT(col1 USING ucs2))
+0041004100410627
+0041004100410628
+0041004100410648
+0041004100410647
+0622063A06270632
+062206410631064A06420627064A064A
+06220644064506270646064A
+06220645062F0647
+06220646
+06220646060C
+06220646062C0627
+0622064606860647
+062206480631062F
+0627062D063306270646
+0627062F0628064A
+0627062F064806270631062F
+06270632
+06270633062A
+06270634
+0627064206270645062A
+062706A9062A06280631
+0627064506480631
+06270646062F
+062706460642064406270628
+0627064606AF0644064A0633
+06270648
+06270648060C
+0627064806510644
+0627064A
+0627064A063106270646
+0627064A063106270646060C
+0627064A0631062706460650
+0627064A063106270646064A
+0627064A0646
+0628
+06280627
+0628062706310632
+06280627063206AF0634062A
+0628062D062B
+06280631062706480646200C06310627
+062806310627064A
+0628063106310633064A
+06280639062F0627064B
+06280648062C0648062F
+06280648062F
+06280648062F060C
+06280648062F0646062F
+06280647
+0628064A0633062A
+0628064A0646
+067E0631062F0627062E062A0647
+067E0631062F062706320645
+067E0633
+067E064A06480633062A
+062A0627
+062A06270631064A062E
+062A0623062B064A0631
+062A06280631064A0632
+062A062D062A
+062A0631
+062A0634062E064A0635
+062A064106270648062A
+062A064106A906510631
+062A0642064A
+062A0642064A200C06320627062F0647
+062A0645062F06510646
+062A064606470627
+062A064806270646
+062C064606AF
+062C064706270646
+068606340645
+0686064706310647
+062D06270644062A
+062D062F0651
+062D062F0648062F
+062D06330646
+062D064806320647
+062E0627064606480627062F06AF064A
+062E064806270646062F0647
+062E06480631062F
+062F0627062F
+062F06270631062F
+062F062706460634
+062F062706460634062C0648064A06270646064A
+062F06270646063406AF06270647
+062F0631
+062F0633062A
+062F06390648062A0650
+062F064406280633062A0647
+062F0646064A0633064F0646
+062F0648
+062F06480628062706310647
+062F064806310647
+062F06480644062A
+062F064806510645
+062F064A06AF0631
+06310627
+063106270633
+06310641062A
+063106470628063106270646
+06320627062F0647
+0698062706460648064A0647
+063306500631
+063306270644
+06330627064406AF064A060C
+06330641064A0631
+0633064A06270633064A
+0633064A0651062F
+06340627064A062F
+0634062E0635064A0651062A064A
+0634062F
+0634062F0647
+063406470631
+06350641062D0627062A
+0637063106270632
+0639063106350647
+063906A90633
+063906440645
+063906440645064A
+0639064406480645200C063406310642064A
+06390645064400BB
+063906480636060C
+063A064406280647
+064106310647064606AF
+0642063106270631
+06420648064A
+06A90627063106470627064A
+06A906270631064A
+06A90627064506440627064B
+06A90627064606480646
+06A9062A06270628
+06A90631062F0646062F
+06A9064506280631064A062C
+06A9064806340634
+06A90647
+06AF
+06AF06310641062A0647
+06AF06310645064A
+06440646062F0646
+064506270646062F
+0645062C06440633
+0645062D064206510642
+0645062E062A06270631
+0645062F063106330647
+0645063306270639062F
+064506340631064806370647
+06450635064506510645
+06450642062706440627062A
+06450646
+06450646062A06340631
+06450646062A06420644
+064506480631062F
+064506470645
+06450647064506270646
+0645064A
+0645064A200C062F0647062F060C
+0646062706450647
+064606280648062F060C
+064606330628062A
+0646063406270646
+064606380631
+064606450627064A0646062F0647
+064606480634062A0647
+064606470636062A
+0646064A0632
+0648
+0648067E0646062C
+06480632064A0631
+06480644064A
+0648064A
+0648064A06980647
+064706500646064A064606AF
+0647063106860646062F
+06470645
+0647064506270646
+0647064506330631
+06470645063306310634
+064706450647
+0647064606AF06270645064A
+0647064A0626062A
+064A062706310634062706370631
+064A06A9
+064A06A9062F064A06AF0631
+064A06A9064A
+DROP TABLE t1;
+SET @test_character_set= 'utf8';
+SET @test_collation= 'utf8_swedish_ci';
+SET @safe_character_set_server= @@character_set_server;
+SET @safe_collation_server= @@collation_server;
+SET character_set_server= @test_character_set;
+SET collation_server= @test_collation;
+CREATE DATABASE d1;
+USE d1;
+CREATE TABLE t1 (c CHAR(10), KEY(c));
+SHOW FULL COLUMNS FROM t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+c char(10) utf8_swedish_ci YES MUL NULL
+INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
+SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
+want3results
+aaa
+aaaa
+aaaaa
+DROP TABLE t1;
+CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
+SHOW FULL COLUMNS FROM t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+c1 varchar(15) utf8_swedish_ci YES MUL NULL
+INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
+SELECT c1 as want3results from t1 where c1 like 'l%';
+want3results
+location
+loberge
+lotre
+SELECT c1 as want3results from t1 where c1 like 'lo%';
+want3results
+location
+loberge
+lotre
+SELECT c1 as want1result from t1 where c1 like 'loc%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'loca%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'locat%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'locati%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'locatio%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'location%';
+want1result
+location
+DROP TABLE t1;
+DROP DATABASE d1;
+USE test;
+SET character_set_server= @safe_character_set_server;
+SET collation_server= @safe_collation_server;
+create table t1 (a varchar(1)) character set utf8 collate utf8_estonian_ci;
+insert into t1 values ('A'),('B'),('C'),('a'),('b'),('c');
+select a, a regexp '[a]' from t1 order by binary a;
+a a regexp '[a]'
+A 1
+B 0
+C 0
+a 1
+b 0
+c 0
+drop table t1;
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
new file mode 100644
index 00000000000..b1b83eb8b6c
--- /dev/null
+++ b/mysql-test/r/ctype_ucs.result
@@ -0,0 +1,594 @@
+DROP TABLE IF EXISTS t1;
+SET NAMES latin1;
+SET character_set_connection=ucs2;
+select 'a' = 'a', 'a' = 'a ', 'a ' = 'a';
+'a' = 'a' 'a' = 'a ' 'a ' = 'a'
+1 1 1
+select 'a\0' = 'a', 'a\0' < 'a', 'a\0' > 'a';
+'a\0' = 'a' 'a\0' < 'a' 'a\0' > 'a'
+0 1 0
+select 'a' = 'a\0', 'a' < 'a\0', 'a' > 'a\0';
+'a' = 'a\0' 'a' < 'a\0' 'a' > 'a\0'
+0 0 1
+select 'a\0' = 'a ', 'a\0' < 'a ', 'a\0' > 'a ';
+'a\0' = 'a ' 'a\0' < 'a ' 'a\0' > 'a '
+0 1 0
+select 'a ' = 'a\0', 'a ' < 'a\0', 'a ' > 'a\0';
+'a ' = 'a\0' 'a ' < 'a\0' 'a ' > 'a\0'
+0 0 1
+select 'a a' > 'a', 'a \0' < 'a';
+'a a' > 'a' 'a \0' < 'a'
+1 1
+select binary 'a a' > 'a', binary 'a \0' > 'a', binary 'a\0' > 'a';
+binary 'a a' > 'a' binary 'a \0' > 'a' binary 'a\0' > 'a'
+1 1 1
+SET CHARACTER SET koi8r;
+CREATE TABLE t1 (word VARCHAR(64) CHARACTER SET ucs2);
+INSERT INTO t1 VALUES (_koi8r'ò'), (X'2004');
+SELECT hex(word) FROM t1 ORDER BY word;
+hex(word)
+0420
+2004
+DELETE FROM t1;
+INSERT INTO t1 VALUES (X'042000200020'), (X'200400200020');
+SELECT hex(word) FROM t1 ORDER BY word;
+hex(word)
+0420
+2004
+DROP TABLE t1;
+SELECT LPAD(_ucs2 X'0420',10,_ucs2 X'0421');
+LPAD(_ucs2 X'0420',10,_ucs2 X'0421')
+óóóóóóóóóò
+SELECT LPAD(_ucs2 X'0420',10,_ucs2 X'04210422');
+LPAD(_ucs2 X'0420',10,_ucs2 X'04210422')
+óôóôóôóôóò
+SELECT LPAD(_ucs2 X'0420',10,_ucs2 X'042104220423');
+LPAD(_ucs2 X'0420',10,_ucs2 X'042104220423')
+óôõóôõóôõò
+SELECT LPAD(_ucs2 X'0420042104220423042404250426042704280429042A042B',10,_ucs2 X'042104220423');
+LPAD(_ucs2 X'0420042104220423042404250426042704280429042A042B',10,_ucs2 X'042104220423')
+òóôõæèãþûý
+SELECT RPAD(_ucs2 X'0420',10,_ucs2 X'0421');
+RPAD(_ucs2 X'0420',10,_ucs2 X'0421')
+òóóóóóóóóó
+SELECT RPAD(_ucs2 X'0420',10,_ucs2 X'04210422');
+RPAD(_ucs2 X'0420',10,_ucs2 X'04210422')
+òóôóôóôóôó
+SELECT RPAD(_ucs2 X'0420',10,_ucs2 X'042104220423');
+RPAD(_ucs2 X'0420',10,_ucs2 X'042104220423')
+òóôõóôõóôõ
+SELECT RPAD(_ucs2 X'0420042104220423042404250426042704280429042A042B',10,_ucs2 X'042104220423');
+RPAD(_ucs2 X'0420042104220423042404250426042704280429042A042B',10,_ucs2 X'042104220423')
+òóôõæèãþûý
+CREATE TABLE t1 SELECT
+LPAD(_ucs2 X'0420',10,_ucs2 X'0421') l,
+RPAD(_ucs2 X'0420',10,_ucs2 X'0421') r;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `l` char(10) character set ucs2 NOT NULL default '',
+ `r` char(10) character set ucs2 NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+create table t2(f1 Char(30));
+insert into t2 values ("103000"), ("22720000"), ("3401200"), ("78000");
+select lpad(f1, 12, "-o-/") from t2;
+lpad(f1, 12, "-o-/")
+-o-/-o103000
+-o-/22720000
+-o-/-3401200
+-o-/-o-78000
+drop table t2;
+SET NAMES koi8r;
+SET character_set_connection=ucs2;
+create table t1 (a varchar(10) character set ucs2, key(a));
+insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
+explain select * from t1 where a like 'abc%';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 21 NULL 1 Using where; Using index
+explain select * from t1 where a like concat('abc','%');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 21 NULL 1 Using where; Using index
+select * from t1 where a like "abc%";
+a
+abc
+abcd
+select * from t1 where a like concat("abc","%");
+a
+abc
+abcd
+select * from t1 where a like "ABC%";
+a
+abc
+abcd
+select * from t1 where a like "test%";
+a
+test
+select * from t1 where a like "te_t";
+a
+test
+select * from t1 where a like "%a%";
+a
+a
+abc
+abcd
+select * from t1 where a like "%abcd%";
+a
+abcd
+select * from t1 where a like "%abc\d%";
+a
+abcd
+drop table t1;
+select 'AA' like 'AA';
+'AA' like 'AA'
+1
+select 'AA' like 'A%A';
+'AA' like 'A%A'
+1
+select 'AA' like 'A%%A';
+'AA' like 'A%%A'
+1
+select 'AA' like 'AA%';
+'AA' like 'AA%'
+1
+select 'AA' like '%AA%';
+'AA' like '%AA%'
+1
+select 'AA' like '%A';
+'AA' like '%A'
+1
+select 'AA' like '%AA';
+'AA' like '%AA'
+1
+select 'AA' like 'A%A%';
+'AA' like 'A%A%'
+1
+select 'AA' like '_%_%';
+'AA' like '_%_%'
+1
+select 'AA' like '%A%A';
+'AA' like '%A%A'
+1
+select 'AAA'like 'A%A%A';
+'AAA'like 'A%A%A'
+1
+select 'AZ' like 'AZ';
+'AZ' like 'AZ'
+1
+select 'AZ' like 'A%Z';
+'AZ' like 'A%Z'
+1
+select 'AZ' like 'A%%Z';
+'AZ' like 'A%%Z'
+1
+select 'AZ' like 'AZ%';
+'AZ' like 'AZ%'
+1
+select 'AZ' like '%AZ%';
+'AZ' like '%AZ%'
+1
+select 'AZ' like '%Z';
+'AZ' like '%Z'
+1
+select 'AZ' like '%AZ';
+'AZ' like '%AZ'
+1
+select 'AZ' like 'A%Z%';
+'AZ' like 'A%Z%'
+1
+select 'AZ' like '_%_%';
+'AZ' like '_%_%'
+1
+select 'AZ' like '%A%Z';
+'AZ' like '%A%Z'
+1
+select 'AZ' like 'A_';
+'AZ' like 'A_'
+1
+select 'AZ' like '_Z';
+'AZ' like '_Z'
+1
+select 'AMZ'like 'A%M%Z';
+'AMZ'like 'A%M%Z'
+1
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ucs2);
+INSERT INTO t1 VALUES ('ÆÙ×Á'),('æÙ×Á'),('Æù×Á'),('ÆÙ÷Á'),('ÆÙ×á'),('æù÷á');
+INSERT INTO t1 VALUES ('ÆÙ×ÁÐÒÏÌÄÖ'),('æÙ×ÁÐÒÏÌÄÖ'),('Æù×ÁÐÒÏÌÄÖ'),('ÆÙ÷ÁÐÒÏÌÄÖ');
+INSERT INTO t1 VALUES ('ÆÙ×áÐÒÏÌÄÖ'),('ÆÙ×ÁðÒÏÌÄÖ'),('ÆÙ×ÁÐòÏÌÄÖ'),('ÆÙ×ÁÐÒïÌÄÖ');
+INSERT INTO t1 VALUES ('ÆÙ×ÁÐÒÏìÄÖ'),('ÆÙ×ÁÐÒÏÌäÖ'),('ÆÙ×ÁÐÒÏÌÄö'),('æù÷áðòïìäö');
+SELECT * FROM t1 WHERE a LIKE '%Æù×Á%';
+a
+ÆÙ×Á
+æÙ×Á
+Æù×Á
+ÆÙ÷Á
+ÆÙ×á
+æù÷á
+ÆÙ×ÁÐÒÏÌÄÖ
+æÙ×ÁÐÒÏÌÄÖ
+Æù×ÁÐÒÏÌÄÖ
+ÆÙ÷ÁÐÒÏÌÄÖ
+ÆÙ×áÐÒÏÌÄÖ
+ÆÙ×ÁðÒÏÌÄÖ
+ÆÙ×ÁÐòÏÌÄÖ
+ÆÙ×ÁÐÒïÌÄÖ
+ÆÙ×ÁÐÒÏìÄÖ
+ÆÙ×ÁÐÒÏÌäÖ
+ÆÙ×ÁÐÒÏÌÄö
+æù÷áðòïìäö
+SELECT * FROM t1 WHERE a LIKE '%Æù×%';
+a
+ÆÙ×Á
+æÙ×Á
+Æù×Á
+ÆÙ÷Á
+ÆÙ×á
+æù÷á
+ÆÙ×ÁÐÒÏÌÄÖ
+æÙ×ÁÐÒÏÌÄÖ
+Æù×ÁÐÒÏÌÄÖ
+ÆÙ÷ÁÐÒÏÌÄÖ
+ÆÙ×áÐÒÏÌÄÖ
+ÆÙ×ÁðÒÏÌÄÖ
+ÆÙ×ÁÐòÏÌÄÖ
+ÆÙ×ÁÐÒïÌÄÖ
+ÆÙ×ÁÐÒÏìÄÖ
+ÆÙ×ÁÐÒÏÌäÖ
+ÆÙ×ÁÐÒÏÌÄö
+æù÷áðòïìäö
+SELECT * FROM t1 WHERE a LIKE 'Æù×Á%';
+a
+ÆÙ×Á
+æÙ×Á
+Æù×Á
+ÆÙ÷Á
+ÆÙ×á
+æù÷á
+ÆÙ×ÁÐÒÏÌÄÖ
+æÙ×ÁÐÒÏÌÄÖ
+Æù×ÁÐÒÏÌÄÖ
+ÆÙ÷ÁÐÒÏÌÄÖ
+ÆÙ×áÐÒÏÌÄÖ
+ÆÙ×ÁðÒÏÌÄÖ
+ÆÙ×ÁÐòÏÌÄÖ
+ÆÙ×ÁÐÒïÌÄÖ
+ÆÙ×ÁÐÒÏìÄÖ
+ÆÙ×ÁÐÒÏÌäÖ
+ÆÙ×ÁÐÒÏÌÄö
+æù÷áðòïìäö
+SELECT * FROM t1 WHERE a LIKE 'Æù×Á%' COLLATE ucs2_bin;
+a
+Æù×Á
+Æù×ÁÐÒÏÌÄÖ
+DROP TABLE t1;
+CREATE TABLE t1 (word varchar(64) NOT NULL, PRIMARY KEY (word))
+ENGINE=MyISAM CHARACTER SET ucs2 COLLATE ucs2_general_ci;
+INSERT INTO t1 (word) VALUES ("cat");
+SELECT * FROM t1 WHERE word LIKE "c%";
+word
+cat
+SELECT * FROM t1 WHERE word LIKE "ca_";
+word
+cat
+SELECT * FROM t1 WHERE word LIKE "cat";
+word
+cat
+SELECT * FROM t1 WHERE word LIKE _ucs2 x'00630025';
+word
+cat
+SELECT * FROM t1 WHERE word LIKE _ucs2 x'00630061005F';
+word
+cat
+DROP TABLE t1;
+select insert(_ucs2 0x006100620063,10,2,_ucs2 0x006400650066);
+insert(_ucs2 0x006100620063,10,2,_ucs2 0x006400650066)
+abc
+select insert(_ucs2 0x006100620063,1,2,_ucs2 0x006400650066);
+insert(_ucs2 0x006100620063,1,2,_ucs2 0x006400650066)
+defc
+SET NAMES latin1;
+CREATE TABLE t1 (
+word VARCHAR(64),
+bar INT(11) default 0,
+PRIMARY KEY (word))
+ENGINE=MyISAM
+CHARSET ucs2
+COLLATE ucs2_general_ci ;
+INSERT INTO t1 (word) VALUES ("aar");
+INSERT INTO t1 (word) VALUES ("a");
+INSERT INTO t1 (word) VALUES ("aardvar");
+INSERT INTO t1 (word) VALUES ("aardvark");
+INSERT INTO t1 (word) VALUES ("aardvara");
+INSERT INTO t1 (word) VALUES ("aardvarz");
+EXPLAIN SELECT * FROM t1 ORDER BY word;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
+SELECT * FROM t1 ORDER BY word;
+word bar
+a 0
+aar 0
+aardvar 0
+aardvara 0
+aardvark 0
+aardvarz 0
+EXPLAIN SELECT word FROM t1 ORDER BY word;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 128 NULL 6 Using index
+SELECT word FROM t1 ORDER by word;
+word
+a
+aar
+aardvar
+aardvara
+aardvark
+aardvarz
+DROP TABLE t1;
+CREATE TABLE t1 (
+word VARCHAR(64) ,
+PRIMARY KEY (word))
+ENGINE=MyISAM
+CHARSET ucs2
+COLLATE ucs2_general_ci;
+INSERT INTO t1 (word) VALUES ("aar");
+INSERT INTO t1 (word) VALUES ("a");
+INSERT INTO t1 (word) VALUES ("aardvar");
+INSERT INTO t1 (word) VALUES ("aardvark");
+INSERT INTO t1 (word) VALUES ("aardvara");
+INSERT INTO t1 (word) VALUES ("aardvarz");
+EXPLAIN SELECT * FROM t1 ORDER BY WORD;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 128 NULL 6 Using index
+SELECT * FROM t1 ORDER BY word;
+word
+a
+aar
+aardvar
+aardvara
+aardvark
+aardvarz
+DROP TABLE t1;
+CREATE TABLE t1 (
+word TEXT,
+bar INT(11) AUTO_INCREMENT,
+PRIMARY KEY (bar))
+ENGINE=MyISAM
+CHARSET ucs2
+COLLATE ucs2_general_ci ;
+INSERT INTO t1 (word) VALUES ("aar");
+INSERT INTO t1 (word) VALUES ("a" );
+INSERT INTO t1 (word) VALUES ("aardvar");
+INSERT INTO t1 (word) VALUES ("aardvark");
+INSERT INTO t1 (word) VALUES ("aardvara");
+INSERT INTO t1 (word) VALUES ("aardvarz");
+EXPLAIN SELECT * FROM t1 ORDER BY word;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
+SELECT * FROM t1 ORDER BY word;
+word bar
+a 2
+aar 1
+aardvar 3
+aardvara 5
+aardvark 4
+aardvarz 6
+EXPLAIN SELECT word FROM t1 ORDER BY word;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
+SELECT word FROM t1 ORDER BY word;
+word
+a
+aar
+aardvar
+aardvara
+aardvark
+aardvarz
+DROP TABLE t1;
+SELECT HEX(_ucs2 0x0);
+HEX(_ucs2 0x0)
+0000
+SELECT HEX(_ucs2 0x01);
+HEX(_ucs2 0x01)
+0001
+SELECT HEX(_ucs2 0x012);
+HEX(_ucs2 0x012)
+0012
+SELECT HEX(_ucs2 0x0123);
+HEX(_ucs2 0x0123)
+0123
+SELECT HEX(_ucs2 0x01234);
+HEX(_ucs2 0x01234)
+00001234
+SELECT HEX(_ucs2 0x012345);
+HEX(_ucs2 0x012345)
+00012345
+SELECT HEX(_ucs2 0x0123456);
+HEX(_ucs2 0x0123456)
+00123456
+SELECT HEX(_ucs2 0x01234567);
+HEX(_ucs2 0x01234567)
+01234567
+SELECT HEX(_ucs2 0x012345678);
+HEX(_ucs2 0x012345678)
+000012345678
+SELECT HEX(_ucs2 0x0123456789);
+HEX(_ucs2 0x0123456789)
+000123456789
+SELECT HEX(_ucs2 0x0123456789A);
+HEX(_ucs2 0x0123456789A)
+00123456789A
+SELECT HEX(_ucs2 0x0123456789AB);
+HEX(_ucs2 0x0123456789AB)
+0123456789AB
+SELECT HEX(_ucs2 0x0123456789ABC);
+HEX(_ucs2 0x0123456789ABC)
+0000123456789ABC
+SELECT HEX(_ucs2 0x0123456789ABCD);
+HEX(_ucs2 0x0123456789ABCD)
+000123456789ABCD
+SELECT HEX(_ucs2 0x0123456789ABCDE);
+HEX(_ucs2 0x0123456789ABCDE)
+00123456789ABCDE
+SELECT HEX(_ucs2 0x0123456789ABCDEF);
+HEX(_ucs2 0x0123456789ABCDEF)
+0123456789ABCDEF
+SELECT hex(cast(0xAA as char character set ucs2));
+hex(cast(0xAA as char character set ucs2))
+00AA
+SELECT hex(convert(0xAA using ucs2));
+hex(convert(0xAA using ucs2))
+00AA
+CREATE TABLE t1 (a char(10) character set ucs2);
+INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
+SELECT HEX(a) FROM t1;
+HEX(a)
+000A
+00AA
+0AAA
+AAAA
+000AAAAA
+DROP TABLE t1;
+CREATE TABLE t1 (a varchar(10) character set ucs2);
+INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
+SELECT HEX(a) FROM t1;
+HEX(a)
+000A
+00AA
+0AAA
+AAAA
+000AAAAA
+DROP TABLE t1;
+CREATE TABLE t1 (a text character set ucs2);
+INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
+SELECT HEX(a) FROM t1;
+HEX(a)
+000A
+00AA
+0AAA
+AAAA
+000AAAAA
+DROP TABLE t1;
+CREATE TABLE t1 (a mediumtext character set ucs2);
+INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
+SELECT HEX(a) FROM t1;
+HEX(a)
+000A
+00AA
+0AAA
+AAAA
+000AAAAA
+DROP TABLE t1;
+CREATE TABLE t1 (a longtext character set ucs2);
+INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
+SELECT HEX(a) FROM t1;
+HEX(a)
+000A
+00AA
+0AAA
+AAAA
+000AAAAA
+DROP TABLE t1;
+create table t1 (s1 char character set `ucs2` collate `ucs2_czech_ci`);
+insert into t1 values ('0'),('1'),('2'),('a'),('b'),('c');
+select s1 from t1 where s1 > 'a' order by s1;
+s1
+b
+c
+drop table t1;
+create table t1(a char(1)) default charset = ucs2;
+insert into t1 values ('a'),('b'),('c');
+alter table t1 modify a char(5);
+select a, hex(a) from t1;
+a hex(a)
+a 0061
+b 0062
+c 0063
+drop table t1;
+set @ivar= 1234;
+set @str1 = 'select ?';
+set @str2 = convert(@str1 using ucs2);
+prepare stmt1 from @str2;
+execute stmt1 using @ivar;
+?
+1234
+SET TIMESTAMP=10000;
+create table t2 (c char(30)) charset=ucs2;
+set @v=convert('abc' using ucs2);
+reset master;
+insert into t2 values (@v);
+show binlog events from 79;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 79 User var 1 79 @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci
+master-bin.000001 119 Query 1 119 use `test`; insert into t2 values (@v)
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+SET @`v`:=_ucs2 0x006100620063 COLLATE ucs2_general_ci;
+use test;
+SET TIMESTAMP=10000;
+insert into t2 values (@v);
+drop table t2;
+set names latin1;
+create table t1 (a enum('x','y','z') character set ucs2);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` enum('x','y','z') character set ucs2 default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values ('x');
+insert into t1 values ('y');
+insert into t1 values ('z');
+select a, hex(a) from t1 order by a;
+a hex(a)
+x 0078
+y 0079
+z 007A
+alter table t1 change a a enum('x','y','z','d','e','ä','ö','ü') character set ucs2;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` enum('x','y','z','d','e','ä','ö','ü') character set ucs2 default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values ('D');
+insert into t1 values ('E ');
+insert into t1 values ('Ä');
+insert into t1 values ('Ö');
+insert into t1 values ('Ü');
+select a, hex(a) from t1 order by a;
+a hex(a)
+x 0078
+y 0079
+z 007A
+d 0064
+e 0065
+ä 00E4
+ö 00F6
+ü 00FC
+drop table t1;
+create table t1 (a set ('x','y','z','ä','ö','ü') character set ucs2);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` set('x','y','z','ä','ö','ü') character set ucs2 default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values ('x');
+insert into t1 values ('y');
+insert into t1 values ('z');
+insert into t1 values ('x,y');
+insert into t1 values ('x,y,z,Ä,Ö,Ü');
+select a, hex(a) from t1 order by a;
+a hex(a)
+x 0078
+y 0079
+x,y 0078002C0079
+z 007A
+x,y,z,ä,ö,ü 0078002C0079002C007A002C00E4002C00F6002C00FC
+drop table t1;
+create table t1(a enum('a','b','c')) default character set ucs2;
+insert into t1 values('a'),('b'),('c');
+alter table t1 add b char(1);
+show warnings;
+Level Code Message
+select * from t1 order by a;
+a b
+a NULL
+b NULL
+c NULL
+drop table t1;
diff --git a/mysql-test/r/ctype_ujis.result b/mysql-test/r/ctype_ujis.result
index 223a18f19e9..aa4c347d54f 100644
--- a/mysql-test/r/ctype_ujis.result
+++ b/mysql-test/r/ctype_ujis.result
@@ -1,8 +1,2209 @@
drop table if exists t1;
-create table t1 (c text);
+set names ujis;
+create table t1 (c text character set ujis);
insert into t1 values (0xa4a2),(0xa4a3);
select hex(left(c,1)) from t1 group by c;
hex(left(c,1))
A4A2
A4A3
drop table t1;
+select locate(0xa2a1,0xa1a2a1a3);
+locate(0xa2a1,0xa1a2a1a3)
+2
+select locate(_ujis 0xa2a1,_ujis 0xa1a2a1a3);
+locate(_ujis 0xa2a1,_ujis 0xa1a2a1a3)
+0
+select locate(_ujis 0xa2a1,_ujis 0xa1a2a1a3 collate ujis_bin);
+locate(_ujis 0xa2a1,_ujis 0xa1a2a1a3 collate ujis_bin)
+0
+select locate('he','hello');
+locate('he','hello')
+1
+select locate('he','hello',2);
+locate('he','hello',2)
+0
+select locate('lo','hello',2);
+locate('lo','hello',2)
+4
+select locate('HE','hello');
+locate('HE','hello')
+1
+select locate('HE','hello',2);
+locate('HE','hello',2)
+0
+select locate('LO','hello',2);
+locate('LO','hello',2)
+4
+select locate('HE','hello' collate ujis_bin);
+locate('HE','hello' collate ujis_bin)
+0
+select locate('HE','hello' collate ujis_bin,2);
+locate('HE','hello' collate ujis_bin,2)
+0
+select locate('LO','hello' collate ujis_bin,2);
+locate('LO','hello' collate ujis_bin,2)
+0
+select locate(_ujis 0xa1a3,_ujis 0xa1a2a1a3);
+locate(_ujis 0xa1a3,_ujis 0xa1a2a1a3)
+2
+select 0xa1a2a1a3 like concat(_binary'%',0xa2a1,_binary'%');
+0xa1a2a1a3 like concat(_binary'%',0xa2a1,_binary'%')
+1
+select _ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%');
+_ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%')
+0
+select _ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%') collate ujis_bin;
+_ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%') collate ujis_bin
+0
+select 'a' like 'a';
+'a' like 'a'
+1
+select 'A' like 'a';
+'A' like 'a'
+1
+select 'A' like 'a' collate ujis_bin;
+'A' like 'a' collate ujis_bin
+0
+set @ujis1= _ujis 0x8EA18EA28EA38EA48EA58EA68EA78EA88EA98EAA8EAB8EAC8EAD8EAE8EAF;
+set @ujis2= _ujis 0x8EB08EB18EB28EB38EB48EB58EB68EB78EB88EB98EBA8EBB8EBC8EBD8EBE8EBF;
+set @ujis3= _ujis 0x8EC08EC18EC28EC38EC48EC58EC68EC78EC88EC98ECA8ECB8ECC8ECD8ECE8ECF;
+set @ujis4= _ujis 0x8ED08ED18ED28ED38ED48ED58ED68ED78ED88ED98EDA8EDB8EDC8EDD8EDE8EDF;
+select hex(@utf81:= CONVERT(@ujis1 USING utf8));
+hex(@utf81:= CONVERT(@ujis1 USING utf8))
+EFBDA1EFBDA2EFBDA3EFBDA4EFBDA5EFBDA6EFBDA7EFBDA8EFBDA9EFBDAAEFBDABEFBDACEFBDADEFBDAEEFBDAF
+select hex(@utf82:= CONVERT(@ujis2 USING utf8));
+hex(@utf82:= CONVERT(@ujis2 USING utf8))
+EFBDB0EFBDB1EFBDB2EFBDB3EFBDB4EFBDB5EFBDB6EFBDB7EFBDB8EFBDB9EFBDBAEFBDBBEFBDBCEFBDBDEFBDBEEFBDBF
+select hex(@utf83:= CONVERT(@ujis3 USING utf8));
+hex(@utf83:= CONVERT(@ujis3 USING utf8))
+EFBE80EFBE81EFBE82EFBE83EFBE84EFBE85EFBE86EFBE87EFBE88EFBE89EFBE8AEFBE8BEFBE8CEFBE8DEFBE8EEFBE8F
+select hex(@utf84:= CONVERT(@ujis4 USING utf8));
+hex(@utf84:= CONVERT(@ujis4 USING utf8))
+EFBE90EFBE91EFBE92EFBE93EFBE94EFBE95EFBE96EFBE97EFBE98EFBE99EFBE9AEFBE9BEFBE9CEFBE9DEFBE9EEFBE9F
+select @ujis1 = CONVERT(@utf81 USING ujis);
+@ujis1 = CONVERT(@utf81 USING ujis)
+1
+select @ujis2 = CONVERT(@utf82 USING ujis);
+@ujis2 = CONVERT(@utf82 USING ujis)
+1
+select @ujis3 = CONVERT(@utf83 USING ujis);
+@ujis3 = CONVERT(@utf83 USING ujis)
+1
+select @ujis4 = CONVERT(@utf84 USING ujis);
+@ujis4 = CONVERT(@utf84 USING ujis)
+1
+drop table if exists t1;
+Warnings:
+Note 1051 Unknown table 't1'
+create table t1 (c1 varchar(8)) default character set 'ujis';
+insert into t1 values (0xA4A2),(0xA2A2),(0xA4A2);
+select c1 as 'no index' from t1 where c1 like cast(concat(0xA4A2, '%') as char character set ujis);
+no index
+€¢
+€¢
+create index idx_c1 on t1(c1);
+select c1 as 'using index' from t1 where c1 like cast(concat(0xA4A2, '%') as char character set ujis);
+using index
+€¢
+€¢
+select c1 as 'no index' from t1 where c1 like cast(concat('%',0xA4A2, '%') as char character set ujis);
+no index
+€¢
+€¢
+drop table t1;
+CREATE TABLE t1 (
+a char(1) NOT NULL default '',
+b enum('€¢','€€') default NULL
+) CHARACTER SET ujis;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(1) NOT NULL default '',
+ `b` enum('€¢','€€') default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=ujis
+SHOW COLUMNS FROM t1;
+Field Type Null Key Default Extra
+a char(1)
+b enum('€¢','€€') YES NULL
+DROP TABLE t1;
+CREATE TABLE t1
+(
+a INTEGER NOT NULL,
+b VARCHAR(50) NOT NULL DEFAULT '',
+PRIMARY KEY (a),
+KEY b (b(10))
+) TYPE=InnoDB CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
+INSERT INTO t1 (a, b) VALUES (0, 'aaabbbcccddd');
+INSERT INTO t1 (a, b) VALUES (1, 'eeefffggghhh');
+INSERT INTO t1 (a, b) VALUES (2, 'iiijjjkkkl');
+SELECT t1.* FROM t1 WHERE b='aaabbbcccddd' ORDER BY a;
+a b
+0 aaabbbcccddd
+SELECT t1.* FROM t1 WHERE b='eeefffggghhh' ORDER BY a;
+a b
+1 eeefffggghhh
+SELECT t1.* FROM t1 WHERE b='iiijjjkkkl' ORDER BY a;
+a b
+2 iiijjjkkkl
+DROP TABLE t1;
+CREATE TABLE t1
+(
+a INTEGER NOT NULL,
+b VARCHAR(50) NOT NULL DEFAULT '',
+PRIMARY KEY (a),
+KEY b (b(10))
+) TYPE=MyISAM CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
+INSERT INTO t1 (a, b) VALUES (0, 'aaabbbcccddd');
+INSERT INTO t1 (a, b) VALUES (1, 'eeefffggghhh');
+INSERT INTO t1 (a, b) VALUES (2, 'iiijjjkkkl');
+SELECT t1.* FROM t1 WHERE b='aaabbbcccddd' ORDER BY a;
+a b
+0 aaabbbcccddd
+SELECT t1.* FROM t1 WHERE b='eeefffggghhh' ORDER BY a;
+a b
+1 eeefffggghhh
+SELECT t1.* FROM t1 WHERE b='iiijjjkkkl' ORDER BY a;
+a b
+2 iiijjjkkkl
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1(c char(1)) character set ujis;
+INSERT INTO t1 VALUES(0xA2AF);
+INSERT INTO t1 VALUES(0xA2B0);
+INSERT INTO t1 VALUES(0xA2B1);
+INSERT INTO t1 VALUES(0xA2B2);
+INSERT INTO t1 VALUES(0xA2B3);
+INSERT INTO t1 VALUES(0xA2B4);
+INSERT INTO t1 VALUES(0xA2B5);
+INSERT INTO t1 VALUES(0xA2B6);
+INSERT INTO t1 VALUES(0xA2B7);
+INSERT INTO t1 VALUES(0xA2B8);
+INSERT INTO t1 VALUES(0xA2B9);
+INSERT INTO t1 VALUES(0xA2C2);
+INSERT INTO t1 VALUES(0xA2C3);
+INSERT INTO t1 VALUES(0xA2C4);
+INSERT INTO t1 VALUES(0xA2C5);
+INSERT INTO t1 VALUES(0xA2C6);
+INSERT INTO t1 VALUES(0xA2C7);
+INSERT INTO t1 VALUES(0xA2C8);
+INSERT INTO t1 VALUES(0xA2C9);
+INSERT INTO t1 VALUES(0xA2D1);
+INSERT INTO t1 VALUES(0xA2D2);
+INSERT INTO t1 VALUES(0xA2D3);
+INSERT INTO t1 VALUES(0xA2D4);
+INSERT INTO t1 VALUES(0xA2D5);
+INSERT INTO t1 VALUES(0xA2D6);
+INSERT INTO t1 VALUES(0xA2D7);
+INSERT INTO t1 VALUES(0xA2D8);
+INSERT INTO t1 VALUES(0xA2D9);
+INSERT INTO t1 VALUES(0xA2DA);
+INSERT INTO t1 VALUES(0xA2DB);
+INSERT INTO t1 VALUES(0xA2EB);
+INSERT INTO t1 VALUES(0xA2EC);
+INSERT INTO t1 VALUES(0xA2ED);
+INSERT INTO t1 VALUES(0xA2EE);
+INSERT INTO t1 VALUES(0xA2EF);
+INSERT INTO t1 VALUES(0xA2F0);
+INSERT INTO t1 VALUES(0xA2F1);
+INSERT INTO t1 VALUES(0xA2FA);
+INSERT INTO t1 VALUES(0xA2FB);
+INSERT INTO t1 VALUES(0xA2FC);
+INSERT INTO t1 VALUES(0xA2FD);
+INSERT INTO t1 VALUES(0xA3A1);
+INSERT INTO t1 VALUES(0xA3A2);
+INSERT INTO t1 VALUES(0xA3A3);
+INSERT INTO t1 VALUES(0xA3A4);
+INSERT INTO t1 VALUES(0xA3A5);
+INSERT INTO t1 VALUES(0xA3A6);
+INSERT INTO t1 VALUES(0xA3A7);
+INSERT INTO t1 VALUES(0xA3A8);
+INSERT INTO t1 VALUES(0xA3A9);
+INSERT INTO t1 VALUES(0xA3AA);
+INSERT INTO t1 VALUES(0xA3AB);
+INSERT INTO t1 VALUES(0xA3AC);
+INSERT INTO t1 VALUES(0xA3AD);
+INSERT INTO t1 VALUES(0xA3AE);
+INSERT INTO t1 VALUES(0xA3AF);
+INSERT INTO t1 VALUES(0xA3BA);
+INSERT INTO t1 VALUES(0xA3BB);
+INSERT INTO t1 VALUES(0xA3BC);
+INSERT INTO t1 VALUES(0xA3BD);
+INSERT INTO t1 VALUES(0xA3BE);
+INSERT INTO t1 VALUES(0xA3BF);
+INSERT INTO t1 VALUES(0xA3C0);
+INSERT INTO t1 VALUES(0xA3DB);
+INSERT INTO t1 VALUES(0xA3DC);
+INSERT INTO t1 VALUES(0xA3DD);
+INSERT INTO t1 VALUES(0xA3DE);
+INSERT INTO t1 VALUES(0xA3DF);
+INSERT INTO t1 VALUES(0xA3E0);
+INSERT INTO t1 VALUES(0xA3FB);
+INSERT INTO t1 VALUES(0xA3FC);
+INSERT INTO t1 VALUES(0xA3FD);
+INSERT INTO t1 VALUES(0xA3FE);
+INSERT INTO t1 VALUES(0xA4F4);
+INSERT INTO t1 VALUES(0xA4F5);
+INSERT INTO t1 VALUES(0xA4F6);
+INSERT INTO t1 VALUES(0xA4F7);
+INSERT INTO t1 VALUES(0xA4F8);
+INSERT INTO t1 VALUES(0xA4F9);
+INSERT INTO t1 VALUES(0xA4FA);
+INSERT INTO t1 VALUES(0xA4FB);
+INSERT INTO t1 VALUES(0xA4FC);
+INSERT INTO t1 VALUES(0xA4FD);
+INSERT INTO t1 VALUES(0xA4FE);
+INSERT INTO t1 VALUES(0xA5F7);
+INSERT INTO t1 VALUES(0xA5F8);
+INSERT INTO t1 VALUES(0xA5F9);
+INSERT INTO t1 VALUES(0xA5FA);
+INSERT INTO t1 VALUES(0xA5FB);
+INSERT INTO t1 VALUES(0xA5FC);
+INSERT INTO t1 VALUES(0xA5FD);
+INSERT INTO t1 VALUES(0xA5FE);
+INSERT INTO t1 VALUES(0xA6B9);
+INSERT INTO t1 VALUES(0xA6BA);
+INSERT INTO t1 VALUES(0xA6BB);
+INSERT INTO t1 VALUES(0xA6BC);
+INSERT INTO t1 VALUES(0xA6BD);
+INSERT INTO t1 VALUES(0xA6BE);
+INSERT INTO t1 VALUES(0xA6BF);
+INSERT INTO t1 VALUES(0xA6C0);
+INSERT INTO t1 VALUES(0xA6D9);
+INSERT INTO t1 VALUES(0xA6DA);
+INSERT INTO t1 VALUES(0xA6DB);
+INSERT INTO t1 VALUES(0xA6DC);
+INSERT INTO t1 VALUES(0xA6DD);
+INSERT INTO t1 VALUES(0xA6DE);
+INSERT INTO t1 VALUES(0xA6DF);
+INSERT INTO t1 VALUES(0xA6E0);
+INSERT INTO t1 VALUES(0xA6E1);
+INSERT INTO t1 VALUES(0xA6E2);
+INSERT INTO t1 VALUES(0xA6E3);
+INSERT INTO t1 VALUES(0xA6E4);
+INSERT INTO t1 VALUES(0xA6E5);
+INSERT INTO t1 VALUES(0xA6E6);
+INSERT INTO t1 VALUES(0xA6E7);
+INSERT INTO t1 VALUES(0xA6E8);
+INSERT INTO t1 VALUES(0xA6E9);
+INSERT INTO t1 VALUES(0xA6EA);
+INSERT INTO t1 VALUES(0xA6EB);
+INSERT INTO t1 VALUES(0xA6EC);
+INSERT INTO t1 VALUES(0xA6ED);
+INSERT INTO t1 VALUES(0xA6EE);
+INSERT INTO t1 VALUES(0xA6EF);
+INSERT INTO t1 VALUES(0xA6F0);
+INSERT INTO t1 VALUES(0xA6F1);
+INSERT INTO t1 VALUES(0xA6F2);
+INSERT INTO t1 VALUES(0xA6F3);
+INSERT INTO t1 VALUES(0xA6F4);
+INSERT INTO t1 VALUES(0xA6F5);
+INSERT INTO t1 VALUES(0xA6F6);
+INSERT INTO t1 VALUES(0xA6F7);
+INSERT INTO t1 VALUES(0xA6F8);
+INSERT INTO t1 VALUES(0xA6F9);
+INSERT INTO t1 VALUES(0xA6FA);
+INSERT INTO t1 VALUES(0xA6FB);
+INSERT INTO t1 VALUES(0xA6FC);
+INSERT INTO t1 VALUES(0xA6FD);
+INSERT INTO t1 VALUES(0xA6FE);
+INSERT INTO t1 VALUES(0xA7C2);
+INSERT INTO t1 VALUES(0xA7C3);
+INSERT INTO t1 VALUES(0xA7C4);
+INSERT INTO t1 VALUES(0xA7C5);
+INSERT INTO t1 VALUES(0xA7C6);
+INSERT INTO t1 VALUES(0xA7C7);
+INSERT INTO t1 VALUES(0xA7C8);
+INSERT INTO t1 VALUES(0xA7C9);
+INSERT INTO t1 VALUES(0xA7CA);
+INSERT INTO t1 VALUES(0xA7CB);
+INSERT INTO t1 VALUES(0xA7CC);
+INSERT INTO t1 VALUES(0xA7CD);
+INSERT INTO t1 VALUES(0xA7CE);
+INSERT INTO t1 VALUES(0xA7CF);
+INSERT INTO t1 VALUES(0xA7D0);
+INSERT INTO t1 VALUES(0xA7F2);
+INSERT INTO t1 VALUES(0xA7F3);
+INSERT INTO t1 VALUES(0xA7F4);
+INSERT INTO t1 VALUES(0xA7F5);
+INSERT INTO t1 VALUES(0xA7F6);
+INSERT INTO t1 VALUES(0xA7F7);
+INSERT INTO t1 VALUES(0xA7F8);
+INSERT INTO t1 VALUES(0xA7F9);
+INSERT INTO t1 VALUES(0xA7FA);
+INSERT INTO t1 VALUES(0xA7FB);
+INSERT INTO t1 VALUES(0xA7FC);
+INSERT INTO t1 VALUES(0xA7FD);
+INSERT INTO t1 VALUES(0xA7FE);
+INSERT INTO t1 VALUES(0xA8C1);
+INSERT INTO t1 VALUES(0xA8C2);
+INSERT INTO t1 VALUES(0xA8C3);
+INSERT INTO t1 VALUES(0xA8C4);
+INSERT INTO t1 VALUES(0xA8C5);
+INSERT INTO t1 VALUES(0xA8C6);
+INSERT INTO t1 VALUES(0xA8C7);
+INSERT INTO t1 VALUES(0xA8C8);
+INSERT INTO t1 VALUES(0xA8C9);
+INSERT INTO t1 VALUES(0xA8CA);
+INSERT INTO t1 VALUES(0xA8CB);
+INSERT INTO t1 VALUES(0xA8CC);
+INSERT INTO t1 VALUES(0xA8CD);
+INSERT INTO t1 VALUES(0xA8CE);
+INSERT INTO t1 VALUES(0xA8CF);
+INSERT INTO t1 VALUES(0xA8D0);
+INSERT INTO t1 VALUES(0xA8D1);
+INSERT INTO t1 VALUES(0xA8D2);
+INSERT INTO t1 VALUES(0xA8D3);
+INSERT INTO t1 VALUES(0xA8D4);
+INSERT INTO t1 VALUES(0xA8D5);
+INSERT INTO t1 VALUES(0xA8D6);
+INSERT INTO t1 VALUES(0xA8D7);
+INSERT INTO t1 VALUES(0xA8D8);
+INSERT INTO t1 VALUES(0xA8D9);
+INSERT INTO t1 VALUES(0xA8DA);
+INSERT INTO t1 VALUES(0xA8DB);
+INSERT INTO t1 VALUES(0xA8DC);
+INSERT INTO t1 VALUES(0xA8DD);
+INSERT INTO t1 VALUES(0xA8DE);
+INSERT INTO t1 VALUES(0xA8DF);
+INSERT INTO t1 VALUES(0xA8E0);
+INSERT INTO t1 VALUES(0xA8E1);
+INSERT INTO t1 VALUES(0xA8E2);
+INSERT INTO t1 VALUES(0xA8E3);
+INSERT INTO t1 VALUES(0xA8E4);
+INSERT INTO t1 VALUES(0xA8E5);
+INSERT INTO t1 VALUES(0xA8E6);
+INSERT INTO t1 VALUES(0xA8E7);
+INSERT INTO t1 VALUES(0xA8E8);
+INSERT INTO t1 VALUES(0xA8E9);
+INSERT INTO t1 VALUES(0xA8EA);
+INSERT INTO t1 VALUES(0xA8EB);
+INSERT INTO t1 VALUES(0xA8EC);
+INSERT INTO t1 VALUES(0xA8ED);
+INSERT INTO t1 VALUES(0xA8EE);
+INSERT INTO t1 VALUES(0xA8EF);
+INSERT INTO t1 VALUES(0xA8F0);
+INSERT INTO t1 VALUES(0xA8F1);
+INSERT INTO t1 VALUES(0xA8F2);
+INSERT INTO t1 VALUES(0xA8F3);
+INSERT INTO t1 VALUES(0xA8F4);
+INSERT INTO t1 VALUES(0xA8F5);
+INSERT INTO t1 VALUES(0xA8F6);
+INSERT INTO t1 VALUES(0xA8F7);
+INSERT INTO t1 VALUES(0xA8F8);
+INSERT INTO t1 VALUES(0xA8F9);
+INSERT INTO t1 VALUES(0xA8FA);
+INSERT INTO t1 VALUES(0xA8FB);
+INSERT INTO t1 VALUES(0xA8FC);
+INSERT INTO t1 VALUES(0xA8FD);
+INSERT INTO t1 VALUES(0xA8FE);
+INSERT INTO t1 VALUES(0xA9A1);
+INSERT INTO t1 VALUES(0xA9A2);
+INSERT INTO t1 VALUES(0xA9A3);
+INSERT INTO t1 VALUES(0xA9A4);
+INSERT INTO t1 VALUES(0xA9A5);
+INSERT INTO t1 VALUES(0xA9A6);
+INSERT INTO t1 VALUES(0xA9A7);
+INSERT INTO t1 VALUES(0xA9A8);
+INSERT INTO t1 VALUES(0xA9A9);
+INSERT INTO t1 VALUES(0xA9AA);
+INSERT INTO t1 VALUES(0xA9AB);
+INSERT INTO t1 VALUES(0xA9AC);
+INSERT INTO t1 VALUES(0xA9AD);
+INSERT INTO t1 VALUES(0xA9AE);
+INSERT INTO t1 VALUES(0xA9AF);
+INSERT INTO t1 VALUES(0xA9B0);
+INSERT INTO t1 VALUES(0xA9B1);
+INSERT INTO t1 VALUES(0xA9B2);
+INSERT INTO t1 VALUES(0xA9B3);
+INSERT INTO t1 VALUES(0xA9B4);
+INSERT INTO t1 VALUES(0xA9B5);
+INSERT INTO t1 VALUES(0xA9B6);
+INSERT INTO t1 VALUES(0xA9B7);
+INSERT INTO t1 VALUES(0xA9B8);
+INSERT INTO t1 VALUES(0xA9B9);
+INSERT INTO t1 VALUES(0xA9BA);
+INSERT INTO t1 VALUES(0xA9BB);
+INSERT INTO t1 VALUES(0xA9BC);
+INSERT INTO t1 VALUES(0xA9BD);
+INSERT INTO t1 VALUES(0xA9BE);
+INSERT INTO t1 VALUES(0xA9BF);
+INSERT INTO t1 VALUES(0xA9C0);
+INSERT INTO t1 VALUES(0xA9C1);
+INSERT INTO t1 VALUES(0xA9C2);
+INSERT INTO t1 VALUES(0xA9C3);
+INSERT INTO t1 VALUES(0xA9C4);
+INSERT INTO t1 VALUES(0xA9C5);
+INSERT INTO t1 VALUES(0xA9C6);
+INSERT INTO t1 VALUES(0xA9C7);
+INSERT INTO t1 VALUES(0xA9C8);
+INSERT INTO t1 VALUES(0xA9C9);
+INSERT INTO t1 VALUES(0xA9CA);
+INSERT INTO t1 VALUES(0xA9CB);
+INSERT INTO t1 VALUES(0xA9CC);
+INSERT INTO t1 VALUES(0xA9CD);
+INSERT INTO t1 VALUES(0xA9CE);
+INSERT INTO t1 VALUES(0xA9CF);
+INSERT INTO t1 VALUES(0xA9D0);
+INSERT INTO t1 VALUES(0xA9D1);
+INSERT INTO t1 VALUES(0xA9D2);
+INSERT INTO t1 VALUES(0xA9D3);
+INSERT INTO t1 VALUES(0xA9D4);
+INSERT INTO t1 VALUES(0xA9D5);
+INSERT INTO t1 VALUES(0xA9D6);
+INSERT INTO t1 VALUES(0xA9D7);
+INSERT INTO t1 VALUES(0xA9D8);
+INSERT INTO t1 VALUES(0xA9D9);
+INSERT INTO t1 VALUES(0xA9DA);
+INSERT INTO t1 VALUES(0xA9DB);
+INSERT INTO t1 VALUES(0xA9DC);
+INSERT INTO t1 VALUES(0xA9DD);
+INSERT INTO t1 VALUES(0xA9DE);
+INSERT INTO t1 VALUES(0xA9DF);
+INSERT INTO t1 VALUES(0xA9E0);
+INSERT INTO t1 VALUES(0xA9E1);
+INSERT INTO t1 VALUES(0xA9E2);
+INSERT INTO t1 VALUES(0xA9E3);
+INSERT INTO t1 VALUES(0xA9E4);
+INSERT INTO t1 VALUES(0xA9E5);
+INSERT INTO t1 VALUES(0xA9E6);
+INSERT INTO t1 VALUES(0xA9E7);
+INSERT INTO t1 VALUES(0xA9E8);
+INSERT INTO t1 VALUES(0xA9E9);
+INSERT INTO t1 VALUES(0xA9EA);
+INSERT INTO t1 VALUES(0xA9EB);
+INSERT INTO t1 VALUES(0xA9EC);
+INSERT INTO t1 VALUES(0xA9ED);
+INSERT INTO t1 VALUES(0xA9EE);
+INSERT INTO t1 VALUES(0xA9EF);
+INSERT INTO t1 VALUES(0xA9F0);
+INSERT INTO t1 VALUES(0xA9F1);
+INSERT INTO t1 VALUES(0xA9F2);
+INSERT INTO t1 VALUES(0xA9F3);
+INSERT INTO t1 VALUES(0xA9F4);
+INSERT INTO t1 VALUES(0xA9F5);
+INSERT INTO t1 VALUES(0xA9F6);
+INSERT INTO t1 VALUES(0xA9F7);
+INSERT INTO t1 VALUES(0xA9F8);
+INSERT INTO t1 VALUES(0xA9F9);
+INSERT INTO t1 VALUES(0xA9FA);
+INSERT INTO t1 VALUES(0xA9FB);
+INSERT INTO t1 VALUES(0xA9FC);
+INSERT INTO t1 VALUES(0xA9FD);
+INSERT INTO t1 VALUES(0xA9FE);
+INSERT INTO t1 VALUES(0xAAA1);
+INSERT INTO t1 VALUES(0xAAA2);
+INSERT INTO t1 VALUES(0xAAA3);
+INSERT INTO t1 VALUES(0xAAA4);
+INSERT INTO t1 VALUES(0xAAA5);
+INSERT INTO t1 VALUES(0xAAA6);
+INSERT INTO t1 VALUES(0xAAA7);
+INSERT INTO t1 VALUES(0xAAA8);
+INSERT INTO t1 VALUES(0xAAA9);
+INSERT INTO t1 VALUES(0xAAAA);
+INSERT INTO t1 VALUES(0xAAAB);
+INSERT INTO t1 VALUES(0xAAAC);
+INSERT INTO t1 VALUES(0xAAAD);
+INSERT INTO t1 VALUES(0xAAAE);
+INSERT INTO t1 VALUES(0xAAAF);
+INSERT INTO t1 VALUES(0xAAB0);
+INSERT INTO t1 VALUES(0xAAB1);
+INSERT INTO t1 VALUES(0xAAB2);
+INSERT INTO t1 VALUES(0xAAB3);
+INSERT INTO t1 VALUES(0xAAB4);
+INSERT INTO t1 VALUES(0xAAB5);
+INSERT INTO t1 VALUES(0xAAB6);
+INSERT INTO t1 VALUES(0xAAB7);
+INSERT INTO t1 VALUES(0xAAB8);
+INSERT INTO t1 VALUES(0xAAB9);
+INSERT INTO t1 VALUES(0xAABA);
+INSERT INTO t1 VALUES(0xAABB);
+INSERT INTO t1 VALUES(0xAABC);
+INSERT INTO t1 VALUES(0xAABD);
+INSERT INTO t1 VALUES(0xAABE);
+INSERT INTO t1 VALUES(0xAABF);
+INSERT INTO t1 VALUES(0xAAC0);
+INSERT INTO t1 VALUES(0xAAC1);
+INSERT INTO t1 VALUES(0xAAC2);
+INSERT INTO t1 VALUES(0xAAC3);
+INSERT INTO t1 VALUES(0xAAC4);
+INSERT INTO t1 VALUES(0xAAC5);
+INSERT INTO t1 VALUES(0xAAC6);
+INSERT INTO t1 VALUES(0xAAC7);
+INSERT INTO t1 VALUES(0xAAC8);
+INSERT INTO t1 VALUES(0xAAC9);
+INSERT INTO t1 VALUES(0xAACA);
+INSERT INTO t1 VALUES(0xAACB);
+INSERT INTO t1 VALUES(0xAACC);
+INSERT INTO t1 VALUES(0xAACD);
+INSERT INTO t1 VALUES(0xAACE);
+INSERT INTO t1 VALUES(0xAACF);
+INSERT INTO t1 VALUES(0xAAD0);
+INSERT INTO t1 VALUES(0xAAD1);
+INSERT INTO t1 VALUES(0xAAD2);
+INSERT INTO t1 VALUES(0xAAD3);
+INSERT INTO t1 VALUES(0xAAD4);
+INSERT INTO t1 VALUES(0xAAD5);
+INSERT INTO t1 VALUES(0xAAD6);
+INSERT INTO t1 VALUES(0xAAD7);
+INSERT INTO t1 VALUES(0xAAD8);
+INSERT INTO t1 VALUES(0xAAD9);
+INSERT INTO t1 VALUES(0xAADA);
+INSERT INTO t1 VALUES(0xAADB);
+INSERT INTO t1 VALUES(0xAADC);
+INSERT INTO t1 VALUES(0xAADD);
+INSERT INTO t1 VALUES(0xAADE);
+INSERT INTO t1 VALUES(0xAADF);
+INSERT INTO t1 VALUES(0xAAE0);
+INSERT INTO t1 VALUES(0xAAE1);
+INSERT INTO t1 VALUES(0xAAE2);
+INSERT INTO t1 VALUES(0xAAE3);
+INSERT INTO t1 VALUES(0xAAE4);
+INSERT INTO t1 VALUES(0xAAE5);
+INSERT INTO t1 VALUES(0xAAE6);
+INSERT INTO t1 VALUES(0xAAE7);
+INSERT INTO t1 VALUES(0xAAE8);
+INSERT INTO t1 VALUES(0xAAE9);
+INSERT INTO t1 VALUES(0xAAEA);
+INSERT INTO t1 VALUES(0xAAEB);
+INSERT INTO t1 VALUES(0xAAEC);
+INSERT INTO t1 VALUES(0xAAED);
+INSERT INTO t1 VALUES(0xAAEE);
+INSERT INTO t1 VALUES(0xAAEF);
+INSERT INTO t1 VALUES(0xAAF0);
+INSERT INTO t1 VALUES(0xAAF1);
+INSERT INTO t1 VALUES(0xAAF2);
+INSERT INTO t1 VALUES(0xAAF3);
+INSERT INTO t1 VALUES(0xAAF4);
+INSERT INTO t1 VALUES(0xAAF5);
+INSERT INTO t1 VALUES(0xAAF6);
+INSERT INTO t1 VALUES(0xAAF7);
+INSERT INTO t1 VALUES(0xAAF8);
+INSERT INTO t1 VALUES(0xAAF9);
+INSERT INTO t1 VALUES(0xAAFA);
+INSERT INTO t1 VALUES(0xAAFB);
+INSERT INTO t1 VALUES(0xAAFC);
+INSERT INTO t1 VALUES(0xAAFD);
+INSERT INTO t1 VALUES(0xAAFE);
+INSERT INTO t1 VALUES(0xABA1);
+INSERT INTO t1 VALUES(0xABA2);
+INSERT INTO t1 VALUES(0xABA3);
+INSERT INTO t1 VALUES(0xABA4);
+INSERT INTO t1 VALUES(0xABA5);
+INSERT INTO t1 VALUES(0xABA6);
+INSERT INTO t1 VALUES(0xABA7);
+INSERT INTO t1 VALUES(0xABA8);
+INSERT INTO t1 VALUES(0xABA9);
+INSERT INTO t1 VALUES(0xABAA);
+INSERT INTO t1 VALUES(0xABAB);
+INSERT INTO t1 VALUES(0xABAC);
+INSERT INTO t1 VALUES(0xABAD);
+INSERT INTO t1 VALUES(0xABAE);
+INSERT INTO t1 VALUES(0xABAF);
+INSERT INTO t1 VALUES(0xABB0);
+INSERT INTO t1 VALUES(0xABB1);
+INSERT INTO t1 VALUES(0xABB2);
+INSERT INTO t1 VALUES(0xABB3);
+INSERT INTO t1 VALUES(0xABB4);
+INSERT INTO t1 VALUES(0xABB5);
+INSERT INTO t1 VALUES(0xABB6);
+INSERT INTO t1 VALUES(0xABB7);
+INSERT INTO t1 VALUES(0xABB8);
+INSERT INTO t1 VALUES(0xABB9);
+INSERT INTO t1 VALUES(0xABBA);
+INSERT INTO t1 VALUES(0xABBB);
+INSERT INTO t1 VALUES(0xABBC);
+INSERT INTO t1 VALUES(0xABBD);
+INSERT INTO t1 VALUES(0xABBE);
+INSERT INTO t1 VALUES(0xABBF);
+INSERT INTO t1 VALUES(0xABC0);
+INSERT INTO t1 VALUES(0xABC1);
+INSERT INTO t1 VALUES(0xABC2);
+INSERT INTO t1 VALUES(0xABC3);
+INSERT INTO t1 VALUES(0xABC4);
+INSERT INTO t1 VALUES(0xABC5);
+INSERT INTO t1 VALUES(0xABC6);
+INSERT INTO t1 VALUES(0xABC7);
+INSERT INTO t1 VALUES(0xABC8);
+INSERT INTO t1 VALUES(0xABC9);
+INSERT INTO t1 VALUES(0xABCA);
+INSERT INTO t1 VALUES(0xABCB);
+INSERT INTO t1 VALUES(0xABCC);
+INSERT INTO t1 VALUES(0xABCD);
+INSERT INTO t1 VALUES(0xABCE);
+INSERT INTO t1 VALUES(0xABCF);
+INSERT INTO t1 VALUES(0xABD0);
+INSERT INTO t1 VALUES(0xABD1);
+INSERT INTO t1 VALUES(0xABD2);
+INSERT INTO t1 VALUES(0xABD3);
+INSERT INTO t1 VALUES(0xABD4);
+INSERT INTO t1 VALUES(0xABD5);
+INSERT INTO t1 VALUES(0xABD6);
+INSERT INTO t1 VALUES(0xABD7);
+INSERT INTO t1 VALUES(0xABD8);
+INSERT INTO t1 VALUES(0xABD9);
+INSERT INTO t1 VALUES(0xABDA);
+INSERT INTO t1 VALUES(0xABDB);
+INSERT INTO t1 VALUES(0xABDC);
+INSERT INTO t1 VALUES(0xABDD);
+INSERT INTO t1 VALUES(0xABDE);
+INSERT INTO t1 VALUES(0xABDF);
+INSERT INTO t1 VALUES(0xABE0);
+INSERT INTO t1 VALUES(0xABE1);
+INSERT INTO t1 VALUES(0xABE2);
+INSERT INTO t1 VALUES(0xABE3);
+INSERT INTO t1 VALUES(0xABE4);
+INSERT INTO t1 VALUES(0xABE5);
+INSERT INTO t1 VALUES(0xABE6);
+INSERT INTO t1 VALUES(0xABE7);
+INSERT INTO t1 VALUES(0xABE8);
+INSERT INTO t1 VALUES(0xABE9);
+INSERT INTO t1 VALUES(0xABEA);
+INSERT INTO t1 VALUES(0xABEB);
+INSERT INTO t1 VALUES(0xABEC);
+INSERT INTO t1 VALUES(0xABED);
+INSERT INTO t1 VALUES(0xABEE);
+INSERT INTO t1 VALUES(0xABEF);
+INSERT INTO t1 VALUES(0xABF0);
+INSERT INTO t1 VALUES(0xABF1);
+INSERT INTO t1 VALUES(0xABF2);
+INSERT INTO t1 VALUES(0xABF3);
+INSERT INTO t1 VALUES(0xABF4);
+INSERT INTO t1 VALUES(0xABF5);
+INSERT INTO t1 VALUES(0xABF6);
+INSERT INTO t1 VALUES(0xABF7);
+INSERT INTO t1 VALUES(0xABF8);
+INSERT INTO t1 VALUES(0xABF9);
+INSERT INTO t1 VALUES(0xABFA);
+INSERT INTO t1 VALUES(0xABFB);
+INSERT INTO t1 VALUES(0xABFC);
+INSERT INTO t1 VALUES(0xABFD);
+INSERT INTO t1 VALUES(0xABFE);
+INSERT INTO t1 VALUES(0xACA1);
+INSERT INTO t1 VALUES(0xACA2);
+INSERT INTO t1 VALUES(0xACA3);
+INSERT INTO t1 VALUES(0xACA4);
+INSERT INTO t1 VALUES(0xACA5);
+INSERT INTO t1 VALUES(0xACA6);
+INSERT INTO t1 VALUES(0xACA7);
+INSERT INTO t1 VALUES(0xACA8);
+INSERT INTO t1 VALUES(0xACA9);
+INSERT INTO t1 VALUES(0xACAA);
+INSERT INTO t1 VALUES(0xACAB);
+INSERT INTO t1 VALUES(0xACAC);
+INSERT INTO t1 VALUES(0xACAD);
+INSERT INTO t1 VALUES(0xACAE);
+INSERT INTO t1 VALUES(0xACAF);
+INSERT INTO t1 VALUES(0xACB0);
+INSERT INTO t1 VALUES(0xACB1);
+INSERT INTO t1 VALUES(0xACB2);
+INSERT INTO t1 VALUES(0xACB3);
+INSERT INTO t1 VALUES(0xACB4);
+INSERT INTO t1 VALUES(0xACB5);
+INSERT INTO t1 VALUES(0xACB6);
+INSERT INTO t1 VALUES(0xACB7);
+INSERT INTO t1 VALUES(0xACB8);
+INSERT INTO t1 VALUES(0xACB9);
+INSERT INTO t1 VALUES(0xACBA);
+INSERT INTO t1 VALUES(0xACBB);
+INSERT INTO t1 VALUES(0xACBC);
+INSERT INTO t1 VALUES(0xACBD);
+INSERT INTO t1 VALUES(0xACBE);
+INSERT INTO t1 VALUES(0xACBF);
+INSERT INTO t1 VALUES(0xACC0);
+INSERT INTO t1 VALUES(0xACC1);
+INSERT INTO t1 VALUES(0xACC2);
+INSERT INTO t1 VALUES(0xACC3);
+INSERT INTO t1 VALUES(0xACC4);
+INSERT INTO t1 VALUES(0xACC5);
+INSERT INTO t1 VALUES(0xACC6);
+INSERT INTO t1 VALUES(0xACC7);
+INSERT INTO t1 VALUES(0xACC8);
+INSERT INTO t1 VALUES(0xACC9);
+INSERT INTO t1 VALUES(0xACCA);
+INSERT INTO t1 VALUES(0xACCB);
+INSERT INTO t1 VALUES(0xACCC);
+INSERT INTO t1 VALUES(0xACCD);
+INSERT INTO t1 VALUES(0xACCE);
+INSERT INTO t1 VALUES(0xACCF);
+INSERT INTO t1 VALUES(0xACD0);
+INSERT INTO t1 VALUES(0xACD1);
+INSERT INTO t1 VALUES(0xACD2);
+INSERT INTO t1 VALUES(0xACD3);
+INSERT INTO t1 VALUES(0xACD4);
+INSERT INTO t1 VALUES(0xACD5);
+INSERT INTO t1 VALUES(0xACD6);
+INSERT INTO t1 VALUES(0xACD7);
+INSERT INTO t1 VALUES(0xACD8);
+INSERT INTO t1 VALUES(0xACD9);
+INSERT INTO t1 VALUES(0xACDA);
+INSERT INTO t1 VALUES(0xACDB);
+INSERT INTO t1 VALUES(0xACDC);
+INSERT INTO t1 VALUES(0xACDD);
+INSERT INTO t1 VALUES(0xACDE);
+INSERT INTO t1 VALUES(0xACDF);
+INSERT INTO t1 VALUES(0xACE0);
+INSERT INTO t1 VALUES(0xACE1);
+INSERT INTO t1 VALUES(0xACE2);
+INSERT INTO t1 VALUES(0xACE3);
+INSERT INTO t1 VALUES(0xACE4);
+INSERT INTO t1 VALUES(0xACE5);
+INSERT INTO t1 VALUES(0xACE6);
+INSERT INTO t1 VALUES(0xACE7);
+INSERT INTO t1 VALUES(0xACE8);
+INSERT INTO t1 VALUES(0xACE9);
+INSERT INTO t1 VALUES(0xACEA);
+INSERT INTO t1 VALUES(0xACEB);
+INSERT INTO t1 VALUES(0xACEC);
+INSERT INTO t1 VALUES(0xACED);
+INSERT INTO t1 VALUES(0xACEE);
+INSERT INTO t1 VALUES(0xACEF);
+INSERT INTO t1 VALUES(0xACF0);
+INSERT INTO t1 VALUES(0xACF1);
+INSERT INTO t1 VALUES(0xACF2);
+INSERT INTO t1 VALUES(0xACF3);
+INSERT INTO t1 VALUES(0xACF4);
+INSERT INTO t1 VALUES(0xACF5);
+INSERT INTO t1 VALUES(0xACF6);
+INSERT INTO t1 VALUES(0xACF7);
+INSERT INTO t1 VALUES(0xACF8);
+INSERT INTO t1 VALUES(0xACF9);
+INSERT INTO t1 VALUES(0xACFA);
+INSERT INTO t1 VALUES(0xACFB);
+INSERT INTO t1 VALUES(0xACFC);
+INSERT INTO t1 VALUES(0xACFD);
+INSERT INTO t1 VALUES(0xACFE);
+INSERT INTO t1 VALUES(0xADA1);
+INSERT INTO t1 VALUES(0xADA2);
+INSERT INTO t1 VALUES(0xADA3);
+INSERT INTO t1 VALUES(0xADA4);
+INSERT INTO t1 VALUES(0xADA5);
+INSERT INTO t1 VALUES(0xADA6);
+INSERT INTO t1 VALUES(0xADA7);
+INSERT INTO t1 VALUES(0xADA8);
+INSERT INTO t1 VALUES(0xADA9);
+INSERT INTO t1 VALUES(0xADAA);
+INSERT INTO t1 VALUES(0xADAB);
+INSERT INTO t1 VALUES(0xADAC);
+INSERT INTO t1 VALUES(0xADAD);
+INSERT INTO t1 VALUES(0xADAE);
+INSERT INTO t1 VALUES(0xADAF);
+INSERT INTO t1 VALUES(0xADB0);
+INSERT INTO t1 VALUES(0xADB1);
+INSERT INTO t1 VALUES(0xADB2);
+INSERT INTO t1 VALUES(0xADB3);
+INSERT INTO t1 VALUES(0xADB4);
+INSERT INTO t1 VALUES(0xADB5);
+INSERT INTO t1 VALUES(0xADB6);
+INSERT INTO t1 VALUES(0xADB7);
+INSERT INTO t1 VALUES(0xADB8);
+INSERT INTO t1 VALUES(0xADB9);
+INSERT INTO t1 VALUES(0xADBA);
+INSERT INTO t1 VALUES(0xADBB);
+INSERT INTO t1 VALUES(0xADBC);
+INSERT INTO t1 VALUES(0xADBD);
+INSERT INTO t1 VALUES(0xADBE);
+INSERT INTO t1 VALUES(0xADBF);
+INSERT INTO t1 VALUES(0xADC0);
+INSERT INTO t1 VALUES(0xADC1);
+INSERT INTO t1 VALUES(0xADC2);
+INSERT INTO t1 VALUES(0xADC3);
+INSERT INTO t1 VALUES(0xADC4);
+INSERT INTO t1 VALUES(0xADC5);
+INSERT INTO t1 VALUES(0xADC6);
+INSERT INTO t1 VALUES(0xADC7);
+INSERT INTO t1 VALUES(0xADC8);
+INSERT INTO t1 VALUES(0xADC9);
+INSERT INTO t1 VALUES(0xADCA);
+INSERT INTO t1 VALUES(0xADCB);
+INSERT INTO t1 VALUES(0xADCC);
+INSERT INTO t1 VALUES(0xADCD);
+INSERT INTO t1 VALUES(0xADCE);
+INSERT INTO t1 VALUES(0xADCF);
+INSERT INTO t1 VALUES(0xADD0);
+INSERT INTO t1 VALUES(0xADD1);
+INSERT INTO t1 VALUES(0xADD2);
+INSERT INTO t1 VALUES(0xADD3);
+INSERT INTO t1 VALUES(0xADD4);
+INSERT INTO t1 VALUES(0xADD5);
+INSERT INTO t1 VALUES(0xADD6);
+INSERT INTO t1 VALUES(0xADD7);
+INSERT INTO t1 VALUES(0xADD8);
+INSERT INTO t1 VALUES(0xADD9);
+INSERT INTO t1 VALUES(0xADDA);
+INSERT INTO t1 VALUES(0xADDB);
+INSERT INTO t1 VALUES(0xADDC);
+INSERT INTO t1 VALUES(0xADDD);
+INSERT INTO t1 VALUES(0xADDE);
+INSERT INTO t1 VALUES(0xADDF);
+INSERT INTO t1 VALUES(0xADE0);
+INSERT INTO t1 VALUES(0xADE1);
+INSERT INTO t1 VALUES(0xADE2);
+INSERT INTO t1 VALUES(0xADE3);
+INSERT INTO t1 VALUES(0xADE4);
+INSERT INTO t1 VALUES(0xADE5);
+INSERT INTO t1 VALUES(0xADE6);
+INSERT INTO t1 VALUES(0xADE7);
+INSERT INTO t1 VALUES(0xADE8);
+INSERT INTO t1 VALUES(0xADE9);
+INSERT INTO t1 VALUES(0xADEA);
+INSERT INTO t1 VALUES(0xADEB);
+INSERT INTO t1 VALUES(0xADEC);
+INSERT INTO t1 VALUES(0xADED);
+INSERT INTO t1 VALUES(0xADEE);
+INSERT INTO t1 VALUES(0xADEF);
+INSERT INTO t1 VALUES(0xADF0);
+INSERT INTO t1 VALUES(0xADF1);
+INSERT INTO t1 VALUES(0xADF2);
+INSERT INTO t1 VALUES(0xADF3);
+INSERT INTO t1 VALUES(0xADF4);
+INSERT INTO t1 VALUES(0xADF5);
+INSERT INTO t1 VALUES(0xADF6);
+INSERT INTO t1 VALUES(0xADF7);
+INSERT INTO t1 VALUES(0xADF8);
+INSERT INTO t1 VALUES(0xADF9);
+INSERT INTO t1 VALUES(0xADFA);
+INSERT INTO t1 VALUES(0xADFB);
+INSERT INTO t1 VALUES(0xADFC);
+INSERT INTO t1 VALUES(0xADFD);
+INSERT INTO t1 VALUES(0xADFE);
+INSERT INTO t1 VALUES(0xAEA1);
+INSERT INTO t1 VALUES(0xAEA2);
+INSERT INTO t1 VALUES(0xAEA3);
+INSERT INTO t1 VALUES(0xAEA4);
+INSERT INTO t1 VALUES(0xAEA5);
+INSERT INTO t1 VALUES(0xAEA6);
+INSERT INTO t1 VALUES(0xAEA7);
+INSERT INTO t1 VALUES(0xAEA8);
+INSERT INTO t1 VALUES(0xAEA9);
+INSERT INTO t1 VALUES(0xAEAA);
+INSERT INTO t1 VALUES(0xAEAB);
+INSERT INTO t1 VALUES(0xAEAC);
+INSERT INTO t1 VALUES(0xAEAD);
+INSERT INTO t1 VALUES(0xAEAE);
+INSERT INTO t1 VALUES(0xAEAF);
+INSERT INTO t1 VALUES(0xAEB0);
+INSERT INTO t1 VALUES(0xAEB1);
+INSERT INTO t1 VALUES(0xAEB2);
+INSERT INTO t1 VALUES(0xAEB3);
+INSERT INTO t1 VALUES(0xAEB4);
+INSERT INTO t1 VALUES(0xAEB5);
+INSERT INTO t1 VALUES(0xAEB6);
+INSERT INTO t1 VALUES(0xAEB7);
+INSERT INTO t1 VALUES(0xAEB8);
+INSERT INTO t1 VALUES(0xAEB9);
+INSERT INTO t1 VALUES(0xAEBA);
+INSERT INTO t1 VALUES(0xAEBB);
+INSERT INTO t1 VALUES(0xAEBC);
+INSERT INTO t1 VALUES(0xAEBD);
+INSERT INTO t1 VALUES(0xAEBE);
+INSERT INTO t1 VALUES(0xAEBF);
+INSERT INTO t1 VALUES(0xAEC0);
+INSERT INTO t1 VALUES(0xAEC1);
+INSERT INTO t1 VALUES(0xAEC2);
+INSERT INTO t1 VALUES(0xAEC3);
+INSERT INTO t1 VALUES(0xAEC4);
+INSERT INTO t1 VALUES(0xAEC5);
+INSERT INTO t1 VALUES(0xAEC6);
+INSERT INTO t1 VALUES(0xAEC7);
+INSERT INTO t1 VALUES(0xAEC8);
+INSERT INTO t1 VALUES(0xAEC9);
+INSERT INTO t1 VALUES(0xAECA);
+INSERT INTO t1 VALUES(0xAECB);
+INSERT INTO t1 VALUES(0xAECC);
+INSERT INTO t1 VALUES(0xAECD);
+INSERT INTO t1 VALUES(0xAECE);
+INSERT INTO t1 VALUES(0xAECF);
+INSERT INTO t1 VALUES(0xAED0);
+INSERT INTO t1 VALUES(0xAED1);
+INSERT INTO t1 VALUES(0xAED2);
+INSERT INTO t1 VALUES(0xAED3);
+INSERT INTO t1 VALUES(0xAED4);
+INSERT INTO t1 VALUES(0xAED5);
+INSERT INTO t1 VALUES(0xAED6);
+INSERT INTO t1 VALUES(0xAED7);
+INSERT INTO t1 VALUES(0xAED8);
+INSERT INTO t1 VALUES(0xAED9);
+INSERT INTO t1 VALUES(0xAEDA);
+INSERT INTO t1 VALUES(0xAEDB);
+INSERT INTO t1 VALUES(0xAEDC);
+INSERT INTO t1 VALUES(0xAEDD);
+INSERT INTO t1 VALUES(0xAEDE);
+INSERT INTO t1 VALUES(0xAEDF);
+INSERT INTO t1 VALUES(0xAEE0);
+INSERT INTO t1 VALUES(0xAEE1);
+INSERT INTO t1 VALUES(0xAEE2);
+INSERT INTO t1 VALUES(0xAEE3);
+INSERT INTO t1 VALUES(0xAEE4);
+INSERT INTO t1 VALUES(0xAEE5);
+INSERT INTO t1 VALUES(0xAEE6);
+INSERT INTO t1 VALUES(0xAEE7);
+INSERT INTO t1 VALUES(0xAEE8);
+INSERT INTO t1 VALUES(0xAEE9);
+INSERT INTO t1 VALUES(0xAEEA);
+INSERT INTO t1 VALUES(0xAEEB);
+INSERT INTO t1 VALUES(0xAEEC);
+INSERT INTO t1 VALUES(0xAEED);
+INSERT INTO t1 VALUES(0xAEEE);
+INSERT INTO t1 VALUES(0xAEEF);
+INSERT INTO t1 VALUES(0xAEF0);
+INSERT INTO t1 VALUES(0xAEF1);
+INSERT INTO t1 VALUES(0xAEF2);
+INSERT INTO t1 VALUES(0xAEF3);
+INSERT INTO t1 VALUES(0xAEF4);
+INSERT INTO t1 VALUES(0xAEF5);
+INSERT INTO t1 VALUES(0xAEF6);
+INSERT INTO t1 VALUES(0xAEF7);
+INSERT INTO t1 VALUES(0xAEF8);
+INSERT INTO t1 VALUES(0xAEF9);
+INSERT INTO t1 VALUES(0xAEFA);
+INSERT INTO t1 VALUES(0xAEFB);
+INSERT INTO t1 VALUES(0xAEFC);
+INSERT INTO t1 VALUES(0xAEFD);
+INSERT INTO t1 VALUES(0xAEFE);
+INSERT INTO t1 VALUES(0xAFA1);
+INSERT INTO t1 VALUES(0xAFA2);
+INSERT INTO t1 VALUES(0xAFA3);
+INSERT INTO t1 VALUES(0xAFA4);
+INSERT INTO t1 VALUES(0xAFA5);
+INSERT INTO t1 VALUES(0xAFA6);
+INSERT INTO t1 VALUES(0xAFA7);
+INSERT INTO t1 VALUES(0xAFA8);
+INSERT INTO t1 VALUES(0xAFA9);
+INSERT INTO t1 VALUES(0xAFAA);
+INSERT INTO t1 VALUES(0xAFAB);
+INSERT INTO t1 VALUES(0xAFAC);
+INSERT INTO t1 VALUES(0xAFAD);
+INSERT INTO t1 VALUES(0xAFAE);
+INSERT INTO t1 VALUES(0xAFAF);
+INSERT INTO t1 VALUES(0xAFB0);
+INSERT INTO t1 VALUES(0xAFB1);
+INSERT INTO t1 VALUES(0xAFB2);
+INSERT INTO t1 VALUES(0xAFB3);
+INSERT INTO t1 VALUES(0xAFB4);
+INSERT INTO t1 VALUES(0xAFB5);
+INSERT INTO t1 VALUES(0xAFB6);
+INSERT INTO t1 VALUES(0xAFB7);
+INSERT INTO t1 VALUES(0xAFB8);
+INSERT INTO t1 VALUES(0xAFB9);
+INSERT INTO t1 VALUES(0xAFBA);
+INSERT INTO t1 VALUES(0xAFBB);
+INSERT INTO t1 VALUES(0xAFBC);
+INSERT INTO t1 VALUES(0xAFBD);
+INSERT INTO t1 VALUES(0xAFBE);
+INSERT INTO t1 VALUES(0xAFBF);
+INSERT INTO t1 VALUES(0xAFC0);
+INSERT INTO t1 VALUES(0xAFC1);
+INSERT INTO t1 VALUES(0xAFC2);
+INSERT INTO t1 VALUES(0xAFC3);
+INSERT INTO t1 VALUES(0xAFC4);
+INSERT INTO t1 VALUES(0xAFC5);
+INSERT INTO t1 VALUES(0xAFC6);
+INSERT INTO t1 VALUES(0xAFC7);
+INSERT INTO t1 VALUES(0xAFC8);
+INSERT INTO t1 VALUES(0xAFC9);
+INSERT INTO t1 VALUES(0xAFCA);
+INSERT INTO t1 VALUES(0xAFCB);
+INSERT INTO t1 VALUES(0xAFCC);
+INSERT INTO t1 VALUES(0xAFCD);
+INSERT INTO t1 VALUES(0xAFCE);
+INSERT INTO t1 VALUES(0xAFCF);
+INSERT INTO t1 VALUES(0xAFD0);
+INSERT INTO t1 VALUES(0xAFD1);
+INSERT INTO t1 VALUES(0xAFD2);
+INSERT INTO t1 VALUES(0xAFD3);
+INSERT INTO t1 VALUES(0xAFD4);
+INSERT INTO t1 VALUES(0xAFD5);
+INSERT INTO t1 VALUES(0xAFD6);
+INSERT INTO t1 VALUES(0xAFD7);
+INSERT INTO t1 VALUES(0xAFD8);
+INSERT INTO t1 VALUES(0xAFD9);
+INSERT INTO t1 VALUES(0xAFDA);
+INSERT INTO t1 VALUES(0xAFDB);
+INSERT INTO t1 VALUES(0xAFDC);
+INSERT INTO t1 VALUES(0xAFDD);
+INSERT INTO t1 VALUES(0xAFDE);
+INSERT INTO t1 VALUES(0xAFDF);
+INSERT INTO t1 VALUES(0xAFE0);
+INSERT INTO t1 VALUES(0xAFE1);
+INSERT INTO t1 VALUES(0xAFE2);
+INSERT INTO t1 VALUES(0xAFE3);
+INSERT INTO t1 VALUES(0xAFE4);
+INSERT INTO t1 VALUES(0xAFE5);
+INSERT INTO t1 VALUES(0xAFE6);
+INSERT INTO t1 VALUES(0xAFE7);
+INSERT INTO t1 VALUES(0xAFE8);
+INSERT INTO t1 VALUES(0xAFE9);
+INSERT INTO t1 VALUES(0xAFEA);
+INSERT INTO t1 VALUES(0xAFEB);
+INSERT INTO t1 VALUES(0xAFEC);
+INSERT INTO t1 VALUES(0xAFED);
+INSERT INTO t1 VALUES(0xAFEE);
+INSERT INTO t1 VALUES(0xAFEF);
+INSERT INTO t1 VALUES(0xAFF0);
+INSERT INTO t1 VALUES(0xAFF1);
+INSERT INTO t1 VALUES(0xAFF2);
+INSERT INTO t1 VALUES(0xAFF3);
+INSERT INTO t1 VALUES(0xAFF4);
+INSERT INTO t1 VALUES(0xAFF5);
+INSERT INTO t1 VALUES(0xAFF6);
+INSERT INTO t1 VALUES(0xAFF7);
+INSERT INTO t1 VALUES(0xAFF8);
+INSERT INTO t1 VALUES(0xAFF9);
+INSERT INTO t1 VALUES(0xAFFA);
+INSERT INTO t1 VALUES(0xAFFB);
+INSERT INTO t1 VALUES(0xAFFC);
+INSERT INTO t1 VALUES(0xAFFD);
+INSERT INTO t1 VALUES(0xAFFE);
+INSERT INTO t1 VALUES(0xCFD4);
+INSERT INTO t1 VALUES(0xCFD5);
+INSERT INTO t1 VALUES(0xCFD6);
+INSERT INTO t1 VALUES(0xCFD7);
+INSERT INTO t1 VALUES(0xCFD8);
+INSERT INTO t1 VALUES(0xCFD9);
+INSERT INTO t1 VALUES(0xCFDA);
+INSERT INTO t1 VALUES(0xCFDB);
+INSERT INTO t1 VALUES(0xCFDC);
+INSERT INTO t1 VALUES(0xCFDD);
+INSERT INTO t1 VALUES(0xCFDE);
+INSERT INTO t1 VALUES(0xCFDF);
+INSERT INTO t1 VALUES(0xCFE0);
+INSERT INTO t1 VALUES(0xCFE1);
+INSERT INTO t1 VALUES(0xCFE2);
+INSERT INTO t1 VALUES(0xCFE3);
+INSERT INTO t1 VALUES(0xCFE4);
+INSERT INTO t1 VALUES(0xCFE5);
+INSERT INTO t1 VALUES(0xCFE6);
+INSERT INTO t1 VALUES(0xCFE7);
+INSERT INTO t1 VALUES(0xCFE8);
+INSERT INTO t1 VALUES(0xCFE9);
+INSERT INTO t1 VALUES(0xCFEA);
+INSERT INTO t1 VALUES(0xCFEB);
+INSERT INTO t1 VALUES(0xCFEC);
+INSERT INTO t1 VALUES(0xCFED);
+INSERT INTO t1 VALUES(0xCFEE);
+INSERT INTO t1 VALUES(0xCFEF);
+INSERT INTO t1 VALUES(0xCFF0);
+INSERT INTO t1 VALUES(0xCFF1);
+INSERT INTO t1 VALUES(0xCFF2);
+INSERT INTO t1 VALUES(0xCFF3);
+INSERT INTO t1 VALUES(0xCFF4);
+INSERT INTO t1 VALUES(0xCFF5);
+INSERT INTO t1 VALUES(0xCFF6);
+INSERT INTO t1 VALUES(0xCFF7);
+INSERT INTO t1 VALUES(0xCFF8);
+INSERT INTO t1 VALUES(0xCFF9);
+INSERT INTO t1 VALUES(0xCFFA);
+INSERT INTO t1 VALUES(0xCFFB);
+INSERT INTO t1 VALUES(0xCFFC);
+INSERT INTO t1 VALUES(0xCFFD);
+INSERT INTO t1 VALUES(0xCFFE);
+INSERT INTO t1 VALUES(0xF4A7);
+INSERT INTO t1 VALUES(0xF4A8);
+INSERT INTO t1 VALUES(0xF4A9);
+INSERT INTO t1 VALUES(0xF4AA);
+INSERT INTO t1 VALUES(0xF4AB);
+INSERT INTO t1 VALUES(0xF4AC);
+INSERT INTO t1 VALUES(0xF4AD);
+INSERT INTO t1 VALUES(0xF4AE);
+INSERT INTO t1 VALUES(0xF4AF);
+INSERT INTO t1 VALUES(0xF4B0);
+INSERT INTO t1 VALUES(0xF4B1);
+INSERT INTO t1 VALUES(0xF4B2);
+INSERT INTO t1 VALUES(0xF4B3);
+INSERT INTO t1 VALUES(0xF4B4);
+INSERT INTO t1 VALUES(0xF4B5);
+INSERT INTO t1 VALUES(0xF4B6);
+INSERT INTO t1 VALUES(0xF4B7);
+INSERT INTO t1 VALUES(0xF4B8);
+INSERT INTO t1 VALUES(0xF4B9);
+INSERT INTO t1 VALUES(0xF4BA);
+INSERT INTO t1 VALUES(0xF4BB);
+INSERT INTO t1 VALUES(0xF4BC);
+INSERT INTO t1 VALUES(0xF4BD);
+INSERT INTO t1 VALUES(0xF4BE);
+INSERT INTO t1 VALUES(0xF4BF);
+INSERT INTO t1 VALUES(0xF4C0);
+INSERT INTO t1 VALUES(0xF4C1);
+INSERT INTO t1 VALUES(0xF4C2);
+INSERT INTO t1 VALUES(0xF4C3);
+INSERT INTO t1 VALUES(0xF4C4);
+INSERT INTO t1 VALUES(0xF4C5);
+INSERT INTO t1 VALUES(0xF4C6);
+INSERT INTO t1 VALUES(0xF4C7);
+INSERT INTO t1 VALUES(0xF4C8);
+INSERT INTO t1 VALUES(0xF4C9);
+INSERT INTO t1 VALUES(0xF4CA);
+INSERT INTO t1 VALUES(0xF4CB);
+INSERT INTO t1 VALUES(0xF4CC);
+INSERT INTO t1 VALUES(0xF4CD);
+INSERT INTO t1 VALUES(0xF4CE);
+INSERT INTO t1 VALUES(0xF4CF);
+INSERT INTO t1 VALUES(0xF4D0);
+INSERT INTO t1 VALUES(0xF4D1);
+INSERT INTO t1 VALUES(0xF4D2);
+INSERT INTO t1 VALUES(0xF4D3);
+INSERT INTO t1 VALUES(0xF4D4);
+INSERT INTO t1 VALUES(0xF4D5);
+INSERT INTO t1 VALUES(0xF4D6);
+INSERT INTO t1 VALUES(0xF4D7);
+INSERT INTO t1 VALUES(0xF4D8);
+INSERT INTO t1 VALUES(0xF4D9);
+INSERT INTO t1 VALUES(0xF4DA);
+INSERT INTO t1 VALUES(0xF4DB);
+INSERT INTO t1 VALUES(0xF4DC);
+INSERT INTO t1 VALUES(0xF4DD);
+INSERT INTO t1 VALUES(0xF4DE);
+INSERT INTO t1 VALUES(0xF4DF);
+INSERT INTO t1 VALUES(0xF4E0);
+INSERT INTO t1 VALUES(0xF4E1);
+INSERT INTO t1 VALUES(0xF4E2);
+INSERT INTO t1 VALUES(0xF4E3);
+INSERT INTO t1 VALUES(0xF4E4);
+INSERT INTO t1 VALUES(0xF4E5);
+INSERT INTO t1 VALUES(0xF4E6);
+INSERT INTO t1 VALUES(0xF4E7);
+INSERT INTO t1 VALUES(0xF4E8);
+INSERT INTO t1 VALUES(0xF4E9);
+INSERT INTO t1 VALUES(0xF4EA);
+INSERT INTO t1 VALUES(0xF4EB);
+INSERT INTO t1 VALUES(0xF4EC);
+INSERT INTO t1 VALUES(0xF4ED);
+INSERT INTO t1 VALUES(0xF4EE);
+INSERT INTO t1 VALUES(0xF4EF);
+INSERT INTO t1 VALUES(0xF4F0);
+INSERT INTO t1 VALUES(0xF4F1);
+INSERT INTO t1 VALUES(0xF4F2);
+INSERT INTO t1 VALUES(0xF4F3);
+INSERT INTO t1 VALUES(0xF4F4);
+INSERT INTO t1 VALUES(0xF4F5);
+INSERT INTO t1 VALUES(0xF4F6);
+INSERT INTO t1 VALUES(0xF4F7);
+INSERT INTO t1 VALUES(0xF4F8);
+INSERT INTO t1 VALUES(0xF4F9);
+INSERT INTO t1 VALUES(0xF4FA);
+INSERT INTO t1 VALUES(0xF4FB);
+INSERT INTO t1 VALUES(0xF4FC);
+INSERT INTO t1 VALUES(0xF4FD);
+INSERT INTO t1 VALUES(0xF4FE);
+SELECT HEX(c) FROM t1 ORDER BY BINARY c;
+HEX(c)
+A2AF
+A2B0
+A2B1
+A2B2
+A2B3
+A2B4
+A2B5
+A2B6
+A2B7
+A2B8
+A2B9
+A2C2
+A2C3
+A2C4
+A2C5
+A2C6
+A2C7
+A2C8
+A2C9
+A2D1
+A2D2
+A2D3
+A2D4
+A2D5
+A2D6
+A2D7
+A2D8
+A2D9
+A2DA
+A2DB
+A2EB
+A2EC
+A2ED
+A2EE
+A2EF
+A2F0
+A2F1
+A2FA
+A2FB
+A2FC
+A2FD
+A3A1
+A3A2
+A3A3
+A3A4
+A3A5
+A3A6
+A3A7
+A3A8
+A3A9
+A3AA
+A3AB
+A3AC
+A3AD
+A3AE
+A3AF
+A3BA
+A3BB
+A3BC
+A3BD
+A3BE
+A3BF
+A3C0
+A3DB
+A3DC
+A3DD
+A3DE
+A3DF
+A3E0
+A3FB
+A3FC
+A3FD
+A3FE
+A4F4
+A4F5
+A4F6
+A4F7
+A4F8
+A4F9
+A4FA
+A4FB
+A4FC
+A4FD
+A4FE
+A5F7
+A5F8
+A5F9
+A5FA
+A5FB
+A5FC
+A5FD
+A5FE
+A6B9
+A6BA
+A6BB
+A6BC
+A6BD
+A6BE
+A6BF
+A6C0
+A6D9
+A6DA
+A6DB
+A6DC
+A6DD
+A6DE
+A6DF
+A6E0
+A6E1
+A6E2
+A6E3
+A6E4
+A6E5
+A6E6
+A6E7
+A6E8
+A6E9
+A6EA
+A6EB
+A6EC
+A6ED
+A6EE
+A6EF
+A6F0
+A6F1
+A6F2
+A6F3
+A6F4
+A6F5
+A6F6
+A6F7
+A6F8
+A6F9
+A6FA
+A6FB
+A6FC
+A6FD
+A6FE
+A7C2
+A7C3
+A7C4
+A7C5
+A7C6
+A7C7
+A7C8
+A7C9
+A7CA
+A7CB
+A7CC
+A7CD
+A7CE
+A7CF
+A7D0
+A7F2
+A7F3
+A7F4
+A7F5
+A7F6
+A7F7
+A7F8
+A7F9
+A7FA
+A7FB
+A7FC
+A7FD
+A7FE
+A8C1
+A8C2
+A8C3
+A8C4
+A8C5
+A8C6
+A8C7
+A8C8
+A8C9
+A8CA
+A8CB
+A8CC
+A8CD
+A8CE
+A8CF
+A8D0
+A8D1
+A8D2
+A8D3
+A8D4
+A8D5
+A8D6
+A8D7
+A8D8
+A8D9
+A8DA
+A8DB
+A8DC
+A8DD
+A8DE
+A8DF
+A8E0
+A8E1
+A8E2
+A8E3
+A8E4
+A8E5
+A8E6
+A8E7
+A8E8
+A8E9
+A8EA
+A8EB
+A8EC
+A8ED
+A8EE
+A8EF
+A8F0
+A8F1
+A8F2
+A8F3
+A8F4
+A8F5
+A8F6
+A8F7
+A8F8
+A8F9
+A8FA
+A8FB
+A8FC
+A8FD
+A8FE
+A9A1
+A9A2
+A9A3
+A9A4
+A9A5
+A9A6
+A9A7
+A9A8
+A9A9
+A9AA
+A9AB
+A9AC
+A9AD
+A9AE
+A9AF
+A9B0
+A9B1
+A9B2
+A9B3
+A9B4
+A9B5
+A9B6
+A9B7
+A9B8
+A9B9
+A9BA
+A9BB
+A9BC
+A9BD
+A9BE
+A9BF
+A9C0
+A9C1
+A9C2
+A9C3
+A9C4
+A9C5
+A9C6
+A9C7
+A9C8
+A9C9
+A9CA
+A9CB
+A9CC
+A9CD
+A9CE
+A9CF
+A9D0
+A9D1
+A9D2
+A9D3
+A9D4
+A9D5
+A9D6
+A9D7
+A9D8
+A9D9
+A9DA
+A9DB
+A9DC
+A9DD
+A9DE
+A9DF
+A9E0
+A9E1
+A9E2
+A9E3
+A9E4
+A9E5
+A9E6
+A9E7
+A9E8
+A9E9
+A9EA
+A9EB
+A9EC
+A9ED
+A9EE
+A9EF
+A9F0
+A9F1
+A9F2
+A9F3
+A9F4
+A9F5
+A9F6
+A9F7
+A9F8
+A9F9
+A9FA
+A9FB
+A9FC
+A9FD
+A9FE
+AAA1
+AAA2
+AAA3
+AAA4
+AAA5
+AAA6
+AAA7
+AAA8
+AAA9
+AAAA
+AAAB
+AAAC
+AAAD
+AAAE
+AAAF
+AAB0
+AAB1
+AAB2
+AAB3
+AAB4
+AAB5
+AAB6
+AAB7
+AAB8
+AAB9
+AABA
+AABB
+AABC
+AABD
+AABE
+AABF
+AAC0
+AAC1
+AAC2
+AAC3
+AAC4
+AAC5
+AAC6
+AAC7
+AAC8
+AAC9
+AACA
+AACB
+AACC
+AACD
+AACE
+AACF
+AAD0
+AAD1
+AAD2
+AAD3
+AAD4
+AAD5
+AAD6
+AAD7
+AAD8
+AAD9
+AADA
+AADB
+AADC
+AADD
+AADE
+AADF
+AAE0
+AAE1
+AAE2
+AAE3
+AAE4
+AAE5
+AAE6
+AAE7
+AAE8
+AAE9
+AAEA
+AAEB
+AAEC
+AAED
+AAEE
+AAEF
+AAF0
+AAF1
+AAF2
+AAF3
+AAF4
+AAF5
+AAF6
+AAF7
+AAF8
+AAF9
+AAFA
+AAFB
+AAFC
+AAFD
+AAFE
+ABA1
+ABA2
+ABA3
+ABA4
+ABA5
+ABA6
+ABA7
+ABA8
+ABA9
+ABAA
+ABAB
+ABAC
+ABAD
+ABAE
+ABAF
+ABB0
+ABB1
+ABB2
+ABB3
+ABB4
+ABB5
+ABB6
+ABB7
+ABB8
+ABB9
+ABBA
+ABBB
+ABBC
+ABBD
+ABBE
+ABBF
+ABC0
+ABC1
+ABC2
+ABC3
+ABC4
+ABC5
+ABC6
+ABC7
+ABC8
+ABC9
+ABCA
+ABCB
+ABCC
+ABCD
+ABCE
+ABCF
+ABD0
+ABD1
+ABD2
+ABD3
+ABD4
+ABD5
+ABD6
+ABD7
+ABD8
+ABD9
+ABDA
+ABDB
+ABDC
+ABDD
+ABDE
+ABDF
+ABE0
+ABE1
+ABE2
+ABE3
+ABE4
+ABE5
+ABE6
+ABE7
+ABE8
+ABE9
+ABEA
+ABEB
+ABEC
+ABED
+ABEE
+ABEF
+ABF0
+ABF1
+ABF2
+ABF3
+ABF4
+ABF5
+ABF6
+ABF7
+ABF8
+ABF9
+ABFA
+ABFB
+ABFC
+ABFD
+ABFE
+ACA1
+ACA2
+ACA3
+ACA4
+ACA5
+ACA6
+ACA7
+ACA8
+ACA9
+ACAA
+ACAB
+ACAC
+ACAD
+ACAE
+ACAF
+ACB0
+ACB1
+ACB2
+ACB3
+ACB4
+ACB5
+ACB6
+ACB7
+ACB8
+ACB9
+ACBA
+ACBB
+ACBC
+ACBD
+ACBE
+ACBF
+ACC0
+ACC1
+ACC2
+ACC3
+ACC4
+ACC5
+ACC6
+ACC7
+ACC8
+ACC9
+ACCA
+ACCB
+ACCC
+ACCD
+ACCE
+ACCF
+ACD0
+ACD1
+ACD2
+ACD3
+ACD4
+ACD5
+ACD6
+ACD7
+ACD8
+ACD9
+ACDA
+ACDB
+ACDC
+ACDD
+ACDE
+ACDF
+ACE0
+ACE1
+ACE2
+ACE3
+ACE4
+ACE5
+ACE6
+ACE7
+ACE8
+ACE9
+ACEA
+ACEB
+ACEC
+ACED
+ACEE
+ACEF
+ACF0
+ACF1
+ACF2
+ACF3
+ACF4
+ACF5
+ACF6
+ACF7
+ACF8
+ACF9
+ACFA
+ACFB
+ACFC
+ACFD
+ACFE
+ADA1
+ADA2
+ADA3
+ADA4
+ADA5
+ADA6
+ADA7
+ADA8
+ADA9
+ADAA
+ADAB
+ADAC
+ADAD
+ADAE
+ADAF
+ADB0
+ADB1
+ADB2
+ADB3
+ADB4
+ADB5
+ADB6
+ADB7
+ADB8
+ADB9
+ADBA
+ADBB
+ADBC
+ADBD
+ADBE
+ADBF
+ADC0
+ADC1
+ADC2
+ADC3
+ADC4
+ADC5
+ADC6
+ADC7
+ADC8
+ADC9
+ADCA
+ADCB
+ADCC
+ADCD
+ADCE
+ADCF
+ADD0
+ADD1
+ADD2
+ADD3
+ADD4
+ADD5
+ADD6
+ADD7
+ADD8
+ADD9
+ADDA
+ADDB
+ADDC
+ADDD
+ADDE
+ADDF
+ADE0
+ADE1
+ADE2
+ADE3
+ADE4
+ADE5
+ADE6
+ADE7
+ADE8
+ADE9
+ADEA
+ADEB
+ADEC
+ADED
+ADEE
+ADEF
+ADF0
+ADF1
+ADF2
+ADF3
+ADF4
+ADF5
+ADF6
+ADF7
+ADF8
+ADF9
+ADFA
+ADFB
+ADFC
+ADFD
+ADFE
+AEA1
+AEA2
+AEA3
+AEA4
+AEA5
+AEA6
+AEA7
+AEA8
+AEA9
+AEAA
+AEAB
+AEAC
+AEAD
+AEAE
+AEAF
+AEB0
+AEB1
+AEB2
+AEB3
+AEB4
+AEB5
+AEB6
+AEB7
+AEB8
+AEB9
+AEBA
+AEBB
+AEBC
+AEBD
+AEBE
+AEBF
+AEC0
+AEC1
+AEC2
+AEC3
+AEC4
+AEC5
+AEC6
+AEC7
+AEC8
+AEC9
+AECA
+AECB
+AECC
+AECD
+AECE
+AECF
+AED0
+AED1
+AED2
+AED3
+AED4
+AED5
+AED6
+AED7
+AED8
+AED9
+AEDA
+AEDB
+AEDC
+AEDD
+AEDE
+AEDF
+AEE0
+AEE1
+AEE2
+AEE3
+AEE4
+AEE5
+AEE6
+AEE7
+AEE8
+AEE9
+AEEA
+AEEB
+AEEC
+AEED
+AEEE
+AEEF
+AEF0
+AEF1
+AEF2
+AEF3
+AEF4
+AEF5
+AEF6
+AEF7
+AEF8
+AEF9
+AEFA
+AEFB
+AEFC
+AEFD
+AEFE
+AFA1
+AFA2
+AFA3
+AFA4
+AFA5
+AFA6
+AFA7
+AFA8
+AFA9
+AFAA
+AFAB
+AFAC
+AFAD
+AFAE
+AFAF
+AFB0
+AFB1
+AFB2
+AFB3
+AFB4
+AFB5
+AFB6
+AFB7
+AFB8
+AFB9
+AFBA
+AFBB
+AFBC
+AFBD
+AFBE
+AFBF
+AFC0
+AFC1
+AFC2
+AFC3
+AFC4
+AFC5
+AFC6
+AFC7
+AFC8
+AFC9
+AFCA
+AFCB
+AFCC
+AFCD
+AFCE
+AFCF
+AFD0
+AFD1
+AFD2
+AFD3
+AFD4
+AFD5
+AFD6
+AFD7
+AFD8
+AFD9
+AFDA
+AFDB
+AFDC
+AFDD
+AFDE
+AFDF
+AFE0
+AFE1
+AFE2
+AFE3
+AFE4
+AFE5
+AFE6
+AFE7
+AFE8
+AFE9
+AFEA
+AFEB
+AFEC
+AFED
+AFEE
+AFEF
+AFF0
+AFF1
+AFF2
+AFF3
+AFF4
+AFF5
+AFF6
+AFF7
+AFF8
+AFF9
+AFFA
+AFFB
+AFFC
+AFFD
+AFFE
+CFD4
+CFD5
+CFD6
+CFD7
+CFD8
+CFD9
+CFDA
+CFDB
+CFDC
+CFDD
+CFDE
+CFDF
+CFE0
+CFE1
+CFE2
+CFE3
+CFE4
+CFE5
+CFE6
+CFE7
+CFE8
+CFE9
+CFEA
+CFEB
+CFEC
+CFED
+CFEE
+CFEF
+CFF0
+CFF1
+CFF2
+CFF3
+CFF4
+CFF5
+CFF6
+CFF7
+CFF8
+CFF9
+CFFA
+CFFB
+CFFC
+CFFD
+CFFE
+F4A7
+F4A8
+F4A9
+F4AA
+F4AB
+F4AC
+F4AD
+F4AE
+F4AF
+F4B0
+F4B1
+F4B2
+F4B3
+F4B4
+F4B5
+F4B6
+F4B7
+F4B8
+F4B9
+F4BA
+F4BB
+F4BC
+F4BD
+F4BE
+F4BF
+F4C0
+F4C1
+F4C2
+F4C3
+F4C4
+F4C5
+F4C6
+F4C7
+F4C8
+F4C9
+F4CA
+F4CB
+F4CC
+F4CD
+F4CE
+F4CF
+F4D0
+F4D1
+F4D2
+F4D3
+F4D4
+F4D5
+F4D6
+F4D7
+F4D8
+F4D9
+F4DA
+F4DB
+F4DC
+F4DD
+F4DE
+F4DF
+F4E0
+F4E1
+F4E2
+F4E3
+F4E4
+F4E5
+F4E6
+F4E7
+F4E8
+F4E9
+F4EA
+F4EB
+F4EC
+F4ED
+F4EE
+F4EF
+F4F0
+F4F1
+F4F2
+F4F3
+F4F4
+F4F5
+F4F6
+F4F7
+F4F8
+F4F9
+F4FA
+F4FB
+F4FC
+F4FD
+F4FE
+DROP TABLE t1;
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
new file mode 100644
index 00000000000..599d49208e7
--- /dev/null
+++ b/mysql-test/r/ctype_utf8.result
@@ -0,0 +1,819 @@
+drop table if exists t1,t2;
+set names utf8;
+select left(_utf8 0xD0B0D0B1D0B2,1);
+left(_utf8 0xD0B0D0B1D0B2,1)
+а
+select right(_utf8 0xD0B0D0B2D0B2,1);
+right(_utf8 0xD0B0D0B2D0B2,1)
+в
+select locate('he','hello');
+locate('he','hello')
+1
+select locate('he','hello',2);
+locate('he','hello',2)
+0
+select locate('lo','hello',2);
+locate('lo','hello',2)
+4
+select locate('HE','hello');
+locate('HE','hello')
+1
+select locate('HE','hello',2);
+locate('HE','hello',2)
+0
+select locate('LO','hello',2);
+locate('LO','hello',2)
+4
+select locate('HE','hello' collate utf8_bin);
+locate('HE','hello' collate utf8_bin)
+0
+select locate('HE','hello' collate utf8_bin,2);
+locate('HE','hello' collate utf8_bin,2)
+0
+select locate('LO','hello' collate utf8_bin,2);
+locate('LO','hello' collate utf8_bin,2)
+0
+select locate(_utf8 0xD0B1, _utf8 0xD0B0D0B1D0B2);
+locate(_utf8 0xD0B1, _utf8 0xD0B0D0B1D0B2)
+2
+select locate(_utf8 0xD091, _utf8 0xD0B0D0B1D0B2);
+locate(_utf8 0xD091, _utf8 0xD0B0D0B1D0B2)
+2
+select locate(_utf8 0xD0B1, _utf8 0xD0B0D091D0B2);
+locate(_utf8 0xD0B1, _utf8 0xD0B0D091D0B2)
+2
+select locate(_utf8 0xD091, _utf8 0xD0B0D0B1D0B2 collate utf8_bin);
+locate(_utf8 0xD091, _utf8 0xD0B0D0B1D0B2 collate utf8_bin)
+0
+select locate(_utf8 0xD0B1, _utf8 0xD0B0D091D0B2 collate utf8_bin);
+locate(_utf8 0xD0B1, _utf8 0xD0B0D091D0B2 collate utf8_bin)
+0
+select length(_utf8 0xD0B1), bit_length(_utf8 0xD0B1), char_length(_utf8 0xD0B1);
+length(_utf8 0xD0B1) bit_length(_utf8 0xD0B1) char_length(_utf8 0xD0B1)
+2 16 1
+select 'a' like 'a';
+'a' like 'a'
+1
+select 'A' like 'a';
+'A' like 'a'
+1
+select 'A' like 'a' collate utf8_bin;
+'A' like 'a' collate utf8_bin
+0
+select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%');
+_utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%')
+1
+select convert(_latin1'Günter André' using utf8) like CONVERT(_latin1'GÜNTER%' USING utf8);
+convert(_latin1'Günter André' using utf8) like CONVERT(_latin1'GÜNTER%' USING utf8)
+1
+select CONVERT(_koi8r'×ÁÓÑ' USING utf8) LIKE CONVERT(_koi8r'÷áóñ' USING utf8);
+CONVERT(_koi8r'×ÁÓÑ' USING utf8) LIKE CONVERT(_koi8r'÷áóñ' USING utf8)
+1
+select CONVERT(_koi8r'÷áóñ' USING utf8) LIKE CONVERT(_koi8r'×ÁÓÑ' USING utf8);
+CONVERT(_koi8r'÷áóñ' USING utf8) LIKE CONVERT(_koi8r'×ÁÓÑ' USING utf8)
+1
+SELECT 'a' = 'a ';
+'a' = 'a '
+1
+SELECT 'a\0' < 'a';
+'a\0' < 'a'
+1
+SELECT 'a\0' < 'a ';
+'a\0' < 'a '
+1
+SELECT 'a\t' < 'a';
+'a\t' < 'a'
+1
+SELECT 'a\t' < 'a ';
+'a\t' < 'a '
+1
+SELECT 'a' = 'a ' collate utf8_bin;
+'a' = 'a ' collate utf8_bin
+1
+SELECT 'a\0' < 'a' collate utf8_bin;
+'a\0' < 'a' collate utf8_bin
+1
+SELECT 'a\0' < 'a ' collate utf8_bin;
+'a\0' < 'a ' collate utf8_bin
+1
+SELECT 'a\t' < 'a' collate utf8_bin;
+'a\t' < 'a' collate utf8_bin
+1
+SELECT 'a\t' < 'a ' collate utf8_bin;
+'a\t' < 'a ' collate utf8_bin
+1
+CREATE TABLE t1 (a char(10) character set utf8 not null);
+INSERT INTO t1 VALUES ('a'),('a\0'),('a\t'),('a ');
+SELECT hex(a),STRCMP(a,'a'), STRCMP(a,'a ') FROM t1;
+hex(a) STRCMP(a,'a') STRCMP(a,'a ')
+61 0 0
+6100 -1 -1
+6109 -1 -1
+61 0 0
+DROP TABLE t1;
+select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
+insert('txs',2,1,'hi') insert('is ',4,0,'a') insert('txxxxt',2,4,'es')
+this is a test
+select insert("aa",100,1,"b"),insert("aa",1,3,"b");
+insert("aa",100,1,"b") insert("aa",1,3,"b")
+aa b
+select char_length(left(@a:='тест',5)), length(@a), @a;
+char_length(left(@a:='тест',5)) length(@a) @a
+4 8 тест
+create table t1 select date_format("2004-01-19 10:10:10", "%Y-%m-%d");
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `date_format("2004-01-19 10:10:10", "%Y-%m-%d")` binary(10) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+date_format("2004-01-19 10:10:10", "%Y-%m-%d")
+2004-01-19
+drop table t1;
+set names koi8r;
+create table t1 (s1 char(1) character set utf8);
+insert into t1 values (_koi8r'ÁÂ');
+Warnings:
+Warning 1265 Data truncated for column 's1' at row 1
+select s1,hex(s1),char_length(s1),octet_length(s1) from t1;
+s1 hex(s1) char_length(s1) octet_length(s1)
+Á D0B0 1 2
+drop table t1;
+create table t1 (s1 tinytext character set utf8);
+insert into t1 select repeat('a',300);
+Warnings:
+Warning 1265 Data truncated for column 's1' at row 1
+insert into t1 select repeat('Ñ',300);
+Warnings:
+Warning 1265 Data truncated for column 's1' at row 1
+insert into t1 select repeat('aÑ',300);
+Warnings:
+Warning 1265 Data truncated for column 's1' at row 1
+insert into t1 select repeat('Ña',300);
+Warnings:
+Warning 1265 Data truncated for column 's1' at row 1
+insert into t1 select repeat('ÑÑ',300);
+Warnings:
+Warning 1265 Data truncated for column 's1' at row 1
+select hex(s1) from t1;
+hex(s1)
+616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161
+D18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18F
+61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F
+D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61
+D18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18F
+select length(s1),char_length(s1) from t1;
+length(s1) char_length(s1)
+255 255
+254 127
+255 170
+255 170
+254 127
+drop table t1;
+create table t1 (s1 text character set utf8);
+insert into t1 select repeat('a',66000);
+Warnings:
+Warning 1265 Data truncated for column 's1' at row 1
+insert into t1 select repeat('Ñ',66000);
+Warnings:
+Warning 1265 Data truncated for column 's1' at row 1
+insert into t1 select repeat('aÑ',66000);
+Warnings:
+Warning 1265 Data truncated for column 's1' at row 1
+insert into t1 select repeat('Ña',66000);
+Warnings:
+Warning 1265 Data truncated for column 's1' at row 1
+insert into t1 select repeat('ÑÑ',66000);
+Warnings:
+Warning 1265 Data truncated for column 's1' at row 1
+select length(s1),char_length(s1) from t1;
+length(s1) char_length(s1)
+65535 65535
+65534 32767
+65535 43690
+65535 43690
+65534 32767
+drop table t1;
+create table t1 (s1 char(10) character set utf8);
+insert into t1 values (0x41FF);
+Warnings:
+Warning 1265 Data truncated for column 's1' at row 1
+select hex(s1) from t1;
+hex(s1)
+41
+drop table t1;
+create table t1 (s1 varchar(10) character set utf8);
+insert into t1 values (0x41FF);
+Warnings:
+Warning 1265 Data truncated for column 's1' at row 1
+select hex(s1) from t1;
+hex(s1)
+41
+drop table t1;
+create table t1 (s1 text character set utf8);
+insert into t1 values (0x41FF);
+Warnings:
+Warning 1265 Data truncated for column 's1' at row 1
+select hex(s1) from t1;
+hex(s1)
+41
+drop table t1;
+create table t1 (a text character set utf8, primary key(a(360)));
+ERROR 42000: Specified key was too long; max key length is 1000 bytes
+CREATE TABLE t1 ( a varchar(10) ) CHARACTER SET utf8;
+INSERT INTO t1 VALUES ( 'test' );
+SELECT a.a, b.a FROM t1 a, t1 b WHERE a.a = b.a;
+a a
+test test
+SELECT a.a, b.a FROM t1 a, t1 b WHERE a.a = 'test' and b.a = 'test';
+a a
+test test
+SELECT a.a, b.a FROM t1 a, t1 b WHERE a.a = b.a and a.a = 'test';
+a a
+test test
+DROP TABLE t1;
+create table t1 (a char(255) character set utf8);
+insert into t1 values('b'),('b');
+select * from t1 where a = 'b';
+a
+b
+b
+select * from t1 where a = 'b' and a = 'b';
+a
+b
+b
+select * from t1 where a = 'b' and a != 'b';
+a
+drop table t1;
+set names utf8;
+select 'вася' rlike '[[:<:]]вася[[:>:]]';
+'вася' rlike '[[:<:]]вася[[:>:]]'
+1
+select 'вася ' rlike '[[:<:]]вася[[:>:]]';
+'вася ' rlike '[[:<:]]вася[[:>:]]'
+1
+select ' вася' rlike '[[:<:]]вася[[:>:]]';
+' вася' rlike '[[:<:]]вася[[:>:]]'
+1
+select ' вася ' rlike '[[:<:]]вася[[:>:]]';
+' вася ' rlike '[[:<:]]вася[[:>:]]'
+1
+select 'васяz' rlike '[[:<:]]вася[[:>:]]';
+'васяz' rlike '[[:<:]]вася[[:>:]]'
+0
+select 'zвася' rlike '[[:<:]]вася[[:>:]]';
+'zвася' rlike '[[:<:]]вася[[:>:]]'
+0
+select 'zвасяz' rlike '[[:<:]]вася[[:>:]]';
+'zвасяz' rlike '[[:<:]]вася[[:>:]]'
+0
+CREATE TABLE t1 (a enum ('Y', 'N') DEFAULT 'N' COLLATE utf8_unicode_ci);
+ALTER TABLE t1 ADD COLUMN b CHAR(20);
+DROP TABLE t1;
+set names utf8;
+create table t1 (a enum('aaaa','прПба') character set utf8);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` enum('aaaa','прПба') character set utf8 default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values ('прПба');
+select * from t1;
+a
+прПба
+create table t2 select ifnull(a,a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `ifnull(a,a)` char(5) character set utf8 default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t2;
+ifnull(a,a)
+прПба
+drop table t1;
+drop table t2;
+create table t1 (c varchar(30) character set utf8, unique(c(10)));
+insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
+insert into t1 values ('aaaaaaaaaa');
+insert into t1 values ('aaaaaaaaaaa');
+ERROR 23000: Duplicate entry 'aaaaaaaaaaa' for key 1
+insert into t1 values ('aaaaaaaaaaaa');
+ERROR 23000: Duplicate entry 'aaaaaaaaaaaa' for key 1
+insert into t1 values (repeat('b',20));
+select c c1 from t1 where c='1';
+c1
+1
+select c c2 from t1 where c='2';
+c2
+2
+select c c3 from t1 where c='3';
+c3
+3
+select c cx from t1 where c='x';
+cx
+x
+select c cy from t1 where c='y';
+cy
+y
+select c cz from t1 where c='z';
+cz
+z
+select c ca10 from t1 where c='aaaaaaaaaa';
+ca10
+aaaaaaaaaa
+select c cb20 from t1 where c=repeat('b',20);
+cb20
+bbbbbbbbbbbbbbbbbbbb
+drop table t1;
+create table t1 (c varchar(30) character set utf8, unique(c(10))) engine=innodb;
+insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
+insert into t1 values ('aaaaaaaaaa');
+insert into t1 values ('aaaaaaaaaaa');
+ERROR 23000: Duplicate entry 'aaaaaaaaaaa' for key 1
+insert into t1 values ('aaaaaaaaaaaa');
+ERROR 23000: Duplicate entry 'aaaaaaaaaaaa' for key 1
+insert into t1 values (repeat('b',20));
+select c c1 from t1 where c='1';
+c1
+1
+select c c2 from t1 where c='2';
+c2
+2
+select c c3 from t1 where c='3';
+c3
+3
+select c cx from t1 where c='x';
+cx
+x
+select c cy from t1 where c='y';
+cy
+y
+select c cz from t1 where c='z';
+cz
+z
+select c ca10 from t1 where c='aaaaaaaaaa';
+ca10
+aaaaaaaaaa
+select c cb20 from t1 where c=repeat('b',20);
+cb20
+bbbbbbbbbbbbbbbbbbbb
+drop table t1;
+create table t1 (c char(3) character set utf8, unique (c(2)));
+insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
+insert into t1 values ('a');
+insert into t1 values ('aa');
+insert into t1 values ('aaa');
+ERROR 23000: Duplicate entry 'aaa' for key 1
+insert into t1 values ('b');
+insert into t1 values ('bb');
+insert into t1 values ('bbb');
+ERROR 23000: Duplicate entry 'bbb' for key 1
+insert into t1 values ('а');
+insert into t1 values ('аа');
+insert into t1 values ('ааа');
+ERROR 23000: Duplicate entry 'ааа' for key 1
+insert into t1 values ('б');
+insert into t1 values ('бб');
+insert into t1 values ('ббб');
+ERROR 23000: Duplicate entry 'ббб' for key 1
+insert into t1 values ('ꪪ');
+insert into t1 values ('ꪪꪪ');
+insert into t1 values ('ꪪꪪꪪ');
+ERROR 23000: Duplicate entry 'ꪪꪪ' for key 1
+drop table t1;
+create table t1 (c char(3) character set utf8, unique (c(2))) engine=innodb;
+insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
+insert into t1 values ('a');
+insert into t1 values ('aa');
+insert into t1 values ('aaa');
+ERROR 23000: Duplicate entry 'aaa' for key 1
+insert into t1 values ('b');
+insert into t1 values ('bb');
+insert into t1 values ('bbb');
+ERROR 23000: Duplicate entry 'bbb' for key 1
+insert into t1 values ('а');
+insert into t1 values ('аа');
+insert into t1 values ('ааа');
+ERROR 23000: Duplicate entry 'ааа' for key 1
+insert into t1 values ('б');
+insert into t1 values ('бб');
+insert into t1 values ('ббб');
+ERROR 23000: Duplicate entry 'ббб' for key 1
+insert into t1 values ('ꪪ');
+insert into t1 values ('ꪪꪪ');
+insert into t1 values ('ꪪꪪꪪ');
+ERROR 23000: Duplicate entry 'ꪪꪪ' for key 1
+drop table t1;
+create table t1 (
+c char(10) character set utf8,
+unique key a using hash (c(1))
+) engine=heap;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` char(10) character set utf8 default NULL,
+ UNIQUE KEY `a` (`c`(1))
+) ENGINE=HEAP DEFAULT CHARSET=latin1
+insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
+insert into t1 values ('aa');
+ERROR 23000: Duplicate entry 'aa' for key 1
+insert into t1 values ('aaa');
+ERROR 23000: Duplicate entry 'aaa' for key 1
+insert into t1 values ('б');
+insert into t1 values ('бб');
+ERROR 23000: Duplicate entry 'бÐ' for key 1
+insert into t1 values ('ббб');
+ERROR 23000: Duplicate entry 'бÐ' for key 1
+select c as c_all from t1 order by c;
+c_all
+a
+b
+c
+d
+e
+f
+б
+select c as c_a from t1 where c='a';
+c_a
+a
+select c as c_a from t1 where c='б';
+c_a
+б
+drop table t1;
+create table t1 (
+c char(10) character set utf8,
+unique key a using btree (c(1))
+) engine=heap;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` char(10) character set utf8 default NULL,
+ UNIQUE KEY `a` TYPE BTREE (`c`(1))
+) ENGINE=HEAP DEFAULT CHARSET=latin1
+insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
+insert into t1 values ('aa');
+ERROR 23000: Duplicate entry 'aa' for key 1
+insert into t1 values ('aaa');
+ERROR 23000: Duplicate entry 'aaa' for key 1
+insert into t1 values ('б');
+insert into t1 values ('бб');
+ERROR 23000: Duplicate entry 'бÐ' for key 1
+insert into t1 values ('ббб');
+ERROR 23000: Duplicate entry 'бÐ' for key 1
+select c as c_all from t1 order by c;
+c_all
+a
+b
+c
+d
+e
+f
+б
+select c as c_a from t1 where c='a';
+c_a
+a
+select c as c_a from t1 where c='б';
+c_a
+б
+drop table t1;
+create table t1 (
+c char(10) character set utf8,
+unique key a (c(1))
+) engine=bdb;
+insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
+insert into t1 values ('aa');
+ERROR 23000: Duplicate entry 'aa' for key 1
+insert into t1 values ('aaa');
+ERROR 23000: Duplicate entry 'aaa' for key 1
+insert into t1 values ('б');
+insert into t1 values ('бб');
+ERROR 23000: Duplicate entry 'бÐ' for key 1
+insert into t1 values ('ббб');
+ERROR 23000: Duplicate entry 'бÐ' for key 1
+select c as c_all from t1 order by c;
+c_all
+a
+b
+c
+d
+e
+f
+б
+select c as c_a from t1 where c='a';
+c_a
+a
+select c as c_a from t1 where c='б';
+c_a
+б
+drop table t1;
+create table t1 (c varchar(30) character set utf8 collate utf8_bin, unique(c(10)));
+insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
+insert into t1 values ('aaaaaaaaaa');
+insert into t1 values ('aaaaaaaaaaa');
+ERROR 23000: Duplicate entry 'aaaaaaaaaaa' for key 1
+insert into t1 values ('aaaaaaaaaaaa');
+ERROR 23000: Duplicate entry 'aaaaaaaaaaaa' for key 1
+insert into t1 values (repeat('b',20));
+select c c1 from t1 where c='1';
+c1
+1
+select c c2 from t1 where c='2';
+c2
+2
+select c c3 from t1 where c='3';
+c3
+3
+select c cx from t1 where c='x';
+cx
+x
+select c cy from t1 where c='y';
+cy
+y
+select c cz from t1 where c='z';
+cz
+z
+select c ca10 from t1 where c='aaaaaaaaaa';
+ca10
+aaaaaaaaaa
+select c cb20 from t1 where c=repeat('b',20);
+cb20
+bbbbbbbbbbbbbbbbbbbb
+drop table t1;
+create table t1 (c char(3) character set utf8 collate utf8_bin, unique (c(2)));
+insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
+insert into t1 values ('a');
+insert into t1 values ('aa');
+insert into t1 values ('aaa');
+ERROR 23000: Duplicate entry 'aaa' for key 1
+insert into t1 values ('b');
+insert into t1 values ('bb');
+insert into t1 values ('bbb');
+ERROR 23000: Duplicate entry 'bbb' for key 1
+insert into t1 values ('а');
+insert into t1 values ('аа');
+insert into t1 values ('ааа');
+ERROR 23000: Duplicate entry 'ааа' for key 1
+insert into t1 values ('б');
+insert into t1 values ('бб');
+insert into t1 values ('ббб');
+ERROR 23000: Duplicate entry 'ббб' for key 1
+insert into t1 values ('ꪪ');
+insert into t1 values ('ꪪꪪ');
+insert into t1 values ('ꪪꪪꪪ');
+ERROR 23000: Duplicate entry 'ꪪꪪ' for key 1
+drop table t1;
+create table t1 (
+c char(10) character set utf8 collate utf8_bin,
+unique key a using hash (c(1))
+) engine=heap;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` char(10) character set utf8 collate utf8_bin default NULL,
+ UNIQUE KEY `a` (`c`(1))
+) ENGINE=HEAP DEFAULT CHARSET=latin1
+insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
+insert into t1 values ('aa');
+ERROR 23000: Duplicate entry 'aa' for key 1
+insert into t1 values ('aaa');
+ERROR 23000: Duplicate entry 'aaa' for key 1
+insert into t1 values ('б');
+insert into t1 values ('бб');
+ERROR 23000: Duplicate entry 'бÐ' for key 1
+insert into t1 values ('ббб');
+ERROR 23000: Duplicate entry 'бÐ' for key 1
+select c as c_all from t1 order by c;
+c_all
+a
+b
+c
+d
+e
+f
+б
+select c as c_a from t1 where c='a';
+c_a
+a
+select c as c_a from t1 where c='б';
+c_a
+б
+drop table t1;
+create table t1 (
+c char(10) character set utf8 collate utf8_bin,
+unique key a using btree (c(1))
+) engine=heap;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` char(10) character set utf8 collate utf8_bin default NULL,
+ UNIQUE KEY `a` TYPE BTREE (`c`(1))
+) ENGINE=HEAP DEFAULT CHARSET=latin1
+insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
+insert into t1 values ('aa');
+ERROR 23000: Duplicate entry 'aa' for key 1
+insert into t1 values ('aaa');
+ERROR 23000: Duplicate entry 'aaa' for key 1
+insert into t1 values ('б');
+insert into t1 values ('бб');
+ERROR 23000: Duplicate entry 'бÐ' for key 1
+insert into t1 values ('ббб');
+ERROR 23000: Duplicate entry 'бÐ' for key 1
+select c as c_all from t1 order by c;
+c_all
+a
+b
+c
+d
+e
+f
+б
+select c as c_a from t1 where c='a';
+c_a
+a
+select c as c_a from t1 where c='б';
+c_a
+б
+drop table t1;
+create table t1 (
+c char(10) character set utf8 collate utf8_bin,
+unique key a (c(1))
+) engine=bdb;
+insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
+insert into t1 values ('aa');
+ERROR 23000: Duplicate entry 'aa' for key 1
+insert into t1 values ('aaa');
+ERROR 23000: Duplicate entry 'aaa' for key 1
+insert into t1 values ('б');
+insert into t1 values ('бб');
+ERROR 23000: Duplicate entry 'бÐ' for key 1
+insert into t1 values ('ббб');
+ERROR 23000: Duplicate entry 'бÐ' for key 1
+select c as c_all from t1 order by c;
+c_all
+a
+b
+c
+d
+e
+f
+б
+select c as c_a from t1 where c='a';
+c_a
+a
+select c as c_a from t1 where c='б';
+c_a
+б
+drop table t1;
+create table t1 (
+str varchar(255) character set utf8 not null,
+key str (str(2))
+) engine=myisam;
+INSERT INTO t1 VALUES ('str');
+INSERT INTO t1 VALUES ('str2');
+select * from t1 where str='str';
+str
+str
+drop table t1;
+create table t1 (
+str varchar(255) character set utf8 not null,
+key str (str(2))
+) engine=innodb;
+INSERT INTO t1 VALUES ('str');
+INSERT INTO t1 VALUES ('str2');
+select * from t1 where str='str';
+str
+str
+drop table t1;
+create table t1 (
+str varchar(255) character set utf8 not null,
+key str using btree (str(2))
+) engine=heap;
+INSERT INTO t1 VALUES ('str');
+INSERT INTO t1 VALUES ('str2');
+select * from t1 where str='str';
+str
+str
+drop table t1;
+create table t1 (
+str varchar(255) character set utf8 not null,
+key str using hash (str(2))
+) engine=heap;
+INSERT INTO t1 VALUES ('str');
+INSERT INTO t1 VALUES ('str2');
+select * from t1 where str='str';
+str
+str
+drop table t1;
+create table t1 (
+str varchar(255) character set utf8 not null,
+key str (str(2))
+) engine=bdb;
+INSERT INTO t1 VALUES ('str');
+INSERT INTO t1 VALUES ('str2');
+select * from t1 where str='str';
+str
+str
+drop table t1;
+CREATE TABLE t1 (a varchar(32) BINARY) CHARACTER SET utf8;
+INSERT INTO t1 VALUES ('test');
+SELECT a FROM t1 WHERE a LIKE '%te';
+a
+DROP TABLE t1;
+SET NAMES utf8;
+CREATE TABLE t1 (
+subject varchar(255) character set utf8 collate utf8_unicode_ci,
+p varchar(15) character set utf8
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES ('谷川俊二ず申したすが、むンタヌネット予玄の䌚員登録をしたしたずころ、メヌルアドレスを間違えおしたい䌚員が受け取るこずが出来たせんでした。間違えアドレスはtani-shun@n.vodafone.ne.jpを曞き蟌みたした。どうすればよいですか その他、䜏所等は間違えありたせん。連絡ください。よろしくお願いしたす。m(__)m','040312-000057');
+INSERT INTO t1 VALUES ('aaa','bbb');
+SELECT length(subject) FROM t1;
+length(subject)
+432
+3
+SELECT length(subject) FROM t1 ORDER BY 1;
+length(subject)
+3
+432
+DROP TABLE t1;
+CREATE TABLE t1 (
+id int unsigned NOT NULL auto_increment,
+list_id smallint unsigned NOT NULL,
+term TEXT NOT NULL,
+PRIMARY KEY(id),
+INDEX(list_id, term(4))
+) ENGINE=MYISAM CHARSET=utf8;
+INSERT INTO t1 SET list_id = 1, term = "letterc";
+INSERT INTO t1 SET list_id = 1, term = "letterb";
+INSERT INTO t1 SET list_id = 1, term = "lettera";
+INSERT INTO t1 SET list_id = 1, term = "letterd";
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterc");
+id
+1
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterb");
+id
+2
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "lettera");
+id
+3
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd");
+id
+4
+DROP TABLE t1;
+SET NAMES latin1;
+CREATE TABLE t1 (
+id int unsigned NOT NULL auto_increment,
+list_id smallint unsigned NOT NULL,
+term text NOT NULL,
+PRIMARY KEY(id),
+INDEX(list_id, term(19))
+) ENGINE=MyISAM CHARSET=utf8;
+INSERT INTO t1 set list_id = 1, term = "testétest";
+INSERT INTO t1 set list_id = 1, term = "testetest";
+INSERT INTO t1 set list_id = 1, term = "testètest";
+SELECT id, term FROM t1 where (list_id = 1) AND (term = "testétest");
+id term
+1 testétest
+2 testetest
+3 testètest
+SELECT id, term FROM t1 where (list_id = 1) AND (term = "testetest");
+id term
+1 testétest
+2 testetest
+3 testètest
+SELECT id, term FROM t1 where (list_id = 1) AND (term = "testètest");
+id term
+1 testétest
+2 testetest
+3 testètest
+DROP TABLE t1;
+set names utf8;
+create table t1 (
+a int primary key,
+b varchar(6),
+index b3(b(3))
+) engine=innodb character set=utf8;
+insert into t1 values(1,'foo'),(2,'foobar');
+select * from t1 where b like 'foob%';
+a b
+2 foobar
+alter table t1 engine=bdb;
+select * from t1 where b like 'foob%';
+a b
+2 foobar
+drop table t1;
+create table t1 (
+a enum('петя','вася','аМюта') character set utf8 not null default 'аМюта',
+b set('петя','вася','аМюта') character set utf8 not null default 'аМюта'
+);
+create table t2 select concat(a,_utf8'') as a, concat(b,_utf8'')as b from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` char(5) character set utf8 NOT NULL default '',
+ `b` char(15) character set utf8 NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t2;
+drop table t1;
+select 'c' like '\_' as want0;
+want0
+0
diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result
new file mode 100644
index 00000000000..2db014c4a52
--- /dev/null
+++ b/mysql-test/r/date_formats.result
@@ -0,0 +1,458 @@
+drop table if exists t1;
+SHOW GLOBAL VARIABLES LIKE "%_format%";
+Variable_name Value
+date_format %d.%m.%Y
+datetime_format %Y-%m-%d %H:%i:%s
+default_week_format 0
+time_format %H.%i.%s
+SHOW SESSION VARIABLES LIKE "%_format%";
+Variable_name Value
+date_format %d.%m.%Y
+datetime_format %Y-%m-%d %H:%i:%s
+default_week_format 0
+time_format %H.%i.%s
+SET time_format='%H%i%s';
+SET time_format='%H:%i:%s.%f';
+SET time_format='%h-%i-%s.%f%p';
+SET time_format='%h:%i:%s.%f %p';
+SET time_format='%h:%i:%s%p';
+SET date_format='%Y%m%d';
+SET date_format='%Y.%m.%d';
+SET date_format='%d.%m.%Y';
+SET date_format='%m-%d-%Y';
+set datetime_format= '%Y%m%d%H%i%s';
+set datetime_format= '%Y-%m-%d %H:%i:%s';
+set datetime_format= '%m-%d-%y %H:%i:%s.%f';
+set datetime_format= '%d-%m-%Y %h:%i:%s%p';
+set datetime_format= '%H:%i:%s %Y-%m-%d';
+set datetime_format= '%H:%i:%s.%f %m-%d-%Y';
+set datetime_format= '%h:%i:%s %p %Y-%m-%d';
+set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d';
+SHOW SESSION VARIABLES LIKE "%format";
+Variable_name Value
+date_format %m-%d-%Y
+datetime_format %h:%i:%s.%f %p %Y-%m-%d
+default_week_format 0
+time_format %h:%i:%s%p
+SET time_format='%h:%i:%s';
+ERROR 42000: Variable 'time_format' can't be set to the value of '%h:%i:%s'
+SET time_format='%H %i:%s';
+ERROR 42000: Variable 'time_format' can't be set to the value of '%H %i:%s'
+SET time_format='%H::%i:%s';
+ERROR 42000: Variable 'time_format' can't be set to the value of '%H::%i:%s'
+SET time_format='%H:%i:%s%f';
+ERROR 42000: Variable 'time_format' can't be set to the value of '%H:%i:%s%f'
+SET time_format='%H:%i.%f:%s';
+ERROR 42000: Variable 'time_format' can't be set to the value of '%H:%i.%f:%s'
+SET time_format='%H:%i:%s%p';
+ERROR 42000: Variable 'time_format' can't be set to the value of '%H:%i:%s%p'
+SET time_format='%h:%i:%s.%f %p %Y-%m-%d';
+ERROR 42000: Variable 'time_format' can't be set to the value of '%h:%i:%s.%f %p %Y-%m-%d'
+SET time_format='%H%i%s.%f';
+ERROR 42000: Variable 'time_format' can't be set to the value of '%H%i%s.%f'
+SET time_format='%H:%i-%s.%f';
+ERROR 42000: Variable 'time_format' can't be set to the value of '%H:%i-%s.%f'
+SET date_format='%d.%m.%d';
+ERROR 42000: Variable 'date_format' can't be set to the value of '%d.%m.%d'
+SET datetime_format='%h.%m.%y %d.%i.%s';
+ERROR 42000: Variable 'datetime_format' can't be set to the value of '%h.%m.%y %d.%i.%s'
+set datetime_format= '%H:%i:%s.%f %p %Y-%m-%d';
+ERROR 42000: Variable 'datetime_format' can't be set to the value of '%H:%i:%s.%f %p %Y-%m-%d'
+set GLOBAL datetime_format= '%H:%i:%s %Y-%m-%d';
+SET SESSION datetime_format=default;
+select @@global.datetime_format, @@session.datetime_format;
+@@global.datetime_format @@session.datetime_format
+%H:%i:%s %Y-%m-%d %H:%i:%s %Y-%m-%d
+SET GLOBAL datetime_format=default;
+SET SESSION datetime_format=default;
+select @@global.datetime_format, @@session.datetime_format;
+@@global.datetime_format @@session.datetime_format
+%Y-%m-%d %H:%i:%s %Y-%m-%d %H:%i:%s
+SET GLOBAL date_format=default;
+SET GLOBAL time_format=default;
+SET GLOBAL datetime_format=default;
+SET time_format=default;
+SET date_format=default;
+SET datetime_format=default;
+select str_to_date(concat('15-01-2001',' 2:59:58.999'),
+concat('%d-%m-%Y',' ','%H:%i:%s.%f'));
+str_to_date(concat('15-01-2001',' 2:59:58.999'),
+concat('%d-%m-%Y',' ','%H:%i:%s.%f'))
+2001-01-15 02:59:58.999000
+create table t1 (date char(30), format char(30) not null);
+insert into t1 values
+('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'),
+('03-01-02 8:11:2.123456', '%y-%m-%d %H:%i:%S.%#'),
+('2003-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p'),
+('2003-01-02 01:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f%p'),
+('2003-01-02 02:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f %p'),
+('2003-01-02 12:11:12.12345 am', '%Y-%m-%d %h:%i:%S.%f%p'),
+('2003-01-02 11:11:12Pm', '%Y-%m-%d %h:%i:%S%p'),
+('10:20:10', '%H:%i:%s'),
+('10:20:10', '%h:%i:%s.%f'),
+('10:20:10', '%T'),
+('10:20:10AM', '%h:%i:%s%p'),
+('10:20:10AM', '%r'),
+('10:20:10.44AM', '%h:%i:%s.%f%p'),
+('15-01-2001 12:59:58', '%d-%m-%Y %H:%i:%S'),
+('15 September 2001', '%d %M %Y'),
+('15 SEPTEMB 2001', '%d %M %Y'),
+('15 MAY 2001', '%d %b %Y'),
+('15th May 2001', '%D %b %Y'),
+('Sunday 15 MAY 2001', '%W %d %b %Y'),
+('Sund 15 MAY 2001', '%W %d %b %Y'),
+('Tuesday 00 2002', '%W %U %Y'),
+('Thursday 53 1998', '%W %u %Y'),
+('Sunday 01 2001', '%W %v %x'),
+('Tuesday 52 2001', '%W %V %X'),
+('060 2004', '%j %Y'),
+('4 53 1998', '%w %u %Y'),
+('15-01-2001', '%d-%m-%Y %H:%i:%S'),
+('15-01-20', '%d-%m-%y'),
+('15-2001-1', '%d-%Y-%c');
+select date,format,str_to_date(date, format) as str_to_date from t1;
+date format str_to_date
+2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12
+03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
+2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
+2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.123450
+2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450
+2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 00:11:12.123450
+2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02 23:11:12
+10:20:10 %H:%i:%s 0000-00-00 10:20:10
+10:20:10 %h:%i:%s.%f 0000-00-00 10:20:10
+10:20:10 %T 0000-00-00 10:20:10
+10:20:10AM %h:%i:%s%p 0000-00-00 10:20:10
+10:20:10AM %r 0000-00-00 10:20:10
+10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 10:20:10.440000
+15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15 12:59:58
+15 September 2001 %d %M %Y 2001-09-15 00:00:00
+15 SEPTEMB 2001 %d %M %Y 2001-09-15 00:00:00
+15 MAY 2001 %d %b %Y 2001-05-15 00:00:00
+15th May 2001 %D %b %Y 2001-05-15 00:00:00
+Sunday 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
+Sund 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
+Tuesday 00 2002 %W %U %Y 2002-01-01 00:00:00
+Thursday 53 1998 %W %u %Y 1998-12-31 00:00:00
+Sunday 01 2001 %W %v %x 2001-01-07 00:00:00
+Tuesday 52 2001 %W %V %X 2002-01-01 00:00:00
+060 2004 %j %Y 2004-02-29 00:00:00
+4 53 1998 %w %u %Y 1998-12-31 00:00:00
+15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15 00:00:00
+15-01-20 %d-%m-%y 2020-01-15 00:00:00
+15-2001-1 %d-%Y-%c 2001-01-15 00:00:00
+select date,format,concat('',str_to_date(date, format)) as con from t1;
+date format con
+2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12
+03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
+2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
+2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.123450
+2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450
+2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 00:11:12.123450
+2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02 23:11:12
+10:20:10 %H:%i:%s 0000-00-00 10:20:10
+10:20:10 %h:%i:%s.%f 0000-00-00 10:20:10
+10:20:10 %T 0000-00-00 10:20:10
+10:20:10AM %h:%i:%s%p 0000-00-00 10:20:10
+10:20:10AM %r 0000-00-00 10:20:10
+10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 10:20:10.440000
+15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15 12:59:58
+15 September 2001 %d %M %Y 2001-09-15 00:00:00
+15 SEPTEMB 2001 %d %M %Y 2001-09-15 00:00:00
+15 MAY 2001 %d %b %Y 2001-05-15 00:00:00
+15th May 2001 %D %b %Y 2001-05-15 00:00:00
+Sunday 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
+Sund 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
+Tuesday 00 2002 %W %U %Y 2002-01-01 00:00:00
+Thursday 53 1998 %W %u %Y 1998-12-31 00:00:00
+Sunday 01 2001 %W %v %x 2001-01-07 00:00:00
+Tuesday 52 2001 %W %V %X 2002-01-01 00:00:00
+060 2004 %j %Y 2004-02-29 00:00:00
+4 53 1998 %w %u %Y 1998-12-31 00:00:00
+15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15 00:00:00
+15-01-20 %d-%m-%y 2020-01-15 00:00:00
+15-2001-1 %d-%Y-%c 2001-01-15 00:00:00
+select date,format,cast(str_to_date(date, format) as datetime) as datetime from t1;
+date format datetime
+2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12
+03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
+2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
+2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.123450
+2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450
+2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 00:11:12.123450
+2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02 23:11:12
+10:20:10 %H:%i:%s 0000-00-00 10:20:10
+10:20:10 %h:%i:%s.%f 0000-00-00 10:20:10
+10:20:10 %T 0000-00-00 10:20:10
+10:20:10AM %h:%i:%s%p 0000-00-00 10:20:10
+10:20:10AM %r 0000-00-00 10:20:10
+10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 10:20:10.440000
+15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15 12:59:58
+15 September 2001 %d %M %Y 2001-09-15 00:00:00
+15 SEPTEMB 2001 %d %M %Y 2001-09-15 00:00:00
+15 MAY 2001 %d %b %Y 2001-05-15 00:00:00
+15th May 2001 %D %b %Y 2001-05-15 00:00:00
+Sunday 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
+Sund 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
+Tuesday 00 2002 %W %U %Y 2002-01-01 00:00:00
+Thursday 53 1998 %W %u %Y 1998-12-31 00:00:00
+Sunday 01 2001 %W %v %x 2001-01-07 00:00:00
+Tuesday 52 2001 %W %V %X 2002-01-01 00:00:00
+060 2004 %j %Y 2004-02-29 00:00:00
+4 53 1998 %w %u %Y 1998-12-31 00:00:00
+15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15 00:00:00
+15-01-20 %d-%m-%y 2020-01-15 00:00:00
+15-2001-1 %d-%Y-%c 2001-01-15 00:00:00
+select date,format,DATE(str_to_date(date, format)) as date2 from t1;
+date format date2
+2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02
+03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02
+2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02
+2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02
+2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02
+2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02
+2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02
+10:20:10 %H:%i:%s 0000-00-00
+10:20:10 %h:%i:%s.%f 0000-00-00
+10:20:10 %T 0000-00-00
+10:20:10AM %h:%i:%s%p 0000-00-00
+10:20:10AM %r 0000-00-00
+10:20:10.44AM %h:%i:%s.%f%p 0000-00-00
+15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15
+15 September 2001 %d %M %Y 2001-09-15
+15 SEPTEMB 2001 %d %M %Y 2001-09-15
+15 MAY 2001 %d %b %Y 2001-05-15
+15th May 2001 %D %b %Y 2001-05-15
+Sunday 15 MAY 2001 %W %d %b %Y 2001-05-15
+Sund 15 MAY 2001 %W %d %b %Y 2001-05-15
+Tuesday 00 2002 %W %U %Y 2002-01-01
+Thursday 53 1998 %W %u %Y 1998-12-31
+Sunday 01 2001 %W %v %x 2001-01-07
+Tuesday 52 2001 %W %V %X 2002-01-01
+060 2004 %j %Y 2004-02-29
+4 53 1998 %w %u %Y 1998-12-31
+15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15
+15-01-20 %d-%m-%y 2020-01-15
+15-2001-1 %d-%Y-%c 2001-01-15
+select date,format,TIME(str_to_date(date, format)) as time from t1;
+date format time
+2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12
+03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 08:11:02
+2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 22:11:12
+2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 01:11:12.123450
+2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450
+2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 00:11:12.123450
+2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12
+10:20:10 %H:%i:%s 10:20:10
+10:20:10 %h:%i:%s.%f 10:20:10
+10:20:10 %T 10:20:10
+10:20:10AM %h:%i:%s%p 10:20:10
+10:20:10AM %r 10:20:10
+10:20:10.44AM %h:%i:%s.%f%p 10:20:10.440000
+15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58
+15 September 2001 %d %M %Y 00:00:00
+15 SEPTEMB 2001 %d %M %Y 00:00:00
+15 MAY 2001 %d %b %Y 00:00:00
+15th May 2001 %D %b %Y 00:00:00
+Sunday 15 MAY 2001 %W %d %b %Y 00:00:00
+Sund 15 MAY 2001 %W %d %b %Y 00:00:00
+Tuesday 00 2002 %W %U %Y 00:00:00
+Thursday 53 1998 %W %u %Y 00:00:00
+Sunday 01 2001 %W %v %x 00:00:00
+Tuesday 52 2001 %W %V %X 00:00:00
+060 2004 %j %Y 00:00:00
+4 53 1998 %w %u %Y 00:00:00
+15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00
+15-01-20 %d-%m-%y 00:00:00
+15-2001-1 %d-%Y-%c 00:00:00
+select date,format,concat(TIME(str_to_date(date, format))) as time2 from t1;
+date format time2
+2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12
+03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 08:11:02
+2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 22:11:12
+2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 01:11:12.123450
+2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450
+2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 00:11:12.123450
+2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12
+10:20:10 %H:%i:%s 10:20:10
+10:20:10 %h:%i:%s.%f 10:20:10
+10:20:10 %T 10:20:10
+10:20:10AM %h:%i:%s%p 10:20:10
+10:20:10AM %r 10:20:10
+10:20:10.44AM %h:%i:%s.%f%p 10:20:10.440000
+15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58
+15 September 2001 %d %M %Y 00:00:00
+15 SEPTEMB 2001 %d %M %Y 00:00:00
+15 MAY 2001 %d %b %Y 00:00:00
+15th May 2001 %D %b %Y 00:00:00
+Sunday 15 MAY 2001 %W %d %b %Y 00:00:00
+Sund 15 MAY 2001 %W %d %b %Y 00:00:00
+Tuesday 00 2002 %W %U %Y 00:00:00
+Thursday 53 1998 %W %u %Y 00:00:00
+Sunday 01 2001 %W %v %x 00:00:00
+Tuesday 52 2001 %W %V %X 00:00:00
+060 2004 %j %Y 00:00:00
+4 53 1998 %w %u %Y 00:00:00
+15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00
+15-01-20 %d-%m-%y 00:00:00
+15-2001-1 %d-%Y-%c 00:00:00
+select concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d'));
+concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d'))
+2003-01-02 08:11:02.123456
+truncate table t1;
+insert into t1 values
+('2003-01-02 10:11:12 PM', '%Y-%m-%d %H:%i:%S %p'),
+('2003-01-02 10:11:12.123456', '%Y-%m-%d %h:%i:%S %p'),
+('2003-01-02 10:11:12AM', '%Y-%m-%d %h:%i:%S.%f %p'),
+('2003-01-02 10:11:12AN', '%Y-%m-%d %h:%i:%S%p'),
+('2003-01-02 10:11:12 PM', '%y-%m-%d %H:%i:%S %p'),
+('10:20:10AM', '%H:%i:%s%p'),
+('15 Septembei 2001', '%d %M %Y'),
+('15 Ju 2001', '%d %M %Y'),
+('Sund 15 MA', '%W %d %b %Y'),
+('Thursdai 12 1998', '%W %u %Y'),
+('Sunday 01 2001', '%W %v %X'),
+('Tuesday 52 2001', '%W %V %x'),
+('Tuesday 52 2001', '%W %V %Y'),
+('Tuesday 52 2001', '%W %u %x'),
+('7 53 1998', '%w %u %Y'),
+(NULL, get_format(DATE,'USA'));
+select date,format,str_to_date(date, format) as str_to_date from t1;
+date format str_to_date
+2003-01-02 10:11:12 PM %Y-%m-%d %H:%i:%S %p NULL
+2003-01-02 10:11:12.123456 %Y-%m-%d %h:%i:%S %p NULL
+2003-01-02 10:11:12AM %Y-%m-%d %h:%i:%S.%f %p NULL
+2003-01-02 10:11:12AN %Y-%m-%d %h:%i:%S%p NULL
+2003-01-02 10:11:12 PM %y-%m-%d %H:%i:%S %p NULL
+10:20:10AM %H:%i:%s%p NULL
+15 Septembei 2001 %d %M %Y NULL
+15 Ju 2001 %d %M %Y NULL
+Sund 15 MA %W %d %b %Y NULL
+Thursdai 12 1998 %W %u %Y NULL
+Sunday 01 2001 %W %v %X NULL
+Tuesday 52 2001 %W %V %x NULL
+Tuesday 52 2001 %W %V %Y NULL
+Tuesday 52 2001 %W %u %x NULL
+7 53 1998 %w %u %Y NULL
+NULL %m.%d.%Y NULL
+select date,format,concat(str_to_date(date, format),'') as con from t1;
+date format con
+2003-01-02 10:11:12 PM %Y-%m-%d %H:%i:%S %p NULL
+2003-01-02 10:11:12.123456 %Y-%m-%d %h:%i:%S %p NULL
+2003-01-02 10:11:12AM %Y-%m-%d %h:%i:%S.%f %p NULL
+2003-01-02 10:11:12AN %Y-%m-%d %h:%i:%S%p NULL
+2003-01-02 10:11:12 PM %y-%m-%d %H:%i:%S %p NULL
+10:20:10AM %H:%i:%s%p NULL
+15 Septembei 2001 %d %M %Y NULL
+15 Ju 2001 %d %M %Y NULL
+Sund 15 MA %W %d %b %Y NULL
+Thursdai 12 1998 %W %u %Y NULL
+Sunday 01 2001 %W %v %X NULL
+Tuesday 52 2001 %W %V %x NULL
+Tuesday 52 2001 %W %V %Y NULL
+Tuesday 52 2001 %W %u %x NULL
+7 53 1998 %w %u %Y NULL
+NULL %m.%d.%Y NULL
+truncate table t1;
+insert into t1 values
+('10:20:10AM', '%h:%i:%s'),
+('2003-01-02 10:11:12', '%Y-%m-%d %h:%i:%S'),
+('03-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p');
+select date,format,str_to_date(date, format) as str_to_date from t1;
+date format str_to_date
+10:20:10AM %h:%i:%s 0000-00-00 10:20:10
+2003-01-02 10:11:12 %Y-%m-%d %h:%i:%S 2003-01-02 10:11:12
+03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 0003-01-02 22:11:12
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '10:20:10AM'
+select date,format,concat(str_to_date(date, format),'') as con from t1;
+date format con
+10:20:10AM %h:%i:%s 0000-00-00 10:20:10
+2003-01-02 10:11:12 %Y-%m-%d %h:%i:%S 2003-01-02 10:11:12
+03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 0003-01-02 22:11:12
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '10:20:10AM'
+drop table t1;
+select get_format(DATE, 'USA') as a;
+a
+%m.%d.%Y
+select get_format(TIME, 'internal') as a;
+a
+%H%i%s
+select get_format(DATETIME, 'eur') as a;
+a
+%Y-%m-%d %H.%i.%s
+select get_format(TIMESTAMP, 'eur') as a;
+a
+%Y-%m-%d %H.%i.%s
+select get_format(DATE, 'TEST') as a;
+a
+NULL
+select str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA'));
+str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA'))
+NULL
+explain extended select makedate(1997,1), addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM"),cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME), maketime(23,11,12),microsecond("1997-12-31 23:59:59.000001");
+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 makedate(1997,1) AS `makedate(1997,1)`,addtime(_latin1'31.12.97 11.59.59.999999 PM',_latin1'31.12.97 11.59.59.999999 PM') AS `addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,subtime(_latin1'31.12.97 11.59.59.999999 PM',_latin1'31.12.97 11.59.59.999999 PM') AS `subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,timediff(_latin1'01.01.97 11:59:59.000001 PM',_latin1'31.12.95 11:59:59.000002 PM') AS `timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM")`,cast(str_to_date(_latin1'15-01-2001 12:59:59',_latin1'%d-%m-%Y %H:%i:%S') as time) AS `cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME)`,maketime(23,11,12) AS `maketime(23,11,12)`,microsecond(_latin1'1997-12-31 23:59:59.000001') AS `microsecond("1997-12-31 23:59:59.000001")`
+create table t1 (d date);
+insert into t1 values ('2004-07-14'),('2005-07-14');
+select date_format(d,"%d") from t1 order by 1;
+date_format(d,"%d")
+14
+14
+drop table t1;
+select str_to_date("2003-....01ABCD-02 10:11:12.0012", "%Y-%.%m%@-%d %H:%i:%S.%f") as a;
+a
+2003-01-02 10:11:12.001200
+create table t1 select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f") as f1,
+str_to_date("10:11:12.0012", "%H:%i:%S.%f") as f2,
+str_to_date("2003-01-02", "%Y-%m-%d") as f3,
+str_to_date("02", "%d") as f4, str_to_date("02 10", "%d %H") as f5;
+describe t1;
+Field Type Null Key Default Extra
+f1 datetime YES NULL
+f2 time YES NULL
+f3 date YES NULL
+f4 date YES NULL
+f5 time YES NULL
+select * from t1;
+f1 f2 f3 f4 f5
+2003-01-02 10:11:12 10:11:12 2003-01-02 0000-00-02 58:00:00
+drop table t1;
+create table t1 select "02 10" as a, "%d %H" as b;
+select str_to_date(a,b) from t1;
+str_to_date(a,b)
+0000-00-02 10:00:00
+create table t2 select str_to_date(a,b) from t1;
+describe t2;
+Field Type Null Key Default Extra
+str_to_date(a,b) binary(29) YES NULL
+select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f") as f1,
+str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S") as f2,
+str_to_date("2003-01-02", "%Y-%m-%d") as f3,
+str_to_date("02 10:11:12", "%d %H:%i:%S.%f") as f4,
+str_to_date("02 10:11:12", "%d %H:%i:%S") as f5,
+str_to_date("02 10", "%d %f") as f6;
+f1 f2 f3 f4 f5 f6
+2003-01-02 10:11:12.001200 2003-01-02 10:11:12 2003-01-02 58:11:12 58:11:12 48:00:00.100000
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '2003-01-02 10:11:12.0012'
+drop table t1, t2;
+select str_to_date("2003-01-02 10:11:12.0012ABCD", "%Y-%m-%d %H:%i:%S.%f") as f1,
+addtime("-01:01:01.01 GGG", "-23:59:59.1") as f2,
+microsecond("1997-12-31 23:59:59.01XXXX") as f3;
+f1 f2 f3
+2003-01-02 10:11:12.001200 -25:01:00.110000 10000
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '2003-01-02 10:11:12.0012ABCD'
+Warning 1292 Truncated incorrect time value: '-01:01:01.01 GGG'
+Warning 1292 Truncated incorrect time value: '1997-12-31 23:59:59.01XXXX'
+select str_to_date("2003-04-05 g", "%Y-%m-%d") as f1,
+str_to_date("2003-04-05 10:11:12.101010234567", "%Y-%m-%d %H:%i:%S.%f") as f2;
+f1 f2
+2003-04-05 2003-04-05 10:11:12.101010
+Warnings:
+Warning 1292 Truncated incorrect date value: '2003-04-05 g'
+Warning 1292 Truncated incorrect datetime value: '2003-04-05 10:11:12.101010234567'
diff --git a/mysql-test/r/delayed.result b/mysql-test/r/delayed.result
index 9e375203e49..ceb511a7891 100644
--- a/mysql-test/r/delayed.result
+++ b/mysql-test/r/delayed.result
@@ -12,16 +12,16 @@ select * from t1 where tmsp=0;
a tmsp
select * from t1 where tmsp=19711006010203;
a tmsp
-5 19711006010203
-6 19711006010203
-8 19711006010203
+5 1971-10-06 01:02:03
+6 1971-10-06 01:02:03
+8 1971-10-06 01:02:03
drop table t1;
create table t1 (a int not null auto_increment primary key, b char(10));
insert delayed into t1 values (1,"b");
insert delayed into t1 values (null,"c");
insert delayed into t1 values (3,"d"),(null,"e");
insert delayed into t1 values (3,"this will give an","error");
-Column count doesn't match value count at row 1
+ERROR 21S01: Column count doesn't match value count at row 1
select * from t1;
a b
1 b
diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result
index 7353e687ae7..f1fba87c70b 100644
--- a/mysql-test/r/delete.result
+++ b/mysql-test/r/delete.result
@@ -1,4 +1,4 @@
-drop table if exists t1;
+drop table if exists t1,t11,t12,t2;
CREATE TABLE t1 (a tinyint(3), b tinyint(5));
INSERT INTO t1 VALUES (1,1);
INSERT LOW_PRIORITY INTO t1 VALUES (1,2);
@@ -16,20 +16,50 @@ SET AUTOCOMMIT=0;
DELETE from t1;
SET AUTOCOMMIT=1;
drop table t1;
-create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
-insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23);
+create table t1 (
+a bigint not null,
+b bigint not null default 0,
+c bigint not null default 0,
+d bigint not null default 0,
+e bigint not null default 0,
+f bigint not null default 0,
+g bigint not null default 0,
+h bigint not null default 0,
+i bigint not null default 0,
+j bigint not null default 0,
+primary key (a,b,c,d,e,f,g,h,i,j));
+insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23);
delete from t1 where a=26;
drop table t1;
-create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
-insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
+create table t1 (
+a bigint not null,
+b bigint not null default 0,
+c bigint not null default 0,
+d bigint not null default 0,
+e bigint not null default 0,
+f bigint not null default 0,
+g bigint not null default 0,
+h bigint not null default 0,
+i bigint not null default 0,
+j bigint not null default 0,
+primary key (a,b,c,d,e,f,g,h,i,j));
+insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
delete from t1 where a=27;
drop table t1;
+CREATE TABLE `t1` (
+`i` int(10) NOT NULL default '0',
+`i2` int(10) NOT NULL default '0',
+PRIMARY KEY (`i`)
+);
+DELETE FROM t1 USING t1 WHERE post='1';
+ERROR 42S22: Unknown column 'post' in 'where clause'
+drop table t1;
CREATE TABLE t1 (
bool char(0) default NULL,
not_null varchar(20) binary NOT NULL default '',
misc integer not null,
PRIMARY KEY (not_null)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (NULL,'a',4), (NULL,'b',5), (NULL,'c',6), (NULL,'d',7);
select * from t1 where misc > 5 and bool is null;
bool not_null misc
@@ -61,3 +91,75 @@ select * from t1;
a b
1 apple
drop table t1;
+create table t11 (a int NOT NULL, b int, primary key (a));
+create table t12 (a int NOT NULL, b int, primary key (a));
+create table t2 (a int NOT NULL, b int, primary key (a));
+insert into t11 values (0, 10),(1, 11),(2, 12);
+insert into t12 values (33, 10),(0, 11),(2, 12);
+insert into t2 values (1, 21),(2, 12),(3, 23);
+select * from t11;
+a b
+0 10
+1 11
+2 12
+select * from t12;
+a b
+33 10
+0 11
+2 12
+select * from t2;
+a b
+1 21
+2 12
+3 23
+delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
+ERROR 21000: Subquery returns more than 1 row
+select * from t11;
+a b
+0 10
+1 11
+2 12
+select * from t12;
+a b
+33 10
+0 11
+2 12
+delete ignore t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
+Warnings:
+Error 1242 Subquery returns more than 1 row
+Error 1242 Subquery returns more than 1 row
+select * from t11;
+a b
+0 10
+1 11
+select * from t12;
+a b
+33 10
+0 11
+insert into t11 values (2, 12);
+delete from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
+ERROR 21000: Subquery returns more than 1 row
+select * from t11;
+a b
+0 10
+1 11
+2 12
+delete ignore from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
+Warnings:
+Error 1242 Subquery returns more than 1 row
+Error 1242 Subquery returns more than 1 row
+select * from t11;
+a b
+0 10
+1 11
+drop table t11, t12, t2;
+create table t1 (a int, b int, unique key (a), key (b));
+insert into t1 values (3, 3), (7, 7);
+delete t1 from t1 where a = 3;
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+select * from t1;
+a b
+7 7
+drop table t1;
diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result
new file mode 100644
index 00000000000..7e6b9b44566
--- /dev/null
+++ b/mysql-test/r/derived.result
@@ -0,0 +1,332 @@
+drop table if exists t1,t2,t3;
+select * from (select 2 from DUAL) b;
+2
+2
+SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b;
+ERROR 42S22: Unknown column 'a' in 'field list'
+SELECT 1 as a FROM (SELECT a UNION SELECT 1) b;
+ERROR 42S22: Unknown column 'a' in 'field list'
+CREATE TABLE t1 (a int not null, b char (10) not null);
+insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
+CREATE TABLE t2 (a int not null, b char (10) not null);
+insert into t2 values (3,'c'),(4,'d'),(5,'f'),(6,'e');
+select t1.a,t3.y from t1,(select a as y from t2 where b='c') as t3 where t1.a = t3.y;
+a y
+3 3
+3 3
+select t1.a,t3.a from t1,(select * from t2 where b='c') as t3 where t1.a = t3.a;
+a a
+3 3
+3 3
+CREATE TABLE t3 (a int not null, b char (10) not null);
+insert into t3 values (3,'f'),(4,'y'),(5,'z'),(6,'c');
+select t1.a,t4.y from t1,(select t2.a as y from t2,(select t3.b from t3 where t3.a>3) as t5 where t2.b=t5.b) as t4 where t1.a = t4.y;
+a y
+3 3
+3 3
+SELECT a FROM (SELECT 1 FROM (SELECT 1) a HAVING a=1) b;
+ERROR 42S22: Unknown column 'a' in 'having clause'
+SELECT a,b as a FROM (SELECT '1' as a,'2' as b) b HAVING a=1;
+ERROR 23000: Column 'a' in having clause is ambiguous
+SELECT a,2 as a FROM (SELECT '1' as a) b HAVING a=2;
+a a
+1 2
+SELECT a,2 as a FROM (SELECT '1' as a) b HAVING a=1;
+a a
+SELECT 1 FROM (SELECT 1) a WHERE a=2;
+ERROR 42S22: Unknown column 'a' in 'where clause'
+SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) as a;
+ERROR 42S22: Unknown column 'a' in 'having clause'
+select * from t1 as x1, (select * from t1) as x2;
+a b a b
+1 a 1 a
+2 b 1 a
+3 c 1 a
+3 c 1 a
+1 a 2 b
+2 b 2 b
+3 c 2 b
+3 c 2 b
+1 a 3 c
+2 b 3 c
+3 c 3 c
+3 c 3 c
+1 a 3 c
+2 b 3 c
+3 c 3 c
+3 c 3 c
+explain select * from t1 as x1, (select * from t1) as x2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY x1 ALL NULL NULL NULL NULL 4
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4
+2 DERIVED t1 ALL NULL NULL NULL NULL 4
+drop table if exists t2,t3;
+select * from (select 1) as a;
+1
+1
+select a from (select 1 as a) as b;
+a
+1
+select 1 from (select 1) as a;
+1
+1
+select * from (select * from t1 union select * from t1) a;
+a b
+1 a
+2 b
+3 c
+select * from (select * from t1 union all select * from t1) a;
+a b
+1 a
+2 b
+3 c
+3 c
+1 a
+2 b
+3 c
+3 c
+select * from (select * from t1 union all select * from t1 limit 2) a;
+a b
+1 a
+2 b
+explain select * from (select * from t1 union select * from t1) a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3
+2 DERIVED t1 ALL NULL NULL NULL NULL 4
+3 UNION t1 ALL NULL NULL NULL NULL 4
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+explain select * from (select * from t1 union all select * from t1) a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 8
+2 DERIVED t1 ALL NULL NULL NULL NULL 4
+3 UNION t1 ALL NULL NULL NULL NULL 4
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+CREATE TABLE t2 (a int not null);
+insert into t2 values(1);
+select * from (select * from t1 where t1.a=(select a from t2 where t2.a=t1.a)) a;
+a b
+1 a
+select * from (select * from t1 where t1.a=(select t2.a from t2 where t2.a=t1.a) union select t1.a, t1.b from t1) a;
+a b
+1 a
+2 b
+3 c
+explain select * from (select * from t1,t2 where t1.a=t2.a) t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> system NULL NULL NULL NULL 1
+2 DERIVED t2 system NULL NULL NULL NULL 1
+2 DERIVED t1 ALL NULL NULL NULL NULL 4 Using where
+drop table t1, t2;
+create table t1(a int not null, t char(8), index(a));
+SELECT * FROM (SELECT * FROM t1) as b ORDER BY a ASC LIMIT 0,20;
+a t
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+10 10
+11 11
+12 12
+13 13
+14 14
+15 15
+16 16
+17 17
+18 18
+19 19
+20 20
+explain select count(*) from t1 as tt1, (select * from t1) as tt2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+2 DERIVED t1 ALL NULL NULL NULL NULL 10000
+drop table t1;
+SELECT * FROM (SELECT (SELECT * FROM (SELECT 1 as a) as a )) as b;
+(SELECT * FROM (SELECT 1 as a) as a )
+1
+select * from (select 1 as a) b left join (select 2 as a) c using(a);
+a a
+1 NULL
+SELECT * FROM (SELECT 1 UNION SELECT a) b;
+ERROR 42S22: Unknown column 'a' in 'field list'
+SELECT 1 as a FROM (SELECT a UNION SELECT 1) b;
+ERROR 42S22: Unknown column 'a' in 'field list'
+SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b;
+ERROR 42S22: Unknown column 'a' in 'field list'
+select 1 from (select 2) a order by 0;
+ERROR 42S22: Unknown column '0' in 'order clause'
+create table t1 (id int);
+insert into t1 values (1),(2),(3);
+describe select * from (select * from t1 group by id) bar;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3
+2 DERIVED t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort
+drop table t1;
+create table t1 (mat_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, matintnum CHAR(6) NOT NULL, test MEDIUMINT UNSIGNED NULL);
+create table t2 (mat_id MEDIUMINT UNSIGNED NOT NULL, pla_id MEDIUMINT UNSIGNED NOT NULL);
+insert into t1 values (NULL, 'a', 1), (NULL, 'b', 2), (NULL, 'c', 3), (NULL, 'd', 4), (NULL, 'e', 5), (NULL, 'f', 6), (NULL, 'g', 7), (NULL, 'h', 8), (NULL, 'i', 9);
+insert into t2 values (1, 100), (1, 101), (1, 102), (2, 100), (2, 103), (2, 104), (3, 101), (3, 102), (3, 105);
+SELECT STRAIGHT_JOIN d.pla_id, m2.mat_id FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum;
+pla_id mat_id
+100 1
+101 1
+102 1
+103 2
+104 2
+105 3
+SELECT STRAIGHT_JOIN d.pla_id, m2.test FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum;
+pla_id test
+100 1
+101 1
+102 1
+103 2
+104 2
+105 3
+explain SELECT STRAIGHT_JOIN d.pla_id, m2.mat_id FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY m2 ALL NULL NULL NULL NULL 9
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 6 Using where
+2 DERIVED mp ALL NULL NULL NULL NULL 9 Using temporary; Using filesort
+2 DERIVED m1 eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1
+explain SELECT STRAIGHT_JOIN d.pla_id, m2.test FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY m2 ALL NULL NULL NULL NULL 9
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 6 Using where
+2 DERIVED mp ALL NULL NULL NULL NULL 9 Using temporary; Using filesort
+2 DERIVED m1 eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1
+drop table t1,t2;
+SELECT a.x FROM (SELECT 1 AS x) AS a HAVING a.x = 1;
+x
+1
+create table t1 select 1 as a;
+select 2 as a from (select * from t1) b;
+ERROR 3D000: No database selected
+use test;
+select 2 as a from (select * from t1) b;
+a
+2
+drop table t1;
+select mail_id, if(folder.f_description!='', folder.f_description, folder.f_name) as folder_name, date, address_id, phrase, address, subject from folder, (select mail.mail_id as mail_id, date_format(mail.h_date, '%b %e, %Y %h:%i') as date, mail.folder_id, sender.address_id as address_id, sender.phrase as phrase, sender.address as address, mail.h_subject as subject from mail left join mxa as mxa_sender on mail.mail_id=mxa_sender.mail_id and mxa_sender.type='from' left join address as sender on mxa_sender.address_id=sender.address_id mxa as mxa_recipient, address as recipient, where 1 and mail.mail_id=mxa_recipient.mail_id and mxa_recipient.address_id=recipient.address_id and mxa_recipient.type='to' and match(sender.phrase, sender.address, sender.comment) against ('jeremy' in boolean mode) and match(recipient.phrase, recipient.address, recipient.comment) against ('monty' in boolean mode) order by mail.h_date desc limit 0, 25 ) as query where query.folder_id=folder.folder_id;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mxa as mxa_recipient, address as recipient, where 1 and mail.mail_id=mxa_r' at line 1
+create table t1 (a int);
+insert into t1 values (1),(2),(3);
+update (select * from t1) as t1 set a = 5;
+ERROR HY000: The target table t1 of the UPDATE is not updatable
+delete from (select * from t1);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(select * from t1)' at line 1
+insert into (select * from t1) values (5);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(select * from t1) values (5)' at line 1
+drop table t1;
+create table t1 (E1 INTEGER UNSIGNED NOT NULL, E2 INTEGER UNSIGNED NOT NULL, E3 INTEGER UNSIGNED NOT NULL, PRIMARY KEY(E1)
+);
+insert into t1 VALUES(1,1,1), (2,2,1);
+select count(*) from t1 INNER JOIN (SELECT A.E1, A.E2, A.E3 FROM t1 AS A WHERE A.E3 = (SELECT MAX(B.E3) FROM t1 AS B WHERE A.E2 = B.E2)) AS THEMAX ON t1.E1 = THEMAX.E2 AND t1.E1 = t1.E2;
+count(*)
+2
+explain select count(*) from t1 INNER JOIN (SELECT A.E1, A.E2, A.E3 FROM t1 AS A WHERE A.E3 = (SELECT MAX(B.E3) FROM t1 AS B WHERE A.E2 = B.E2)) AS THEMAX ON t1.E1 = THEMAX.E2 AND t1.E1 = t1.E2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 THEMAX.E2 1 Using where
+2 DERIVED A ALL NULL NULL NULL NULL 2 Using where
+3 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 2 Using where
+drop table t1;
+create table t1 (a int);
+insert into t1 values (1),(2);
+select * from ( select * from t1 union select * from t1) a,(select * from t1 union select * from t1) b;
+a a
+1 1
+2 1
+1 2
+2 2
+explain select * from ( select * from t1 union select * from t1) a,(select * from t1 union select * from t1) b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
+1 PRIMARY <derived4> ALL NULL NULL NULL NULL 2
+4 DERIVED t1 ALL NULL NULL NULL NULL 2
+5 UNION t1 ALL NULL NULL NULL NULL 2
+NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL
+2 DERIVED t1 ALL NULL NULL NULL NULL 2
+3 UNION t1 ALL NULL NULL NULL NULL 2
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+drop table t1;
+CREATE TABLE `t1` (
+`N` int(11) unsigned NOT NULL default '0',
+`M` tinyint(1) default '0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO `t1` (N, M) VALUES (1, 0),(1, 0),(1, 0),(2, 0),(2, 0),(3, 0);
+UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
+select * from t1;
+N M
+1 2
+1 2
+1 2
+2 2
+2 2
+3 0
+UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2, P2.N = 2;
+ERROR HY000: The target table P2 of the UPDATE is not updatable
+UPDATE `t1` AS P1 INNER JOIN (SELECT aaaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
+ERROR 42S22: Unknown column 'aaaa' in 'field list'
+delete P1.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
+select * from t1;
+N M
+3 0
+delete P1.*,p2.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS p2 ON P1.N = p2.N;
+ERROR HY000: The target table p2 of the DELETE is not updatable
+delete P1.* from `t1` AS P1 INNER JOIN (SELECT aaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
+ERROR 42S22: Unknown column 'aaa' in 'field list'
+drop table t1;
+CREATE TABLE t1 (
+OBJECTID int(11) NOT NULL default '0',
+SORTORDER int(11) NOT NULL auto_increment,
+KEY t1_SortIndex (SORTORDER),
+KEY t1_IdIndex (OBJECTID)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+CREATE TABLE t2 (
+ID int(11) default NULL,
+PARID int(11) default NULL,
+UNIQUE KEY t2_ID_IDX (ID),
+KEY t2_PARID_IDX (PARID)
+) engine=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO t2 VALUES (1000,0),(1001,0),(1002,0),(1003,0),(1008,1),(1009,1),(1010,1),(1011,1),(1016,2);
+CREATE TABLE t3 (
+ID int(11) default NULL,
+DATA decimal(10,2) default NULL,
+UNIQUE KEY t3_ID_IDX (ID)
+) engine=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO t3 VALUES (1000,0.00),(1001,0.25),(1002,0.50),(1003,0.75),(1008,1.00),(1009,1.25),(1010,1.50),(1011,1.75);
+select 497, TMP.ID, NULL from (select 497 as ID, MAX(t3.DATA) as DATA from t1 join t2 on (t1.ObjectID = t2.ID) join t3 on (t1.ObjectID = t3.ID) group by t2.ParID order by DATA DESC) as TMP;
+497 ID NULL
+drop table t1, t2, t3;
+CREATE TABLE t1 (name char(1) default NULL, val int(5) default NULL);
+INSERT INTO t1 VALUES ('a',1), ('a',2), ('a',2), ('a',2), ('a',3), ('a',6), ('a',7), ('a',11), ('a',11), ('a',12), ('a',13), ('a',13), ('a',20), ('b',2), ('b',3), ('b',4), ('b',5);
+SELECT s.name, AVG(s.val) AS median FROM (SELECT x.name, x.val FROM t1 x, t1 y WHERE x.name=y.name GROUP BY x.name, x.val HAVING SUM(y.val <= x.val) >= COUNT(*)/2 AND SUM(y.val >= x.val) >= COUNT(*)/2) AS s GROUP BY s.name;
+name median
+a 7.0000
+b 3.5000
+explain SELECT s.name, AVG(s.val) AS median FROM (SELECT x.name, x.val FROM t1 x, t1 y WHERE x.name=y.name GROUP BY x.name, x.val HAVING SUM(y.val <= x.val) >= COUNT(*)/2 AND SUM(y.val >= x.val) >= COUNT(*)/2) AS s GROUP BY s.name;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 Using temporary; Using filesort
+2 DERIVED x ALL NULL NULL NULL NULL 17 Using temporary; Using filesort
+2 DERIVED y ALL NULL NULL NULL NULL 17 Using where
+drop table t1;
+create table t2 (a int, b int, primary key (a));
+insert into t2 values (1,7),(2,7);
+explain select a from t2 where a>1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
+explain select a from (select a from t2 where a>1) tt;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> system NULL NULL NULL NULL 1
+2 DERIVED t2 range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
+drop table t2;
+CREATE TABLE `t1` ( `itemid` int(11) NOT NULL default '0', `grpid` varchar(15) NOT NULL default '', `vendor` int(11) NOT NULL default '0', `date_` date NOT NULL default '0000-00-00', `price` decimal(12,2) NOT NULL default '0.00', PRIMARY KEY (`itemid`,`grpid`,`vendor`,`date_`), KEY `itemid` (`itemid`,`vendor`), KEY `itemid_2` (`itemid`,`date_`));
+insert into t1 values (128, 'rozn', 2, now(), 10),(128, 'rozn', 1, now(), 10);
+SELECT MIN(price) min, MAX(price) max, AVG(price) avg FROM (SELECT SUBSTRING( MAX(concat(date_,";",price)), 12) price FROM t1 WHERE itemid=128 AND grpid='rozn' GROUP BY itemid, grpid, vendor) lastprices;
+min max avg
+10.00 10.00 10
+DROP TABLE t1;
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result
index a0343f13394..80af2dd0983 100644
--- a/mysql-test/r/distinct.result
+++ b/mysql-test/r/distinct.result
@@ -172,10 +172,10 @@ b
INSERT INTO t2 values (1),(2),(3);
INSERT INTO t3 VALUES (1,'1'),(2,'2'),(1,'1'),(2,'2');
explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
-table type possible_keys key key_len ref rows Extra
-t3 index a a 5 NULL 6 Using index; Using temporary
-t2 index a a 4 NULL 5 Using index; Distinct
-t1 eq_ref PRIMARY PRIMARY 4 t2.a 1 Using where; Distinct
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 4 Using temporary
+1 SIMPLE t3 ref a a 5 test.t1.b 2 Using where; Using index
+1 SIMPLE t2 index a a 4 NULL 4 Using where; Using index; Distinct
SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
a
1
@@ -188,9 +188,9 @@ insert into t3 select * from t4;
insert into t4 select * from t3;
insert into t3 select * from t4;
explain select distinct t1.a from t1,t3 where t1.a=t3.a;
-table type possible_keys key key_len ref rows Extra
-t1 index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary
-t3 ref a a 5 t1.a 10 Using where; Using index; Distinct
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary
+1 SIMPLE t3 ref a a 5 test.t1.a 10 Using where; Using index; Distinct
select distinct t1.a from t1,t3 where t1.a=t3.a;
a
1
@@ -199,29 +199,29 @@ select distinct 1 from t1,t3 where t1.a=t3.a;
1
1
explain SELECT distinct t1.a from t1;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL PRIMARY 4 NULL 4 Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index
explain SELECT distinct t1.a from t1 order by a desc;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL PRIMARY 4 NULL 4 Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index
explain SELECT t1.a from t1 group by a order by a desc;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL PRIMARY 4 NULL 4 Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index
explain SELECT distinct t1.a from t1 order by a desc limit 1;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL PRIMARY 4 NULL 4 Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index
explain SELECT distinct a from t3 order by a desc limit 2;
-table type possible_keys key key_len ref rows Extra
-t3 index NULL a 5 NULL 204 Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 index NULL a 5 NULL 204 Using index
explain SELECT distinct a,b from t3 order by a+1;
-table type possible_keys key key_len ref rows Extra
-t3 ALL NULL NULL NULL NULL 204 Using temporary; Using filesort
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 ALL NULL NULL NULL NULL 204 Using temporary; Using filesort
explain SELECT distinct a,b from t3 order by a limit 10;
-table type possible_keys key key_len ref rows Extra
-t3 index NULL a 5 NULL 204 Using temporary
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 index NULL a 5 NULL 204 Using temporary
explain SELECT a,b from t3 group by a,b order by a+1;
-table type possible_keys key key_len ref rows Extra
-t3 ALL NULL NULL NULL NULL 204 Using temporary; Using filesort
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 ALL NULL NULL NULL NULL 204 Using temporary; Using filesort
drop table t1,t2,t3,t4;
CREATE TABLE t1 (name varchar(255));
INSERT INTO t1 VALUES ('aa'),('ab'),('ac'),('ad'),('ae');
@@ -298,14 +298,14 @@ on j_lj_t3.id=t3_lj.id
WHERE
((t1.id=j_lj_t2.id AND t2_lj.id IS NULL) OR (t1.id=t2.id AND t2.idx=2))
AND ((t1.id=j_lj_t3.id AND t3_lj.id IS NULL) OR (t1.id=t3.id AND t3.idx=2));
-table type possible_keys key key_len ref rows Extra
-t1 index id id 4 NULL 2 Using index; Using temporary
-t2 index id id 8 NULL 1 Using index; Distinct
-t3 index id id 8 NULL 1 Using index; Distinct
-j_lj_t2 index id id 4 NULL 2 Using where; Using index; Distinct
-t2_lj ref id id 4 j_lj_t2.id 1 Using where; Using index; Distinct
-j_lj_t3 index id id 4 NULL 2 Using where; Using index; Distinct
-t3_lj ref id id 4 j_lj_t3.id 1 Using where; Using index; Distinct
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index id id 4 NULL 2 Using index; Using temporary
+1 SIMPLE t2 index id id 8 NULL 1 Using index; Distinct
+1 SIMPLE t3 index id id 8 NULL 1 Using index; Distinct
+1 SIMPLE j_lj_t2 index id id 4 NULL 2 Using where; Using index; Distinct
+1 SIMPLE t2_lj ref id id 4 test.j_lj_t2.id 1 Using where; Using index; Distinct
+1 SIMPLE j_lj_t3 index id id 4 NULL 2 Using where; Using index; Distinct
+1 SIMPLE t3_lj ref id id 4 test.j_lj_t3.id 1 Using where; Using index; Distinct
SELECT DISTINCT
t1.id
from
@@ -326,7 +326,6 @@ AND ((t1.id=j_lj_t3.id AND t3_lj.id IS NULL) OR (t1.id=t3.id AND t3.idx=2));
id
2
drop table t1,t2,t3;
-drop table if exists t1;
create table t1 (a int not null, b int not null, t time);
insert into t1 values (1,1,"00:06:15"),(1,2,"00:06:15"),(1,2,"00:30:15"),(1,3,"00:06:15"),(1,3,"00:30:15");
select a,sec_to_time(sum(time_to_sec(t))) from t1 group by a,b;
@@ -361,7 +360,7 @@ a c
4 NULL
3 NULL
drop table t1;
-create table t1 (a char(1), key(a)) type=myisam;
+create table t1 (a char(1), key(a)) engine=myisam;
insert into t1 values('1'),('1');
select * from t1 where a >= '1';
a
@@ -403,14 +402,14 @@ test2@testdomain.com Z001
test2@testdomain.com R002
test3@testdomain.com Z001
drop table t1,t2;
-CREATE TABLE t1 (privatemessageid int(10) unsigned NOT NULL auto_increment, folderid smallint(6) NOT NULL default '0', userid int(10) unsigned NOT NULL default '0', touserid int(10) unsigned NOT NULL default '0', fromuserid int(10) unsigned NOT NULL default '0', title varchar(250) NOT NULL default '', message mediumtext NOT NULL, dateline int(10) unsigned NOT NULL default '0', showsignature smallint(6) NOT NULL default '0', iconid smallint(5) unsigned NOT NULL default '0', messageread smallint(6) NOT NULL default '0', readtime int(10) unsigned NOT NULL default '0', receipt smallint(6) unsigned NOT NULL default '0', deleteprompt smallint(6) unsigned NOT NULL default '0', multiplerecipients smallint(6) unsigned NOT NULL default '0', PRIMARY KEY (privatemessageid), KEY userid (userid)) TYPE=MyISAM;
+CREATE TABLE t1 (privatemessageid int(10) unsigned NOT NULL auto_increment, folderid smallint(6) NOT NULL default '0', userid int(10) unsigned NOT NULL default '0', touserid int(10) unsigned NOT NULL default '0', fromuserid int(10) unsigned NOT NULL default '0', title varchar(250) NOT NULL default '', message mediumtext NOT NULL, dateline int(10) unsigned NOT NULL default '0', showsignature smallint(6) NOT NULL default '0', iconid smallint(5) unsigned NOT NULL default '0', messageread smallint(6) NOT NULL default '0', readtime int(10) unsigned NOT NULL default '0', receipt smallint(6) unsigned NOT NULL default '0', deleteprompt smallint(6) unsigned NOT NULL default '0', multiplerecipients smallint(6) unsigned NOT NULL default '0', PRIMARY KEY (privatemessageid), KEY userid (userid)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (128,0,33,33,8,':D','',996121863,1,0,2,996122850,2,0,0);
-CREATE TABLE t2 (userid int(10) unsigned NOT NULL auto_increment, usergroupid smallint(5) unsigned NOT NULL default '0', username varchar(50) NOT NULL default '', password varchar(50) NOT NULL default '', email varchar(50) NOT NULL default '', styleid smallint(5) unsigned NOT NULL default '0', parentemail varchar(50) NOT NULL default '', coppauser smallint(6) NOT NULL default '0', homepage varchar(100) NOT NULL default '', icq varchar(20) NOT NULL default '', aim varchar(20) NOT NULL default '', yahoo varchar(20) NOT NULL default '', signature mediumtext NOT NULL, adminemail smallint(6) NOT NULL default '0', showemail smallint(6) NOT NULL default '0', invisible smallint(6) NOT NULL default '0', usertitle varchar(250) NOT NULL default '', customtitle smallint(6) NOT NULL default '0', joindate int(10) unsigned NOT NULL default '0', cookieuser smallint(6) NOT NULL default '0', daysprune smallint(6) NOT NULL default '0', lastvisit int(10) unsigned NOT NULL default '0', lastactivity int(10) unsigned NOT NULL default '0', lastpost int(10) unsigned NOT NULL default '0', posts smallint(5) unsigned NOT NULL default '0', timezoneoffset varchar(4) NOT NULL default '', emailnotification smallint(6) NOT NULL default '0', buddylist mediumtext NOT NULL, ignorelist mediumtext NOT NULL, pmfolders mediumtext NOT NULL, receivepm smallint(6) NOT NULL default '0', emailonpm smallint(6) NOT NULL default '0', pmpopup smallint(6) NOT NULL default '0', avatarid smallint(6) NOT NULL default '0', avatarrevision int(6) unsigned NOT NULL default '0', options smallint(6) NOT NULL default '15', birthday date NOT NULL default '0000-00-00', maxposts smallint(6) NOT NULL default '-1', startofweek smallint(6) NOT NULL default '1', ipaddress varchar(20) NOT NULL default '', referrerid int(10) unsigned NOT NULL default '0', nosessionhash smallint(6) NOT NULL default '0', autorefresh smallint(6) NOT NULL default '-1', messagepopup tinyint(2) NOT NULL default '0', inforum smallint(5) unsigned NOT NULL default '0', ratenum smallint(5) unsigned NOT NULL default '0', ratetotal smallint(5) unsigned NOT NULL default '0', allowrate smallint(5) unsigned NOT NULL default '1', PRIMARY KEY (userid), KEY usergroupid (usergroupid), KEY username (username), KEY inforum (inforum)) TYPE=MyISAM;
+CREATE TABLE t2 (userid int(10) unsigned NOT NULL auto_increment, usergroupid smallint(5) unsigned NOT NULL default '0', username varchar(50) NOT NULL default '', password varchar(50) NOT NULL default '', email varchar(50) NOT NULL default '', styleid smallint(5) unsigned NOT NULL default '0', parentemail varchar(50) NOT NULL default '', coppauser smallint(6) NOT NULL default '0', homepage varchar(100) NOT NULL default '', icq varchar(20) NOT NULL default '', aim varchar(20) NOT NULL default '', yahoo varchar(20) NOT NULL default '', signature mediumtext NOT NULL, adminemail smallint(6) NOT NULL default '0', showemail smallint(6) NOT NULL default '0', invisible smallint(6) NOT NULL default '0', usertitle varchar(250) NOT NULL default '', customtitle smallint(6) NOT NULL default '0', joindate int(10) unsigned NOT NULL default '0', cookieuser smallint(6) NOT NULL default '0', daysprune smallint(6) NOT NULL default '0', lastvisit int(10) unsigned NOT NULL default '0', lastactivity int(10) unsigned NOT NULL default '0', lastpost int(10) unsigned NOT NULL default '0', posts smallint(5) unsigned NOT NULL default '0', timezoneoffset varchar(4) NOT NULL default '', emailnotification smallint(6) NOT NULL default '0', buddylist mediumtext NOT NULL, ignorelist mediumtext NOT NULL, pmfolders mediumtext NOT NULL, receivepm smallint(6) NOT NULL default '0', emailonpm smallint(6) NOT NULL default '0', pmpopup smallint(6) NOT NULL default '0', avatarid smallint(6) NOT NULL default '0', avatarrevision int(6) unsigned NOT NULL default '0', options smallint(6) NOT NULL default '15', birthday date NOT NULL default '0000-00-00', maxposts smallint(6) NOT NULL default '-1', startofweek smallint(6) NOT NULL default '1', ipaddress varchar(20) NOT NULL default '', referrerid int(10) unsigned NOT NULL default '0', nosessionhash smallint(6) NOT NULL default '0', autorefresh smallint(6) NOT NULL default '-1', messagepopup tinyint(2) NOT NULL default '0', inforum smallint(5) unsigned NOT NULL default '0', ratenum smallint(5) unsigned NOT NULL default '0', ratetotal smallint(5) unsigned NOT NULL default '0', allowrate smallint(5) unsigned NOT NULL default '1', PRIMARY KEY (userid), KEY usergroupid (usergroupid), KEY username (username), KEY inforum (inforum)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (33,6,'Kevin','0','kevin@stileproject.com',1,'',0,'http://www.stileproject.com','','','','',1,1,0,'Administrator',0,996120694,1,-1,1030996168,1031027028,1030599436,36,'-6',0,'','','',1,0,1,0,0,15,'0000-00-00',-1,1,'64.0.0.0',0,1,-1,0,0,4,19,1);
SELECT DISTINCT t1.*, t2.* FROM t1 LEFT JOIN t2 ON (t2.userid = t1.touserid);
privatemessageid folderid userid touserid fromuserid title message dateline showsignature iconid messageread readtime receipt deleteprompt multiplerecipients userid usergroupid username password email styleid parentemail coppauser homepage icq aim yahoo signature adminemail showemail invisible usertitle customtitle joindate cookieuser daysprune lastvisit lastactivity lastpost posts timezoneoffset emailnotification buddylist ignorelist pmfolders receivepm emailonpm pmpopup avatarid avatarrevision options birthday maxposts startofweek ipaddress referrerid nosessionhash autorefresh messagepopup inforum ratenum ratetotal allowrate
128 0 33 33 8 :D 996121863 1 0 2 996122850 2 0 0 33 6 Kevin 0 kevin@stileproject.com 1 0 http://www.stileproject.com 1 1 0 Administrator 0 996120694 1 -1 1030996168 1031027028 1030599436 36 -6 0 1 0 1 0 0 15 0000-00-00 -1 1 64.0.0.0 0 1 -1 0 0 4 19 1
-DROP TABLE IF EXISTS t1,t2;
+DROP TABLE t1,t2;
CREATE TABLE t1 (a int primary key, b int, c int);
INSERT t1 VALUES (1,2,3);
CREATE TABLE t2 (a int primary key, b int, c int);
@@ -418,8 +417,8 @@ INSERT t2 VALUES (3,4,5);
SELECT DISTINCT t1.a, t2.b FROM t1, t2 WHERE t1.a=1 ORDER BY t2.c;
a b
1 4
-DROP TABLE IF EXISTS t1,t2;
-CREATE table t1 ( `id` int(11) NOT NULL auto_increment, `name` varchar(50) NOT NULL default '', PRIMARY KEY (`id`)) TYPE=MyISAM AUTO_INCREMENT=3 ;
+DROP TABLE t1,t2;
+CREATE table t1 ( `id` int(11) NOT NULL auto_increment, `name` varchar(50) NOT NULL default '', PRIMARY KEY (`id`)) ENGINE=MyISAM AUTO_INCREMENT=3 ;
INSERT INTO t1 VALUES (1, 'aaaaa');
INSERT INTO t1 VALUES (3, 'aaaaa');
INSERT INTO t1 VALUES (2, 'eeeeeee');
@@ -428,3 +427,40 @@ name
a
e
drop table t1;
+CREATE TABLE t1 (
+ID int(11) NOT NULL auto_increment,
+NAME varchar(75) DEFAULT '' NOT NULL,
+LINK_ID int(11) DEFAULT '0' NOT NULL,
+PRIMARY KEY (ID),
+KEY NAME (NAME),
+KEY LINK_ID (LINK_ID)
+);
+INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (1,'Mike',0);
+INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (2,'Jack',0);
+INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (3,'Bill',0);
+CREATE TABLE t2 (
+ID int(11) NOT NULL auto_increment,
+NAME varchar(150) DEFAULT '' NOT NULL,
+PRIMARY KEY (ID),
+KEY NAME (NAME)
+);
+SELECT DISTINCT
+t2.id AS key_link_id,
+t2.name AS link
+FROM t1
+LEFT JOIN t2 ON t1.link_id=t2.id
+GROUP BY t1.id
+ORDER BY link;
+key_link_id link
+NULL NULL
+drop table t1,t2;
+CREATE TABLE t1 (
+html varchar(5) default NULL,
+rin int(11) default '0',
+out int(11) default '0'
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('1',1,0);
+SELECT DISTINCT html,SUM(out)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin;
+html prod
+1 0.00
+drop table t1;
diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result
index 5c732aebbcc..8b919964163 100644
--- a/mysql-test/r/drop.result
+++ b/mysql-test/r/drop.result
@@ -1,17 +1,17 @@
drop table if exists t1;
+drop database if exists mysqltest;
drop table t1;
-Unknown table 't1'
+ERROR 42S02: Unknown table 't1'
create table t1(n int);
insert into t1 values(1);
create temporary table t1( n int);
insert into t1 values(2);
create table t1(n int);
-Table 't1' already exists
+ERROR 42S01: Table 't1' already exists
drop table t1;
select * from t1;
n
1
-drop database if exists mysqltest;
create database mysqltest;
drop database if exists mysqltest;
create database mysqltest;
@@ -21,6 +21,7 @@ select * from mysqltest.mysqltest;
n
4
drop database if exists mysqltest;
+affected rows: 1
create database mysqltest;
drop database mysqltest;
flush tables with read lock;
@@ -43,4 +44,14 @@ Database
mysql
test
drop database mysqltest;
-Can't drop database 'mysqltest'. Database doesn't exist
+ERROR HY000: Can't drop database 'mysqltest'; database doesn't exist
+drop table t1;
+flush tables with read lock;
+create table t1(n int);
+ERROR HY000: Can't execute the query because you have a conflicting read lock
+unlock tables;
+create table t1(n int);
+show tables;
+Tables_in_test
+t1
+drop table t1;
diff --git a/mysql-test/r/drop_temp_table.result b/mysql-test/r/drop_temp_table.result
index fa3a72d9472..266196877c8 100644
--- a/mysql-test/r/drop_temp_table.result
+++ b/mysql-test/r/drop_temp_table.result
@@ -10,9 +10,9 @@ get_lock("a",10)
1
show binlog events;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
-master-bin.001 79 Query 1 79 use `test`; create database `drop-temp+table-test`
-master-bin.001 152 Query 1 152 use `drop-temp+table-test`; create temporary table `table:name` (a int)
-master-bin.001 246 Query 1 246 use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`table:name`
-master-bin.001 375 Query 1 375 use `drop-temp+table-test`; DO RELEASE_LOCK("a")
+master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
+master-bin.000001 79 Query 1 79 create database `drop-temp+table-test`
+master-bin.000001 168 Query 1 168 use `drop-temp+table-test`; create temporary table `table:name` (a int)
+master-bin.000001 262 Query 1 262 use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`table:name`
+master-bin.000001 391 Query 1 391 use `drop-temp+table-test`; DO RELEASE_LOCK("a")
drop database `drop-temp+table-test`;
diff --git a/mysql-test/r/drop_temp_table.result.es b/mysql-test/r/drop_temp_table.result.es
new file mode 100644
index 00000000000..4497022520e
--- /dev/null
+++ b/mysql-test/r/drop_temp_table.result.es
@@ -0,0 +1,12 @@
+reset master;
+create database `drop-temp+table-test`;
+use `drop-temp+table-test`;
+create temporary table `table:name` (a int);
+select get_lock("a",10);
+get_lock("a",10)
+1
+select get_lock("a",10);
+get_lock("a",10)
+1
+show binlog events;
+drop database `drop-temp+table-test`;
diff --git a/mysql-test/r/endspace.result b/mysql-test/r/endspace.result
new file mode 100644
index 00000000000..96210a0e16d
--- /dev/null
+++ b/mysql-test/r/endspace.result
@@ -0,0 +1,217 @@
+drop table if exists t1;
+select 'a' = 'a', 'a' = 'a ', 'a ' = 'a';
+'a' = 'a' 'a' = 'a ' 'a ' = 'a'
+1 1 1
+select 'a\0' = 'a', 'a\0' < 'a', 'a\0' > 'a';
+'a\0' = 'a' 'a\0' < 'a' 'a\0' > 'a'
+0 1 0
+select 'a' = 'a\0', 'a' < 'a\0', 'a' > 'a\0';
+'a' = 'a\0' 'a' < 'a\0' 'a' > 'a\0'
+0 0 1
+select 'a\0' = 'a ', 'a\0' < 'a ', 'a\0' > 'a ';
+'a\0' = 'a ' 'a\0' < 'a ' 'a\0' > 'a '
+0 1 0
+select 'a ' = 'a\0', 'a ' < 'a\0', 'a ' > 'a\0';
+'a ' = 'a\0' 'a ' < 'a\0' 'a ' > 'a\0'
+0 0 1
+select 'a a' > 'a', 'a \0' < 'a';
+'a a' > 'a' 'a \0' < 'a'
+1 1
+select binary 'a a' > 'a', binary 'a \0' > 'a', binary 'a\0' > 'a';
+binary 'a a' > 'a' binary 'a \0' > 'a' binary 'a\0' > 'a'
+1 1 1
+create table t1 (text1 varchar(32) not NULL, KEY key1 (text1));
+insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+select * from t1 ignore key (key1) where text1='teststring' or text1 like 'teststring_%';
+text1
+teststring
+teststring
+select * from t1 where text1='teststring' or text1 like 'teststring_%';
+text1
+teststring
+teststring
+select * from t1 where text1='teststring' or text1 > 'teststring\t';
+text1
+teststring
+select * from t1 order by text1;
+text1
+nothing
+teststring
+teststring
+explain select * from t1 order by text1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL key1 32 NULL 3 Using index
+alter table t1 modify text1 char(32) binary not null;
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+select * from t1 ignore key (key1) where text1='teststring' or text1 like 'teststring_%';
+text1
+teststring
+teststring
+select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
+concat('|', text1, '|')
+|teststring |
+|teststring|
+select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
+concat('|', text1, '|')
+|teststring|
+select text1, length(text1) from t1 order by text1;
+text1 length(text1)
+nothing 7
+teststring 11
+teststring 10
+select text1, length(text1) from t1 order by binary text1;
+text1 length(text1)
+nothing 7
+teststring 10
+teststring 11
+alter table t1 modify text1 blob not null, drop key key1, add key key1 (text1(20));
+insert into t1 values ('teststring ');
+select concat('|', text1, '|') from t1 order by text1;
+concat('|', text1, '|')
+|nothing|
+|teststring|
+|teststring |
+|teststring |
+select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
+concat('|', text1, '|')
+|teststring|
+|teststring |
+select concat('|', text1, '|') from t1 where text1='teststring';
+concat('|', text1, '|')
+|teststring|
+select concat('|', text1, '|') from t1 where text1='teststring ';
+concat('|', text1, '|')
+|teststring |
+alter table t1 modify text1 text not null, pack_keys=1;
+select concat('|', text1, '|') from t1 where text1='teststring';
+concat('|', text1, '|')
+|teststring|
+|teststring |
+select concat('|', text1, '|') from t1 where text1='teststring ';
+concat('|', text1, '|')
+|teststring|
+|teststring |
+explain select concat('|', text1, '|') from t1 where text1='teststring ';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range key1 key1 22 NULL 2 Using where
+select * from t1 where text1 like 'teststring_%';
+text1
+teststring
+teststring
+select * from t1 where text1='teststring' or text1 like 'teststring_%';
+text1
+teststring
+teststring
+teststring
+select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
+concat('|', text1, '|')
+|teststring|
+|teststring |
+select concat('|', text1, '|') from t1 order by text1;
+concat('|', text1, '|')
+|nothing|
+|teststring |
+|teststring|
+|teststring |
+drop table t1;
+create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)) pack_keys=0;
+insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
+select * from t1 where text1='teststring' or text1 like 'teststring_%';
+text1
+teststring
+teststring
+select * from t1 where text1='teststring' or text1 >= 'teststring\t';
+text1
+teststring
+teststring
+drop table t1;
+create table t1 (text1 varchar(32) not NULL, KEY key1 using BTREE (text1)) engine=heap;
+insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
+select * from t1 ignore key (key1) where text1='teststring' or text1 like 'teststring_%';
+text1
+teststring
+teststring
+select * from t1 where text1='teststring' or text1 like 'teststring_%';
+text1
+teststring
+teststring
+select * from t1 where text1='teststring' or text1 >= 'teststring\t';
+text1
+teststring
+teststring
+select * from t1 order by text1;
+text1
+nothing
+teststring
+teststring
+explain select * from t1 order by text1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL key1 32 NULL 3
+alter table t1 modify text1 char(32) binary not null;
+select * from t1 order by text1;
+text1
+nothing
+teststring
+teststring
+drop table t1;
+create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)) engine=innodb;
+insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+select * from t1 where text1='teststring' or text1 like 'teststring_%';
+text1
+teststring
+teststring
+select * from t1 where text1='teststring' or text1 > 'teststring\t';
+text1
+teststring
+select * from t1 order by text1;
+text1
+nothing
+teststring
+teststring
+explain select * from t1 order by text1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL key1 32 NULL 3 Using index
+alter table t1 modify text1 char(32) binary not null;
+select * from t1 order by text1;
+text1
+nothing
+teststring
+teststring
+alter table t1 modify text1 blob not null, drop key key1, add key key1 (text1(20));
+insert into t1 values ('teststring ');
+select concat('|', text1, '|') from t1 order by text1;
+concat('|', text1, '|')
+|nothing|
+|teststring|
+|teststring |
+|teststring |
+alter table t1 modify text1 text not null, pack_keys=1;
+select * from t1 where text1 like 'teststring_%';
+text1
+teststring
+teststring
+select text1, length(text1) from t1 where text1='teststring' or text1 like 'teststring_%';
+text1 length(text1)
+teststring 10
+teststring 11
+teststring 11
+select text1, length(text1) from t1 where text1='teststring' or text1 >= 'teststring\t';
+text1 length(text1)
+teststring 10
+teststring 11
+teststring 11
+select concat('|', text1, '|') from t1 order by text1;
+concat('|', text1, '|')
+|nothing|
+|teststring |
+|teststring|
+|teststring |
+drop table t1;
diff --git a/mysql-test/r/errors.result b/mysql-test/r/errors.result
index 5afecc6d600..d0011c8deb6 100644
--- a/mysql-test/r/errors.result
+++ b/mysql-test/r/errors.result
@@ -1,25 +1,25 @@
drop table if exists t1;
insert into t1 values(1);
-Table 'test.t1' doesn't exist
+ERROR 42S02: Table 'test.t1' doesn't exist
delete from t1;
-Table 'test.t1' doesn't exist
+ERROR 42S02: Table 'test.t1' doesn't exist
update t1 set a=1;
-Table 'test.t1' doesn't exist
+ERROR 42S02: Table 'test.t1' doesn't exist
create table t1 (a int);
select count(test.t1.b) from t1;
-Unknown column 'test.t1.b' in 'field list'
+ERROR 42S22: Unknown column 'test.t1.b' in 'field list'
select count(not_existing_database.t1) from t1;
-Unknown table 'not_existing_database' in field list
+ERROR 42S02: Unknown table 'not_existing_database' in field list
select count(not_existing_database.t1.a) from t1;
-Unknown table 'not_existing_database.t1' in field list
+ERROR 42S02: Unknown table 'not_existing_database.t1' in field list
select count(not_existing_database.t1.a) from not_existing_database.t1;
Got one of the listed errors
select 1 from t1 order by 2;
-Unknown column '2' in 'order clause'
+ERROR 42S22: Unknown column '2' in 'order clause'
select 1 from t1 group by 2;
-Unknown column '2' in 'group statement'
+ERROR 42S22: Unknown column '2' in 'group statement'
select 1 from t1 order by t1.b;
-Unknown column 't1.b' in 'order clause'
+ERROR 42S22: Unknown column 't1.b' in 'order clause'
select count(*),b from t1;
-Unknown column 'b' in 'field list'
+ERROR 42S22: Unknown column 'b' in 'field list'
drop table t1;
diff --git a/mysql-test/r/exampledb.result b/mysql-test/r/exampledb.result
new file mode 100644
index 00000000000..9bfb77c1c0b
--- /dev/null
+++ b/mysql-test/r/exampledb.result
@@ -0,0 +1,6 @@
+drop table if exists t1;
+CREATE TABLE t1 (
+Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
+Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
+) ENGINE=example;
+drop table t1;
diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result
index d433078a251..d66dec741bd 100644
--- a/mysql-test/r/explain.result
+++ b/mysql-test/r/explain.result
@@ -1,8 +1,8 @@
drop table if exists t1;
create table t1 (id int not null, str char(10), unique(str));
explain select * from t1;
-table type possible_keys key key_len ref rows Extra
-t1 system NULL NULL NULL NULL 0 const row not found
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
insert into t1 values (1, null),(2, null),(3, "foo"),(4, "bar");
select * from t1 where str is null;
id str
@@ -12,35 +12,44 @@ select * from t1 where str="foo";
id str
3 foo
explain select * from t1 where str is null;
-table type possible_keys key key_len ref rows Extra
-t1 ref str str 11 const 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref str str 11 const 1 Using where
explain select * from t1 where str="foo";
-table type possible_keys key key_len ref rows Extra
-t1 const str str 11 const 1
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const str str 11 const 1
explain select * from t1 ignore key (str) where str="foo";
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 4 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
explain select * from t1 use key (str,str) where str="foo";
-table type possible_keys key key_len ref rows Extra
-t1 const str str 11 const 1
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const str str 11 const 1
explain select * from t1 use key (str,str,foo) where str="foo";
-Key column 'foo' doesn't exist in table
+ERROR 42000: Key column 'foo' doesn't exist in table
explain select * from t1 ignore key (str,str,foo) where str="foo";
-Key column 'foo' doesn't exist in table
+ERROR 42000: Key column 'foo' doesn't exist in table
drop table t1;
explain select 1;
-Comment
-No tables used
+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
create table t1 (a int not null);
explain select count(*) from t1;
-Comment
-Select tables optimized away
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
insert into t1 values(1);
explain select count(*) from t1;
-Comment
-Select tables optimized away
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
insert into t1 values(1);
explain select count(*) from t1;
-Comment
-Select tables optimized away
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
drop table t1;
+set names koi8r;
+create table ÔÁÂ (ËÏÌ0 int, ËÏÌ1 int, key ÉÎÄ0 (ËÏÌ0), key ÉÎÄ01 (ËÏÌ0,ËÏÌ1));
+insert into ÔÁÂ (ËÏÌ0) values (1);
+insert into ÔÁÂ (ËÏÌ0) values (2);
+explain select ËÏÌ0 from ÔÁÂ where ËÏÌ0=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE ÔÁÂ ref ÉÎÄ0,ÉÎÄ01 ÉÎÄ0 5 const 1 Using where; Using index
+drop table ÔÁÂ;
+set names latin1;
diff --git a/mysql-test/r/flush.result b/mysql-test/r/flush.result
index 8dc73e446c7..bab9b543307 100644
--- a/mysql-test/r/flush.result
+++ b/mysql-test/r/flush.result
@@ -1,7 +1,6 @@
-drop table if exists t1;
+drop table if exists t1,t2;
drop database if exists mysqltest;
create temporary table t1(n int not null primary key);
-drop table if exists t2;
create table t2(n int);
insert into t2 values(3);
select * from t1;
@@ -9,7 +8,7 @@ n
3
flush tables with read lock;
drop table t2;
-Table 't2' was locked with a READ lock and can't be updated
+ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
drop table t2;
unlock tables;
create database mysqltest;
diff --git a/mysql-test/r/flush_block_commit.result b/mysql-test/r/flush_block_commit.result
index 20917147e4d..2e9f1920937 100644
--- a/mysql-test/r/flush_block_commit.result
+++ b/mysql-test/r/flush_block_commit.result
@@ -1,5 +1,5 @@
drop table if exists t1;
-create table t1 (a int) type=innodb;
+create table t1 (a int) engine=innodb;
begin;
insert into t1 values(1);
flush tables with read lock;
@@ -28,4 +28,12 @@ commit;
unlock tables;
flush tables with read lock;
unlock tables;
+begin;
+select * from t1;
+a
+1
+10
+show create database test;
+Database Create Database
+test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */
drop table t1;
diff --git a/mysql-test/r/flush_table.result b/mysql-test/r/flush_table.result
index ff69291193f..2ef4ab5b52b 100644
--- a/mysql-test/r/flush_table.result
+++ b/mysql-test/r/flush_table.result
@@ -1,4 +1,4 @@
-drop table if exists t1;
+drop table if exists t1,t2;
create table t1 (a int not null auto_increment primary key);
insert into t1 values(0);
lock table t1 read;
@@ -7,8 +7,6 @@ check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
-drop table if exists t1;
-drop table if exists t2;
create table t1(table_id char(20) primary key);
create table t2(table_id char(20) primary key);
insert into t1 values ('test.t1');
@@ -44,11 +42,11 @@ table_id
test.t2
handler t1 open as a1;
-Not unique table/alias: 'a1'
+ERROR 42000: Not unique table/alias: 'a1'
handler t1 open as a2;
-Not unique table/alias: 'a2'
+ERROR 42000: Not unique table/alias: 'a2'
handler t2 open;
-Not unique table/alias: 't2'
+ERROR 42000: Not unique table/alias: 't2'
handler a1 read first limit 9;
table_id
test.t1
diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result
index 50f0a1dc120..7acc8a2d23f 100644
--- a/mysql-test/r/fulltext.result
+++ b/mysql-test/r/fulltext.result
@@ -7,12 +7,17 @@ INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
('Full-text search in MySQL', 'implements vector space model');
SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
-t1 1 a 1 a A NULL NULL NULL YES FULLTEXT
-t1 1 a 2 b A NULL NULL NULL YES FULLTEXT
+t1 1 a 1 a NULL NULL NULL NULL YES FULLTEXT
+t1 1 a 2 b NULL NULL NULL NULL YES FULLTEXT
select * from t1 where MATCH(a,b) AGAINST ("collections");
a b
Only MyISAM tables support collections
Full-text indexes are called collections
+explain extended select * from t1 where MATCH(a,b) AGAINST ("collections");
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext a a 0 1 Using where
+Warnings:
+Note 1003 select test.t1.a AS `a`,test.t1.b AS `b` from test.t1 where (match test.t1.a,test.t1.b against (_latin1'collections'))
select * from t1 where MATCH(a,b) AGAINST ("indexes");
a b
Full-text indexes are called collections
@@ -20,39 +25,60 @@ select * from t1 where MATCH(a,b) AGAINST ("indexes collections");
a b
Full-text indexes are called collections
Only MyISAM tables support collections
+select * from t1 where MATCH(a,b) AGAINST ("only");
+a b
+select * from t1 where MATCH(a,b) AGAINST ("collections" WITH QUERY EXPANSION);
+a b
+Only MyISAM tables support collections
+Full-text indexes are called collections
+MySQL has now support for full-text search
+select * from t1 where MATCH(a,b) AGAINST ("indexes" WITH QUERY EXPANSION);
+a b
+Full-text indexes are called collections
+Only MyISAM tables support collections
+select * from t1 where MATCH(a,b) AGAINST ("indexes collections" WITH QUERY EXPANSION);
+a b
+Full-text indexes are called collections
+Only MyISAM tables support collections
+MySQL has now support for full-text search
explain select * from t1 where MATCH(a,b) AGAINST ("collections");
-table type possible_keys key key_len ref rows Extra
-t1 fulltext a a 0 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext a a 0 1 Using where
explain select * from t1 where MATCH(a,b) AGAINST ("collections")>0;
-table type possible_keys key key_len ref rows Extra
-t1 fulltext a a 0 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext a a 0 1 Using where
explain select * from t1 where MATCH(a,b) AGAINST ("collections")>1;
-table type possible_keys key key_len ref rows Extra
-t1 fulltext a a 0 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext a a 0 1 Using where
explain select * from t1 where MATCH(a,b) AGAINST ("collections")>=0;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 5 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
explain select * from t1 where MATCH(a,b) AGAINST ("collections")>=1;
-table type possible_keys key key_len ref rows Extra
-t1 fulltext a a 0 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext a a 0 1 Using where
explain select * from t1 where 0<MATCH(a,b) AGAINST ("collections");
-table type possible_keys key key_len ref rows Extra
-t1 fulltext a a 0 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext a a 0 1 Using where
explain select * from t1 where 1<MATCH(a,b) AGAINST ("collections");
-table type possible_keys key key_len ref rows Extra
-t1 fulltext a a 0 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext a a 0 1 Using where
explain select * from t1 where 0<=MATCH(a,b) AGAINST ("collections");
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 5 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
explain select * from t1 where 1<=MATCH(a,b) AGAINST ("collections");
-table type possible_keys key key_len ref rows Extra
-t1 fulltext a a 0 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext a a 0 1 Using where
explain select * from t1 where MATCH(a,b) AGAINST ("collections")>0 and a like '%ll%';
-table type possible_keys key key_len ref rows Extra
-t1 fulltext a a 0 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext a a 0 1 Using where
select * from t1 where MATCH(a,b) AGAINST("support -collections" IN BOOLEAN MODE);
a b
MySQL has now support for full-text search
+explain extended select * from t1 where MATCH(a,b) AGAINST("support -collections" IN BOOLEAN MODE);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext a a 0 1 Using where
+Warnings:
+Note 1003 select test.t1.a AS `a`,test.t1.b AS `b` from test.t1 where (match test.t1.a,test.t1.b against (_latin1'support -collections' in boolean mode))
select * from t1 where MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE);
a b
MySQL has now support for full-text search
@@ -122,6 +148,8 @@ select * from t1 where MATCH a,b AGAINST ('+(support collections) +foobar*' IN B
a b
select * from t1 where MATCH a,b AGAINST ('+(+(support collections)) +foobar*' IN BOOLEAN MODE);
a b
+select * from t1 where MATCH a,b AGAINST ('"xt indexes"' IN BOOLEAN MODE);
+a b
select * from t1 where MATCH a,b AGAINST('"space model' IN BOOLEAN MODE);
a b
Full-text search in MySQL implements vector space model
@@ -203,7 +231,7 @@ id
show keys from t2;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t2 1 tig 1 ticket A NULL NULL NULL YES BTREE
-t2 1 tix 1 inhalt A NULL NULL NULL YES FULLTEXT
+t2 1 tix 1 inhalt NULL NULL NULL NULL YES FULLTEXT
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
@@ -211,7 +239,7 @@ t2 CREATE TABLE `t2` (
`inhalt` text,
KEY `tig` (`ticket`),
FULLTEXT KEY `tix` (`inhalt`)
-) TYPE=MyISAM
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t2 where MATCH inhalt AGAINST (NULL);
ticket inhalt
select * from t2 where MATCH inhalt AGAINST ('foobar');
@@ -220,6 +248,12 @@ ticket inhalt
select * from t2 having MATCH inhalt AGAINST ('foobar');
ticket inhalt
3 foobar
+CREATE TABLE t3 (t int(11),i text,fulltext tix (t,i));
+ERROR HY000: Column 't' cannot be part of FULLTEXT index
+CREATE TABLE t3 (t int(11),i text,
+j varchar(200) CHARACTER SET latin2,
+fulltext tix (i,j));
+ERROR HY000: Column 'j' cannot be part of FULLTEXT index
CREATE TABLE t3 (
ticket int(11),
inhalt text,
@@ -227,19 +261,19 @@ KEY tig (ticket),
fulltext index tix (inhalt)
);
select * from t2 where MATCH inhalt AGAINST (t2.inhalt);
-Wrong arguments to AGAINST
+ERROR HY000: Incorrect arguments to AGAINST
select * from t2 where MATCH ticket AGAINST ('foobar');
-Can't find FULLTEXT index matching the column list
+ERROR HY000: Can't find FULLTEXT index matching the column list
select * from t2,t3 where MATCH (t2.inhalt,t3.inhalt) AGAINST ('foobar');
-Wrong arguments to MATCH
+ERROR HY000: Incorrect arguments to MATCH
drop table t1,t2,t3;
CREATE TABLE t1 (
id int(11) auto_increment,
title varchar(100) default '',
PRIMARY KEY (id),
-KEY ind5 (title),
-FULLTEXT KEY FT1 (title)
-) TYPE=MyISAM;
+KEY ind5 (title)
+) ENGINE=MyISAM;
+CREATE FULLTEXT INDEX ft1 ON t1(title);
insert into t1 (title) values ('this is a test');
select * from t1 where match title against ('test' in boolean mode);
id title
@@ -254,7 +288,7 @@ id title
1 this test once revealed a bug
update t1 set title=NULL where id=1;
drop table t1;
-CREATE TABLE t1 (a int(11), b text, FULLTEXT KEY (b)) TYPE=MyISAM;
+CREATE TABLE t1 (a int(11), b text, FULLTEXT KEY (b)) ENGINE=MyISAM;
insert into t1 values (1,"I wonder why the fulltext index doesnt work?");
SELECT * from t1 where MATCH (b) AGAINST ('apples');
a b
@@ -264,7 +298,7 @@ a b
2 fullaaa fullzzz
1 I wonder why the fulltext index doesnt work?
drop table t1;
-CREATE TABLE t1 ( id int(11) NOT NULL auto_increment primary key, mytext text NOT NULL, FULLTEXT KEY mytext (mytext)) TYPE=MyISAM;
+CREATE TABLE t1 ( id int(11) NOT NULL auto_increment primary key, mytext text NOT NULL, FULLTEXT KEY mytext (mytext)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,'my small mouse'),(2,'la-la-la'),(3,'It is so funny'),(4,'MySQL Tutorial');
select 8 from t1;
8
@@ -273,7 +307,6 @@ select 8 from t1;
8
8
drop table t1;
-drop table if exists t1;
create table t1 (a text, fulltext key (a));
insert into t1 values ('aaaa');
repair table t1;
@@ -282,7 +315,6 @@ test.t1 repair status OK
select * from t1 where match (a) against ('aaaa');
a
drop table t1;
-drop table if exists t1;
create table t1 ( ref_mag text not null, fulltext (ref_mag));
insert into t1 values ('test');
select ref_mag from t1 where match ref_mag against ('+test' in boolean mode);
@@ -306,6 +338,58 @@ t1_id name t2_id t1_id name
select * from t2 where match name against ('a* b* c* d* e* f*' in boolean mode);
t2_id t1_id name
drop table t1,t2;
+create table t1 (a text, fulltext key (a));
+insert into t1 select "xxxx yyyy zzzz";
+drop table t1;
+SET NAMES latin1;
+CREATE TABLE t1 (t text character set utf8 not null, fulltext(t));
+INSERT t1 VALUES ('Mit freundlichem Grüß'), ('aus Osnabrück');
+SET NAMES koi8r;
+INSERT t1 VALUES ("üÔÏ ÍÙ - ÏÐÉÌËÉ"),("ïÔÌÅÚØ, ÇÎÉÄÁ!"),
+("îÅ ×ÌÅÚÁÊ, ÕÂØÅÔ!"),("É ÂÕÄÅÔ ÐÒÁ×!");
+SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('ïðéìëé');
+t collation(t)
+üÔÏ ÍÙ - ÏÐÉÌËÉ utf8_general_ci
+SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('ðÒá*' IN BOOLEAN MODE);
+t collation(t)
+É ÂÕÄÅÔ ÐÒÁ×! utf8_general_ci
+SELECT * FROM t1 WHERE MATCH t AGAINST ('ÜÔÏ' IN BOOLEAN MODE);
+t
+SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrück');
+t collation(t)
+SET NAMES latin1;
+SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrück');
+t collation(t)
+aus Osnabrück utf8_general_ci
+SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrueck');
+t collation(t)
+SELECT t, collation(t),FORMAT(MATCH t AGAINST ('Osnabruck'),6) FROM t1 WHERE MATCH t AGAINST ('Osnabruck');
+t collation(t) FORMAT(MATCH t AGAINST ('Osnabruck'),6)
+aus Osnabrück utf8_general_ci 1.591140
+alter table t1 modify t varchar(200) collate latin1_german2_ci not null;
+Warnings:
+Warning 1265 Data truncated for column 't' at row 3
+Warning 1265 Data truncated for column 't' at row 4
+Warning 1265 Data truncated for column 't' at row 5
+Warning 1265 Data truncated for column 't' at row 6
+SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrück');
+t collation(t)
+aus Osnabrück latin1_german2_ci
+SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrueck');
+t collation(t)
+aus Osnabrück latin1_german2_ci
+DROP TABLE t1;
+CREATE TABLE t1 (s varchar(255), FULLTEXT (s)) DEFAULT CHARSET=utf8;
+insert into t1 (s) values ('pära para para'),('para para para');
+select * from t1 where match(s) against('para' in boolean mode);
+s
+pära para para
+para para para
+select * from t1 where match(s) against('par*' in boolean mode);
+s
+pära para para
+para para para
+DROP TABLE t1;
CREATE TABLE t1 (h text, FULLTEXT (h));
INSERT INTO t1 VALUES ('Jesses Hasse Ling and his syncopators of Swing');
REPAIR TABLE t1;
@@ -315,3 +399,9 @@ select count(*) from t1;
count(*)
1
drop table t1;
+create table t1 (a int primary key, b text, fulltext(b));
+create table t2 (a int, b text);
+insert t1 values (1, "aaaa"), (2, "bbbb");
+insert t2 values (10, "aaaa"), (2, "cccc");
+replace t1 select * from t2;
+drop table t1, t2;
diff --git a/mysql-test/r/fulltext2.result b/mysql-test/r/fulltext2.result
new file mode 100644
index 00000000000..0b1d8eb9a15
--- /dev/null
+++ b/mysql-test/r/fulltext2.result
@@ -0,0 +1,217 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+i int(10) unsigned not null auto_increment primary key,
+a varchar(255) not null,
+FULLTEXT KEY (a)
+) ENGINE=MyISAM;
+repair table t1 quick;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+optimize table t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+select count(*) from t1 where match a against ('aaaxxx');
+count(*)
+260
+select count(*) from t1 where match a against ('aaayyy');
+count(*)
+250
+select count(*) from t1 where match a against ('aaazzz');
+count(*)
+255
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+count(*)
+260
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+count(*)
+250
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+count(*)
+255
+select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz');
+count(*)
+765
+select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz' in boolean mode);
+count(*)
+765
+select count(*) from t1 where match a against ('aaax*' in boolean mode);
+count(*)
+260
+select count(*) from t1 where match a against ('aaay*' in boolean mode);
+count(*)
+250
+select count(*) from t1 where match a against ('aaa*' in boolean mode);
+count(*)
+765
+insert t1 (a) values ('aaaxxx'),('aaayyy');
+insert t1 (a) values ('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz');
+select count(*) from t1 where match a against ('aaaxxx');
+count(*)
+261
+select count(*) from t1 where match a against ('aaayyy');
+count(*)
+251
+select count(*) from t1 where match a against ('aaazzz');
+count(*)
+260
+insert t1 (a) values ('aaaxxx 000000');
+select count(*) from t1 where match a against ('000000');
+count(*)
+1
+delete from t1 where match a against ('000000');
+select count(*) from t1 where match a against ('000000');
+count(*)
+0
+select count(*) from t1 where match a against ('aaaxxx');
+count(*)
+261
+delete from t1 where match a against ('aaazzz');
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+count(*)
+261
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+count(*)
+251
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+count(*)
+0
+select count(*) from t1 where a = 'aaaxxx';
+count(*)
+261
+select count(*) from t1 where a = 'aaayyy';
+count(*)
+251
+select count(*) from t1 where a = 'aaazzz';
+count(*)
+0
+insert t1 (a) values ('aaaxxx 000000');
+select count(*) from t1 where match a against ('000000');
+count(*)
+1
+update t1 set a='aaazzz' where match a against ('000000');
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+count(*)
+261
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+count(*)
+1
+update t1 set a='aaazzz' where a = 'aaaxxx';
+update t1 set a='aaaxxx' where a = 'aaayyy';
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+count(*)
+251
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+count(*)
+0
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+count(*)
+262
+drop table t1;
+CREATE TABLE t1 (
+i int(10) unsigned not null auto_increment primary key,
+a varchar(255) not null,
+FULLTEXT KEY (a)
+) ENGINE=MyISAM;
+select count(*) from t1 where match a against ('aaaxxx');
+count(*)
+260
+select count(*) from t1 where match a against ('aaayyy');
+count(*)
+250
+select count(*) from t1 where match a against ('aaazzz');
+count(*)
+255
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+count(*)
+260
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+count(*)
+250
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+count(*)
+255
+select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz');
+count(*)
+765
+select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz' in boolean mode);
+count(*)
+765
+select count(*) from t1 where match a against ('aaax*' in boolean mode);
+count(*)
+260
+select count(*) from t1 where match a against ('aaay*' in boolean mode);
+count(*)
+250
+select count(*) from t1 where match a against ('aaa*' in boolean mode);
+count(*)
+765
+insert t1 (a) values ('aaaxxx'),('aaayyy');
+insert t1 (a) values ('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz');
+select count(*) from t1 where match a against ('aaaxxx');
+count(*)
+261
+select count(*) from t1 where match a against ('aaayyy');
+count(*)
+251
+select count(*) from t1 where match a against ('aaazzz');
+count(*)
+260
+insert t1 (a) values ('aaaxxx 000000');
+select count(*) from t1 where match a against ('000000');
+count(*)
+1
+delete from t1 where match a against ('000000');
+select count(*) from t1 where match a against ('000000');
+count(*)
+0
+select count(*) from t1 where match a against ('aaaxxx');
+count(*)
+261
+delete from t1 where match a against ('aaazzz');
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+count(*)
+261
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+count(*)
+251
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+count(*)
+0
+select count(*) from t1 where a = 'aaaxxx';
+count(*)
+261
+select count(*) from t1 where a = 'aaayyy';
+count(*)
+251
+select count(*) from t1 where a = 'aaazzz';
+count(*)
+0
+insert t1 (a) values ('aaaxxx 000000');
+select count(*) from t1 where match a against ('000000');
+count(*)
+1
+update t1 set a='aaazzz' where match a against ('000000');
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+count(*)
+261
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+count(*)
+1
+update t1 set a='aaazzz' where a = 'aaaxxx';
+update t1 set a='aaaxxx' where a = 'aaayyy';
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+count(*)
+251
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+count(*)
+0
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+count(*)
+262
+drop table t1;
diff --git a/mysql-test/r/fulltext_cache.result b/mysql-test/r/fulltext_cache.result
index c489bdefeb8..6a94189d8b4 100644
--- a/mysql-test/r/fulltext_cache.result
+++ b/mysql-test/r/fulltext_cache.result
@@ -21,17 +21,17 @@ INSERT INTO t2 VALUES (5,2,'um copo de Vodka');
INSERT INTO t2 VALUES (6,2,'um chocolate Snickers');
INSERT INTO t2 VALUES (7,1,'Bife');
INSERT INTO t2 VALUES (8,1,'Pizza de Salmao');
-SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi')
+SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),8)
as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
q item id x
-aaaaaaaaa dsaass de sushi 1 1.92378664016724
-aaaaaaaaa dsaass de Bolo de Chocolate 2 0
-aaaaaaaaa dsaass de Feijoada 3 0
-aaaaaaaaa dsaass de Mousse de Chocolate 4 0
-ssde df s fsda sad er um copo de Vodka 5 0
-ssde df s fsda sad er um chocolate Snickers 6 0
-aaaaaaaaa dsaass de Bife 7 0
-aaaaaaaaa dsaass de Pizza de Salmao 8 0
+aaaaaaaaa dsaass de sushi 1 1.92378664
+aaaaaaaaa dsaass de Bolo de Chocolate 2 0.00000000
+aaaaaaaaa dsaass de Feijoada 3 0.00000000
+aaaaaaaaa dsaass de Mousse de Chocolate 4 0.00000000
+ssde df s fsda sad er um copo de Vodka 5 0.00000000
+ssde df s fsda sad er um chocolate Snickers 6 0.00000000
+aaaaaaaaa dsaass de Bife 7 0.00000000
+aaaaaaaaa dsaass de Pizza de Salmao 8 0.00000000
SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE)
as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
q item id x
@@ -43,17 +43,17 @@ ssde df s fsda sad er um copo de Vodka 5 0
ssde df s fsda sad er um chocolate Snickers 6 0
aaaaaaaaa dsaass de Bife 7 0
aaaaaaaaa dsaass de Pizza de Salmao 8 0
-SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi')
+SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),8)
as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
q item id x
-aaaaaaaaa dsaass de sushi 1 1.92378664016724
-aaaaaaaaa dsaass de Bolo de Chocolate 2 0
-aaaaaaaaa dsaass de Feijoada 3 0
-aaaaaaaaa dsaass de Mousse de Chocolate 4 0
-ssde df s fsda sad er um copo de Vodka 5 0
-ssde df s fsda sad er um chocolate Snickers 6 0
-aaaaaaaaa dsaass de Bife 7 0
-aaaaaaaaa dsaass de Pizza de Salmao 8 0
+aaaaaaaaa dsaass de sushi 1 1.92378664
+aaaaaaaaa dsaass de Bolo de Chocolate 2 0.00000000
+aaaaaaaaa dsaass de Feijoada 3 0.00000000
+aaaaaaaaa dsaass de Mousse de Chocolate 4 0.00000000
+ssde df s fsda sad er um copo de Vodka 5 0.00000000
+ssde df s fsda sad er um chocolate Snickers 6 0.00000000
+aaaaaaaaa dsaass de Bife 7 0.00000000
+aaaaaaaaa dsaass de Pizza de Salmao 8 0.00000000
SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE)
as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
q item id x
diff --git a/mysql-test/r/fulltext_distinct.result b/mysql-test/r/fulltext_distinct.result
index abb4929d0ec..de0668ff28c 100644
--- a/mysql-test/r/fulltext_distinct.result
+++ b/mysql-test/r/fulltext_distinct.result
@@ -7,14 +7,14 @@ PRIMARY KEY (id),
KEY kt(tag),
KEY kv(value(15)),
FULLTEXT KEY kvf(value)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
CREATE TABLE t2 (
id_t2 mediumint unsigned NOT NULL default '0',
id_t1 mediumint unsigned NOT NULL default '0',
field_number tinyint unsigned NOT NULL default '0',
PRIMARY KEY (id_t2,id_t1,field_number),
KEY id_t1(id_t1)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 (tag,value) VALUES ('foo123','bar111');
INSERT INTO t1 (tag,value) VALUES ('foo123','bar222');
INSERT INTO t1 (tag,value) VALUES ('bar345','baz333 ar');
diff --git a/mysql-test/r/fulltext_left_join.result b/mysql-test/r/fulltext_left_join.result
index d215ea0cea8..f3dad290525 100644
--- a/mysql-test/r/fulltext_left_join.result
+++ b/mysql-test/r/fulltext_left_join.result
@@ -16,13 +16,13 @@ author VARCHAR(255) NOT NULL
INSERT INTO t2 VALUES('123', 'moi');
INSERT INTO t2 VALUES('123', 'lui');
INSERT INTO t2 VALUES('456', 'lui');
-select match(t1.texte,t1.sujet,t1.motsclefs) against('droit')
+select round(match(t1.texte,t1.sujet,t1.motsclefs) against('droit'),5)
from t1 left join t2 on t2.id=t1.id;
-match(t1.texte,t1.sujet,t1.motsclefs) against('droit')
-0
-0
-0.67003107070923
-0
+round(match(t1.texte,t1.sujet,t1.motsclefs) against('droit'),5)
+0.00000
+0.00000
+0.67003
+0.00000
select match(t1.texte,t1.sujet,t1.motsclefs) against('droit' IN BOOLEAN MODE)
from t1 left join t2 on t2.id=t1.id;
match(t1.texte,t1.sujet,t1.motsclefs) against('droit' IN BOOLEAN MODE)
@@ -31,9 +31,9 @@ match(t1.texte,t1.sujet,t1.motsclefs) against('droit' IN BOOLEAN MODE)
1
0
drop table t1, t2;
-create table t1 (venue_id int(11) default null, venue_text varchar(255) default null, dt datetime default null) type=myisam;
+create table t1 (venue_id int(11) default null, venue_text varchar(255) default null, dt datetime default null) engine=myisam;
insert into t1 (venue_id, venue_text, dt) values (1, 'a1', '2003-05-23 19:30:00'),(null, 'a2', '2003-05-23 19:30:00');
-create table t2 (name varchar(255) not null default '', entity_id int(11) not null auto_increment, primary key (entity_id), fulltext key name (name)) type=myisam;
+create table t2 (name varchar(255) not null default '', entity_id int(11) not null auto_increment, primary key (entity_id), fulltext key name (name)) engine=myisam;
insert into t2 (name, entity_id) values ('aberdeen town hall', 1), ('glasgow royal concert hall', 2), ('queen\'s hall, edinburgh', 3);
select * from t1 left join t2 on venue_id = entity_id where match(name) against('aberdeen' in boolean mode) and dt = '2003-05-23 19:30:00';
venue_id venue_text dt name entity_id
diff --git a/mysql-test/r/fulltext_multi.result b/mysql-test/r/fulltext_multi.result
index 968b00020e2..289ee004395 100644
--- a/mysql-test/r/fulltext_multi.result
+++ b/mysql-test/r/fulltext_multi.result
@@ -11,19 +11,19 @@ FULLTEXT KEY a(b,c)
INSERT INTO t1 VALUES (1,'lala lolo lili','oooo aaaa pppp');
INSERT INTO t1 VALUES (2,'asdf fdsa','lkjh fghj');
INSERT INTO t1 VALUES (3,'qpwoei','zmxnvb');
-SELECT a, MATCH b AGAINST ('lala lkjh') FROM t1;
-a MATCH b AGAINST ('lala lkjh')
-1 0.67003107070923
-2 0
-3 0
-SELECT a, MATCH c AGAINST ('lala lkjh') FROM t1;
-a MATCH c AGAINST ('lala lkjh')
-1 0
-2 0.67756325006485
-3 0
-SELECT a, MATCH b,c AGAINST ('lala lkjh') FROM t1;
-a MATCH b,c AGAINST ('lala lkjh')
-1 0.64840710163116
-2 0.66266459226608
-3 0
+SELECT a, round(MATCH b AGAINST ('lala lkjh'),5) FROM t1;
+a round(MATCH b AGAINST ('lala lkjh'),5)
+1 0.67003
+2 0.00000
+3 0.00000
+SELECT a, round(MATCH c AGAINST ('lala lkjh'),5) FROM t1;
+a round(MATCH c AGAINST ('lala lkjh'),5)
+1 0.00000
+2 0.67756
+3 0.00000
+SELECT a, round(MATCH b,c AGAINST ('lala lkjh'),5) FROM t1;
+a round(MATCH b,c AGAINST ('lala lkjh'),5)
+1 0.64841
+2 0.66266
+3 0.00000
drop table t1;
diff --git a/mysql-test/r/fulltext_order_by.result b/mysql-test/r/fulltext_order_by.result
index bfee9eba280..c6c42fa2e8b 100644
--- a/mysql-test/r/fulltext_order_by.result
+++ b/mysql-test/r/fulltext_order_by.result
@@ -6,53 +6,53 @@ FULLTEXT(message)
) comment = 'original testcase by sroussey@network54.com';
INSERT INTO t1 (message) VALUES ("Testing"),("table"),("testbug"),
("steve"),("is"),("cool"),("steve is cool");
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve');
-a MATCH (message) AGAINST ('steve')
-4 0.90587323904037
-7 0.89568990468979
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve');
+a FORMAT(MATCH (message) AGAINST ('steve'),6)
+4 0.905873
+7 0.895690
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve');
a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
4 1
7 1
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
-a MATCH (message) AGAINST ('steve')
-4 0.90587323904037
-7 0.89568990468979
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
+a FORMAT(MATCH (message) AGAINST ('steve'),6)
+4 0.905873
+7 0.895690
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
4 1
7 1
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a;
-a MATCH (message) AGAINST ('steve')
-4 0.90587323904037
-7 0.89568990468979
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a;
+a FORMAT(MATCH (message) AGAINST ('steve'),6)
+4 0.905873
+7 0.895690
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a;
a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
4 1
7 1
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC;
-a MATCH (message) AGAINST ('steve')
-7 0.89568990468979
-4 0.90587323904037
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC;
+a FORMAT(MATCH (message) AGAINST ('steve'),6)
+7 0.895690
+4 0.905873
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a DESC;
a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
7 1
4 1
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1;
-a MATCH (message) AGAINST ('steve')
-7 0.89568990468979
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1;
+a FORMAT(MATCH (message) AGAINST ('steve'),6)
+7 0.895690
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY 1;
a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
7 1
-SELECT a, MATCH (message) AGAINST ('steve') as rel FROM t1 ORDER BY rel;
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) as rel FROM t1 ORDER BY rel;
a rel
-1 0
-2 0
-3 0
-5 0
-6 0
-7 0.89568990468979
-4 0.90587323904037
+1 0.000000
+2 0.000000
+3 0.000000
+5 0.000000
+6 0.000000
+7 0.895690
+4 0.905873
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel;
a rel
1 0
diff --git a/mysql-test/r/fulltext_var.result b/mysql-test/r/fulltext_var.result
index dda8e332fba..50afea2a500 100644
--- a/mysql-test/r/fulltext_var.result
+++ b/mysql-test/r/fulltext_var.result
@@ -1,7 +1,38 @@
+drop table if exists t1;
show variables like "ft\_%";
Variable_name Value
ft_boolean_syntax + -><()~*:""&|
+ft_max_word_len 84
ft_min_word_len 4
-ft_max_word_len 254
-ft_max_word_len_for_sort 20
+ft_query_expansion_limit 20
ft_stopword_file (built-in)
+create table t1 (b text not null);
+insert t1 values ('aaaaaa bbbbbb cccccc');
+insert t1 values ('bbbbbb cccccc');
+insert t1 values ('aaaaaa cccccc');
+select * from t1 where match b against ('+aaaaaa bbbbbb' in boolean mode);
+b
+aaaaaa bbbbbb cccccc
+aaaaaa cccccc
+set ft_boolean_syntax=' +-><()~*:""&|';
+ERROR HY000: Variable 'ft_boolean_syntax' is a GLOBAL variable and should be set with SET GLOBAL
+set global ft_boolean_syntax=' +-><()~*:""&|';
+select * from t1 where match b against ('+aaaaaa bbbbbb' in boolean mode);
+b
+aaaaaa bbbbbb cccccc
+bbbbbb cccccc
+set global ft_boolean_syntax='@ -><()~*:""&|';
+select * from t1 where match b against ('+aaaaaa bbbbbb' in boolean mode);
+b
+aaaaaa bbbbbb cccccc
+bbbbbb cccccc
+aaaaaa cccccc
+select * from t1 where match b against ('+aaaaaa @bbbbbb' in boolean mode);
+b
+aaaaaa bbbbbb cccccc
+bbbbbb cccccc
+set global ft_boolean_syntax='@ -><()~*:""@|';
+ERROR 42000: Variable 'ft_boolean_syntax' can't be set to the value of '@ -><()~*:""@|'
+set global ft_boolean_syntax='+ -><()~*:""@!|';
+ERROR 42000: Variable 'ft_boolean_syntax' can't be set to the value of '+ -><()~*:""@!|'
+drop table t1;
diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result
new file mode 100644
index 00000000000..9bc8e417e19
--- /dev/null
+++ b/mysql-test/r/func_compress.result
@@ -0,0 +1,74 @@
+select @test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ';
+@test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa '
+string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+select length(@test_compress_string);
+length(@test_compress_string)
+117
+select uncompress(compress(@test_compress_string));
+uncompress(compress(@test_compress_string))
+string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+explain extended select uncompress(compress(@test_compress_string));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select sql_no_cache uncompress(compress((@test_compress_string))) AS `uncompress(compress(@test_compress_string))`
+select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
+uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)
+1
+explain extended select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select sql_no_cache (uncompressed_length(compress((@test_compress_string))) = length((@test_compress_string))) AS `uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)`
+select uncompressed_length(compress(@test_compress_string));
+uncompressed_length(compress(@test_compress_string))
+117
+select length(compress(@test_compress_string))<length(@test_compress_string);
+length(compress(@test_compress_string))<length(@test_compress_string)
+1
+create table t1 (a text, b char(255), c char(4)) engine=myisam;
+insert into t1 (a,b,c) values (compress(@test_compress_string),compress(@test_compress_string),'d ');
+select uncompress(a) from t1;
+uncompress(a)
+string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+select uncompress(b) from t1;
+uncompress(b)
+string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+select concat('|',c,'|') from t1;
+concat('|',c,'|')
+|d|
+drop table t1;
+select compress("");
+compress("")
+
+select uncompress("");
+uncompress("")
+
+select uncompress(compress(""));
+uncompress(compress(""))
+
+select uncompressed_length("");
+uncompressed_length("")
+0
+create table t1 (a text);
+insert t1 values (compress(null)), ('A\0\0\0BBBBBBBB'), (compress(space(50000))), (space(50000));
+select length(a) from t1;
+length(a)
+NULL
+12
+76
+50000
+select length(uncompress(a)) from t1;
+length(uncompress(a))
+NULL
+NULL
+50000
+NULL
+Warnings:
+Error 1259 ZLIB: Input data corrupted
+Error 1256 Uncompressed data size too large; the maximum size is 1048576 (probably, length of uncompressed data was corrupted)
+drop table t1;
+set @@max_allowed_packet=1048576*100;
+select compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null;
+compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null
+0
diff --git a/mysql-test/r/func_concat.result b/mysql-test/r/func_concat.result
index 17afd49b54c..0bd53b32dd7 100644
--- a/mysql-test/r/func_concat.result
+++ b/mysql-test/r/func_concat.result
@@ -26,3 +26,45 @@ FROM t1 GROUP BY new LIMIT 1;
number alpha new
1413006 idlfmv 1413006<------------------>idlfmv
drop table t1;
+create table t1 (a char(4), b double, c date, d tinyint(4));
+insert into t1 values ('AAAA', 105, '2003-03-01', 1);
+select * from t1 where concat(A,C,B,D) = 'AAAA2003-03-011051';
+a b c d
+AAAA 105 2003-03-01 1
+drop table t1;
+select 'a' union select concat('a', -4);
+a
+a
+a-4
+select 'a' union select concat('a', -4.5);
+a
+a
+a-4.5
+select 'a' union select concat('a', -(4 + 1));
+a
+a
+a-5
+select 'a' union select concat('a', 4 - 5);
+a
+a
+a-1
+select 'a' union select concat('a', -'3');
+a
+a
+a-3
+select 'a' union select concat('a', -concat('3',4));
+a
+a
+a-34
+select 'a' union select concat('a', -0);
+a
+a
+a0
+select 'a' union select concat('a', -0.0);
+a
+a
+a0.0
+select 'a' union select concat('a', -0.0000);
+a
+a
+a0.0000
diff --git a/mysql-test/r/func_crypt.result b/mysql-test/r/func_crypt.result
index 96bbaa6cae7..2ee3e770a2e 100644
--- a/mysql-test/r/func_crypt.result
+++ b/mysql-test/r/func_crypt.result
@@ -1,14 +1,8 @@
+drop table if exists t1;
select length(encrypt('foo', 'ff')) <> 0;
length(encrypt('foo', 'ff')) <> 0
1
-select old_password('test'), password('test');
-old_password('test') password('test')
-378b243e220ca493 378b243e220ca493
-select length(encrypt('test')), encrypt('test','aa');
-length(encrypt('test')) encrypt('test','aa')
-13 aaqPiZY5xR5l.
-drop table if exists t1;
-create table t1 (name varchar(50), pw varchar(16));
+create table t1 (name varchar(50), pw varchar(64));
insert into t1 values ('tom', password('my_pass'));
set @pass='my_pass';
select name from t1 where name='tom' and pw=password(@pass);
@@ -17,3 +11,84 @@ tom
select name from t1 where name='tom' and pw=password(@undefined);
name
drop table t1;
+select password('abc');
+password('abc')
+*0D3CED9BEC10A777AEC23CCC353A8C08A633045E
+select password('');
+password('')
+
+select old_password('abc');
+old_password('abc')
+7cd2b5942be28759
+select old_password('');
+old_password('')
+
+select password('gabbagabbahey');
+password('gabbagabbahey')
+*B0F99D2963660DD7E16B751EC9EE2F17B6A68FA6
+select old_password('idkfa');
+old_password('idkfa')
+5c078dc54ca0fcca
+select length(password('1'));
+length(password('1'))
+41
+select length(encrypt('test'));
+length(encrypt('test'))
+13
+select encrypt('test','aa');
+encrypt('test','aa')
+aaqPiZY5xR5l.
+select old_password(NULL);
+old_password(NULL)
+NULL
+select password(NULL);
+password(NULL)
+NULL
+set global old_passwords=on;
+select password('');
+password('')
+
+select old_password('');
+old_password('')
+
+select password('idkfa');
+password('idkfa')
+*B669C9DAC3AA6F2254B03CDEF8DFDD6B2D1054BA
+select old_password('idkfa');
+old_password('idkfa')
+5c078dc54ca0fcca
+set old_passwords=on;
+select password('idkfa');
+password('idkfa')
+5c078dc54ca0fcca
+select old_password('idkfa');
+old_password('idkfa')
+5c078dc54ca0fcca
+set global old_passwords=off;
+select password('idkfa');
+password('idkfa')
+5c078dc54ca0fcca
+select old_password('idkfa');
+old_password('idkfa')
+5c078dc54ca0fcca
+set old_passwords=off;
+select password('idkfa ');
+password('idkfa ')
+*2DC31D90647B4C1ABC9231563D2236E96C9A2DB2
+select password('idkfa');
+password('idkfa')
+*B669C9DAC3AA6F2254B03CDEF8DFDD6B2D1054BA
+select password(' idkfa');
+password(' idkfa')
+*12B099E56BB7FE8D43C78FD834A9D1D11178D045
+select old_password('idkfa');
+old_password('idkfa')
+5c078dc54ca0fcca
+select old_password(' i d k f a ');
+old_password(' i d k f a ')
+5c078dc54ca0fcca
+explain extended select password('idkfa '), old_password('idkfa');
+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 password(_latin1'idkfa ') AS `password('idkfa ')`,old_password(_latin1'idkfa') AS `old_password('idkfa')`
diff --git a/mysql-test/r/func_date_add.result b/mysql-test/r/func_date_add.result
index acdf2c5d7be..f4091ff4c0e 100644
--- a/mysql-test/r/func_date_add.result
+++ b/mysql-test/r/func_date_add.result
@@ -6,7 +6,7 @@ hits int(10) unsigned DEFAULT '0' NOT NULL,
sessions int(10) unsigned DEFAULT '0' NOT NULL,
ts timestamp(14),
PRIMARY KEY (visitor_id,group_id)
-)/*! type=MyISAM */;
+)/*! engine=MyISAM */;
INSERT INTO t1 VALUES (465931136,7,2,2,20000318160952);
INSERT INTO t1 VALUES (173865424,2,2,2,20000318233615);
INSERT INTO t1 VALUES (173865424,8,2,2,20000318233615);
@@ -31,17 +31,17 @@ INSERT INTO t1 VALUES (357917728,7,2,2,20000319145027);
select visitor_id,max(ts) as mts from t1 group by visitor_id
having mts < DATE_SUB(NOW(),INTERVAL 3 MONTH);
visitor_id mts
-48985536 20000319013932
-173865424 20000318233615
-357917728 20000319145027
-465931136 20000318160953
-1092858576 20000319013445
+48985536 2000-03-19 01:39:32
+173865424 2000-03-18 23:36:15
+357917728 2000-03-19 14:50:27
+465931136 2000-03-18 16:09:53
+1092858576 2000-03-19 01:34:45
select visitor_id,max(ts) as mts from t1 group by visitor_id
having DATE_ADD(mts,INTERVAL 3 MONTH) < NOW();
visitor_id mts
-48985536 20000319013932
-173865424 20000318233615
-357917728 20000319145027
-465931136 20000318160953
-1092858576 20000319013445
+48985536 2000-03-19 01:39:32
+173865424 2000-03-18 23:36:15
+357917728 2000-03-19 14:50:27
+465931136 2000-03-18 16:09:53
+1092858576 2000-03-19 01:34:45
drop table t1;
diff --git a/mysql-test/r/func_default.result b/mysql-test/r/func_default.result
new file mode 100644
index 00000000000..2993d79a870
--- /dev/null
+++ b/mysql-test/r/func_default.result
@@ -0,0 +1,18 @@
+drop table if exists t1,t2;
+create table t1(str varchar(10) default 'def',strnull varchar(10),intg int default '10',rel double default '3.14');
+insert into t1 values ('','',0,0.0);
+select default(str), default(strnull), default(intg), default(rel) from t1;
+default(str) default(strnull) default(intg) default(rel)
+def NULL 10 3.14
+explain extended select default(str), default(strnull), default(intg), default(rel) from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 1
+Warnings:
+Note 1003 select default(test.t1.str) AS `default(str)`,default(test.t1.strnull) AS `default(strnull)`,default(test.t1.intg) AS `default(intg)`,default(test.t1.rel) AS `default(rel)` from test.t1
+select * from t1 where str <> default(str);
+str strnull intg rel
+ 0 0
+explain select * from t1 where str <> default(str);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 1
+drop table t1;
diff --git a/mysql-test/r/func_encrypt.result b/mysql-test/r/func_encrypt.result
index 39c734999b2..d32e67fe7d5 100644
--- a/mysql-test/r/func_encrypt.result
+++ b/mysql-test/r/func_encrypt.result
@@ -134,3 +134,8 @@ NULL
select hex(des_decrypt(des_encrypt("hello","hidden")));
hex(des_decrypt(des_encrypt("hello","hidden")))
NULL
+explain extended select des_decrypt(des_encrypt("hello",4),'password2'), des_decrypt(des_encrypt("hello","hidden"));
+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 des_decrypt(des_encrypt(_latin1'hello',4),_latin1'password2') AS `des_decrypt(des_encrypt("hello",4),'password2')`,des_decrypt(des_encrypt(_latin1'hello',_latin1'hidden')) AS `des_decrypt(des_encrypt("hello","hidden"))`
diff --git a/mysql-test/r/func_equal.result b/mysql-test/r/func_equal.result
index 32a911eedf8..352b76f2744 100644
--- a/mysql-test/r/func_equal.result
+++ b/mysql-test/r/func_equal.result
@@ -1,3 +1,4 @@
+drop table if exists t1,t2;
select 0<=>0,0.0<=>0.0,"A"<=>"A",NULL<=>NULL;
0<=>0 0.0<=>0.0 "A"<=>"A" NULL<=>NULL
1 1 1 1
@@ -10,7 +11,6 @@ select 1.0<=>0.0,0.0<=>NULL,NULL<=>0.0;
select "A"<=>"B","A"<=>NULL,NULL<=>"A";
"A"<=>"B" "A"<=>NULL NULL<=>"A"
0 0 0
-drop table if exists t1,t2;
create table t1 (id int, value int);
create table t2 (id int, value int);
insert into t1 values (1,null);
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
new file mode 100644
index 00000000000..aa202823c77
--- /dev/null
+++ b/mysql-test/r/func_gconcat.result
@@ -0,0 +1,459 @@
+drop table if exists t1, t2;
+create table t1 (grp int, a bigint unsigned, c char(10) not null, d char(10) not null);
+insert into t1 values (1,1,"a","a");
+insert into t1 values (2,2,"b","a");
+insert into t1 values (2,3,"c","b");
+insert into t1 values (3,4,"E","a");
+insert into t1 values (3,5,"C","b");
+insert into t1 values (3,6,"D","b");
+insert into t1 values (3,7,"d","d");
+insert into t1 values (3,8,"d","d");
+insert into t1 values (3,9,"D","c");
+select grp,group_concat(c) from t1 group by grp;
+grp group_concat(c)
+1 a
+2 b,c
+3 E,C,D,d,d,D
+explain extended select grp,group_concat(c) from t1 group by grp;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using filesort
+Warnings:
+Note 1003 select test.t1.grp AS `grp`,group_concat(test.t1.c separator ',') AS `group_concat(c)` from test.t1 group by test.t1.grp
+select grp,group_concat(a,c) from t1 group by grp;
+grp group_concat(a,c)
+1 1a
+2 2b,3c
+3 4E,5C,6D,7d,8d,9D
+select grp,group_concat("(",a,":",c,")") from t1 group by grp;
+grp group_concat("(",a,":",c,")")
+1 (1:a)
+2 (2:b),(3:c)
+3 (4:E),(5:C),(6:D),(7:d),(8:d),(9:D)
+select grp,group_concat(c separator ",") from t1 group by grp;
+grp group_concat(c separator ",")
+1 a
+2 b,c
+3 E,C,D,d,d,D
+select grp,group_concat(c separator "---->") from t1 group by grp;
+grp group_concat(c separator "---->")
+1 a
+2 b---->c
+3 E---->C---->D---->d---->d---->D
+select grp,group_concat(c order by c) from t1 group by grp;
+grp group_concat(c order by c)
+1 a
+2 b,c
+3 C,D,d,d,D,E
+select grp,group_concat(c order by c desc) from t1 group by grp;
+grp group_concat(c order by c desc)
+1 a
+2 c,b
+3 E,D,d,d,D,C
+select grp,group_concat(d order by a) from t1 group by grp;
+grp group_concat(d order by a)
+1 a
+2 a,b
+3 a,b,b,d,d,c
+select grp,group_concat(d order by a desc) from t1 group by grp;
+grp group_concat(d order by a desc)
+1 a
+2 b,a
+3 c,d,d,b,b,a
+select grp,group_concat(a order by a,d+c-ascii(c)-a) from t1 group by grp;
+grp group_concat(a order by a,d+c-ascii(c)-a)
+1 1
+2 2,3
+3 4,5,6,7,8,9
+select grp,group_concat(a order by d+c-ascii(c),a) from t1 group by grp;
+grp group_concat(a order by d+c-ascii(c),a)
+1 1
+2 3,2
+3 7,8,4,6,9,5
+select grp,group_concat(c order by 1) from t1 group by grp;
+grp group_concat(c order by 1)
+1 a
+2 b,c
+3 C,D,d,d,D,E
+select grp,group_concat(c order by "c") from t1 group by grp;
+grp group_concat(c order by "c")
+1 a
+2 b,c
+3 C,D,d,d,D,E
+select grp,group_concat(distinct c order by c) from t1 group by grp;
+grp group_concat(distinct c order by c)
+1 a
+2 b,c
+3 C,D,E
+select grp,group_concat(distinct c order by c desc) from t1 group by grp;
+grp group_concat(distinct c order by c desc)
+1 a
+2 c,b
+3 E,D,C
+explain extended select grp,group_concat(distinct c order by c desc) from t1 group by grp;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using filesort
+Warnings:
+Note 1003 select test.t1.grp AS `grp`,group_concat(distinct test.t1.c order by test.t1.c separator ',') AS `group_concat(distinct c order by c desc)` from test.t1 group by test.t1.grp
+select grp,group_concat(c order by c separator ",") from t1 group by grp;
+grp group_concat(c order by c separator ",")
+1 a
+2 b,c
+3 C,D,d,d,D,E
+select grp,group_concat(c order by c desc separator ",") from t1 group by grp;
+grp group_concat(c order by c desc separator ",")
+1 a
+2 c,b
+3 E,D,d,d,D,C
+select grp,group_concat(distinct c order by c separator ",") from t1 group by grp;
+grp group_concat(distinct c order by c separator ",")
+1 a
+2 b,c
+3 C,D,E
+explain extended select grp,group_concat(distinct c order by c separator ",") from t1 group by grp;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using filesort
+Warnings:
+Note 1003 select test.t1.grp AS `grp`,group_concat(distinct test.t1.c order by test.t1.c separator ',') AS `group_concat(distinct c order by c separator ",")` from test.t1 group by test.t1.grp
+select grp,group_concat(distinct c order by c desc separator ",") from t1 group by grp;
+grp group_concat(distinct c order by c desc separator ",")
+1 a
+2 c,b
+3 E,D,C
+select grp,group_concat(c order by grp desc) from t1 group by grp order by grp;
+grp group_concat(c order by grp desc)
+1 a
+2 c,b
+3 D,d,d,D,C,E
+select grp, group_concat(a separator "")+0 from t1 group by grp;
+grp group_concat(a separator "")+0
+1 1
+2 23
+3 456789
+select grp, group_concat(a separator "")+0.0 from t1 group by grp;
+grp group_concat(a separator "")+0.0
+1 1.0
+2 23.0
+3 456789.0
+select grp, ROUND(group_concat(a separator "")) from t1 group by grp;
+grp ROUND(group_concat(a separator ""))
+1 1
+2 23
+3 456789
+drop table t1;
+create table t1 (grp int, c char(10));
+insert into t1 values (1,NULL),(2,"b"),(2,NULL),(3,"E"),(3,NULL),(3,"D"),(3,NULL),(3,NULL),(3,"D"),(4,""),(5,NULL);
+select grp,group_concat(c order by c) from t1 group by grp;
+grp group_concat(c order by c)
+1 NULL
+2 b
+3 D,D,E
+4
+5 NULL
+set group_concat_max_len = 4;
+select grp,group_concat(c) from t1 group by grp;
+grp group_concat(c)
+1 NULL
+2 b
+3 D,D,
+4
+5 NULL
+Warnings:
+Warning 1260 1 line(s) were cut by GROUP_CONCAT()
+show warnings;
+Level Code Message
+Warning 1260 1 line(s) were cut by GROUP_CONCAT()
+set group_concat_max_len = 1024;
+select group_concat(sum(a)) from t1 group by grp;
+ERROR HY000: Invalid use of group function
+select grp,group_concat(c order by 2) from t1 group by grp;
+ERROR 42S22: Unknown column '2' in 'group statement'
+drop table t1;
+create table t1 ( URL_ID int(11), URL varchar(80));
+create table t2 ( REQ_ID int(11), URL_ID int(11));
+insert into t1 values (4,'www.host.com'), (5,'www.google.com'),(5,'www.help.com');
+insert into t2 values (1,4), (5,4), (5,5);
+select REQ_ID, Group_Concat(URL) as URL from t1, t2 where
+t2.URL_ID = t1.URL_ID group by REQ_ID;
+REQ_ID URL
+1 X
+5 X,X,X
+select REQ_ID, Group_Concat(URL) as URL, Min(t1.URL_ID) urll,
+Max(t1.URL_ID) urlg from t1, t2 where t2.URL_ID = t1.URL_ID group by REQ_ID;
+REQ_ID URL urll urlg
+1 X 4 4
+5 X,X,X 4 5
+drop table t1;
+drop table t2;
+create table t1 (id int, name varchar(16));
+insert into t1 values (1,'longername'),(1,'evenlongername');
+select ifnull(group_concat(concat(t1.id, ':', t1.name)), 'shortname') as 'without distinct: how it should be' from t1;
+without distinct: how it should be
+1:longername,1:evenlongername
+select distinct ifnull(group_concat(concat(t1.id, ':', t1.name)), 'shortname') as 'with distinct: cutoff at length of shortname' from t1;
+with distinct: cutoff at length of shortname
+1:longername,1:evenlongername
+drop table t1;
+create table t1(id int);
+create table t2(id int);
+insert into t1 values(0),(1);
+select group_concat(t1.id) FROM t1,t2;
+group_concat(t1.id)
+NULL
+drop table t1;
+drop table t2;
+create table t1 (bar varchar(32));
+insert into t1 values('test1'),('test2');
+select group_concat(bar order by concat(bar,bar)) from t1;
+group_concat(bar order by concat(bar,bar))
+test1,test2
+select group_concat(bar order by concat(bar,bar) desc) from t1;
+group_concat(bar order by concat(bar,bar) desc)
+test2,test1
+select bar from t1 having group_concat(bar)='';
+bar
+select bar from t1 having instr(group_concat(bar), "test") > 0;
+bar
+test1
+select bar from t1 having instr(group_concat(bar order by concat(bar,bar) desc), "test2,test1") > 0;
+bar
+test1
+drop table t1;
+create table t1 (a int, a1 varchar(10));
+create table t2 (a0 int);
+insert into t1 values (0,"a"),(0,"b"),(1,"c");
+insert into t2 values (1),(2),(3);
+select group_concat(a1 order by (t1.a IN (select a0 from t2))) from t1;
+group_concat(a1 order by (t1.a IN (select a0 from t2)))
+b,a,c
+select group_concat(a1 order by (t1.a)) from t1;
+group_concat(a1 order by (t1.a))
+b,a,c
+drop table t1, t2;
+CREATE TABLE t1 (id1 tinyint(4) NOT NULL, id2 tinyint(4) NOT NULL);
+INSERT INTO t1 VALUES (1, 1),(1, 2),(1, 3),(1, 4),(1, 5),(2, 1),(2, 2),(2, 3);
+CREATE TABLE t2 (id1 tinyint(4) NOT NULL);
+INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
+SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 AND t1.id1=1 GROUP BY t1.id1;
+id1 concat_id
+1 1,2,3,4,5
+SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1;
+id1 concat_id
+1 1,2,3,4,5
+2 1,2,3
+SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY t1.id2 DESC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1;
+id1 concat_id
+1 5,4,3,2,1
+2 3,2,1
+SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY 6-t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1;
+id1 concat_id
+1 5,4,3,2,1
+2 3,2,1
+SELECT t1.id1, GROUP_CONCAT(t1.id2,6-t1.id2 ORDER BY 6-t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1;
+id1 concat_id
+1 51,42,33,24,15
+2 33,24,15
+SELECT t1.id1, GROUP_CONCAT(t1.id2,6-t1.id2 ORDER BY 6-t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1;
+id1 concat_id
+1 51,42,33,24,15
+2 33,24,15
+SELECT t1.id1, GROUP_CONCAT(t1.id2,"/",6-t1.id2 ORDER BY 1+0,6-t1.id2,t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1;
+id1 concat_id
+1 5/1,4/2,3/3,2/4,1/5
+2 3/3,2/4,1/5
+drop table t1,t2;
+create table t1 (s1 char(10), s2 int not null);
+insert into t1 values ('a',2),('b',2),('c',1),('a',3),('b',4),('c',4);
+select distinct s1 from t1 order by s2,s1;
+s1
+c
+a
+b
+select group_concat(distinct s1) from t1;
+group_concat(distinct s1)
+a,b,c
+select group_concat(distinct s1 order by s2) from t1 where s2 < 4;
+group_concat(distinct s1 order by s2)
+c,b,a
+select group_concat(distinct s1 order by s2) from t1;
+group_concat(distinct s1 order by s2)
+c,b,a,c
+drop table t1;
+create table t1 (a int, c int);
+insert into t1 values (1, 2), (2, 3), (2, 4), (3, 5);
+create table t2 (a int, c int);
+insert into t2 values (1, 5), (2, 4), (3, 3), (3,3);
+select group_concat(c) from t1;
+group_concat(c)
+2,3,4,5
+select group_concat(c order by (select c from t2 where t2.a=t1.a limit 1)) as grp from t1;
+grp
+5,4,3,2
+select group_concat(c order by (select mid(group_concat(c order by a),1,5) from t2 where t2.a=t1.a)) as grp from t1;
+grp
+5,4,3,2
+select group_concat(c order by (select mid(group_concat(c order by a),1,5) from t2 where t2.a=t1.a) desc) as grp from t1;
+grp
+2,4,3,5
+select t1.a, group_concat(c order by (select c from t2 where t2.a=t1.a limit 1)) as grp from t1 group by 1;
+a grp
+1 2
+2 4,3
+3 5
+select t1.a, group_concat(c order by (select mid(group_concat(c order by a),1,5) from t2 where t2.a=t1.a)) as grp from t1 group by 1;
+a grp
+1 2
+2 4,3
+3 5
+select t1.a, group_concat(c order by (select mid(group_concat(c order by a),1,5) from t2 where t2.a=t1.a) desc) as grp from t1 group by 1;
+a grp
+1 2
+2 4,3
+3 5
+select a,c,(select group_concat(c order by a) from t2 where a=t1.a) as grp from t1 order by grp;
+a c grp
+3 5 3,3
+2 3 4
+2 4 4
+1 2 5
+drop table t1,t2;
+CREATE TABLE t1 ( a int );
+CREATE TABLE t2 ( a int );
+INSERT INTO t1 VALUES (1), (2);
+INSERT INTO t2 VALUES (1), (2);
+SELECT GROUP_CONCAT(t1.a*t2.a ORDER BY t2.a) FROM t1, t2 GROUP BY t1.a;
+GROUP_CONCAT(t1.a*t2.a ORDER BY t2.a)
+1,2
+2,4
+DROP TABLE t1, t2;
+CREATE TABLE t1 (a char(4));
+INSERT INTO t1 VALUES ('John'), ('Anna'), ('Bill');
+SELECT GROUP_CONCAT(a SEPARATOR '||') AS names FROM t1
+HAVING names LIKE '%An%';
+names
+John||Anna||Bill
+SELECT GROUP_CONCAT(a SEPARATOR '###') AS names FROM t1
+HAVING LEFT(names, 1) ='J';
+names
+John###Anna###Bill
+DROP TABLE t1;
+CREATE TABLE t1 ( a int, b TEXT );
+INSERT INTO t1 VALUES (1,'First Row'), (2,'Second Row');
+SELECT GROUP_CONCAT(b ORDER BY b) FROM t1 GROUP BY a;
+GROUP_CONCAT(b ORDER BY b)
+First Row
+Second Row
+DROP TABLE t1;
+CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES (1),(2),(3);
+CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a),
+CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2);
+SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz;
+a_id b_list
+1 1,2,3
+2 4,5
+3 NULL
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (A_ID INT NOT NULL,A_DESC CHAR(3) NOT NULL,PRIMARY KEY (A_ID));
+INSERT INTO t1 VALUES (1,'ABC'), (2,'EFG'), (3,'HIJ');
+CREATE TABLE t2 (A_ID INT NOT NULL,B_DESC CHAR(3) NOT NULL,PRIMARY KEY (A_ID,B_DESC));
+INSERT INTO t2 VALUES (1,'A'),(1,'B'),(3,'F');
+SELECT t1.A_ID, GROUP_CONCAT(t2.B_DESC) AS B_DESC FROM t1 LEFT JOIN t2 ON t1.A_ID=t2.A_ID GROUP BY t1.A_ID ORDER BY t1.A_DESC;
+A_ID B_DESC
+1 A,B
+2 NULL
+3 F
+DROP TABLE t1;
+DROP TABLE t2;
+create table t1 (a int, b text);
+insert into t1 values (1, 'bb'), (1, 'ccc'), (1, 'a'), (1, 'bb'), (1, 'ccc');
+insert into t1 values (2, 'BB'), (2, 'CCC'), (2, 'A'), (2, 'BB'), (2, 'CCC');
+select group_concat(b) from t1 group by a;
+group_concat(b)
+bb,ccc,a,bb,ccc
+BB,CCC,A,BB,CCC
+select group_concat(distinct b) from t1 group by a;
+group_concat(distinct b)
+bb,ccc,a
+BB,CCC,A
+select group_concat(b order by b) from t1 group by a;
+group_concat(b order by b)
+a,bb,bb,ccc,ccc
+A,BB,BB,CCC,CCC
+select group_concat(distinct b order by b) from t1 group by a;
+group_concat(distinct b order by b)
+a,bb,ccc
+A,BB,CCC
+set local group_concat_max_len=4;
+select group_concat(b) from t1 group by a;
+group_concat(b)
+bb,c
+BB,C
+Warnings:
+Warning 1260 2 line(s) were cut by GROUP_CONCAT()
+select group_concat(distinct b) from t1 group by a;
+group_concat(distinct b)
+bb,c
+BB,C
+Warnings:
+Warning 1260 2 line(s) were cut by GROUP_CONCAT()
+select group_concat(b order by b) from t1 group by a;
+group_concat(b order by b)
+a,bb
+A,BB
+Warnings:
+Warning 1260 2 line(s) were cut by GROUP_CONCAT()
+select group_concat(distinct b order by b) from t1 group by a;
+group_concat(distinct b order by b)
+a,bb
+A,BB
+Warnings:
+Warning 1260 2 line(s) were cut by GROUP_CONCAT()
+insert into t1 values (1, concat(repeat('1', 300), '2')),
+(1, concat(repeat('1', 300), '2')), (1, concat(repeat('0', 300), '1')),
+(2, concat(repeat('1', 300), '2')), (2, concat(repeat('1', 300), '2')),
+(2, concat(repeat('0', 300), '1'));
+set local group_concat_max_len=1024;
+select group_concat(b) from t1 group by a;
+group_concat(b)
+bb,ccc,a,bb,ccc,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
+BB,CCC,A,BB,CCC,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
+select group_concat(distinct b) from t1 group by a;
+group_concat(distinct b)
+bb,ccc,a,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
+BB,CCC,A,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
+select group_concat(b order by b) from t1 group by a;
+group_concat(b order by b)
+0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,a,bb,bb,ccc,ccc
+0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,A,BB,BB,CCC,CCC
+select group_concat(distinct b order by b) from t1 group by a;
+group_concat(distinct b order by b)
+0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,a,bb,ccc
+0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,A,BB,CCC
+set local group_concat_max_len=400;
+select group_concat(b) from t1 group by a;
+group_concat(b)
+bb,ccc,a,bb,ccc,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,1111111111111111111111111111111111111111111111111111111111111111111111111111111111
+BB,CCC,A,BB,CCC,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,1111111111111111111111111111111111111111111111111111111111111111111111111111111111
+Warnings:
+Warning 1260 2 line(s) were cut by GROUP_CONCAT()
+select group_concat(distinct b) from t1 group by a;
+group_concat(distinct b)
+bb,ccc,a,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+BB,CCC,A,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+Warnings:
+Warning 1260 2 line(s) were cut by GROUP_CONCAT()
+select group_concat(b order by b) from t1 group by a;
+group_concat(b order by b)
+0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
+0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
+Warnings:
+Warning 1260 2 line(s) were cut by GROUP_CONCAT()
+select group_concat(distinct b order by b) from t1 group by a;
+group_concat(distinct b order by b)
+0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
+0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
+Warnings:
+Warning 1260 2 line(s) were cut by GROUP_CONCAT()
+drop table t1;
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index ef29d0f2f5b..4bb79a1cb41 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -42,21 +42,21 @@ insert into t1 values (null,null,'');
select count(distinct a),count(distinct grp) from t1;
count(distinct a) count(distinct grp)
6 3
-select sum(all a),count(all a),avg(all a),std(all a),bit_or(all a),bit_and(all a),min(all a),max(all a),min(all c),max(all c) from t1;
-sum(all a) count(all a) avg(all a) std(all a) bit_or(all a) bit_and(all a) min(all a) max(all a) min(all c) max(all c)
-21 6 3.5000 1.7078 7 0 1 6 E
-select grp, sum(a),count(a),avg(a),std(a),bit_or(a),bit_and(a),min(a),max(a),min(c),max(c) from t1 group by grp;
-grp sum(a) count(a) avg(a) std(a) bit_or(a) bit_and(a) min(a) max(a) min(c) max(c)
-NULL NULL 0 NULL NULL 0 18446744073709551615 NULL NULL
-1 1 1 1.0000 0.0000 1 1 1 1 a a
-2 5 2 2.5000 0.5000 3 2 2 3 b c
-3 15 3 5.0000 0.8165 7 4 4 6 C E
-select grp, sum(a)+count(a)+avg(a)+std(a)+bit_or(a)+bit_and(a)+min(a)+max(a)+min(c)+max(c) as sum from t1 group by grp;
+select sum(all a),count(all a),avg(all a),std(all a),variance(all a),bit_or(all a),bit_and(all a),min(all a),max(all a),min(all c),max(all c) from t1;
+sum(all a) count(all a) avg(all a) std(all a) variance(all a) bit_or(all a) bit_and(all a) min(all a) max(all a) min(all c) max(all c)
+21 6 3.5000 1.7078 2.9167 7 0 1 6 E
+select grp, sum(a),count(a),avg(a),std(a),variance(a),bit_or(a),bit_and(a),min(a),max(a),min(c),max(c) from t1 group by grp;
+grp sum(a) count(a) avg(a) std(a) variance(a) bit_or(a) bit_and(a) min(a) max(a) min(c) max(c)
+NULL NULL 0 NULL NULL NULL 0 18446744073709551615 NULL NULL
+1 1 1 1.0000 0.0000 0.0000 1 1 1 1 a a
+2 5 2 2.5000 0.5000 0.2500 3 2 2 3 b c
+3 15 3 5.0000 0.8165 0.6667 7 4 4 6 C E
+select grp, sum(a)+count(a)+avg(a)+std(a)+variance(a)+bit_or(a)+bit_and(a)+min(a)+max(a)+min(c)+max(c) as sum from t1 group by grp;
grp sum
NULL NULL
1 7
-2 20
-3 44.816496580928
+2 20.25
+3 45.483163247594
create table t2 (grp int, a bigint unsigned, c char(10));
insert into t2 select grp,max(a)+max(grp),max(c) from t1 group by grp;
replace into t2 select grp, a, c from t1 limit 2,1;
@@ -72,14 +72,14 @@ CREATE TABLE t1 (id int(11),value1 float(10,2));
INSERT INTO t1 VALUES (1,0.00),(1,1.00), (1,2.00), (2,10.00), (2,11.00), (2,12.00);
CREATE TABLE t2 (id int(11),name char(20));
INSERT INTO t2 VALUES (1,'Set One'),(2,'Set Two');
-select id, avg(value1), std(value1) from t1 group by id;
-id avg(value1) std(value1)
-1 1.000000 0.816497
-2 11.000000 0.816497
-select name, avg(value1), std(value1) from t1, t2 where t1.id = t2.id group by t1.id;
-name avg(value1) std(value1)
-Set One 1.000000 0.816497
-Set Two 11.000000 0.816497
+select id, avg(value1), std(value1), variance(value1) from t1 group by id;
+id avg(value1) std(value1) variance(value1)
+1 1.000000 0.816497 0.666667
+2 11.000000 0.816497 0.666667
+select name, avg(value1), std(value1), variance(value1) from t1, t2 where t1.id = t2.id group by t1.id;
+name avg(value1) std(value1) variance(value1)
+Set One 1.000000 0.816497 0.666667
+Set Two 11.000000 0.816497 0.666667
drop table t1,t2;
create table t1 (id int not null);
create table t2 (id int not null,rating int null);
@@ -173,12 +173,23 @@ select max(t2.a2), max(t1.a1) from t1, t2;
max(t2.a2) max(t1.a1)
NULL NULL
explain select min(a2) from t1;
-Comment
-Select tables optimized away
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
explain select max(t1.a1), max(t2.a2) from t1, t2;
-Comment
-No matching min/max row
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No matching min/max row
insert into t2 values('AAA', 10, 0.5);
+insert into t2 values('BBB', 20, 1.0);
+select t1.a1, t1.a2, t2.a1, t2.a2 from t1,t2;
+a1 a2 a1 a2
+10 aaa AAA 10
+10 NULL AAA 10
+10 bbb AAA 10
+20 zzz AAA 10
+10 aaa BBB 20
+10 NULL BBB 20
+10 bbb BBB 20
+20 zzz BBB 20
select max(t1.a1), max(t2.a1) from t1, t2 where t2.a2=9;
max(t1.a1) max(t2.a1)
NULL NULL
@@ -188,21 +199,27 @@ NULL NULL
select t1.a1, t1.a2, t2.a1, t2.a2 from t1 left outer join t2 on t1.a1=10;
a1 a2 a1 a2
10 aaa AAA 10
+10 aaa BBB 20
10 NULL AAA 10
+10 NULL BBB 20
10 bbb AAA 10
+10 bbb BBB 20
20 zzz NULL NULL
select max(t1.a2) from t1 left outer join t2 on t1.a1=10;
max(t1.a2)
zzz
-select max(t1.a2) from t1 left outer join t2 on t1.a1=10 where t1.a1=20;
-max(t1.a2)
-zzz
-select max(t1.a2) from t1 left outer join t2 on t1.a1=10 where t1.a1=10;
-max(t1.a2)
-bbb
+select max(t2.a1) from t2 left outer join t1 on t2.a2=10 where t2.a2=20;
+max(t2.a1)
+BBB
+select max(t2.a1) from t2 left outer join t1 on t2.a2=10 where t2.a2=10;
+max(t2.a1)
+AAA
select max(t2.a1) from t1 left outer join t2 on t1.a2=t2.a1 and 1=0 where t2.a1='AAA';
max(t2.a1)
NULL
+select max(t1.a2),max(t2.a1) from t1 left outer join t2 on t1.a1=10;
+max(t1.a2) max(t2.a1)
+zzz BBB
drop table t1,t2;
CREATE TABLE t1 (a int, b int);
select count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1;
@@ -239,11 +256,16 @@ a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
2 1 1 1.0000 0.0000 1 1 1 1
3 1 1 1.0000 0.0000 1 1 1 1
-select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
-a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
-1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
-2 1 1 1.0000 0.0000 1 1 1 1
-3 1 1 1.0000 0.0000 1 1 1 1
+select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
+a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b) bit_xor(b)
+1 0 NULL NULL NULL NULL NULL 18446744073709551615 0 0
+2 1 1 1.0000 0.0000 1 1 1 1 1
+3 1 1 1.0000 0.0000 1 1 1 1 1
+explain extended select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort
+Warnings:
+Note 1003 select sql_big_result test.t1.a AS `a`,count(test.t1.b) AS `count(b)`,sum(test.t1.b) AS `sum(b)`,avg(test.t1.b) AS `avg(b)`,std(test.t1.b) AS `std(b)`,min(test.t1.b) AS `min(b)`,max(test.t1.b) AS `max(b)`,bit_and(test.t1.b) AS `bit_and(b)`,bit_or(test.t1.b) AS `bit_or(b)`,bit_xor(test.t1.b) AS `bit_xor(b)` from test.t1 group by test.t1.a
drop table t1;
create table t1 (col int);
insert into t1 values (-1), (-2), (-3);
@@ -261,3 +283,453 @@ select avg(2) from t1;
avg(2)
NULL
drop table t1;
+create table t1(
+a1 char(3) primary key,
+a2 smallint,
+a3 char(3),
+a4 real,
+a5 date,
+key k1(a2,a3),
+key k2(a4 desc,a1),
+key k3(a5,a1)
+);
+create table t2(
+a1 char(3) primary key,
+a2 char(17),
+a3 char(2),
+a4 char(3),
+key k1(a3, a2),
+key k2(a4)
+);
+insert into t1 values('AME',0,'SEA',0.100,date'1942-02-19');
+insert into t1 values('HBR',1,'SEA',0.085,date'1948-03-05');
+insert into t1 values('BOT',2,'SEA',0.085,date'1951-11-29');
+insert into t1 values('BMC',3,'SEA',0.085,date'1958-09-08');
+insert into t1 values('TWU',0,'LAX',0.080,date'1969-10-05');
+insert into t1 values('BDL',0,'DEN',0.080,date'1960-11-27');
+insert into t1 values('DTX',1,'NYC',0.080,date'1961-05-04');
+insert into t1 values('PLS',1,'WDC',0.075,date'1949-01-02');
+insert into t1 values('ZAJ',2,'CHI',0.075,date'1960-06-15');
+insert into t1 values('VVV',2,'MIN',0.075,date'1959-06-28');
+insert into t1 values('GTM',3,'DAL',0.070,date'1977-09-23');
+insert into t1 values('SSJ',null,'CHI',null,date'1974-03-19');
+insert into t1 values('KKK',3,'ATL',null,null);
+insert into t1 values('XXX',null,'MIN',null,null);
+insert into t2 values('TKF','Seattle','WA','AME');
+insert into t2 values('LCC','Los Angeles','CA','TWU');
+insert into t2 values('DEN','Denver','CO','BDL');
+insert into t2 values('SDC','San Diego','CA','TWU');
+insert into t2 values('NOL','New Orleans','LA','GTM');
+insert into t2 values('LAK','Los Angeles','CA','TWU');
+select * from t1;
+a1 a2 a3 a4 a5
+AME 0 SEA 0.1 1942-02-19
+HBR 1 SEA 0.085 1948-03-05
+BOT 2 SEA 0.085 1951-11-29
+BMC 3 SEA 0.085 1958-09-08
+TWU 0 LAX 0.08 1969-10-05
+BDL 0 DEN 0.08 1960-11-27
+DTX 1 NYC 0.08 1961-05-04
+PLS 1 WDC 0.075 1949-01-02
+ZAJ 2 CHI 0.075 1960-06-15
+VVV 2 MIN 0.075 1959-06-28
+GTM 3 DAL 0.07 1977-09-23
+SSJ NULL CHI NULL 1974-03-19
+KKK 3 ATL NULL NULL
+XXX NULL MIN NULL NULL
+select * from t2;
+a1 a2 a3 a4
+TKF Seattle WA AME
+LCC Los Angeles CA TWU
+DEN Denver CO BDL
+SDC San Diego CA TWU
+NOL New Orleans LA GTM
+LAK Los Angeles CA TWU
+explain
+select min(a1) from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select min(a1) from t1;
+min(a1)
+AME
+explain
+select max(a4) from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select max(a4) from t1;
+max(a4)
+0.1
+explain
+select min(a5), max(a5) from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select min(a5), max(a5) from t1;
+min(a5) max(a5)
+1942-02-19 1977-09-23
+explain
+select min(a3) from t1 where a2 = 2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select min(a3) from t1 where a2 = 2;
+min(a3)
+CHI
+explain
+select min(a1), max(a1) from t1 where a4 = 0.080;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select min(a1), max(a1) from t1 where a4 = 0.080;
+min(a1) max(a1)
+BDL TWU
+explain
+select min(t1.a5), max(t2.a3) from t1, t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select min(t1.a5), max(t2.a3) from t1, t2;
+min(t1.a5) max(t2.a3)
+1942-02-19 WA
+explain
+select min(t1.a3), max(t2.a2) from t1, t2 where t1.a2 = 0 and t2.a3 = 'CA';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select min(t1.a3), max(t2.a2) from t1, t2 where t1.a2 = 0 and t2.a3 = 'CA';
+min(t1.a3) max(t2.a2)
+DEN San Diego
+explain
+select min(a1) from t1 where a1 > 'KKK';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select min(a1) from t1 where a1 > 'KKK';
+min(a1)
+PLS
+explain
+select min(a1) from t1 where a1 >= 'KKK';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select min(a1) from t1 where a1 >= 'KKK';
+min(a1)
+KKK
+explain
+select max(a3) from t1 where a2 = 2 and a3 < 'SEA';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select max(a3) from t1 where a2 = 2 and a3 < 'SEA';
+max(a3)
+MIN
+explain
+select max(a5) from t1 where a5 < date'1970-01-01';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select max(a5) from t1 where a5 < date'1970-01-01';
+max(a5)
+1969-10-05
+explain
+select max(a3) from t1 where a2 is null;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select max(a3) from t1 where a2 is null;
+max(a3)
+MIN
+explain
+select max(a3) from t1 where a2 = 0 and a3 between 'K' and 'Q';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select max(a3) from t1 where a2 = 0 and a3 between 'K' and 'Q';
+max(a3)
+LAX
+explain
+select min(a1), max(a1) from t1 where a1 between 'A' and 'P';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select min(a1), max(a1) from t1 where a1 between 'A' and 'P';
+min(a1) max(a1)
+AME KKK
+explain
+select max(a3) from t1 where a3 < 'SEA' and a2 = 2 and a3 <= 'MIN';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select max(a3) from t1 where a3 < 'SEA' and a2 = 2 and a3 <= 'MIN';
+max(a3)
+MIN
+explain
+select max(a3) from t1 where a3 = 'MIN' and a2 = 2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select max(a3) from t1 where a3 = 'MIN' and a2 = 2;
+max(a3)
+MIN
+explain
+select max(a3) from t1 where a3 = 'DEN' and a2 = 2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No matching min/max row
+select max(a3) from t1 where a3 = 'DEN' and a2 = 2;
+max(a3)
+NULL
+explain
+select max(t1.a3), min(t2.a2) from t1, t2 where t1.a2 = 2 and t1.a3 < 'MIN' and t2.a3 = 'CA';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select max(t1.a3), min(t2.a2) from t1, t2 where t1.a2 = 2 and t1.a3 < 'MIN' and t2.a3 = 'CA';
+max(t1.a3) min(t2.a2)
+CHI Los Angeles
+explain
+select max(a3) from t1 where a2 is null and a2 = 2;
+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
+select max(a3) from t1 where a2 is null and a2 = 2;
+max(a3)
+NULL
+explain
+select max(a2) from t1 where a2 >= 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select max(a2) from t1 where a2 >= 1;
+max(a2)
+3
+explain
+select min(a3) from t1 where a2 = 2 and a3 < 'SEA';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select min(a3) from t1 where a2 = 2 and a3 < 'SEA';
+min(a3)
+CHI
+explain
+select min(a3) from t1 where a2 = 4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No matching min/max row
+select min(a3) from t1 where a2 = 4;
+min(a3)
+NULL
+explain
+select min(a3) from t1 where a2 = 2 and a3 > 'SEA';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No matching min/max row
+select min(a3) from t1 where a2 = 2 and a3 > 'SEA';
+min(a3)
+NULL
+explain
+select (min(a4)+max(a4))/2 from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select (min(a4)+max(a4))/2 from t1;
+(min(a4)+max(a4))/2
+0.085
+explain
+select min(a3) from t1 where 2 = a2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select min(a3) from t1 where 2 = a2;
+min(a3)
+CHI
+explain
+select max(a3) from t1 where a2 = 2 and 'SEA' > a3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select max(a3) from t1 where a2 = 2 and 'SEA' > a3;
+max(a3)
+MIN
+explain
+select max(a3) from t1 where a2 = 2 and 'SEA' < a3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No matching min/max row
+select max(a3) from t1 where a2 = 2 and 'SEA' < a3;
+max(a3)
+NULL
+explain
+select min(a3) from t1 where a2 = 2 and a3 >= 'CHI';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select min(a3) from t1 where a2 = 2 and a3 >= 'CHI';
+min(a3)
+CHI
+explain
+select min(a3) from t1 where a2 = 2 and a3 >= 'CHI' and a3 < 'SEA';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select min(a3) from t1 where a2 = 2 and a3 >= 'CHI' and a3 < 'SEA';
+min(a3)
+CHI
+explain
+select min(a3) from t1 where a2 = 2 and a3 >= 'CHI' and a3 = 'MIN';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select min(a3) from t1 where a2 = 2 and a3 >= 'CHI' and a3 = 'MIN';
+min(a3)
+MIN
+explain
+select min(a3) from t1 where a2 = 2 and a3 >= 'SEA' and a3 = 'MIN';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+select min(a3) from t1 where a2 = 2 and a3 >= 'SEA' and a3 = 'MIN';
+min(a3)
+NULL
+explain
+select min(t1.a1), min(t2.a4) from t1,t2 where t1.a1 < 'KKK' and t2.a4 < 'KKK';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select min(t1.a1), min(t2.a4) from t1,t2 where t1.a1 < 'KKK' and t2.a4 < 'KKK';
+min(t1.a1) min(t2.a4)
+AME AME
+explain
+select min(a1) from t1 where a1 > 'KKK' or a1 < 'XXX';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range PRIMARY PRIMARY 0 NULL 15 Using where; Using index
+explain
+select min(a1) from t1 where a1 != 'KKK';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range PRIMARY PRIMARY 3 NULL 14 Using where; Using index
+explain
+select max(a3) from t1 where a2 < 2 and a3 < 'SEA';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range k1 k1 3 NULL 5 Using where; Using index
+explain
+select max(t1.a3), min(t2.a2) from t1, t2 where t1.a2 = 2 and t1.a3 < 'MIN' and t2.a3 > 'CA';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range k1 k1 7 NULL 1 Using where; Using index
+1 SIMPLE t2 range k1 k1 3 NULL 4 Using where; Using index
+explain
+select min(a4 - 0.01) from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL k2 12 NULL 14 Using index
+explain
+select max(a4 + 0.01) from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL k2 12 NULL 14 Using index
+explain
+select min(a3) from t1 where (a2 +1 ) is null;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL k1 7 NULL 14 Using where; Using index
+explain
+select min(a3) from t1 where (a2 + 1) = 2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL k1 7 NULL 14 Using where; Using index
+explain
+select min(a3) from t1 where 2 = (a2 + 1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL k1 7 NULL 14 Using where; Using index
+explain
+select min(a2) from t1 where a2 < 2 * a2 - 8;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL k1 7 NULL 14 Using where; Using index
+explain
+select min(a1) from t1 where a1 between a3 and 'KKK';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 14 Using where
+explain
+select min(a4) from t1 where (a4 + 0.01) between 0.07 and 0.08;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL k2 12 NULL 14 Using where; Using index
+explain
+select concat(min(t1.a1),min(t2.a4)) from t1, t2 where t2.a4 <> 'AME';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range k2 k2 4 NULL 6 Using where; Using index
+1 SIMPLE t1 index NULL PRIMARY 3 NULL 14 Using index
+drop table t1, t2;
+create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB;
+insert into t1 values (1, 3);
+select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ from t1 group by MAX_REQ;
+count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ
+1
+select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = 1 group by MAX_REQ;
+Case When Count(*) < MAX_REQ Then 1 Else 0 End
+1
+drop table t1;
+create table t1 (a char(10));
+insert into t1 values ('a'),('b'),('c');
+select coercibility(max(a)) from t1;
+coercibility(max(a))
+2
+drop table t1;
+create table t1 (a char character set latin2);
+insert into t1 values ('a'),('b');
+select charset(max(a)), coercibility(max(a)),
+charset(min(a)), coercibility(min(a)) from t1;
+charset(max(a)) coercibility(max(a)) charset(min(a)) coercibility(min(a))
+latin2 2 latin2 2
+create table t2 select max(a),min(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `max(a)` char(1) character set latin2 default NULL,
+ `min(a)` char(1) character set latin2 default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t2,t1;
+create table t1 (a int);
+insert into t1 values (1);
+select max(a) as b from t1 having b=1;
+b
+1
+select a from t1 having a=1;
+a
+1
+drop table t1;
+create table t1 (a int);
+select variance(2) from t1;
+variance(2)
+NULL
+select stddev(2) from t1;
+stddev(2)
+NULL
+drop table t1;
+create table t1 (a int);
+insert into t1 values (1),(2);
+prepare stmt1 from 'SELECT COUNT(*) FROM t1';
+execute stmt1;
+COUNT(*)
+2
+execute stmt1;
+COUNT(*)
+2
+execute stmt1;
+COUNT(*)
+2
+deallocate prepare stmt1;
+drop table t1;
+create table t1 (a int, primary key(a));
+insert into t1 values (1),(2);
+prepare stmt1 from 'SELECT max(a) FROM t1';
+execute stmt1;
+max(a)
+2
+execute stmt1;
+max(a)
+2
+execute stmt1;
+max(a)
+2
+deallocate prepare stmt1;
+drop table t1;
+CREATE TABLE t1 (a int primary key);
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+SELECT MAX(a) FROM t1 WHERE a > 5;
+MAX(a)
+NULL
+SELECT MIN(a) FROM t1 WHERE a < 0;
+MIN(a)
+NULL
+DROP TABLE t1;
+CREATE TABLE t1 (
+id int(10) unsigned NOT NULL auto_increment,
+val enum('one','two','three') NOT NULL default 'one',
+PRIMARY KEY (id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES
+(1,'one'),(2,'two'),(3,'three'),(4,'one'),(5,'two');
+select val, count(*) from t1 group by val;
+val count(*)
+one 2
+two 2
+three 1
+drop table t1;
+CREATE TABLE t1 (
+id int(10) unsigned NOT NULL auto_increment,
+val set('one','two','three') NOT NULL default 'one',
+PRIMARY KEY (id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES
+(1,'one'),(2,'two'),(3,'three'),(4,'one'),(5,'two');
+select val, count(*) from t1 group by val;
+val count(*)
+one 2
+two 2
+three 1
+drop table t1;
diff --git a/mysql-test/r/func_if.result b/mysql-test/r/func_if.result
index 72226588de3..508a50caf02 100644
--- a/mysql-test/r/func_if.result
+++ b/mysql-test/r/func_if.result
@@ -2,7 +2,7 @@ drop table if exists t1;
select IF(0,"ERROR","this"),IF(1,"is","ERROR"),IF(NULL,"ERROR","a"),IF(1,2,3)|0,IF(1,2.0,3.0)+0 ;
IF(0,"ERROR","this") IF(1,"is","ERROR") IF(NULL,"ERROR","a") IF(1,2,3)|0 IF(1,2.0,3.0)+0
this is a 2 2.0
-CREATE TABLE t1 (st varchar(255) NOT NULL, u int(11) NOT NULL) TYPE=MyISAM;
+CREATE TABLE t1 (st varchar(255) NOT NULL, u int(11) NOT NULL) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('a',1),('A',1),('aa',1),('AA',1),('a',1),('aaa',0),('BBB',0);
select if(1,st,st) s from t1 order by s;
s
@@ -39,6 +39,25 @@ a
a
aa
aaa
+explain extended select if(u=1,st,binary st) s from t1 where st like "%a%" order by s;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where; Using filesort
+Warnings:
+Note 1003 select if((test.t1.u = 1),test.t1.st,cast(test.t1.st as char charset binary)) AS `s` from test.t1 where (test.t1.st like _latin1'%a%') order by if((test.t1.u = 1),test.t1.st,cast(test.t1.st as char charset binary))
+select nullif(u=0, 'test') from t1;
+nullif(u=0, 'test')
+NULL
+NULL
+NULL
+NULL
+NULL
+1
+1
+explain extended select nullif(u=0, 'test') from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 7
+Warnings:
+Note 1003 select nullif((test.t1.u = 0),_latin1'test') AS `nullif(u=0, 'test')` from test.t1
drop table t1;
select NULLIF(NULL,NULL), NULLIF(NULL,1), NULLIF(NULL,1.0), NULLIF(NULL,"test");
NULLIF(NULL,NULL) NULLIF(NULL,1) NULLIF(NULL,1.0) NULLIF(NULL,"test")
diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result
index ba33ee0831d..daeda51a12a 100644
--- a/mysql-test/r/func_in.result
+++ b/mysql-test/r/func_in.result
@@ -1,11 +1,95 @@
drop table if exists t1;
+select 1 in (1,2,3);
+1 in (1,2,3)
+1
+select 10 in (1,2,3);
+10 in (1,2,3)
+0
+select NULL in (1,2,3);
+NULL in (1,2,3)
+NULL
+select 1 in (1,NULL,3);
+1 in (1,NULL,3)
+1
+select 3 in (1,NULL,3);
+3 in (1,NULL,3)
+1
+select 10 in (1,NULL,3);
+10 in (1,NULL,3)
+NULL
+select 1.5 in (1.5,2.5,3.5);
+1.5 in (1.5,2.5,3.5)
+1
+select 10.5 in (1.5,2.5,3.5);
+10.5 in (1.5,2.5,3.5)
+0
+select NULL in (1.5,2.5,3.5);
+NULL in (1.5,2.5,3.5)
+NULL
+select 1.5 in (1.5,NULL,3.5);
+1.5 in (1.5,NULL,3.5)
+1
+select 3.5 in (1.5,NULL,3.5);
+3.5 in (1.5,NULL,3.5)
+1
+select 10.5 in (1.5,NULL,3.5);
+10.5 in (1.5,NULL,3.5)
+NULL
+CREATE TABLE t1 (a int, b int, c int);
+insert into t1 values (1,2,3), (1,NULL,3);
+select 1 in (a,b,c) from t1;
+1 in (a,b,c)
+1
+1
+select 3 in (a,b,c) from t1;
+3 in (a,b,c)
+1
+1
+select 10 in (a,b,c) from t1;
+10 in (a,b,c)
+0
+NULL
+select NULL in (a,b,c) from t1;
+NULL in (a,b,c)
+NULL
+NULL
+drop table t1;
+CREATE TABLE t1 (a float, b float, c float);
+insert into t1 values (1.5,2.5,3.5), (1.5,NULL,3.5);
+select 1.5 in (a,b,c) from t1;
+1.5 in (a,b,c)
+1
+1
+select 3.5 in (a,b,c) from t1;
+3.5 in (a,b,c)
+1
+1
+select 10.5 in (a,b,c) from t1;
+10.5 in (a,b,c)
+0
+NULL
+drop table t1;
+CREATE TABLE t1 (a varchar(10), b varchar(10), c varchar(10));
+insert into t1 values ('A','BC','EFD'), ('A',NULL,'EFD');
+select 'A' in (a,b,c) from t1;
+'A' in (a,b,c)
+1
+1
+select 'EFD' in (a,b,c) from t1;
+'EFD' in (a,b,c)
+1
+1
+select 'XSFGGHF' in (a,b,c) from t1;
+'XSFGGHF' in (a,b,c)
+0
+NULL
+drop table t1;
CREATE TABLE t1 (field char(1));
INSERT INTO t1 VALUES ('A'),(NULL);
SELECT * from t1 WHERE field IN (NULL);
field
SELECT * from t1 WHERE field NOT IN (NULL);
field
-A
SELECT * from t1 where field = field;
field
A
@@ -16,6 +100,7 @@ NULL
DELETE FROM t1 WHERE field NOT IN (NULL);
SELECT * FROM t1;
field
+A
NULL
drop table t1;
create table t1 (id int(10) primary key);
@@ -26,3 +111,77 @@ id
5
9
drop table t1;
+create table t1 (
+a char(1) character set latin1 collate latin1_general_ci,
+b char(1) character set latin1 collate latin1_swedish_ci,
+c char(1) character set latin1 collate latin1_danish_ci
+);
+insert into t1 values ('A','B','C');
+insert into t1 values ('a','c','c');
+select * from t1 where a in (b);
+ERROR HY000: Illegal mix of collations (latin1_general_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation ' IN '
+select * from t1 where a in (b,c);
+ERROR HY000: Illegal mix of collations (latin1_general_ci,IMPLICIT), (latin1_swedish_ci,IMPLICIT), (latin1_danish_ci,IMPLICIT) for operation ' IN '
+select * from t1 where 'a' in (a,b,c);
+ERROR HY000: Illegal mix of collations for operation ' IN '
+select * from t1 where 'a' in (a);
+a b c
+A B C
+a c c
+select * from t1 where a in ('a');
+a b c
+A B C
+a c c
+select * from t1 where 'a' collate latin1_general_ci in (a,b,c);
+a b c
+A B C
+a c c
+select * from t1 where 'a' collate latin1_bin in (a,b,c);
+a b c
+a c c
+select * from t1 where 'a' in (a,b,c collate latin1_bin);
+a b c
+a c c
+explain extended select * from t1 where 'a' in (a,b,c collate latin1_bin);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
+Warnings:
+Note 1003 select test.t1.a AS `a`,test.t1.b AS `b`,test.t1.c AS `c` from test.t1 where (_latin1'a' in (test.t1.a,test.t1.b,(test.t1.c collate _latin1'latin1_bin')))
+drop table t1;
+set names utf8;
+create table t1 (a char(10) character set utf8 not null);
+insert into t1 values ('bbbb'),(_koi8r'ÃÃÃÃ'),(_latin1'ÄÄÄÄ');
+select a from t1 where a in ('bbbb',_koi8r'ÃÃÃÃ',_latin1'ÄÄÄÄ') order by a;
+a
+ÄÄÄÄ
+bbbb
+цццц
+drop table t1;
+set names latin1;
+select '1.0' in (1,2);
+'1.0' in (1,2)
+1
+select 1 in ('1.0',2);
+1 in ('1.0',2)
+1
+select 1 in (1,'2.0');
+1 in (1,'2.0')
+1
+select 1 in ('1.0',2.0);
+1 in ('1.0',2.0)
+1
+select 1 in (1.0,'2.0');
+1 in (1.0,'2.0')
+1
+select 1 in ('1.1',2);
+1 in ('1.1',2)
+0
+select 1 in ('1.1',2.0);
+1 in ('1.1',2.0)
+0
+create table t1 (a char(20) character set binary);
+insert into t1 values ('aa'), ('bb');
+select * from t1 where a in (NULL, 'aa');
+a
+aa
+drop table t1;
diff --git a/mysql-test/r/func_like.result b/mysql-test/r/func_like.result
index b196b50f53b..a58432cb06e 100644
--- a/mysql-test/r/func_like.result
+++ b/mysql-test/r/func_like.result
@@ -2,11 +2,11 @@ drop table if exists t1;
create table t1 (a varchar(10), key(a));
insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
explain select * from t1 where a like 'abc%';
-table type possible_keys key key_len ref rows Extra
-t1 range a a 11 NULL 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 11 NULL 1 Using where; Using index
explain select * from t1 where a like concat('abc','%');
-table type possible_keys key key_len ref rows Extra
-t1 range a a 11 NULL 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 11 NULL 1 Using where; Using index
select * from t1 where a like "abc%";
a
abc
@@ -45,4 +45,116 @@ a\b
select * from t1 where a like 'a\\%' escape '#' and a like 'a\\\\b';
a
a\b
+prepare stmt1 from 'select * from t1 where a like \'a\\%\' escape ?';
+set @esc='#';
+execute stmt1 using @esc;
+a
+a\b
+deallocate prepare stmt1;
+drop table t1;
+create table t1 (a datetime);
+insert into t1 values ('2004-03-11 12:00:21');
+select * from t1 where a like '2004-03-11 12:00:21';
+a
+2004-03-11 12:00:21
drop table t1;
+SET NAMES koi8r;
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET koi8r);
+INSERT INTO t1 VALUES ('ÆÙ×Á'),('æÙ×Á'),('Æù×Á'),('ÆÙ÷Á'),('ÆÙ×á'),('æù÷á');
+INSERT INTO t1 VALUES ('ÆÙ×ÁÐÒÏÌÄÖ'),('æÙ×ÁÐÒÏÌÄÖ'),('Æù×ÁÐÒÏÌÄÖ'),('ÆÙ÷ÁÐÒÏÌÄÖ');
+INSERT INTO t1 VALUES ('ÆÙ×áÐÒÏÌÄÖ'),('ÆÙ×ÁðÒÏÌÄÖ'),('ÆÙ×ÁÐòÏÌÄÖ'),('ÆÙ×ÁÐÒïÌÄÖ');
+INSERT INTO t1 VALUES ('ÆÙ×ÁÐÒÏìÄÖ'),('ÆÙ×ÁÐÒÏÌäÖ'),('ÆÙ×ÁÐÒÏÌÄö'),('æù÷áðòïìäö');
+SELECT * FROM t1 WHERE a LIKE '%Æù×Á%';
+a
+ÆÙ×Á
+æÙ×Á
+Æù×Á
+ÆÙ÷Á
+ÆÙ×á
+æù÷á
+ÆÙ×ÁÐÒÏÌÄÖ
+æÙ×ÁÐÒÏÌÄÖ
+Æù×ÁÐÒÏÌÄÖ
+ÆÙ÷ÁÐÒÏÌÄÖ
+ÆÙ×áÐÒÏÌÄÖ
+ÆÙ×ÁðÒÏÌÄÖ
+ÆÙ×ÁÐòÏÌÄÖ
+ÆÙ×ÁÐÒïÌÄÖ
+ÆÙ×ÁÐÒÏìÄÖ
+ÆÙ×ÁÐÒÏÌäÖ
+ÆÙ×ÁÐÒÏÌÄö
+æù÷áðòïìäö
+SELECT * FROM t1 WHERE a LIKE '%Æù×%';
+a
+ÆÙ×Á
+æÙ×Á
+Æù×Á
+ÆÙ÷Á
+ÆÙ×á
+æù÷á
+ÆÙ×ÁÐÒÏÌÄÖ
+æÙ×ÁÐÒÏÌÄÖ
+Æù×ÁÐÒÏÌÄÖ
+ÆÙ÷ÁÐÒÏÌÄÖ
+ÆÙ×áÐÒÏÌÄÖ
+ÆÙ×ÁðÒÏÌÄÖ
+ÆÙ×ÁÐòÏÌÄÖ
+ÆÙ×ÁÐÒïÌÄÖ
+ÆÙ×ÁÐÒÏìÄÖ
+ÆÙ×ÁÐÒÏÌäÖ
+ÆÙ×ÁÐÒÏÌÄö
+æù÷áðòïìäö
+SELECT * FROM t1 WHERE a LIKE 'Æù×Á%';
+a
+ÆÙ×Á
+æÙ×Á
+Æù×Á
+ÆÙ÷Á
+ÆÙ×á
+æù÷á
+ÆÙ×ÁÐÒÏÌÄÖ
+æÙ×ÁÐÒÏÌÄÖ
+Æù×ÁÐÒÏÌÄÖ
+ÆÙ÷ÁÐÒÏÌÄÖ
+ÆÙ×áÐÒÏÌÄÖ
+ÆÙ×ÁðÒÏÌÄÖ
+ÆÙ×ÁÐòÏÌÄÖ
+ÆÙ×ÁÐÒïÌÄÖ
+ÆÙ×ÁÐÒÏìÄÖ
+ÆÙ×ÁÐÒÏÌäÖ
+ÆÙ×ÁÐÒÏÌÄö
+æù÷áðòïìäö
+DROP TABLE t1;
+SET NAMES cp1250;
+CREATE TABLE t1 (a varchar(250) NOT NULL) DEFAULT CHARACTER SET=cp1250;
+INSERT INTO t1 VALUES
+('Techni Tapes Sp. z o.o.'),
+('Pojazdy Szynowe PESA Bydgoszcz SA Holding'),
+('AKAPESTER 1 P.P.H.U.'),
+('Pojazdy Szynowe PESA Bydgoszcz S A Holding'),
+('PPUH PESKA-I Maria Struniarska');
+select * from t1 where a like '%PESA%';
+a
+Pojazdy Szynowe PESA Bydgoszcz SA Holding
+Pojazdy Szynowe PESA Bydgoszcz S A Holding
+select * from t1 where a like '%PESA %';
+a
+Pojazdy Szynowe PESA Bydgoszcz SA Holding
+Pojazdy Szynowe PESA Bydgoszcz S A Holding
+select * from t1 where a like '%PES%';
+a
+Techni Tapes Sp. z o.o.
+Pojazdy Szynowe PESA Bydgoszcz SA Holding
+AKAPESTER 1 P.P.H.U.
+Pojazdy Szynowe PESA Bydgoszcz S A Holding
+PPUH PESKA-I Maria Struniarska
+select * from t1 where a like '%PESKA%';
+a
+PPUH PESKA-I Maria Struniarska
+select * from t1 where a like '%ESKA%';
+a
+PPUH PESKA-I Maria Struniarska
+DROP TABLE t1;
+select _cp866'aaaaaaaaa' like _cp866'%aaaa%' collate cp866_bin;
+_cp866'aaaaaaaaa' like _cp866'%aaaa%' collate cp866_bin
+1
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result
index 4688adc61d8..3a28cccfac5 100644
--- a/mysql-test/r/func_math.result
+++ b/mysql-test/r/func_math.result
@@ -1,43 +1,103 @@
select floor(5.5),floor(-5.5);
floor(5.5) floor(-5.5)
5 -6
+explain extended select floor(5.5),floor(-5.5);
+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 floor(5.5) AS `floor(5.5)`,floor(-(5.5)) AS `floor(-5.5)`
select ceiling(5.5),ceiling(-5.5);
ceiling(5.5) ceiling(-5.5)
6 -5
+explain extended select ceiling(5.5),ceiling(-5.5);
+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 ceiling(5.5) AS `ceiling(5.5)`,ceiling(-(5.5)) AS `ceiling(-5.5)`
select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1);
truncate(52.64,1) truncate(52.64,2) truncate(52.64,-1) truncate(52.64,-2) truncate(-52.64,1) truncate(-52.64,-1)
52.6 52.64 50 0 -52.6 -50
+explain extended select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1);
+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 truncate(52.64,1) AS `truncate(52.64,1)`,truncate(52.64,2) AS `truncate(52.64,2)`,truncate(52.64,-(1)) AS `truncate(52.64,-1)`,truncate(52.64,-(2)) AS `truncate(52.64,-2)`,truncate(-(52.64),1) AS `truncate(-52.64,1)`,truncate(-(52.64),-(1)) AS `truncate(-52.64,-1)`
select round(5.5),round(-5.5);
round(5.5) round(-5.5)
6 -6
+explain extended select round(5.5),round(-5.5);
+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 round(5.5,0) AS `round(5.5)`,round(-(5.5),0) AS `round(-5.5)`
select round(5.64,1),round(5.64,2),round(5.64,-1),round(5.64,-2);
round(5.64,1) round(5.64,2) round(5.64,-1) round(5.64,-2)
5.6 5.64 10 0
select abs(-10), sign(-5), sign(5), sign(0);
abs(-10) sign(-5) sign(5) sign(0)
10 -1 1 0
+explain extended select abs(-10), sign(-5), sign(5), sign(0);
+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 abs(-(10)) AS `abs(-10)`,sign(-(5)) AS `sign(-5)`,sign(5) AS `sign(5)`,sign(0) AS `sign(0)`
select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
log(exp(10)) exp(log(sqrt(10))*2) log(-1) log(NULL) log(1,1) log(3,9) log(-1,2) log(NULL,2)
10 10 NULL NULL NULL 2 NULL NULL
+explain extended select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
+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 log(exp(10)) AS `log(exp(10))`,exp((log(sqrt(10)) * 2)) AS `exp(log(sqrt(10))*2)`,log(-(1)) AS `log(-1)`,log(NULL) AS `log(NULL)`,log(1,1) AS `log(1,1)`,log(3,9) AS `log(3,9)`,log(-(1),2) AS `log(-1,2)`,log(NULL,2) AS `log(NULL,2)`
select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
ln(exp(10)) exp(ln(sqrt(10))*2) ln(-1) ln(0) ln(NULL)
10 10 NULL NULL NULL
+explain extended select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
+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 ln(exp(10)) AS `ln(exp(10))`,exp((ln(sqrt(10)) * 2)) AS `exp(ln(sqrt(10))*2)`,ln(-(1)) AS `ln(-1)`,ln(0) AS `ln(0)`,ln(NULL) AS `ln(NULL)`
select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
log2(8) log2(15) log2(-2) log2(0) log2(NULL)
3 3.9068905956085 NULL NULL NULL
+explain extended select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
+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 log2(8) AS `log2(8)`,log2(15) AS `log2(15)`,log2(-(2)) AS `log2(-2)`,log2(0) AS `log2(0)`,log2(NULL) AS `log2(NULL)`
select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
log10(100) log10(18) log10(-4) log10(0) log10(NULL)
2 1.2552725051033 NULL NULL NULL
+explain extended select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
+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 log10(100) AS `log10(100)`,log10(18) AS `log10(18)`,log10(-(4)) AS `log10(-4)`,log10(0) AS `log10(0)`,log10(NULL) AS `log10(NULL)`
select pow(10,log10(10)),power(2,4);
pow(10,log10(10)) power(2,4)
10 16
+explain extended select pow(10,log10(10)),power(2,4);
+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 pow(10,log10(10)) AS `pow(10,log10(10))`,pow(2,4) AS `power(2,4)`
set @@rand_seed1=10000000,@@rand_seed2=1000000;
select rand(999999),rand();
rand(999999) rand()
0.014231365187309 0.028870999839968
+explain extended select rand(999999),rand();
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select sql_no_cache rand(999999) AS `rand(999999)`,rand() AS `rand()`
select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(abs(tan(pi())),6),format(cot(1),6),format(asin(1),6),format(acos(0),6),format(atan(1),6);
pi() format(sin(pi()/2),6) format(cos(pi()/2),6) format(abs(tan(pi())),6) format(cot(1),6) format(asin(1),6) format(acos(0),6) format(atan(1),6)
3.141593 1.000000 0.000000 0.000000 0.642093 1.570796 1.570796 0.785398
+explain extended select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(abs(tan(pi())),6),format(cot(1),6),format(asin(1),6),format(acos(0),6),format(atan(1),6);
+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 pi() AS `pi()`,format(sin((pi() / 2)),6) AS `format(sin(pi()/2),6)`,format(cos((pi() / 2)),6) AS `format(cos(pi()/2),6)`,format(abs(tan(pi())),6) AS `format(abs(tan(pi())),6)`,format((1 / tan(1)),6) AS `format(cot(1),6)`,format(asin(1),6) AS `format(asin(1),6)`,format(acos(0),6) AS `format(acos(0),6)`,format(atan(1),6) AS `format(atan(1),6)`
select degrees(pi()),radians(360);
degrees(pi()) radians(360)
180 6.2831853071796
@@ -59,3 +119,10 @@ ASIN(0.8+0.2)
SELECT ASIN(1.2-0.2);
ASIN(1.2-0.2)
1.5707963267949
+explain extended select degrees(pi()),radians(360);
+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 degrees(pi()) AS `degrees(pi())`,radians(360) AS `radians(360)`
+select rand(rand);
+ERROR 42S22: Unknown column 'rand' in 'field list'
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
index d51bea020ed..5a9f0f68228 100644
--- a/mysql-test/r/func_misc.result
+++ b/mysql-test/r/func_misc.result
@@ -1,15 +1,27 @@
-select format(1.5555,0),format(123.5555,1),format(1234.5555,2),format(12345.5555,3),format(123456.5555,4),format(1234567.5555,5),format("12345.2399",2);
-format(1.5555,0) format(123.5555,1) format(1234.5555,2) format(12345.5555,3) format(123456.5555,4) format(1234567.5555,5) format("12345.2399",2)
+select format(1.5555,0),format(123.5555,1),format(1234.5555,2),format(12345.55555,3),format(123456.5555,4),format(1234567.5555,5),format("12345.2399",2);
+format(1.5555,0) format(123.5555,1) format(1234.5555,2) format(12345.55555,3) format(123456.5555,4) format(1234567.5555,5) format("12345.2399",2)
2 123.6 1,234.56 12,345.556 123,456.5555 1,234,567.55550 12,345.24
select inet_ntoa(inet_aton("255.255.255.255.255.255.255.255"));
inet_ntoa(inet_aton("255.255.255.255.255.255.255.255"))
NULL
select inet_aton("255.255.255.255.255"),inet_aton("255.255.1.255"),inet_aton("0.1.255");
inet_aton("255.255.255.255.255") inet_aton("255.255.1.255") inet_aton("0.1.255")
-1099511627775 4294902271 511
+1099511627775 4294902271 65791
select inet_ntoa(1099511627775),inet_ntoa(4294902271),inet_ntoa(511);
inet_ntoa(1099511627775) inet_ntoa(4294902271) inet_ntoa(511)
NULL 255.255.1.255 0.0.1.255
+select hex(inet_aton('127'));
+hex(inet_aton('127'))
+7F
+select hex(inet_aton('127.1'));
+hex(inet_aton('127.1'))
+7F000001
+select hex(inet_aton('127.1.1'));
+hex(inet_aton('127.1.1'))
+7F010001
+select length(uuid()), charset(uuid()), length(unhex(replace(uuid(),_utf8'-',_utf8'')));
+length(uuid()) charset(uuid()) length(unhex(replace(uuid(),_utf8'-',_utf8'')))
+36 utf8 16
select length(format('nan', 2)) > 0;
length(format('nan', 2)) > 0
1
diff --git a/mysql-test/r/func_op.result b/mysql-test/r/func_op.result
index d009a66353e..6cd975b0911 100644
--- a/mysql-test/r/func_op.result
+++ b/mysql-test/r/func_op.result
@@ -1,9 +1,19 @@
select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2;
1+1 1-1 1+1*2 8/5 8%5 mod(8,5) mod(8,5)|0 -(1+1)*-2
2 0 3 1.60 3 3 3 4
+explain extended select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2;
+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 (1 + 1) AS `1+1`,(1 - 1) AS `1-1`,(1 + (1 * 2)) AS `1+1*2`,(8 / 5) AS `8/5`,(8 % 5) AS `8%5`,(8 % 5) AS `mod(8,5)`,((8 % 5) | 0) AS `mod(8,5)|0`,(-((1 + 1)) * -(2)) AS `-(1+1)*-2`
select 1 | (1+1),5 & 3,bit_count(7) ;
1 | (1+1) 5 & 3 bit_count(7)
3 1 3
+explain extended select 1 | (1+1),5 & 3,bit_count(7) ;
+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 (1 | (1 + 1)) AS `1 | (1+1)`,(5 & 3) AS `5 & 3`,bit_count(7) AS `bit_count(7)`
select 1 << 32,1 << 63, 1 << 64, 4 >> 2, 4 >> 63, 1<< 63 >> 60;
1 << 32 1 << 63 1 << 64 4 >> 2 4 >> 63 1<< 63 >> 60
4294967296 9223372036854775808 0 1 0 8
diff --git a/mysql-test/r/func_regexp.result b/mysql-test/r/func_regexp.result
index 8d22994ef2b..8228d6982d3 100644
--- a/mysql-test/r/func_regexp.result
+++ b/mysql-test/r/func_regexp.result
@@ -36,6 +36,11 @@ insert into t1 (xxx) values('this is a test of some long text to see what happen
select * from t1 where xxx regexp('is a test of some long text to');
xxx
this is a test of some long text to see what happens
+explain extended select * from t1 where xxx regexp('is a test of some long text to');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 1
+Warnings:
+Note 1003 select test.t1.xxx AS `xxx` from test.t1 where (test.t1.xxx regexp _latin1'is a test of some long text to')
select * from t1 where xxx regexp('is a test of some long text to ');
xxx
this is a test of some long text to see what happens
@@ -52,3 +57,44 @@ select * from t1 where xxx REGEXP '^this is some text: to test - out\\.reg exp [
xxx
this is some text: to test - out.reg exp (22/45)
drop table t1;
+select _latin1 0xFF regexp _latin1 '[[:lower:]]' COLLATE latin1_bin;
+_latin1 0xFF regexp _latin1 '[[:lower:]]' COLLATE latin1_bin
+1
+select _koi8r 0xFF regexp _koi8r '[[:lower:]]' COLLATE koi8r_bin;
+_koi8r 0xFF regexp _koi8r '[[:lower:]]' COLLATE koi8r_bin
+0
+select _latin1 0xFF regexp _latin1 '[[:upper:]]' COLLATE latin1_bin;
+_latin1 0xFF regexp _latin1 '[[:upper:]]' COLLATE latin1_bin
+0
+select _koi8r 0xFF regexp _koi8r '[[:upper:]]' COLLATE koi8r_bin;
+_koi8r 0xFF regexp _koi8r '[[:upper:]]' COLLATE koi8r_bin
+1
+select _latin1 0xF7 regexp _latin1 '[[:alpha:]]';
+_latin1 0xF7 regexp _latin1 '[[:alpha:]]'
+0
+select _koi8r 0xF7 regexp _koi8r '[[:alpha:]]';
+_koi8r 0xF7 regexp _koi8r '[[:alpha:]]'
+1
+select _latin1'a' regexp _latin1'A' collate latin1_general_ci;
+_latin1'a' regexp _latin1'A' collate latin1_general_ci
+1
+select _latin1'a' regexp _latin1'A' collate latin1_bin;
+_latin1'a' regexp _latin1'A' collate latin1_bin
+0
+create table t1 (a varchar(40));
+insert into t1 values ('C1'),('C2'),('R1'),('C3'),('R2'),('R3');
+prepare stmt1 from 'select a from t1 where a rlike ? order by a';
+set @a="^C.*";
+execute stmt1 using @a;
+a
+C1
+C2
+C3
+set @a="^R.*";
+execute stmt1 using @a;
+a
+R1
+R2
+R3
+deallocate prepare stmt1;
+drop table t1;
diff --git a/mysql-test/r/func_sapdb.result b/mysql-test/r/func_sapdb.result
new file mode 100644
index 00000000000..cf2bd687115
--- /dev/null
+++ b/mysql-test/r/func_sapdb.result
@@ -0,0 +1,221 @@
+drop table if exists t1, test;
+select extract(DAY_MICROSECOND FROM "1999-01-02 10:11:12.000123");
+extract(DAY_MICROSECOND FROM "1999-01-02 10:11:12.000123")
+2101112000123
+select extract(HOUR_MICROSECOND FROM "1999-01-02 10:11:12.000123");
+extract(HOUR_MICROSECOND FROM "1999-01-02 10:11:12.000123")
+101112000123
+select extract(MINUTE_MICROSECOND FROM "1999-01-02 10:11:12.000123");
+extract(MINUTE_MICROSECOND FROM "1999-01-02 10:11:12.000123")
+1112000123
+select extract(SECOND_MICROSECOND FROM "1999-01-02 10:11:12.000123");
+extract(SECOND_MICROSECOND FROM "1999-01-02 10:11:12.000123")
+12000123
+select extract(MICROSECOND FROM "1999-01-02 10:11:12.000123");
+extract(MICROSECOND FROM "1999-01-02 10:11:12.000123")
+123
+select date_format("1997-12-31 23:59:59.000002", "%f");
+date_format("1997-12-31 23:59:59.000002", "%f")
+000002
+select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000 99:99:99.999999" DAY_MICROSECOND);
+date_add("1997-12-31 23:59:59.000002",INTERVAL "10000 99:99:99.999999" DAY_MICROSECOND)
+2025-05-23 04:40:39.000001
+select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99:99.999999" HOUR_MICROSECOND);
+date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99:99.999999" HOUR_MICROSECOND)
+1999-02-21 17:40:39.000001
+select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99.999999" MINUTE_MICROSECOND);
+date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99.999999" MINUTE_MICROSECOND)
+1998-01-07 22:41:39.000001
+select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000.999999" SECOND_MICROSECOND);
+date_add("1997-12-31 23:59:59.000002",INTERVAL "10000.999999" SECOND_MICROSECOND)
+1998-01-01 02:46:40.000001
+select date_add("1997-12-31 23:59:59.000002",INTERVAL "999999" MICROSECOND);
+date_add("1997-12-31 23:59:59.000002",INTERVAL "999999" MICROSECOND)
+1998-01-01 00:00:00.000001
+select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1 1:1:1.000002" DAY_MICROSECOND);
+date_sub("1998-01-01 00:00:00.000001",INTERVAL "1 1:1:1.000002" DAY_MICROSECOND)
+1997-12-30 22:58:58.999999
+select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1:1.000002" HOUR_MICROSECOND);
+date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1:1.000002" HOUR_MICROSECOND)
+1997-12-31 22:58:58.999999
+select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1.000002" MINUTE_MICROSECOND);
+date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1.000002" MINUTE_MICROSECOND)
+1997-12-31 23:58:58.999999
+select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1.000002" SECOND_MICROSECOND);
+date_sub("1998-01-01 00:00:00.000001",INTERVAL "1.000002" SECOND_MICROSECOND)
+1997-12-31 23:59:58.999999
+select date_sub("1998-01-01 00:00:00.000001",INTERVAL "000002" MICROSECOND);
+date_sub("1998-01-01 00:00:00.000001",INTERVAL "000002" MICROSECOND)
+1997-12-31 23:59:59.999999
+select adddate("1997-12-31 23:59:59.000001", 10);
+adddate("1997-12-31 23:59:59.000001", 10)
+1998-01-10 23:59:59.000001
+select subdate("1997-12-31 23:59:59.000001", 10);
+subdate("1997-12-31 23:59:59.000001", 10)
+1997-12-21 23:59:59.000001
+select datediff("1997-12-31 23:59:59.000001","1997-12-30");
+datediff("1997-12-31 23:59:59.000001","1997-12-30")
+1
+select datediff("1997-11-31 23:59:59.000001","1997-12-31");
+datediff("1997-11-31 23:59:59.000001","1997-12-31")
+-30
+select datediff("1997-11-31 23:59:59.000001",null);
+datediff("1997-11-31 23:59:59.000001",null)
+NULL
+select weekofyear("1997-11-31 23:59:59.000001");
+weekofyear("1997-11-31 23:59:59.000001")
+49
+select makedate(1997,1);
+makedate(1997,1)
+1997-01-01
+select makedate(1997,0);
+makedate(1997,0)
+NULL
+select addtime("1997-12-31 23:59:59.999999", "1 1:1:1.000002");
+addtime("1997-12-31 23:59:59.999999", "1 1:1:1.000002")
+1998-01-02 01:01:01.000001
+select subtime("1997-12-31 23:59:59.000001", "1 1:1:1.000002");
+subtime("1997-12-31 23:59:59.000001", "1 1:1:1.000002")
+1997-12-30 22:58:57.999999
+select addtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999");
+addtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999")
+NULL
+select subtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999");
+subtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999")
+NULL
+select subtime("01:00:00.999999", "02:00:00.999998");
+subtime("01:00:00.999999", "02:00:00.999998")
+-00:59:59.999999
+select subtime("02:01:01.999999", "01:01:01.999999");
+subtime("02:01:01.999999", "01:01:01.999999")
+01:00:00.000000
+select timediff("1997-01-01 23:59:59.000001","1995-12-31 23:59:59.000002");
+timediff("1997-01-01 23:59:59.000001","1995-12-31 23:59:59.000002")
+8807:59:59.999999
+select timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002");
+timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002")
+46:58:57.999999
+select timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002");
+timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002")
+-23:59:59.999999
+select timediff("1997-12-31 23:59:59.000001","23:59:59.000001");
+timediff("1997-12-31 23:59:59.000001","23:59:59.000001")
+NULL
+select timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001");
+timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001")
+-00:00:00.000001
+select maketime(10,11,12);
+maketime(10,11,12)
+10:11:12
+select maketime(25,11,12);
+maketime(25,11,12)
+25:11:12
+select maketime(-25,11,12);
+maketime(-25,11,12)
+-25:11:12
+select timestamp("2001-12-01", "01:01:01.999999");
+timestamp("2001-12-01", "01:01:01.999999")
+2001-12-01 01:01:01.999999
+select timestamp("2001-13-01", "01:01:01.000001");
+timestamp("2001-13-01", "01:01:01.000001")
+NULL
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '2001-13-01'
+select timestamp("2001-12-01", "25:01:01");
+timestamp("2001-12-01", "25:01:01")
+2001-12-02 01:01:01
+select timestamp("2001-12-01 01:01:01.000100");
+timestamp("2001-12-01 01:01:01.000100")
+2001-12-01 01:01:01.000100
+select timestamp("2001-12-01");
+timestamp("2001-12-01")
+2001-12-01 00:00:00
+select day("1997-12-31 23:59:59.000001");
+day("1997-12-31 23:59:59.000001")
+31
+select date("1997-12-31 23:59:59.000001");
+date("1997-12-31 23:59:59.000001")
+1997-12-31
+select date("1997-13-31 23:59:59.000001");
+date("1997-13-31 23:59:59.000001")
+NULL
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '1997-13-31 23:59:59.000001'
+select time("1997-12-31 23:59:59.000001");
+time("1997-12-31 23:59:59.000001")
+23:59:59.000001
+select time("1997-12-31 25:59:59.000001");
+time("1997-12-31 25:59:59.000001")
+NULL
+Warnings:
+Warning 1292 Truncated incorrect time value: '1997-12-31 25:59:59.000001'
+select microsecond("1997-12-31 23:59:59.000001");
+microsecond("1997-12-31 23:59:59.000001")
+1
+create table t1
+select makedate(1997,1) as f1,
+addtime(cast("1997-12-31 23:59:59.000001" as datetime), "1 1:1:1.000002") as f2,
+addtime(cast("23:59:59.999999" as time) , "1 1:1:1.000002") as f3,
+timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002") as f4,
+timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002") as f5,
+maketime(10,11,12) as f6,
+timestamp(cast("2001-12-01" as date), "01:01:01") as f7,
+date("1997-12-31 23:59:59.000001") as f8,
+time("1997-12-31 23:59:59.000001") as f9;
+describe t1;
+Field Type Null Key Default Extra
+f1 date 0000-00-00
+f2 datetime YES NULL
+f3 time YES NULL
+f4 time 00:00:00
+f5 time 00:00:00
+f6 time 00:00:00
+f7 datetime YES NULL
+f8 date YES NULL
+f9 time YES NULL
+select * from t1;
+f1 f2 f3 f4 f5 f6 f7 f8 f9
+1997-01-01 1998-01-02 01:01:00 49:01:01 46:58:57 -23:59:59 10:11:12 2001-12-01 01:01:01 1997-12-31 23:59:59
+create table test(t1 datetime, t2 time, t3 time, t4 datetime);
+insert into test values
+('2001-01-01 01:01:01', '01:01:01', null, '2001-02-01 01:01:01'),
+('2001-01-01 01:01:01', '-01:01:01', '-23:59:59', "1997-12-31 23:59:59.000001"),
+('1997-12-31 23:59:59.000001', '-23:59:59', '-01:01:01', '2001-01-01 01:01:01'),
+('2001-01-01 01:01:01', '01:01:01', '-1 01:01:01', null),
+('2001-01-01 01:01:01', null, '-1 01:01:01', null),
+(null, null, null, null),
+('2001-01-01 01:01:01', '01:01:01', '1 01:01:01', '2001-01-01 01:01:01');
+SELECT ADDTIME(t1,t2) As ttt, ADDTIME(t2, t3) As qqq from test;
+ttt qqq
+2001-01-01 02:02:02 NULL
+2001-01-01 00:00:00 -25:01:00
+1997-12-31 00:00:00 -25:01:00
+2001-01-01 02:02:02 -24:00:00
+NULL NULL
+NULL NULL
+2001-01-01 02:02:02 26:02:02
+SELECT TIMEDIFF(t1,t4) As ttt, TIMEDIFF(t2, t3) As qqq from test;
+ttt qqq
+-744:00:00 NULL
+26305:01:02 22:58:58
+-26305:01:02 -22:58:58
+NULL 26:02:02
+NULL NULL
+NULL NULL
+00:00:00 -24:00:00
+drop table t1, test;
+select addtime("-01:01:01.01", "-23:59:59.1") as a;
+a
+-25:01:00.110000
+select microsecond("1997-12-31 23:59:59.01") as a;
+a
+10000
+select microsecond(19971231235959.01) as a;
+a
+10000
+select date_add("1997-12-31",INTERVAL "10.09" SECOND_MICROSECOND) as a;
+a
+1997-12-31 00:00:10.090000
+select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f");
+str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f")
+2003-01-02 10:11:12.001200
diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result
index 9181fe9e54d..ca6e0a8c319 100644
--- a/mysql-test/r/func_set.result
+++ b/mysql-test/r/func_set.result
@@ -1,6 +1,17 @@
select interval(55,10,20,30,40,50,60,70,80,90,100),interval(3,1,1+1,1+1+1+1),field("IBM","NCA","ICL","SUN","IBM","DIGITAL"),field("A","B","C"),elt(2,"ONE","TWO","THREE"),interval(0,1,2,3,4),elt(1,1,2,3)|0,elt(1,1.1,1.2,1.3)+0;
interval(55,10,20,30,40,50,60,70,80,90,100) interval(3,1,1+1,1+1+1+1) field("IBM","NCA","ICL","SUN","IBM","DIGITAL") field("A","B","C") elt(2,"ONE","TWO","THREE") interval(0,1,2,3,4) elt(1,1,2,3)|0 elt(1,1.1,1.2,1.3)+0
5 2 4 0 TWO 0 1 1.1
+explain extended select INTERVAL(55,10,20,30,40,50,60,70,80,90,100),interval(3,1,1+1,1+1+1+1),field("IBM","NCA","ICL","SUN","IBM","DIGITAL"),field("A","B","C"),elt(2,"ONE","TWO","THREE"),interval(0,1,2,3,4),elt(1,1,2,3)|0,elt(1,1.1,1.2,1.3)+0;
+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 interval((55,10,20,30,40,50,60,70,80,90,100)) AS `INTERVAL(55,10,20,30,40,50,60,70,80,90,100)`,interval((3,1,(1 + 1),(((1 + 1) + 1) + 1))) AS `interval(3,1,1+1,1+1+1+1)`,field(_latin1'IBM',_latin1'NCA',_latin1'ICL',_latin1'SUN',_latin1'IBM',_latin1'DIGITAL') AS `field("IBM","NCA","ICL","SUN","IBM","DIGITAL")`,field(_latin1'A',_latin1'B',_latin1'C') AS `field("A","B","C")`,elt(2,_latin1'ONE',_latin1'TWO',_latin1'THREE') AS `elt(2,"ONE","TWO","THREE")`,interval((0,1,2,3,4)) AS `interval(0,1,2,3,4)`,(elt(1,1,2,3) | 0) AS `elt(1,1,2,3)|0`,(elt(1,1.1,1.2,1.3) + 0) AS `elt(1,1.1,1.2,1.3)+0`
+SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56);
+INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56)
+1
+SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56, 77);
+INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56, 77)
+1
select find_in_set("b","a,b,c"),find_in_set("c","a,b,c"),find_in_set("dd","a,bbb,dd"),find_in_set("bbb","a,bbb,dd");
find_in_set("b","a,b,c") find_in_set("c","a,b,c") find_in_set("dd","a,bbb,dd") find_in_set("bbb","a,bbb,dd")
2 3 3 2
@@ -28,6 +39,22 @@ find_in_set("abc","abc") find_in_set("ab","abc") find_in_set("abcd","abc")
select interval(null, 1, 10, 100);
interval(null, 1, 10, 100)
-1
+drop table if exists t1,t2;
+create table t1 (id int(10) not null unique);
+create table t2 (id int(10) not null primary key, val int(10) not null);
+insert into t1 values (1),(2),(4);
+insert into t2 values (1,1),(2,1),(3,1),(4,2);
+select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id;
+id elt(two.val,'one','two')
+1 one
+2 one
+4 two
+select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id;
+id elt(two.val,'one','two')
+1 one
+2 one
+4 two
+drop table t1,t2;
select find_in_set(binary 'a',binary 'A,B,C');
find_in_set(binary 'a',binary 'A,B,C')
0
@@ -37,3 +64,6 @@ find_in_set('a',binary 'A,B,C')
select find_in_set(binary 'a', 'A,B,C');
find_in_set(binary 'a', 'A,B,C')
0
+select find_in_set('1','3,1,');
+find_in_set('1','3,1,')
+2
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index d38a2edfa1a..41203566aab 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -1,4 +1,5 @@
drop table if exists t1;
+set names latin1;
select 'hello',"'hello'",'""hello""','''h''e''l''l''o''',"hel""lo",'hel\'lo';
hello 'hello' ""hello"" 'h'e'l'l'o' hel"lo hel'lo
hello 'hello' ""hello"" 'h'e'l'l'o' hel"lo hel'lo
@@ -11,9 +12,15 @@ length('\n\t\r\b\0\_\%\\')
select bit_length('\n\t\r\b\0\_\%\\');
bit_length('\n\t\r\b\0\_\%\\')
80
-select concat('monty',' was here ','again'),length('hello'),char(ascii('h'));
-concat('monty',' was here ','again') length('hello') char(ascii('h'))
-monty was here again 5 h
+select char_length('\n\t\r\b\0\_\%\\');
+char_length('\n\t\r\b\0\_\%\\')
+10
+select length(_latin1'\n\t\n\b\0\\_\\%\\');
+length(_latin1'\n\t\n\b\0\\_\\%\\')
+10
+select concat('monty',' was here ','again'),length('hello'),char(ascii('h')),ord('h');
+concat('monty',' was here ','again') length('hello') char(ascii('h')) ord('h')
+monty was here again 5 h 104
select locate('he','hello'),locate('he','hello',2),locate('lo','hello',2) ;
locate('he','hello') locate('he','hello',2) locate('lo','hello',2)
1 0 4
@@ -80,9 +87,27 @@ this is a REAL test
select soundex(''),soundex('he'),soundex('hello all folks'),soundex('#3556 in bugdb');
soundex('') soundex('he') soundex('hello all folks') soundex('#3556 in bugdb')
H000 H4142 I51231
+select 'mood' sounds like 'mud';
+'mood' sounds like 'mud'
+1
+select 'Glazgo' sounds like 'Liverpool';
+'Glazgo' sounds like 'Liverpool'
+0
+select null sounds like 'null';
+null sounds like 'null'
+NULL
+select 'null' sounds like null;
+'null' sounds like null
+NULL
+select null sounds like null;
+null sounds like null
+NULL
select md5('hello');
md5('hello')
5d41402abc4b2a76b9719d911017c592
+select crc32("123");
+crc32("123")
+2286445522
select sha('abc');
sha('abc')
a9993e364706816aba3e25717850c26c9cd0d89d
@@ -167,6 +192,15 @@ length(quote(concat(char(0),"test")))
select hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235))));
hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235))))
27E0E3E6E7E8EAEB27
+select unhex(hex("foobar")), hex(unhex("1234567890ABCDEF")), unhex("345678"), unhex(NULL);
+unhex(hex("foobar")) hex(unhex("1234567890ABCDEF")) unhex("345678") unhex(NULL)
+foobar 1234567890ABCDEF 4Vx NULL
+select hex(unhex("1")), hex(unhex("12")), hex(unhex("123")), hex(unhex("1234")), hex(unhex("12345")), hex(unhex("123456"));
+hex(unhex("1")) hex(unhex("12")) hex(unhex("123")) hex(unhex("1234")) hex(unhex("12345")) hex(unhex("123456"))
+01 12 0123 1234 012345 123456
+select length(unhex(md5("abrakadabra")));
+length(unhex(md5("abrakadabra")))
+16
select concat('a', quote(NULL));
concat('a', quote(NULL))
aNULL
@@ -194,6 +228,8 @@ substring_index("www.tcx.se","",3)
select length(repeat("a",100000000)),length(repeat("a",1000*64));
length(repeat("a",100000000)) length(repeat("a",1000*64))
NULL 64000
+Warnings:
+Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select position("0" in "baaa" in (1)),position("0" in "1" in (1,2,3)),position("sql" in ("mysql"));
position("0" in "baaa" in (1)) position("0" in "1" in (1,2,3)) position("sql" in ("mysql"))
1 0 3
@@ -226,22 +262,22 @@ created datetime default NULL,
modified timestamp(14) NOT NULL,
bugstatus int(10) unsigned default NULL,
submitter int(10) unsigned default NULL
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,'Link',1,1,1,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa','2001-02-28 08:40:16',20010228084016,0,4);
-SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified,bugstatus,submitter), '"') FROM t1;
-CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified,bugstatus,submitter), '"')
+SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter), '"') FROM t1;
+CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter), '"')
"Link";"1";"1";"1";"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";"2001-02-28 08:40:16";"20010228084016";"0";"4"
SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugstatus,submitter), '"') FROM t1;
CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugstatus,submitter), '"')
"Link";"1";"1";"1";"0";"4"
-SELECT CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified,bugstatus,submitter) FROM t1;
-CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified,bugstatus,submitter)
+SELECT CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter) FROM t1;
+CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter)
Link";"1";"1";"1";"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";"2001-02-28 08:40:16";"20010228084016";"0";"4
SELECT bugdesc, REPLACE(bugdesc, 'xxxxxxxxxxxxxxxxxxxx', 'bbbbbbbbbbbbbbbbbbbb') from t1 group by bugdesc;
bugdesc REPLACE(bugdesc, 'xxxxxxxxxxxxxxxxxxxx', 'bbbbbbbbbbbbbbbbbbbb')
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
drop table t1;
-CREATE TABLE t1 (id int(11) NOT NULL auto_increment, tmp text NOT NULL, KEY id (id)) TYPE=MyISAM;
+CREATE TABLE t1 (id int(11) NOT NULL auto_increment, tmp text NOT NULL, KEY id (id)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1, 'a545f661efdd1fb66fdee3aab79945bf');
SELECT 1 FROM t1 WHERE tmp=AES_DECRYPT(tmp,"password");
1
@@ -259,9 +295,7 @@ elt(status_wnio,data_podp)
NULL
NULL
DROP TABLE t1;
-CREATE TABLE t1 (
-title text
-) TYPE=MyISAM;
+CREATE TABLE t1 (title text) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('Congress reconvenes in September to debate welfare and adult education');
INSERT INTO t1 VALUES ('House passes the CAREERS bill');
SELECT CONCAT("</a>",RPAD("",(55 - LENGTH(title)),".")) from t1;
@@ -291,3 +325,369 @@ trim(trailing 'foo' from 'foo')
select trim(leading 'foo' from 'foo');
trim(leading 'foo' from 'foo')
+select 1=_latin1'1';
+1=_latin1'1'
+1
+select _latin1'1'=1;
+_latin1'1'=1
+1
+select _latin2'1'=1;
+_latin2'1'=1
+1
+select 1=_latin2'1';
+1=_latin2'1'
+1
+select _latin1'1'=_latin2'1';
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation '='
+select row('a','b','c') = row('a','b','c');
+row('a','b','c') = row('a','b','c')
+1
+select row('A','b','c') = row('a','b','c');
+row('A','b','c') = row('a','b','c')
+1
+select row('A' COLLATE latin1_bin,'b','c') = row('a','b','c');
+row('A' COLLATE latin1_bin,'b','c') = row('a','b','c')
+0
+select row('A','b','c') = row('a' COLLATE latin1_bin,'b','c');
+row('A','b','c') = row('a' COLLATE latin1_bin,'b','c')
+0
+select row('A' COLLATE latin1_general_ci,'b','c') = row('a' COLLATE latin1_bin,'b','c');
+ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation '='
+select concat(_latin1'a',_latin2'a');
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'concat'
+select concat(_latin1'a',_latin2'a',_latin5'a');
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE), (latin2_general_ci,COERCIBLE), (latin5_turkish_ci,COERCIBLE) for operation 'concat'
+select concat(_latin1'a',_latin2'a',_latin5'a',_latin7'a');
+ERROR HY000: Illegal mix of collations for operation 'concat'
+select concat_ws(_latin1'a',_latin2'a');
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'concat_ws'
+select FIELD('b','A','B');
+FIELD('b','A','B')
+2
+select FIELD('B','A','B');
+FIELD('B','A','B')
+2
+select FIELD('b' COLLATE latin1_bin,'A','B');
+FIELD('b' COLLATE latin1_bin,'A','B')
+0
+select FIELD('b','A' COLLATE latin1_bin,'B');
+FIELD('b','A' COLLATE latin1_bin,'B')
+0
+select FIELD(_latin2'b','A','B');
+ERROR HY000: Illegal mix of collations (latin2_general_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE) for operation 'field'
+select FIELD('b',_latin2'A','B');
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE), (latin2_general_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE) for operation 'field'
+select FIELD('b',_latin2'A','B',1);
+FIELD('b',_latin2'A','B',1)
+1
+select POSITION(_latin1'B' IN _latin1'abcd');
+POSITION(_latin1'B' IN _latin1'abcd')
+2
+select POSITION(_latin1'B' IN _latin1'abcd' COLLATE latin1_bin);
+POSITION(_latin1'B' IN _latin1'abcd' COLLATE latin1_bin)
+0
+select POSITION(_latin1'B' COLLATE latin1_bin IN _latin1'abcd');
+POSITION(_latin1'B' COLLATE latin1_bin IN _latin1'abcd')
+0
+select POSITION(_latin1'B' COLLATE latin1_general_ci IN _latin1'abcd' COLLATE latin1_bin);
+ERROR HY000: Illegal mix of collations (latin1_bin,EXPLICIT) and (latin1_general_ci,EXPLICIT) for operation 'locate'
+select POSITION(_latin1'B' IN _latin2'abcd');
+ERROR HY000: Illegal mix of collations (latin2_general_ci,COERCIBLE) and (latin1_swedish_ci,COERCIBLE) for operation 'locate'
+select FIND_IN_SET(_latin1'B',_latin1'a,b,c,d');
+FIND_IN_SET(_latin1'B',_latin1'a,b,c,d')
+2
+select FIND_IN_SET(_latin1'B' COLLATE latin1_general_ci,_latin1'a,b,c,d' COLLATE latin1_bin);
+ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation 'find_in_set'
+select FIND_IN_SET(_latin1'B',_latin2'a,b,c,d');
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'find_in_set'
+select SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin1'd',2);
+SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin1'd',2)
+abcdabc
+select SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin2'd',2);
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'substr_index'
+select SUBSTRING_INDEX(_latin1'abcdabcdabcd' COLLATE latin1_general_ci,_latin1'd' COLLATE latin1_bin,2);
+ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation 'substr_index'
+select _latin1'B' between _latin1'a' and _latin1'c';
+_latin1'B' between _latin1'a' and _latin1'c'
+1
+select _latin1'B' collate latin1_bin between _latin1'a' and _latin1'c';
+_latin1'B' collate latin1_bin between _latin1'a' and _latin1'c'
+0
+select _latin1'B' between _latin1'a' collate latin1_bin and _latin1'c';
+_latin1'B' between _latin1'a' collate latin1_bin and _latin1'c'
+0
+select _latin1'B' between _latin1'a' and _latin1'c' collate latin1_bin;
+_latin1'B' between _latin1'a' and _latin1'c' collate latin1_bin
+0
+select _latin2'B' between _latin1'a' and _latin1'b';
+ERROR HY000: Illegal mix of collations (latin2_general_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE) for operation 'between'
+select _latin1'B' between _latin2'a' and _latin1'b';
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE), (latin2_general_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE) for operation 'between'
+select _latin1'B' between _latin1'a' and _latin2'b';
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE), (latin2_general_ci,COERCIBLE) for operation 'between'
+select _latin1'B' collate latin1_general_ci between _latin1'a' collate latin1_bin and _latin1'b';
+ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT), (latin1_bin,EXPLICIT), (latin1_swedish_ci,COERCIBLE) for operation 'between'
+select _latin1'B' in (_latin1'a',_latin1'b');
+_latin1'B' in (_latin1'a',_latin1'b')
+1
+select _latin1'B' collate latin1_bin in (_latin1'a',_latin1'b');
+_latin1'B' collate latin1_bin in (_latin1'a',_latin1'b')
+0
+select _latin1'B' in (_latin1'a' collate latin1_bin,_latin1'b');
+_latin1'B' in (_latin1'a' collate latin1_bin,_latin1'b')
+0
+select _latin1'B' in (_latin1'a',_latin1'b' collate latin1_bin);
+_latin1'B' in (_latin1'a',_latin1'b' collate latin1_bin)
+0
+select _latin2'B' in (_latin1'a',_latin1'b');
+ERROR HY000: Illegal mix of collations (latin2_general_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE) for operation ' IN '
+select _latin1'B' in (_latin2'a',_latin1'b');
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE), (latin2_general_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE) for operation ' IN '
+select _latin1'B' in (_latin1'a',_latin2'b');
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE), (latin2_general_ci,COERCIBLE) for operation ' IN '
+select _latin1'B' COLLATE latin1_general_ci in (_latin1'a' COLLATE latin1_bin,_latin1'b');
+ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT), (latin1_bin,EXPLICIT), (latin1_swedish_ci,COERCIBLE) for operation ' IN '
+select _latin1'B' COLLATE latin1_general_ci in (_latin1'a',_latin1'b' COLLATE latin1_bin);
+ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT), (latin1_swedish_ci,COERCIBLE), (latin1_bin,EXPLICIT) for operation ' IN '
+select collation(bin(130)), coercibility(bin(130));
+collation(bin(130)) coercibility(bin(130))
+latin1_swedish_ci 3
+select collation(oct(130)), coercibility(oct(130));
+collation(oct(130)) coercibility(oct(130))
+latin1_swedish_ci 3
+select collation(conv(130,16,10)), coercibility(conv(130,16,10));
+collation(conv(130,16,10)) coercibility(conv(130,16,10))
+latin1_swedish_ci 3
+select collation(hex(130)), coercibility(hex(130));
+collation(hex(130)) coercibility(hex(130))
+latin1_swedish_ci 3
+select collation(char(130)), coercibility(hex(130));
+collation(char(130)) coercibility(hex(130))
+binary 3
+select collation(format(130,10)), coercibility(format(130,10));
+collation(format(130,10)) coercibility(format(130,10))
+latin1_swedish_ci 3
+select collation(lcase(_latin2'a')), coercibility(lcase(_latin2'a'));
+collation(lcase(_latin2'a')) coercibility(lcase(_latin2'a'))
+latin2_general_ci 3
+select collation(ucase(_latin2'a')), coercibility(ucase(_latin2'a'));
+collation(ucase(_latin2'a')) coercibility(ucase(_latin2'a'))
+latin2_general_ci 3
+select collation(left(_latin2'a',1)), coercibility(left(_latin2'a',1));
+collation(left(_latin2'a',1)) coercibility(left(_latin2'a',1))
+latin2_general_ci 3
+select collation(right(_latin2'a',1)), coercibility(right(_latin2'a',1));
+collation(right(_latin2'a',1)) coercibility(right(_latin2'a',1))
+latin2_general_ci 3
+select collation(substring(_latin2'a',1,1)), coercibility(substring(_latin2'a',1,1));
+collation(substring(_latin2'a',1,1)) coercibility(substring(_latin2'a',1,1))
+latin2_general_ci 3
+select collation(concat(_latin2'a',_latin2'b')), coercibility(concat(_latin2'a',_latin2'b'));
+collation(concat(_latin2'a',_latin2'b')) coercibility(concat(_latin2'a',_latin2'b'))
+latin2_general_ci 3
+select collation(lpad(_latin2'a',4,_latin2'b')), coercibility(lpad(_latin2'a',4,_latin2'b'));
+collation(lpad(_latin2'a',4,_latin2'b')) coercibility(lpad(_latin2'a',4,_latin2'b'))
+latin2_general_ci 3
+select collation(rpad(_latin2'a',4,_latin2'b')), coercibility(rpad(_latin2'a',4,_latin2'b'));
+collation(rpad(_latin2'a',4,_latin2'b')) coercibility(rpad(_latin2'a',4,_latin2'b'))
+latin2_general_ci 3
+select collation(concat_ws(_latin2'a',_latin2'b')), coercibility(concat_ws(_latin2'a',_latin2'b'));
+collation(concat_ws(_latin2'a',_latin2'b')) coercibility(concat_ws(_latin2'a',_latin2'b'))
+latin2_general_ci 3
+select collation(make_set(255,_latin2'a',_latin2'b',_latin2'c')), coercibility(make_set(255,_latin2'a',_latin2'b',_latin2'c'));
+collation(make_set(255,_latin2'a',_latin2'b',_latin2'c')) coercibility(make_set(255,_latin2'a',_latin2'b',_latin2'c'))
+latin2_general_ci 3
+select collation(export_set(255,_latin2'y',_latin2'n',_latin2' ')), coercibility(export_set(255,_latin2'y',_latin2'n',_latin2' '));
+collation(export_set(255,_latin2'y',_latin2'n',_latin2' ')) coercibility(export_set(255,_latin2'y',_latin2'n',_latin2' '))
+binary 3
+select collation(trim(_latin2' a ')), coercibility(trim(_latin2' a '));
+collation(trim(_latin2' a ')) coercibility(trim(_latin2' a '))
+latin2_general_ci 3
+select collation(ltrim(_latin2' a ')), coercibility(ltrim(_latin2' a '));
+collation(ltrim(_latin2' a ')) coercibility(ltrim(_latin2' a '))
+latin2_general_ci 3
+select collation(rtrim(_latin2' a ')), coercibility(rtrim(_latin2' a '));
+collation(rtrim(_latin2' a ')) coercibility(rtrim(_latin2' a '))
+latin2_general_ci 3
+select collation(trim(LEADING _latin2' ' FROM _latin2'a')), coercibility(trim(LEADING _latin2'a' FROM _latin2'a'));
+collation(trim(LEADING _latin2' ' FROM _latin2'a')) coercibility(trim(LEADING _latin2'a' FROM _latin2'a'))
+latin2_general_ci 3
+select collation(trim(TRAILING _latin2' ' FROM _latin2'a')), coercibility(trim(TRAILING _latin2'a' FROM _latin2'a'));
+collation(trim(TRAILING _latin2' ' FROM _latin2'a')) coercibility(trim(TRAILING _latin2'a' FROM _latin2'a'))
+latin2_general_ci 3
+select collation(trim(BOTH _latin2' ' FROM _latin2'a')), coercibility(trim(BOTH _latin2'a' FROM _latin2'a'));
+collation(trim(BOTH _latin2' ' FROM _latin2'a')) coercibility(trim(BOTH _latin2'a' FROM _latin2'a'))
+latin2_general_ci 3
+select collation(repeat(_latin2'a',10)), coercibility(repeat(_latin2'a',10));
+collation(repeat(_latin2'a',10)) coercibility(repeat(_latin2'a',10))
+latin2_general_ci 3
+select collation(reverse(_latin2'ab')), coercibility(reverse(_latin2'ab'));
+collation(reverse(_latin2'ab')) coercibility(reverse(_latin2'ab'))
+latin2_general_ci 3
+select collation(quote(_latin2'ab')), coercibility(quote(_latin2'ab'));
+collation(quote(_latin2'ab')) coercibility(quote(_latin2'ab'))
+latin2_general_ci 3
+select collation(soundex(_latin2'ab')), coercibility(soundex(_latin2'ab'));
+collation(soundex(_latin2'ab')) coercibility(soundex(_latin2'ab'))
+latin2_general_ci 3
+select collation(substring(_latin2'ab',1)), coercibility(substring(_latin2'ab',1));
+collation(substring(_latin2'ab',1)) coercibility(substring(_latin2'ab',1))
+latin2_general_ci 3
+select collation(insert(_latin2'abcd',2,3,_latin2'ef')), coercibility(insert(_latin2'abcd',2,3,_latin2'ef'));
+collation(insert(_latin2'abcd',2,3,_latin2'ef')) coercibility(insert(_latin2'abcd',2,3,_latin2'ef'))
+latin2_general_ci 3
+select collation(replace(_latin2'abcd',_latin2'b',_latin2'B')), coercibility(replace(_latin2'abcd',_latin2'b',_latin2'B'));
+collation(replace(_latin2'abcd',_latin2'b',_latin2'B')) coercibility(replace(_latin2'abcd',_latin2'b',_latin2'B'))
+latin2_general_ci 3
+select collation(encode('abcd','ab')), coercibility(encode('abcd','ab'));
+collation(encode('abcd','ab')) coercibility(encode('abcd','ab'))
+binary 3
+create table t1
+select
+bin(130),
+oct(130),
+conv(130,16,10),
+hex(130),
+char(130),
+format(130,10),
+left(_latin2'a',1),
+right(_latin2'a',1),
+lcase(_latin2'a'),
+ucase(_latin2'a'),
+substring(_latin2'a',1,1),
+concat(_latin2'a',_latin2'b'),
+lpad(_latin2'a',4,_latin2'b'),
+rpad(_latin2'a',4,_latin2'b'),
+concat_ws(_latin2'a',_latin2'b'),
+make_set(255,_latin2'a',_latin2'b',_latin2'c'),
+export_set(255,_latin2'y',_latin2'n',_latin2' '),
+trim(_latin2' a '),
+ltrim(_latin2' a '),
+rtrim(_latin2' a '),
+trim(LEADING _latin2' ' FROM _latin2' a '),
+trim(TRAILING _latin2' ' FROM _latin2' a '),
+trim(BOTH _latin2' ' FROM _latin2' a '),
+repeat(_latin2'a',10),
+reverse(_latin2'ab'),
+quote(_latin2'ab'),
+soundex(_latin2'ab'),
+substring(_latin2'ab',1),
+insert(_latin2'abcd',2,3,_latin2'ef'),
+replace(_latin2'abcd',_latin2'b',_latin2'B'),
+encode('abcd','ab')
+;
+Warnings:
+Warning 1265 Data truncated for column 'format(130,10)' at row 1
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `bin(130)` char(64) NOT NULL default '',
+ `oct(130)` char(64) NOT NULL default '',
+ `conv(130,16,10)` char(64) NOT NULL default '',
+ `hex(130)` char(6) NOT NULL default '',
+ `char(130)` char(1) NOT NULL default '',
+ `format(130,10)` char(4) NOT NULL default '',
+ `left(_latin2'a',1)` char(1) character set latin2 NOT NULL default '',
+ `right(_latin2'a',1)` char(1) character set latin2 NOT NULL default '',
+ `lcase(_latin2'a')` char(1) character set latin2 NOT NULL default '',
+ `ucase(_latin2'a')` char(1) character set latin2 NOT NULL default '',
+ `substring(_latin2'a',1,1)` char(1) character set latin2 NOT NULL default '',
+ `concat(_latin2'a',_latin2'b')` char(2) character set latin2 NOT NULL default '',
+ `lpad(_latin2'a',4,_latin2'b')` char(4) character set latin2 NOT NULL default '',
+ `rpad(_latin2'a',4,_latin2'b')` char(4) character set latin2 NOT NULL default '',
+ `concat_ws(_latin2'a',_latin2'b')` char(1) character set latin2 NOT NULL default '',
+ `make_set(255,_latin2'a',_latin2'b',_latin2'c')` char(5) character set latin2 NOT NULL default '',
+ `export_set(255,_latin2'y',_latin2'n',_latin2' ')` char(127) character set latin2 NOT NULL default '',
+ `trim(_latin2' a ')` char(3) character set latin2 NOT NULL default '',
+ `ltrim(_latin2' a ')` char(3) character set latin2 NOT NULL default '',
+ `rtrim(_latin2' a ')` char(3) character set latin2 NOT NULL default '',
+ `trim(LEADING _latin2' ' FROM _latin2' a ')` char(3) character set latin2 NOT NULL default '',
+ `trim(TRAILING _latin2' ' FROM _latin2' a ')` char(3) character set latin2 NOT NULL default '',
+ `trim(BOTH _latin2' ' FROM _latin2' a ')` char(3) character set latin2 NOT NULL default '',
+ `repeat(_latin2'a',10)` char(10) character set latin2 NOT NULL default '',
+ `reverse(_latin2'ab')` char(2) character set latin2 NOT NULL default '',
+ `quote(_latin2'ab')` char(6) character set latin2 NOT NULL default '',
+ `soundex(_latin2'ab')` char(4) character set latin2 NOT NULL default '',
+ `substring(_latin2'ab',1)` char(2) character set latin2 NOT NULL default '',
+ `insert(_latin2'abcd',2,3,_latin2'ef')` char(6) character set latin2 NOT NULL default '',
+ `replace(_latin2'abcd',_latin2'b',_latin2'B')` char(4) character set latin2 NOT NULL default '',
+ `encode('abcd','ab')` binary(4) NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select SUBSTR('abcdefg',3,2);
+SUBSTR('abcdefg',3,2)
+cd
+select SUBSTRING('abcdefg',3,2);
+SUBSTRING('abcdefg',3,2)
+cd
+select SUBSTR('abcdefg',-3,2) FROM DUAL;
+SUBSTR('abcdefg',-3,2)
+ef
+select SUBSTR('abcdefg',-1,5) FROM DUAL;
+SUBSTR('abcdefg',-1,5)
+g
+select SUBSTR('abcdefg',0,0) FROM DUAL;
+SUBSTR('abcdefg',0,0)
+
+select SUBSTR('abcdefg',-1,-1) FROM DUAL;
+SUBSTR('abcdefg',-1,-1)
+
+select SUBSTR('abcdefg',1,-1) FROM DUAL;
+SUBSTR('abcdefg',1,-1)
+
+create table t7 (s1 char);
+select * from t7
+where concat(s1 collate latin1_general_ci,s1 collate latin1_swedish_ci) = 'AA';
+ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT) and (latin1_swedish_ci,EXPLICIT) for operation 'concat'
+drop table t7;
+select substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2),substring_index("1abcd;2abcd;3abcd;4abcd", ';', -2);
+substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2) substring_index("1abcd;2abcd;3abcd;4abcd", ';', -2)
+1abcd;2abcd 3abcd;4abcd
+explain extended select md5('hello'), sha('abc'), sha1('abc'), soundex(''), 'mood' sounds like 'mud', aes_decrypt(aes_encrypt('abc','1'),'1'),concat('*',space(5),'*'), reverse('abc'), rpad('a',4,'1'), lpad('a',4,'1'), concat_ws(',','',NULL,'a'),make_set(255,_latin2'a',_latin2'b',_latin2'c'),elt(2,1),locate("a","b",2),format(130,10),char(0),conv(130,16,10),hex(130),binary 'HE', export_set(255,_latin2'y',_latin2'n',_latin2' '),FIELD('b' COLLATE latin1_bin,'A','B'),FIND_IN_SET(_latin1'B',_latin1'a,b,c,d'),collation(conv(130,16,10)), coercibility(conv(130,16,10)),length('\n\t\r\b\0\_\%\\'),bit_length('\n\t\r\b\0\_\%\\'),bit_length('\n\t\r\b\0\_\%\\'),concat('monty',' was here ','again'),length('hello'),char(ascii('h')),ord('h'),quote(1/0),crc32("123"),replace('aaaa','a','b'),insert('txs',2,1,'hi'),left(_latin2'a',1),right(_latin2'a',1),lcase(_latin2'a'),ucase(_latin2'a'),SUBSTR('abcdefg',3,2),substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2),trim(_latin2' a '),ltrim(_latin2' a '),rtrim(_latin2' a '), decode(encode(repeat("a",100000),"monty"),"monty");
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select md5(_latin1'hello') AS `md5('hello')`,sha(_latin1'abc') AS `sha('abc')`,sha(_latin1'abc') AS `sha1('abc')`,soundex(_latin1'') AS `soundex('')`,(soundex(_latin1'mood') = soundex(_latin1'mud')) AS `'mood' sounds like 'mud'`,aes_decrypt(aes_encrypt(_latin1'abc',_latin1'1'),_latin1'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')`,concat(_latin1'*',repeat(_latin1' ',5),_latin1'*') AS `concat('*',space(5),'*')`,reverse(_latin1'abc') AS `reverse('abc')`,rpad(_latin1'a',4,_latin1'1') AS `rpad('a',4,'1')`,lpad(_latin1'a',4,_latin1'1') AS `lpad('a',4,'1')`,concat_ws(_latin1',',_latin1'',NULL,_latin1'a') AS `concat_ws(',','',NULL,'a')`,make_set(255,_latin2'a',_latin2'b',_latin2'c') AS `make_set(255,_latin2'a',_latin2'b',_latin2'c')`,elt(2,1) AS `elt(2,1)`,locate(_latin1'a',_latin1'b',2) AS `locate("a","b",2)`,format(130,10) AS `format(130,10)`,char(0) AS `char(0)`,conv(130,16,10) AS `conv(130,16,10)`,hex(130) AS `hex(130)`,cast(_latin1'HE' as char charset binary) AS `binary 'HE'`,export_set(255,_latin2'y',_latin2'n',_latin2' ') AS `export_set(255,_latin2'y',_latin2'n',_latin2' ')`,field((_latin1'b' collate _latin1'latin1_bin'),_latin1'A',_latin1'B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`,find_in_set(_latin1'B',_latin1'a,b,c,d') AS `FIND_IN_SET(_latin1'B',_latin1'a,b,c,d')`,collation(conv(130,16,10)) AS `collation(conv(130,16,10))`,coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))`,length(_latin1'\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,concat(_latin1'monty',_latin1' was here ',_latin1'again') AS `concat('monty',' was here ','again')`,length(_latin1'hello') AS `length('hello')`,char(ascii(_latin1'h')) AS `char(ascii('h'))`,ord(_latin1'h') AS `ord('h')`,quote((1 / 0)) AS `quote(1/0)`,crc32(_latin1'123') AS `crc32("123")`,replace(_latin1'aaaa',_latin1'a',_latin1'b') AS `replace('aaaa','a','b')`,insert(_latin1'txs',2,1,_latin1'hi') AS `insert('txs',2,1,'hi')`,left(_latin2'a',1) AS `left(_latin2'a',1)`,right(_latin2'a',1) AS `right(_latin2'a',1)`,lcase(_latin2'a') AS `lcase(_latin2'a')`,ucase(_latin2'a') AS `ucase(_latin2'a')`,substr(_latin1'abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`,substr_index(_latin1'1abcd;2abcd;3abcd;4abcd',_latin1';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`,trim(_latin2' a ') AS `trim(_latin2' a ')`,ltrim(_latin2' a ') AS `ltrim(_latin2' a ')`,rtrim(_latin2' a ') AS `rtrim(_latin2' a ')`,decode(encode(repeat(_latin1'a',100000))) AS `decode(encode(repeat("a",100000),"monty"),"monty")`
+SELECT lpad(12345, 5, "#");
+lpad(12345, 5, "#")
+12345
+SELECT conv(71, 10, 36), conv('1Z', 36, 10);
+conv(71, 10, 36) conv('1Z', 36, 10)
+1Z 71
+create table t1 (id int(1), str varchar(10)) DEFAULT CHARSET=utf8;
+insert into t1 values (1,'aaaaaaaaaa'), (2,'bbbbbbbbbb');
+create table t2 (id int(1), str varchar(10)) DEFAULT CHARSET=utf8;
+insert into t2 values (1,'cccccccccc'), (2,'dddddddddd');
+select substring(concat(t1.str, t2.str), 1, 15) "name" from t1, t2
+where t2.id=t1.id order by name;
+name
+aaaaaaaaaaccccc
+bbbbbbbbbbddddd
+drop table t1, t2;
+create table t1 (c1 INT, c2 INT UNSIGNED);
+insert into t1 values ('21474836461','21474836461');
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+insert into t1 values ('-21474836461','-21474836461');
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+show warnings;
+Level Code Message
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+select * from t1;
+c1 c2
+2147483647 4294967295
+-2147483648 0
+drop table t1;
+select left(1234, 3) + 0;
+left(1234, 3) + 0
+123
+create table t1 (a int not null primary key, b varchar(40), c datetime);
+insert into t1 (a,b,c) values (1,'Tom','2004-12-10 12:13:14'),(2,'ball games','2004-12-10 12:13:14'), (3,'Basil','2004-12-10 12:13:14'), (4,'Dean','2004-12-10 12:13:14'),(5,'Ellis','2004-12-10 12:13:14'), (6,'Serg','2004-12-10 12:13:14'), (7,'Sergei','2004-12-10 12:13:14'),(8,'Georg','2004-12-10 12:13:14'),(9,'Salle','2004-12-10 12:13:14'),(10,'Sinisa','2004-12-10 12:13:14');
+select count(*) as total, left(c,10) as reg from t1 group by reg order by reg desc limit 0,12;
+total reg
+10 2004-12-10
+drop table t1;
diff --git a/mysql-test/r/func_system.result b/mysql-test/r/func_system.result
index 5ea4ed5e4e0..d3db2cc5151 100644
--- a/mysql-test/r/func_system.result
+++ b/mysql-test/r/func_system.result
@@ -1,6 +1,70 @@
-select database(),user() like "%@%";
-database() user() like "%@%"
-test 1
+select database();
+database()
+test
+select charset(database());
+charset(database())
+utf8
+select database() = "test";
+database() = "test"
+1
+select database() = _utf8"test";
+database() = _utf8"test"
+1
+select database() = _latin1"test";
+database() = _latin1"test"
+1
+select user() like "%@%";
+user() like "%@%"
+1
+select user() like _utf8"%@%";
+user() like _utf8"%@%"
+1
+select user() like _latin1"%@%";
+user() like _latin1"%@%"
+1
+select charset(user());
+charset(user())
+utf8
select version()>="3.23.29";
version()>="3.23.29"
1
+select version()>=_utf8"3.23.29";
+version()>=_utf8"3.23.29"
+1
+select version()>=_latin1"3.23.29";
+version()>=_latin1"3.23.29"
+1
+select charset(version());
+charset(version())
+utf8
+explain extended select database(), user();
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select sql_no_cache database() AS `database()`,user() AS `user()`
+create table t1 (version char(40)) select database(), user(), version() as 'version';
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `database()` char(34) character set utf8 default NULL,
+ `user()` char(77) character set utf8 NOT NULL default '',
+ `version` char(40) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select charset(charset(_utf8'a')), charset(collation(_utf8'a'));
+charset(charset(_utf8'a')) charset(collation(_utf8'a'))
+utf8 utf8
+select collation(charset(_utf8'a')), collation(collation(_utf8'a'));
+collation(charset(_utf8'a')) collation(collation(_utf8'a'))
+utf8_general_ci utf8_general_ci
+create table t1 select charset(_utf8'a'), collation(_utf8'a');
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `charset(_utf8'a')` char(64) character set utf8 NOT NULL default '',
+ `collation(_utf8'a')` char(64) character set utf8 NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select TRUE,FALSE,NULL;
+TRUE FALSE NULL
+1 0 NULL
diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result
index aaf5039eb43..8a28312b348 100644
--- a/mysql-test/r/func_test.result
+++ b/mysql-test/r/func_test.result
@@ -1,3 +1,4 @@
+drop table if exists t1,t2;
select 0=0,1>0,1>=1,1<0,1<=0,1!=0,strcmp("abc","abcd"),strcmp("b","a"),strcmp("a","a") ;
0=0 1>0 1>=1 1<0 1<=0 1!=0 strcmp("abc","abcd") strcmp("b","a") strcmp("a","a")
1 1 1 0 0 1 -1 1 0
@@ -43,16 +44,50 @@ select -1.49 or -1.49,0.6 or 0.6;
select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
3 ^ 11 1 ^ 1 1 ^ 0 1 ^ NULL NULL ^ 1
8 0 1 NULL NULL
+explain extended select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
+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 (3 ^ 11) AS `3 ^ 11`,(1 ^ 1) AS `1 ^ 1`,(1 ^ 0) AS `1 ^ 0`,(1 ^ NULL) AS `1 ^ NULL`,(NULL ^ 1) AS `NULL ^ 1`
select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL;
1 XOR 1 1 XOR 0 0 XOR 1 0 XOR 0 NULL XOR 1 1 XOR NULL 0 XOR NULL
0 1 1 0 NULL NULL NULL
select 1 like 2 xor 2 like 1;
1 like 2 xor 2 like 1
0
+select 10 % 7, 10 mod 7, 10 div 3;
+10 % 7 10 mod 7 10 div 3
+3 3 3
+explain extended select 10 % 7, 10 mod 7, 10 div 3;
+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 (10 % 7) AS `10 % 7`,(10 % 7) AS `10 mod 7`,(10 DIV 3) AS `10 div 3`
+select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2;
+(1 << 64)-1 ((1 << 64)-1) DIV 1 ((1 << 64)-1) DIV 2
+18446744073709551615 18446744073709551615 9223372036854775807
+explain extended select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2;
+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 ((1 << 64) - 1) AS `(1 << 64)-1`,(((1 << 64) - 1) DIV 1) AS `((1 << 64)-1) DIV 1`,(((1 << 64) - 1) DIV 2) AS `((1 << 64)-1) DIV 2`
create table t1 (a int);
insert t1 values (1);
select * from t1 where 1 xor 1;
a
+explain extended select * from t1 where 1 xor 1;
+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 test.t1.a AS `a` from test.t1 where (1 xor 1)
+select - a from t1;
+- a
+-1
+explain extended select - a from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 1
+Warnings:
+Note 1003 select -(test.t1.a) AS `- a` from test.t1
drop table t1;
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1
@@ -63,12 +98,88 @@ select 1 and 2 between 2 and 10, 2 between 2 and 10 and 1;
select 1 and 0 or 2, 2 or 1 and 0;
1 and 0 or 2 2 or 1 and 0
1 1
-DROP TABLE IF EXISTS t1,t2;
-CREATE TABLE t1 ( faq_group_id int(11) NOT NULL default '0', faq_id int(11) NOT NULL default '0', title varchar(240) default NULL, keywords text, description longblob, solution longblob, status tinyint(4) NOT NULL default '0', access_id smallint(6) default NULL, lang_id smallint(6) NOT NULL default '0', created datetime NOT NULL default '0000-00-00 00:00:00', updated datetime default NULL, last_access datetime default NULL, last_notify datetime default NULL, solved_count int(11) NOT NULL default '0', static_solved int(11) default NULL, solved_1 int(11) default NULL, solved_2 int(11) default NULL, solved_3 int(11) default NULL, solved_4 int(11) default NULL, solved_5 int(11) default NULL, expires datetime default NULL, notes text, assigned_to smallint(6) default NULL, assigned_group smallint(6) default NULL, last_edited_by smallint(6) default NULL, orig_ref_no varchar(15) binary default NULL, c$fundstate smallint(6) default NULL, c$contributor smallint(6) default NULL, UNIQUE KEY t1$faq_id (faq_id), KEY t1$group_id$faq_id (faq_group_id,faq_id), KEY t1$c$fundstate (c$fundstate) ) TYPE=MyISAM;
+select _koi8r'a' = _koi8r'A';
+_koi8r'a' = _koi8r'A'
+1
+select _koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci;
+_koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci
+1
+explain extended select _koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci;
+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 (_koi8r'a' = (_koi8r'A' collate _latin1'koi8r_general_ci')) AS `_koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci`
+select _koi8r'a' = _koi8r'A' COLLATE koi8r_bin;
+_koi8r'a' = _koi8r'A' COLLATE koi8r_bin
+0
+select _koi8r'a' COLLATE koi8r_general_ci = _koi8r'A';
+_koi8r'a' COLLATE koi8r_general_ci = _koi8r'A'
+1
+select _koi8r'a' COLLATE koi8r_bin = _koi8r'A';
+_koi8r'a' COLLATE koi8r_bin = _koi8r'A'
+0
+select _koi8r'a' COLLATE koi8r_bin = _koi8r'A' COLLATE koi8r_general_ci;
+ERROR HY000: Illegal mix of collations (koi8r_bin,EXPLICIT) and (koi8r_general_ci,EXPLICIT) for operation '='
+select _koi8r'a' = _latin1'A';
+ERROR HY000: Illegal mix of collations (koi8r_general_ci,COERCIBLE) and (latin1_swedish_ci,COERCIBLE) for operation '='
+select strcmp(_koi8r'a', _koi8r'A');
+strcmp(_koi8r'a', _koi8r'A')
+0
+select strcmp(_koi8r'a', _koi8r'A' COLLATE koi8r_general_ci);
+strcmp(_koi8r'a', _koi8r'A' COLLATE koi8r_general_ci)
+0
+select strcmp(_koi8r'a', _koi8r'A' COLLATE koi8r_bin);
+strcmp(_koi8r'a', _koi8r'A' COLLATE koi8r_bin)
+1
+select strcmp(_koi8r'a' COLLATE koi8r_general_ci, _koi8r'A');
+strcmp(_koi8r'a' COLLATE koi8r_general_ci, _koi8r'A')
+0
+select strcmp(_koi8r'a' COLLATE koi8r_bin, _koi8r'A');
+strcmp(_koi8r'a' COLLATE koi8r_bin, _koi8r'A')
+1
+select strcmp(_koi8r'a' COLLATE koi8r_general_ci, _koi8r'A' COLLATE koi8r_bin);
+ERROR HY000: Illegal mix of collations (koi8r_general_ci,EXPLICIT) and (koi8r_bin,EXPLICIT) for operation 'strcmp'
+select strcmp(_koi8r'a', _latin1'A');
+ERROR HY000: Illegal mix of collations (koi8r_general_ci,COERCIBLE) and (latin1_swedish_ci,COERCIBLE) for operation 'strcmp'
+select _koi8r'a' LIKE _koi8r'A';
+_koi8r'a' LIKE _koi8r'A'
+1
+select _koi8r'a' LIKE _koi8r'A' COLLATE koi8r_general_ci;
+_koi8r'a' LIKE _koi8r'A' COLLATE koi8r_general_ci
+1
+select _koi8r'a' LIKE _koi8r'A' COLLATE koi8r_bin;
+_koi8r'a' LIKE _koi8r'A' COLLATE koi8r_bin
+0
+select _koi8r'a' COLLATE koi8r_general_ci LIKE _koi8r'A';
+_koi8r'a' COLLATE koi8r_general_ci LIKE _koi8r'A'
+1
+select _koi8r'a' COLLATE koi8r_bin LIKE _koi8r'A';
+_koi8r'a' COLLATE koi8r_bin LIKE _koi8r'A'
+0
+select _koi8r'a' COLLATE koi8r_general_ci LIKE _koi8r'A' COLLATE koi8r_bin;
+ERROR HY000: Illegal mix of collations (koi8r_general_ci,EXPLICIT) and (koi8r_bin,EXPLICIT) for operation 'like'
+select _koi8r'a' LIKE _latin1'A';
+ERROR HY000: Illegal mix of collations (koi8r_general_ci,COERCIBLE) and (latin1_swedish_ci,COERCIBLE) for operation 'like'
+CREATE TABLE t1 ( faq_group_id int(11) NOT NULL default '0', faq_id int(11) NOT NULL default '0', title varchar(240) default NULL, keywords text, description longblob, solution longblob, status tinyint(4) NOT NULL default '0', access_id smallint(6) default NULL, lang_id smallint(6) NOT NULL default '0', created datetime NOT NULL default '0000-00-00 00:00:00', updated datetime default NULL, last_access datetime default NULL, last_notify datetime default NULL, solved_count int(11) NOT NULL default '0', static_solved int(11) default NULL, solved_1 int(11) default NULL, solved_2 int(11) default NULL, solved_3 int(11) default NULL, solved_4 int(11) default NULL, solved_5 int(11) default NULL, expires datetime default NULL, notes text, assigned_to smallint(6) default NULL, assigned_group smallint(6) default NULL, last_edited_by smallint(6) default NULL, orig_ref_no varchar(15) binary default NULL, c$fundstate smallint(6) default NULL, c$contributor smallint(6) default NULL, UNIQUE KEY t1$faq_id (faq_id), KEY t1$group_id$faq_id (faq_group_id,faq_id), KEY t1$c$fundstate (c$fundstate) ) ENGINE=MyISAM;
INSERT INTO t1 VALUES (82,82,'How to use the DynaVox Usage Counts Feature','usages count, number, corner, white, box, button','<as-html>\r\n<table width=\"100%\" border=\"0\">\r\n <tr>\r\n <td width=\"3%\"> </td>\r\n <td width=\"97%\">\r\n <h3><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"#000000\">How \r\n To</font><!-- #BeginEditable \"CS_troubleshoot_question\" --><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"#000099\"><font color=\"#000000\">: \r\n Display or Hide the Usage Counts to find out how many times each button is being selected. </font></font><!-- #EndEditable --></h3>\r\n </td>\r\n </tr>\r\n</table>','<as-html>\r\n <table width=\"100%\" border=\"0\">\r\n <tr>\r\n <td width=\"3%\"> </td>\r\n \r\n<td width=\"97%\"><!-- #BeginEditable \"CS_troubleshoot_answer\" --> \r\n \r\n<p><font color=\"#000000\" face=\"Verdana, Arial, Helvetica, sans-serif\">1. Select \r\n the <i>On/Setup</i> button to access the DynaVox Setup Menu.<br>\r\n 2. Select <b>Button Features.</b><br>\r\n 3. Below the <b>OK</b> button is the <b>Usage Counts</b> button.<br>\r\n a. If it says \"Hidden\" then the Usage Counts will not be displayed.<br>\r\n b. If it says \"Displayed\" then the Usage Counts will be shown.<br>\r\n c. Select the <b>Usage Counts</b> Option Ring once and it will toggle \r\n to the alternative option.<br>\r\n 4. Once the correct setting has been chosen, select <b>OK</b> to leave the <i>Button \r\n Features</i> menu.<br>\r\n 5. Select <b>OK</b> out of the <i>Setup</i> menu and return to the communication \r\n page.</font></p>\r\n <p><font color=\"#000000\" face=\"Verdana, Arial, Helvetica, sans-serif\">For \r\n further information on <i>Usage Counts,</i> see the <i>Button Features \r\n Menu Entry</i> in the DynaVox/DynaMyte Reference Manual.</font></p>\r\n<!-- #EndEditable --></td>\r\n </tr>\r\n</table>',4,1,1,'2001-11-16 16:43:34','2002-11-25 12:09:43','2003-07-24 01:04:48',NULL,11,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,11,NULL,NULL,NULL);
-CREATE TABLE t2 ( access_id smallint(6) NOT NULL default '0', name varchar(20) binary default NULL, rank smallint(6) NOT NULL default '0', KEY t2$access_id (access_id) ) TYPE=MyISAM;
+CREATE TABLE t2 ( access_id smallint(6) NOT NULL default '0', name varchar(20) binary default NULL, rank smallint(6) NOT NULL default '0', KEY t2$access_id (access_id) ) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,'Everyone',2),(2,'Help',3),(3,'Customer Support',1);
SELECT f_acc.rank, a1.rank, a2.rank FROM t1 LEFT JOIN t1 f1 ON (f1.access_id=1 AND f1.faq_group_id = t1.faq_group_id) LEFT JOIN t2 a1 ON (a1.access_id = f1.access_id) LEFT JOIN t1 f2 ON (f2.access_id=3 AND f2.faq_group_id = t1.faq_group_id) LEFT JOIN t2 a2 ON (a2.access_id = f2.access_id), t2 f_acc WHERE LEAST(a1.rank,a2.rank) = f_acc.rank;
rank rank rank
2 2 NULL
DROP TABLE t1,t2;
+CREATE TABLE t1 (d varchar(6), k int);
+INSERT INTO t1 VALUES (NULL, 2);
+SELECT GREATEST(d,d) FROM t1 WHERE k=2;
+GREATEST(d,d)
+NULL
+DROP TABLE t1;
+select 1197.90 mod 50;
+1197.90 mod 50
+47.90
+select 5.1 mod 3, 5.1 mod -3, -5.1 mod 3, -5.1 mod -3;
+5.1 mod 3 5.1 mod -3 -5.1 mod 3 -5.1 mod -3
+2.1 2.1 -2.1 -2.1
+select 5 mod 3, 5 mod -3, -5 mod 3, -5 mod -3;
+5 mod 3 5 mod -3 -5 mod 3 -5 mod -3
+2 2 -2 -2
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index 32034bf289d..c78b16aed8a 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -406,14 +406,18 @@ monthname(date)
NULL
January
drop table t1,t2;
-CREATE TABLE t1 (updated text) TYPE=MyISAM;
+CREATE TABLE t1 (updated text) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('');
SELECT month(updated) from t1;
month(updated)
NULL
+Warnings:
+Warning 1292 Truncated incorrect datetime value: ''
SELECT year(updated) from t1;
year(updated)
NULL
+Warnings:
+Warning 1292 Truncated incorrect datetime value: ''
drop table t1;
create table t1 (d date, dt datetime, t timestamp, c char(10));
insert into t1 values ("0000-00-00", "0000-00-00", "0000-00-00", "0000-00-00");
@@ -453,10 +457,10 @@ CREATE TABLE t3 (ctime1 char(19) NOT NULL, ctime2 char(19) NOT NULL);
INSERT INTO t3 VALUES ("2002-10-29 16:51:06","2002-11-05 16:47:31");
select * from t1, t2 where t1.start between t2.ctime1 and t2.ctime2;
start ctime1 ctime2
-2002-11-04 00:00:00 20021029165106 20021105164731
+2002-11-04 00:00:00 2002-10-29 16:51:06 2002-11-05 16:47:31
select * from t1, t2 where t1.start >= t2.ctime1 and t1.start <= t2.ctime2;
start ctime1 ctime2
-2002-11-04 00:00:00 20021029165106 20021105164731
+2002-11-04 00:00:00 2002-10-29 16:51:06 2002-11-05 16:47:31
select * from t1, t3 where t1.start between t3.ctime1 and t3.ctime2;
start ctime1 ctime2
2002-11-04 00:00:00 2002-10-29 16:51:06 2002-11-05 16:47:31
@@ -476,3 +480,131 @@ NULL
select from_unixtime(2145916800);
from_unixtime(2145916800)
NULL
+CREATE TABLE t1 (datetime datetime, timestamp timestamp, date date, time time);
+INSERT INTO t1 values ("2001-01-02 03:04:05", "2002-01-02 03:04:05", "2003-01-02", "06:07:08");
+SELECT * from t1;
+datetime timestamp date time
+2001-01-02 03:04:05 2002-01-02 03:04:05 2003-01-02 06:07:08
+select date_add("1997-12-31",INTERVAL 1 SECOND);
+date_add("1997-12-31",INTERVAL 1 SECOND)
+1997-12-31 00:00:01
+select date_add("1997-12-31",INTERVAL "1 1" YEAR_MONTH);
+date_add("1997-12-31",INTERVAL "1 1" YEAR_MONTH)
+1999-01-31
+select date_add(datetime, INTERVAL 1 SECOND) from t1;
+date_add(datetime, INTERVAL 1 SECOND)
+2001-01-02 03:04:06
+select date_add(datetime, INTERVAL 1 YEAR) from t1;
+date_add(datetime, INTERVAL 1 YEAR)
+2002-01-02 03:04:05
+select date_add(date,INTERVAL 1 SECOND) from t1;
+date_add(date,INTERVAL 1 SECOND)
+2003-01-02 00:00:01
+select date_add(date,INTERVAL 1 MINUTE) from t1;
+date_add(date,INTERVAL 1 MINUTE)
+2003-01-02 00:01:00
+select date_add(date,INTERVAL 1 HOUR) from t1;
+date_add(date,INTERVAL 1 HOUR)
+2003-01-02 01:00:00
+select date_add(date,INTERVAL 1 DAY) from t1;
+date_add(date,INTERVAL 1 DAY)
+2003-01-03
+select date_add(date,INTERVAL 1 MONTH) from t1;
+date_add(date,INTERVAL 1 MONTH)
+2003-02-02
+select date_add(date,INTERVAL 1 YEAR) from t1;
+date_add(date,INTERVAL 1 YEAR)
+2004-01-02
+select date_add(date,INTERVAL "1:1" MINUTE_SECOND) from t1;
+date_add(date,INTERVAL "1:1" MINUTE_SECOND)
+2003-01-02 00:01:01
+select date_add(date,INTERVAL "1:1" HOUR_MINUTE) from t1;
+date_add(date,INTERVAL "1:1" HOUR_MINUTE)
+2003-01-02 01:01:00
+select date_add(date,INTERVAL "1:1" DAY_HOUR) from t1;
+date_add(date,INTERVAL "1:1" DAY_HOUR)
+2003-01-03 01:00:00
+select date_add(date,INTERVAL "1 1" YEAR_MONTH) from t1;
+date_add(date,INTERVAL "1 1" YEAR_MONTH)
+2004-02-02
+select date_add(date,INTERVAL "1:1:1" HOUR_SECOND) from t1;
+date_add(date,INTERVAL "1:1:1" HOUR_SECOND)
+2003-01-02 01:01:01
+select date_add(date,INTERVAL "1 1:1" DAY_MINUTE) from t1;
+date_add(date,INTERVAL "1 1:1" DAY_MINUTE)
+2003-01-03 01:01:00
+select date_add(date,INTERVAL "1 1:1:1" DAY_SECOND) from t1;
+date_add(date,INTERVAL "1 1:1:1" DAY_SECOND)
+2003-01-03 01:01:01
+select date_add(time,INTERVAL 1 SECOND) from t1;
+date_add(time,INTERVAL 1 SECOND)
+NULL
+Warnings:
+Warning 1264 Data truncated; out of range for column 'time' at row 1
+drop table t1;
+select last_day('2000-02-05') as f1, last_day('2002-12-31') as f2,
+last_day('2003-03-32') as f3, last_day('2003-04-01') as f4,
+last_day('2001-01-01 01:01:01') as f5, last_day(NULL),
+last_day('2001-02-12');
+f1 f2 f3 f4 f5 last_day(NULL) last_day('2001-02-12')
+2000-02-29 2002-12-31 NULL 2003-04-30 2001-01-31 NULL 2001-02-28
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '2003-03-32'
+create table t1 select last_day('2000-02-05') as a,
+from_days(to_days("960101")) as b;
+describe t1;
+Field Type Null Key Default Extra
+a date 0000-00-00
+b date YES NULL
+select * from t1;
+a b
+2000-02-29 1996-01-01
+drop table t1;
+select last_day('2000-02-05') as a,
+from_days(to_days("960101")) as b;
+a b
+2000-02-29 1996-01-01
+select date_add(last_day("1997-12-1"), INTERVAL 1 DAY);
+date_add(last_day("1997-12-1"), INTERVAL 1 DAY)
+1998-01-01
+select length(last_day("1997-12-1"));
+length(last_day("1997-12-1"))
+10
+select last_day("1997-12-1")+0;
+last_day("1997-12-1")+0
+19971231
+select last_day("1997-12-1")+0.0;
+last_day("1997-12-1")+0.0
+19971231.0
+select strcmp(date_sub(localtimestamp(), interval 3 hour), utc_timestamp())=0;
+strcmp(date_sub(localtimestamp(), interval 3 hour), utc_timestamp())=0
+1
+select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%T"), utc_time())=0;
+strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%T"), utc_time())=0
+1
+select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%Y-%m-%d"), utc_date())=0;
+strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%Y-%m-%d"), utc_date())=0
+1
+select strcmp(date_format(utc_timestamp(),"%T"), utc_time())=0;
+strcmp(date_format(utc_timestamp(),"%T"), utc_time())=0
+1
+select strcmp(date_format(utc_timestamp(),"%Y-%m-%d"), utc_date())=0;
+strcmp(date_format(utc_timestamp(),"%Y-%m-%d"), utc_date())=0
+1
+select strcmp(concat(utc_date(),' ',utc_time()),utc_timestamp())=0;
+strcmp(concat(utc_date(),' ',utc_time()),utc_timestamp())=0
+1
+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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select sql_no_cache 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(to_days(curdate())) - weekday(to_days(now()))) AS `weekday(curdate())-weekday(now())`,dayname(to_days(_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();
+CREATE TABLE t1 (d DATETIME);
+INSERT INTO t1 VALUES (NOW());
+INSERT INTO t1 VALUES (NOW());
+INSERT INTO t1 VALUES (NOW());
+SELECT count(*) FROM t1 WHERE d>FROM_DAYS(TO_DAYS(@TMP)) AND d<=FROM_DAYS(TO_DAYS(@TMP)+1);
+count(*)
+3
+DROP TABLE t1;
diff --git a/mysql-test/r/gcc296.result b/mysql-test/r/gcc296.result
index 8f78f70cc1f..628bbbf3f93 100644
--- a/mysql-test/r/gcc296.result
+++ b/mysql-test/r/gcc296.result
@@ -1,5 +1,5 @@
-drop table if exists obory;
-CREATE TABLE obory (
+drop table if exists t1;
+CREATE TABLE t1 (
kodoboru varchar(10) default NULL,
obor tinytext,
aobor tinytext,
@@ -7,14 +7,14 @@ UNIQUE INDEX kodoboru (kodoboru),
FULLTEXT KEY obor (obor),
FULLTEXT KEY aobor (aobor)
);
-INSERT INTO obory VALUES ('0101000000','aaa','AAA');
-INSERT INTO obory VALUES ('0102000000','bbb','BBB');
-INSERT INTO obory VALUES ('0103000000','ccc','CCC');
-INSERT INTO obory VALUES ('0104000000','xxx','XXX');
-select * from obory;
+INSERT INTO t1 VALUES ('0101000000','aaa','AAA');
+INSERT INTO t1 VALUES ('0102000000','bbb','BBB');
+INSERT INTO t1 VALUES ('0103000000','ccc','CCC');
+INSERT INTO t1 VALUES ('0104000000','xxx','XXX');
+select * from t1;
kodoboru obor aobor
0101000000 aaa AAA
0102000000 bbb BBB
0103000000 ccc CCC
0104000000 xxx XXX
-drop table obory;
+drop table t1;
diff --git a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result
new file mode 100644
index 00000000000..7b63654ffaf
--- /dev/null
+++ b/mysql-test/r/gis-rtree.result
@@ -0,0 +1,806 @@
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (
+fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+g GEOMETRY NOT NULL,
+SPATIAL KEY(g)
+) ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `fid` int(11) NOT NULL auto_increment,
+ `g` geometry NOT NULL default '',
+ PRIMARY KEY (`fid`),
+ SPATIAL KEY `g` (`g`(32))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(150 150, 150 150)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(149 149, 151 151)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(148 148, 152 152)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(147 147, 153 153)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(146 146, 154 154)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(145 145, 155 155)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(144 144, 156 156)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(143 143, 157 157)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(142 142, 158 158)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(141 141, 159 159)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(140 140, 160 160)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(139 139, 161 161)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(138 138, 162 162)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(137 137, 163 163)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(136 136, 164 164)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(135 135, 165 165)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(134 134, 166 166)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(133 133, 167 167)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(132 132, 168 168)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(131 131, 169 169)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(130 130, 170 170)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(129 129, 171 171)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(128 128, 172 172)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(127 127, 173 173)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(126 126, 174 174)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(125 125, 175 175)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(124 124, 176 176)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(123 123, 177 177)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(122 122, 178 178)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(121 121, 179 179)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(120 120, 180 180)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(119 119, 181 181)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(118 118, 182 182)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(117 117, 183 183)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(116 116, 184 184)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(115 115, 185 185)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(114 114, 186 186)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(113 113, 187 187)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(112 112, 188 188)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(111 111, 189 189)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(110 110, 190 190)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(109 109, 191 191)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(108 108, 192 192)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(107 107, 193 193)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(106 106, 194 194)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(105 105, 195 195)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(104 104, 196 196)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(103 103, 197 197)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(102 102, 198 198)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(101 101, 199 199)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(100 100, 200 200)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(99 99, 201 201)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(98 98, 202 202)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(97 97, 203 203)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(96 96, 204 204)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(95 95, 205 205)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(94 94, 206 206)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(93 93, 207 207)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(92 92, 208 208)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(91 91, 209 209)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(90 90, 210 210)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(89 89, 211 211)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(88 88, 212 212)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(87 87, 213 213)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(86 86, 214 214)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(85 85, 215 215)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(84 84, 216 216)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(83 83, 217 217)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(82 82, 218 218)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(81 81, 219 219)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(80 80, 220 220)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(79 79, 221 221)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(78 78, 222 222)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(77 77, 223 223)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(76 76, 224 224)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(75 75, 225 225)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(74 74, 226 226)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(73 73, 227 227)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(72 72, 228 228)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(71 71, 229 229)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(70 70, 230 230)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(69 69, 231 231)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(68 68, 232 232)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(67 67, 233 233)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(66 66, 234 234)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(65 65, 235 235)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(64 64, 236 236)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(63 63, 237 237)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(62 62, 238 238)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(61 61, 239 239)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(60 60, 240 240)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(59 59, 241 241)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(58 58, 242 242)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(57 57, 243 243)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(56 56, 244 244)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(55 55, 245 245)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(54 54, 246 246)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(53 53, 247 247)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(52 52, 248 248)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(51 51, 249 249)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(50 50, 250 250)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(49 49, 251 251)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(48 48, 252 252)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(47 47, 253 253)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(46 46, 254 254)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(45 45, 255 255)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(44 44, 256 256)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(43 43, 257 257)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(42 42, 258 258)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(41 41, 259 259)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(40 40, 260 260)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(39 39, 261 261)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(38 38, 262 262)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(37 37, 263 263)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(36 36, 264 264)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(35 35, 265 265)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(34 34, 266 266)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(33 33, 267 267)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(32 32, 268 268)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(31 31, 269 269)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(30 30, 270 270)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(29 29, 271 271)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(28 28, 272 272)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(27 27, 273 273)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(26 26, 274 274)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(25 25, 275 275)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(24 24, 276 276)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(23 23, 277 277)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(22 22, 278 278)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(21 21, 279 279)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(20 20, 280 280)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(19 19, 281 281)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(18 18, 282 282)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(17 17, 283 283)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(16 16, 284 284)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(15 15, 285 285)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(14 14, 286 286)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(13 13, 287 287)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(12 12, 288 288)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(11 11, 289 289)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(10 10, 290 290)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(9 9, 291 291)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(8 8, 292 292)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(7 7, 293 293)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(6 6, 294 294)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(5 5, 295 295)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(4 4, 296 296)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(3 3, 297 297)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(2 2, 298 298)'));
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(1 1, 299 299)'));
+SELECT count(*) FROM t1;
+count(*)
+150
+EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range g g 32 NULL 7 Using where
+SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
+fid AsText(g)
+1 LINESTRING(150 150,150 150)
+3 LINESTRING(148 148,152 152)
+4 LINESTRING(147 147,153 153)
+5 LINESTRING(146 146,154 154)
+6 LINESTRING(145 145,155 155)
+7 LINESTRING(144 144,156 156)
+8 LINESTRING(143 143,157 157)
+9 LINESTRING(142 142,158 158)
+10 LINESTRING(141 141,159 159)
+11 LINESTRING(140 140,160 160)
+2 LINESTRING(149 149,151 151)
+DROP TABLE t1;
+CREATE TABLE t2 (
+fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+g GEOMETRY NOT NULL
+) ENGINE=MyISAM;
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 9 * 10 - 9), Point(10 * 10, 9 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 8 * 10 - 9), Point(10 * 10, 8 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 7 * 10 - 9), Point(10 * 10, 7 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 6 * 10 - 9), Point(10 * 10, 6 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 5 * 10 - 9), Point(10 * 10, 5 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 4 * 10 - 9), Point(10 * 10, 4 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 3 * 10 - 9), Point(10 * 10, 3 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 2 * 10 - 9), Point(10 * 10, 2 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 1 * 10 - 9), Point(10 * 10, 1 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 10 * 10 - 9), Point(9 * 10, 10 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 9 * 10 - 9), Point(9 * 10, 9 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 8 * 10 - 9), Point(9 * 10, 8 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 7 * 10 - 9), Point(9 * 10, 7 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 6 * 10 - 9), Point(9 * 10, 6 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 5 * 10 - 9), Point(9 * 10, 5 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 4 * 10 - 9), Point(9 * 10, 4 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 3 * 10 - 9), Point(9 * 10, 3 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 2 * 10 - 9), Point(9 * 10, 2 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 1 * 10 - 9), Point(9 * 10, 1 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 10 * 10 - 9), Point(8 * 10, 10 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 9 * 10 - 9), Point(8 * 10, 9 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 8 * 10 - 9), Point(8 * 10, 8 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 7 * 10 - 9), Point(8 * 10, 7 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 6 * 10 - 9), Point(8 * 10, 6 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 5 * 10 - 9), Point(8 * 10, 5 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 4 * 10 - 9), Point(8 * 10, 4 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 3 * 10 - 9), Point(8 * 10, 3 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 2 * 10 - 9), Point(8 * 10, 2 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 1 * 10 - 9), Point(8 * 10, 1 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 10 * 10 - 9), Point(7 * 10, 10 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 9 * 10 - 9), Point(7 * 10, 9 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 8 * 10 - 9), Point(7 * 10, 8 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 7 * 10 - 9), Point(7 * 10, 7 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 6 * 10 - 9), Point(7 * 10, 6 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 5 * 10 - 9), Point(7 * 10, 5 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 4 * 10 - 9), Point(7 * 10, 4 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 3 * 10 - 9), Point(7 * 10, 3 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 2 * 10 - 9), Point(7 * 10, 2 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 1 * 10 - 9), Point(7 * 10, 1 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 10 * 10 - 9), Point(6 * 10, 10 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 9 * 10 - 9), Point(6 * 10, 9 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 8 * 10 - 9), Point(6 * 10, 8 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 7 * 10 - 9), Point(6 * 10, 7 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 6 * 10 - 9), Point(6 * 10, 6 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 5 * 10 - 9), Point(6 * 10, 5 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 4 * 10 - 9), Point(6 * 10, 4 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 3 * 10 - 9), Point(6 * 10, 3 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 2 * 10 - 9), Point(6 * 10, 2 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 1 * 10 - 9), Point(6 * 10, 1 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 10 * 10 - 9), Point(5 * 10, 10 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 9 * 10 - 9), Point(5 * 10, 9 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 8 * 10 - 9), Point(5 * 10, 8 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 7 * 10 - 9), Point(5 * 10, 7 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 6 * 10 - 9), Point(5 * 10, 6 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 5 * 10 - 9), Point(5 * 10, 5 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 4 * 10 - 9), Point(5 * 10, 4 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 3 * 10 - 9), Point(5 * 10, 3 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 2 * 10 - 9), Point(5 * 10, 2 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 1 * 10 - 9), Point(5 * 10, 1 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 10 * 10 - 9), Point(4 * 10, 10 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 9 * 10 - 9), Point(4 * 10, 9 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 8 * 10 - 9), Point(4 * 10, 8 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 7 * 10 - 9), Point(4 * 10, 7 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 6 * 10 - 9), Point(4 * 10, 6 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 5 * 10 - 9), Point(4 * 10, 5 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 4 * 10 - 9), Point(4 * 10, 4 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 3 * 10 - 9), Point(4 * 10, 3 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 2 * 10 - 9), Point(4 * 10, 2 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 1 * 10 - 9), Point(4 * 10, 1 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 10 * 10 - 9), Point(3 * 10, 10 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 9 * 10 - 9), Point(3 * 10, 9 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 8 * 10 - 9), Point(3 * 10, 8 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 7 * 10 - 9), Point(3 * 10, 7 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 6 * 10 - 9), Point(3 * 10, 6 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 5 * 10 - 9), Point(3 * 10, 5 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 4 * 10 - 9), Point(3 * 10, 4 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 3 * 10 - 9), Point(3 * 10, 3 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 2 * 10 - 9), Point(3 * 10, 2 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 1 * 10 - 9), Point(3 * 10, 1 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 10 * 10 - 9), Point(2 * 10, 10 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 9 * 10 - 9), Point(2 * 10, 9 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 8 * 10 - 9), Point(2 * 10, 8 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 7 * 10 - 9), Point(2 * 10, 7 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 6 * 10 - 9), Point(2 * 10, 6 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 5 * 10 - 9), Point(2 * 10, 5 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 4 * 10 - 9), Point(2 * 10, 4 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 3 * 10 - 9), Point(2 * 10, 3 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 2 * 10 - 9), Point(2 * 10, 2 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 1 * 10 - 9), Point(2 * 10, 1 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 10 * 10 - 9), Point(1 * 10, 10 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 9 * 10 - 9), Point(1 * 10, 9 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 8 * 10 - 9), Point(1 * 10, 8 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 7 * 10 - 9), Point(1 * 10, 7 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 6 * 10 - 9), Point(1 * 10, 6 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 5 * 10 - 9), Point(1 * 10, 5 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 4 * 10 - 9), Point(1 * 10, 4 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 3 * 10 - 9), Point(1 * 10, 3 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 2 * 10 - 9), Point(1 * 10, 2 * 10))));
+INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 1 * 10 - 9), Point(1 * 10, 1 * 10))));
+ALTER TABLE t2 ADD SPATIAL KEY(g);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `fid` int(11) NOT NULL auto_increment,
+ `g` geometry NOT NULL default '',
+ PRIMARY KEY (`fid`),
+ SPATIAL KEY `g` (`g`(32))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT count(*) FROM t2;
+count(*)
+100
+EXPLAIN SELECT fid, AsText(g) FROM t2 WHERE Within(g,
+GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range g g 32 NULL 4 Using where
+SELECT fid, AsText(g) FROM t2 WHERE Within(g,
+GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
+fid AsText(g)
+46 LINESTRING(51 41,60 50)
+56 LINESTRING(41 41,50 50)
+45 LINESTRING(51 51,60 60)
+55 LINESTRING(41 51,50 60)
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+99
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 9 * 10 - 9), Point(10 * 10, 9 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+98
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 8 * 10 - 9), Point(10 * 10, 8 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+97
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 7 * 10 - 9), Point(10 * 10, 7 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+96
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 6 * 10 - 9), Point(10 * 10, 6 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+95
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 5 * 10 - 9), Point(10 * 10, 5 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+94
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 4 * 10 - 9), Point(10 * 10, 4 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+93
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 3 * 10 - 9), Point(10 * 10, 3 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+92
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 2 * 10 - 9), Point(10 * 10, 2 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+91
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 1 * 10 - 9), Point(10 * 10, 1 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+90
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 10 * 10 - 9), Point(9 * 10, 10 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+89
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 9 * 10 - 9), Point(9 * 10, 9 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+88
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 8 * 10 - 9), Point(9 * 10, 8 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+87
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 7 * 10 - 9), Point(9 * 10, 7 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+86
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 6 * 10 - 9), Point(9 * 10, 6 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+85
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 5 * 10 - 9), Point(9 * 10, 5 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+84
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 4 * 10 - 9), Point(9 * 10, 4 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+83
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 3 * 10 - 9), Point(9 * 10, 3 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+82
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 2 * 10 - 9), Point(9 * 10, 2 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+81
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 1 * 10 - 9), Point(9 * 10, 1 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+80
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 10 * 10 - 9), Point(8 * 10, 10 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+79
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 9 * 10 - 9), Point(8 * 10, 9 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+78
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 8 * 10 - 9), Point(8 * 10, 8 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+77
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 7 * 10 - 9), Point(8 * 10, 7 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+76
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 6 * 10 - 9), Point(8 * 10, 6 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+75
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 5 * 10 - 9), Point(8 * 10, 5 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+74
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 4 * 10 - 9), Point(8 * 10, 4 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+73
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 3 * 10 - 9), Point(8 * 10, 3 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+72
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 2 * 10 - 9), Point(8 * 10, 2 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+71
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 1 * 10 - 9), Point(8 * 10, 1 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+70
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 10 * 10 - 9), Point(7 * 10, 10 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+69
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 9 * 10 - 9), Point(7 * 10, 9 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+68
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 8 * 10 - 9), Point(7 * 10, 8 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+67
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 7 * 10 - 9), Point(7 * 10, 7 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+66
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 6 * 10 - 9), Point(7 * 10, 6 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+65
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 5 * 10 - 9), Point(7 * 10, 5 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+64
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 4 * 10 - 9), Point(7 * 10, 4 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+63
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 3 * 10 - 9), Point(7 * 10, 3 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+62
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 2 * 10 - 9), Point(7 * 10, 2 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+61
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 1 * 10 - 9), Point(7 * 10, 1 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+60
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 10 * 10 - 9), Point(6 * 10, 10 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+59
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 9 * 10 - 9), Point(6 * 10, 9 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+58
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 8 * 10 - 9), Point(6 * 10, 8 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+57
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 7 * 10 - 9), Point(6 * 10, 7 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+56
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 6 * 10 - 9), Point(6 * 10, 6 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+55
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 5 * 10 - 9), Point(6 * 10, 5 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+54
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 4 * 10 - 9), Point(6 * 10, 4 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+53
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 3 * 10 - 9), Point(6 * 10, 3 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+52
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 2 * 10 - 9), Point(6 * 10, 2 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+51
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 1 * 10 - 9), Point(6 * 10, 1 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+50
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 10 * 10 - 9), Point(5 * 10, 10 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+49
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 9 * 10 - 9), Point(5 * 10, 9 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+48
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 8 * 10 - 9), Point(5 * 10, 8 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+47
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 7 * 10 - 9), Point(5 * 10, 7 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+46
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 6 * 10 - 9), Point(5 * 10, 6 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+45
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 5 * 10 - 9), Point(5 * 10, 5 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+44
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 4 * 10 - 9), Point(5 * 10, 4 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+43
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 3 * 10 - 9), Point(5 * 10, 3 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+42
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 2 * 10 - 9), Point(5 * 10, 2 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+41
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 1 * 10 - 9), Point(5 * 10, 1 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+40
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 10 * 10 - 9), Point(4 * 10, 10 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+39
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 9 * 10 - 9), Point(4 * 10, 9 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+38
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 8 * 10 - 9), Point(4 * 10, 8 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+37
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 7 * 10 - 9), Point(4 * 10, 7 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+36
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 6 * 10 - 9), Point(4 * 10, 6 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+35
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 5 * 10 - 9), Point(4 * 10, 5 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+34
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 4 * 10 - 9), Point(4 * 10, 4 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+33
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 3 * 10 - 9), Point(4 * 10, 3 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+32
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 2 * 10 - 9), Point(4 * 10, 2 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+31
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 1 * 10 - 9), Point(4 * 10, 1 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+30
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 10 * 10 - 9), Point(3 * 10, 10 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+29
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 9 * 10 - 9), Point(3 * 10, 9 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+28
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 8 * 10 - 9), Point(3 * 10, 8 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+27
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 7 * 10 - 9), Point(3 * 10, 7 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+26
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 6 * 10 - 9), Point(3 * 10, 6 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+25
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 5 * 10 - 9), Point(3 * 10, 5 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+24
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 4 * 10 - 9), Point(3 * 10, 4 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+23
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 3 * 10 - 9), Point(3 * 10, 3 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+22
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 2 * 10 - 9), Point(3 * 10, 2 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+21
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 1 * 10 - 9), Point(3 * 10, 1 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+20
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 10 * 10 - 9), Point(2 * 10, 10 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+19
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 9 * 10 - 9), Point(2 * 10, 9 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+18
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 8 * 10 - 9), Point(2 * 10, 8 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+17
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 7 * 10 - 9), Point(2 * 10, 7 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+16
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 6 * 10 - 9), Point(2 * 10, 6 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+15
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 5 * 10 - 9), Point(2 * 10, 5 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+14
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 4 * 10 - 9), Point(2 * 10, 4 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+13
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 3 * 10 - 9), Point(2 * 10, 3 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+12
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 2 * 10 - 9), Point(2 * 10, 2 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+11
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 1 * 10 - 9), Point(2 * 10, 1 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+10
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 10 * 10 - 9), Point(1 * 10, 10 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+9
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 9 * 10 - 9), Point(1 * 10, 9 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+8
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 8 * 10 - 9), Point(1 * 10, 8 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+7
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 7 * 10 - 9), Point(1 * 10, 7 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+6
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 6 * 10 - 9), Point(1 * 10, 6 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+5
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 5 * 10 - 9), Point(1 * 10, 5 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+4
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 4 * 10 - 9), Point(1 * 10, 4 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+3
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 3 * 10 - 9), Point(1 * 10, 3 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+2
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 2 * 10 - 9), Point(1 * 10, 2 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+1
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 1 * 10 - 9), Point(1 * 10, 1 * 10)))));
+SELECT count(*) FROM t2;
+count(*)
+0
+DROP TABLE t2;
+drop table if exists t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1 (a geometry NOT NULL, SPATIAL (a));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+drop table t1;
+CREATE TABLE t1 (
+fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+g GEOMETRY NOT NULL,
+SPATIAL KEY(g)
+) ENGINE=MyISAM;
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(1 2, 2 3)')),(GeomFromText('LineString(1 2, 2 4)'));
+drop table t1;
+CREATE TABLE t1 (
+geoobjid INT NOT NULL,
+line LINESTRING NOT NULL,
+kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po',
+name VARCHAR(32),
+SPATIAL KEY (line)
+) engine=myisam;
+ALTER TABLE t1 DISABLE KEYS;
+INSERT INTO t1 (name, kind, line) VALUES
+("Aadaouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
+("Aadassiye", "pp", GeomFromText("POINT(35.816667 36.216667)")),
+("Aadbel", "pp", GeomFromText("POINT(34.533333 36.100000)")),
+("Aadchit", "pp", GeomFromText("POINT(33.347222 35.423611)")),
+("Aadchite", "pp", GeomFromText("POINT(33.347222 35.423611)")),
+("Aadchit el Qoussair", "pp", GeomFromText("POINT(33.283333 35.483333)")),
+("Aaddaye", "pp", GeomFromText("POINT(36.716667 40.833333)")),
+("'Aadeissa", "pp", GeomFromText("POINT(32.823889 35.698889)")),
+("Aaderup", "pp", GeomFromText("POINT(55.216667 11.766667)")),
+("Qalaat Aades", "pp", GeomFromText("POINT(33.503333 35.377500)")),
+("A ad'ino", "pp", GeomFromText("POINT(54.812222 38.209167)")),
+("Aadi Noia", "pp", GeomFromText("POINT(13.800000 39.833333)")),
+("Aad La Macta", "pp", GeomFromText("POINT(35.779444 -0.129167)")),
+("Aadland", "pp", GeomFromText("POINT(60.366667 5.483333)")),
+("Aadliye", "pp", GeomFromText("POINT(33.366667 36.333333)")),
+("Aadloun", "pp", GeomFromText("POINT(33.403889 35.273889)")),
+("Aadma", "pp", GeomFromText("POINT(58.798333 22.663889)")),
+("Aadma Asundus", "pp", GeomFromText("POINT(58.798333 22.663889)")),
+("Aadmoun", "pp", GeomFromText("POINT(34.150000 35.650000)")),
+("Aadneram", "pp", GeomFromText("POINT(59.016667 6.933333)")),
+("Aadneskaar", "pp", GeomFromText("POINT(58.083333 6.983333)")),
+("Aadorf", "pp", GeomFromText("POINT(47.483333 8.900000)")),
+("Aadorp", "pp", GeomFromText("POINT(52.366667 6.633333)")),
+("Aadouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
+("Aadoui", "pp", GeomFromText("POINT(34.450000 35.983333)")),
+("Aadouiye", "pp", GeomFromText("POINT(34.583333 36.183333)")),
+("Aadouss", "pp", GeomFromText("POINT(33.512500 35.601389)")),
+("Aadra", "pp", GeomFromText("POINT(33.616667 36.500000)")),
+("Aadzi", "pp", GeomFromText("POINT(38.100000 64.850000)"));
+ALTER TABLE t1 ENABLE KEYS;
+INSERT INTO t1 (name, kind, line) VALUES ("austria", "pp", GeomFromText('LINESTRING(14.9906 48.9887,14.9946 48.9904,14.9947 48.9916)'));
+drop table t1;
+CREATE TABLE t1 (st varchar(100));
+INSERT INTO t1 VALUES ("Fake string");
+CREATE TABLE t2 (geom GEOMETRY NOT NULL, SPATIAL KEY gk(geom));
+INSERT INTO t2 SELECT GeomFromText(st) FROM t1;
+ERROR HY000: Unknown error
+drop table t1, t2;
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
new file mode 100644
index 00000000000..c51b07f09d6
--- /dev/null
+++ b/mysql-test/r/gis.result
@@ -0,0 +1,657 @@
+DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
+CREATE TABLE gis_point (fid INTEGER NOT NULL PRIMARY KEY, g POINT);
+CREATE TABLE gis_line (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING);
+CREATE TABLE gis_polygon (fid INTEGER NOT NULL PRIMARY KEY, g POLYGON);
+CREATE TABLE gis_multi_point (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOINT);
+CREATE TABLE gis_multi_line (fid INTEGER NOT NULL PRIMARY KEY, g MULTILINESTRING);
+CREATE TABLE gis_multi_polygon (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOLYGON);
+CREATE TABLE gis_geometrycollection (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRYCOLLECTION);
+CREATE TABLE gis_geometry (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY);
+SHOW FIELDS FROM gis_point;
+Field Type Null Key Default Extra
+fid int(11) PRI 0
+g point YES NULL
+SHOW FIELDS FROM gis_line;
+Field Type Null Key Default Extra
+fid int(11) PRI 0
+g linestring YES NULL
+SHOW FIELDS FROM gis_polygon;
+Field Type Null Key Default Extra
+fid int(11) PRI 0
+g polygon YES NULL
+SHOW FIELDS FROM gis_multi_point;
+Field Type Null Key Default Extra
+fid int(11) PRI 0
+g multipoint YES NULL
+SHOW FIELDS FROM gis_multi_line;
+Field Type Null Key Default Extra
+fid int(11) PRI 0
+g multilinestring YES NULL
+SHOW FIELDS FROM gis_multi_polygon;
+Field Type Null Key Default Extra
+fid int(11) PRI 0
+g multipolygon YES NULL
+SHOW FIELDS FROM gis_geometrycollection;
+Field Type Null Key Default Extra
+fid int(11) PRI 0
+g geometrycollection YES NULL
+SHOW FIELDS FROM gis_geometry;
+Field Type Null Key Default Extra
+fid int(11) PRI 0
+g geometry YES NULL
+INSERT INTO gis_point VALUES
+(101, PointFromText('POINT(10 10)')),
+(102, PointFromText('POINT(20 10)')),
+(103, PointFromText('POINT(20 20)')),
+(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
+INSERT INTO gis_line VALUES
+(105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
+(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
+(107, LineStringFromWKB(LineString(Point(10, 10), Point(40, 10))));
+INSERT INTO gis_polygon VALUES
+(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
+(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
+(110, PolyFromWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)))));
+INSERT INTO gis_multi_point VALUES
+(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
+(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
+(113, MPointFromWKB(MultiPoint(Point(3, 6), Point(4, 10))));
+INSERT INTO gis_multi_line VALUES
+(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
+(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
+(116, MLineFromWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)))));
+INSERT INTO gis_multi_polygon VALUES
+(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+(119, MPolyFromWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))));
+INSERT INTO gis_geometrycollection VALUES
+(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
+(121, GeometryFromWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))));
+INSERT into gis_geometry SELECT * FROM gis_point;
+INSERT into gis_geometry SELECT * FROM gis_line;
+INSERT into gis_geometry SELECT * FROM gis_polygon;
+INSERT into gis_geometry SELECT * FROM gis_multi_point;
+INSERT into gis_geometry SELECT * FROM gis_multi_line;
+INSERT into gis_geometry SELECT * FROM gis_multi_polygon;
+INSERT into gis_geometry SELECT * FROM gis_geometrycollection;
+SELECT fid, AsText(g) FROM gis_point;
+fid AsText(g)
+101 POINT(10 10)
+102 POINT(20 10)
+103 POINT(20 20)
+104 POINT(10 20)
+SELECT fid, AsText(g) FROM gis_line;
+fid AsText(g)
+105 LINESTRING(0 0,0 10,10 0)
+106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+107 LINESTRING(10 10,40 10)
+SELECT fid, AsText(g) FROM gis_polygon;
+fid AsText(g)
+108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
+110 POLYGON((0 0,30 0,30 30,0 0))
+SELECT fid, AsText(g) FROM gis_multi_point;
+fid AsText(g)
+111 MULTIPOINT(0 0,10 10,10 20,20 20)
+112 MULTIPOINT(1 1,11 11,11 21,21 21)
+113 MULTIPOINT(3 6,4 10)
+SELECT fid, AsText(g) FROM gis_multi_line;
+fid AsText(g)
+114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
+115 MULTILINESTRING((10 48,10 21,10 0))
+116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
+SELECT fid, AsText(g) FROM gis_multi_polygon;
+fid AsText(g)
+117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
+SELECT fid, AsText(g) FROM gis_geometrycollection;
+fid AsText(g)
+120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
+121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
+SELECT fid, AsText(g) FROM gis_geometry;
+fid AsText(g)
+101 POINT(10 10)
+102 POINT(20 10)
+103 POINT(20 20)
+104 POINT(10 20)
+105 LINESTRING(0 0,0 10,10 0)
+106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+107 LINESTRING(10 10,40 10)
+108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
+110 POLYGON((0 0,30 0,30 30,0 0))
+111 MULTIPOINT(0 0,10 10,10 20,20 20)
+112 MULTIPOINT(1 1,11 11,11 21,21 21)
+113 MULTIPOINT(3 6,4 10)
+114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
+115 MULTILINESTRING((10 48,10 21,10 0))
+116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
+117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
+120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
+121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
+SELECT fid, Dimension(g) FROM gis_geometry;
+fid Dimension(g)
+101 0
+102 0
+103 0
+104 0
+105 1
+106 1
+107 1
+108 2
+109 2
+110 2
+111 0
+112 0
+113 0
+114 1
+115 1
+116 1
+117 2
+118 2
+119 2
+120 1
+121 1
+SELECT fid, GeometryType(g) FROM gis_geometry;
+fid GeometryType(g)
+101 POINT
+102 POINT
+103 POINT
+104 POINT
+105 LINESTRING
+106 LINESTRING
+107 LINESTRING
+108 POLYGON
+109 POLYGON
+110 POLYGON
+111 MULTIPOINT
+112 MULTIPOINT
+113 MULTIPOINT
+114 MULTILINESTRING
+115 MULTILINESTRING
+116 MULTILINESTRING
+117 MULTIPOLYGON
+118 MULTIPOLYGON
+119 MULTIPOLYGON
+120 GEOMETRYCOLLECTION
+121 GEOMETRYCOLLECTION
+SELECT fid, IsEmpty(g) FROM gis_geometry;
+fid IsEmpty(g)
+101 0
+102 0
+103 0
+104 0
+105 0
+106 0
+107 0
+108 0
+109 0
+110 0
+111 0
+112 0
+113 0
+114 0
+115 0
+116 0
+117 0
+118 0
+119 0
+120 0
+121 0
+SELECT fid, AsText(Envelope(g)) FROM gis_geometry;
+fid AsText(Envelope(g))
+101 POLYGON((10 10,10 10,10 10,10 10,10 10))
+102 POLYGON((20 10,20 10,20 10,20 10,20 10))
+103 POLYGON((20 20,20 20,20 20,20 20,20 20))
+104 POLYGON((10 20,10 20,10 20,10 20,10 20))
+105 POLYGON((0 0,10 0,10 10,0 10,0 0))
+106 POLYGON((10 10,20 10,20 20,10 20,10 10))
+107 POLYGON((10 10,40 10,40 10,10 10,10 10))
+108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+109 POLYGON((0 0,50 0,50 50,0 50,0 0))
+110 POLYGON((0 0,30 0,30 30,0 30,0 0))
+111 POLYGON((0 0,20 0,20 20,0 20,0 0))
+112 POLYGON((1 1,21 1,21 21,1 21,1 1))
+113 POLYGON((3 6,4 6,4 10,3 10,3 6))
+114 POLYGON((10 0,16 0,16 48,10 48,10 0))
+115 POLYGON((10 0,10 0,10 48,10 48,10 0))
+116 POLYGON((1 2,21 2,21 8,1 8,1 2))
+117 POLYGON((28 0,84 0,84 42,28 42,28 0))
+118 POLYGON((28 0,84 0,84 42,28 42,28 0))
+119 POLYGON((0 0,3 0,3 3,0 3,0 0))
+120 POLYGON((0 0,10 0,10 10,0 10,0 0))
+121 POLYGON((3 6,44 6,44 9,3 9,3 6))
+explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from gis_geometry;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21
+Warnings:
+Note 1003 select dimension(test.gis_geometry.g) AS `Dimension(g)`,geometrytype(test.gis_geometry.g) AS `GeometryType(g)`,isempty(test.gis_geometry.g) AS `IsEmpty(g)`,astext(envelope(test.gis_geometry.g)) AS `AsText(Envelope(g))` from test.gis_geometry
+SELECT fid, X(g) FROM gis_point;
+fid X(g)
+101 10
+102 20
+103 20
+104 10
+SELECT fid, Y(g) FROM gis_point;
+fid Y(g)
+101 10
+102 10
+103 20
+104 20
+explain extended select X(g),Y(g) FROM gis_point;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE gis_point ALL NULL NULL NULL NULL 4
+Warnings:
+Note 1003 select x(test.gis_point.g) AS `X(g)`,y(test.gis_point.g) AS `Y(g)` from test.gis_point
+SELECT fid, AsText(StartPoint(g)) FROM gis_line;
+fid AsText(StartPoint(g))
+105 POINT(0 0)
+106 POINT(10 10)
+107 POINT(10 10)
+SELECT fid, AsText(EndPoint(g)) FROM gis_line;
+fid AsText(EndPoint(g))
+105 POINT(10 0)
+106 POINT(10 10)
+107 POINT(40 10)
+SELECT fid, GLength(g) FROM gis_line;
+fid GLength(g)
+105 24.142135623731
+106 40
+107 30
+SELECT fid, NumPoints(g) FROM gis_line;
+fid NumPoints(g)
+105 3
+106 5
+107 2
+SELECT fid, AsText(PointN(g, 2)) FROM gis_line;
+fid AsText(PointN(g, 2))
+105 POINT(0 10)
+106 POINT(20 10)
+107 POINT(40 10)
+SELECT fid, IsClosed(g) FROM gis_line;
+fid IsClosed(g)
+105 0
+106 1
+107 0
+explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),IsClosed(g) FROM gis_line;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE gis_line ALL NULL NULL NULL NULL 3
+Warnings:
+Note 1003 select astext(startpoint(test.gis_line.g)) AS `AsText(StartPoint(g))`,astext(endpoint(test.gis_line.g)) AS `AsText(EndPoint(g))`,glength(test.gis_line.g) AS `GLength(g)`,numpoints(test.gis_line.g) AS `NumPoints(g)`,astext(pointn(test.gis_line.g,2)) AS `AsText(PointN(g, 2))`,isclosed(test.gis_line.g) AS `IsClosed(g)` from test.gis_line
+SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
+fid AsText(Centroid(g))
+108 POINT(15 15)
+109 POINT(25.416666666667 25.416666666667)
+110 POINT(20 10)
+SELECT fid, Area(g) FROM gis_polygon;
+fid Area(g)
+108 100
+109 2400
+110 450
+SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon;
+fid AsText(ExteriorRing(g))
+108 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+109 LINESTRING(0 0,50 0,50 50,0 50,0 0)
+110 LINESTRING(0 0,30 0,30 30,0 0)
+SELECT fid, NumInteriorRings(g) FROM gis_polygon;
+fid NumInteriorRings(g)
+108 0
+109 1
+110 0
+SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon;
+fid AsText(InteriorRingN(g, 1))
+108 NULL
+109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+110 NULL
+explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumInteriorRings(g),AsText(InteriorRingN(g, 1)) FROM gis_polygon;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3
+Warnings:
+Note 1003 select astext(centroid(test.gis_polygon.g)) AS `AsText(Centroid(g))`,area(test.gis_polygon.g) AS `Area(g)`,astext(exteriorring(test.gis_polygon.g)) AS `AsText(ExteriorRing(g))`,numinteriorrings(test.gis_polygon.g) AS `NumInteriorRings(g)`,astext(interiorringn(test.gis_polygon.g,1)) AS `AsText(InteriorRingN(g, 1))` from test.gis_polygon
+SELECT fid, IsClosed(g) FROM gis_multi_line;
+fid IsClosed(g)
+114 0
+115 0
+116 0
+SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
+fid AsText(Centroid(g))
+117 POINT(55.588527753042 17.426536064114)
+118 POINT(55.588527753042 17.426536064114)
+119 POINT(2 2)
+SELECT fid, Area(g) FROM gis_multi_polygon;
+fid Area(g)
+117 1684.5
+118 1684.5
+119 4.5
+SELECT fid, NumGeometries(g) from gis_multi_point;
+fid NumGeometries(g)
+111 4
+112 4
+113 2
+SELECT fid, NumGeometries(g) from gis_multi_line;
+fid NumGeometries(g)
+114 2
+115 1
+116 2
+SELECT fid, NumGeometries(g) from gis_multi_polygon;
+fid NumGeometries(g)
+117 2
+118 2
+119 1
+SELECT fid, NumGeometries(g) from gis_geometrycollection;
+fid NumGeometries(g)
+120 2
+121 2
+explain extended SELECT fid, NumGeometries(g) from gis_multi_point;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3
+Warnings:
+Note 1003 select test.gis_multi_point.fid AS `fid`,numgeometries(test.gis_multi_point.g) AS `NumGeometries(g)` from test.gis_multi_point
+SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
+fid AsText(GeometryN(g, 2))
+111 POINT(10 10)
+112 POINT(11 11)
+113 POINT(4 10)
+SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line;
+fid AsText(GeometryN(g, 2))
+114 LINESTRING(16 0,16 23,16 48)
+115 NULL
+116 LINESTRING(2 5,5 8,21 7)
+SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon;
+fid AsText(GeometryN(g, 2))
+117 POLYGON((59 18,67 18,67 13,59 13,59 18))
+118 POLYGON((59 18,67 18,67 13,59 13,59 18))
+119 NULL
+SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection;
+fid AsText(GeometryN(g, 2))
+120 LINESTRING(0 0,10 10)
+121 LINESTRING(3 6,7 9)
+SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection;
+fid AsText(GeometryN(g, 1))
+120 POINT(0 0)
+121 POINT(44 6)
+explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3
+Warnings:
+Note 1003 select test.gis_multi_point.fid AS `fid`,astext(geometryn(test.gis_multi_point.g,2)) AS `AsText(GeometryN(g, 2))` from test.gis_multi_point
+SELECT g1.fid as first, g2.fid as second,
+Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
+Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
+Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
+FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
+first second w c o e d t i r
+120 120 1 1 0 1 0 0 1 0
+120 121 0 0 0 0 0 0 1 0
+121 120 0 0 1 0 0 0 1 0
+121 121 1 1 0 1 0 0 1 0
+explain extended SELECT g1.fid as first, g2.fid as second,
+Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
+Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
+Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
+FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE g1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
+1 SIMPLE g2 ALL NULL NULL NULL NULL 2
+Warnings:
+Note 1003 select test.g1.fid AS `first`,test.g2.fid AS `second`,within(test.g1.g,test.g2.g) AS `w`,contains(test.g1.g,test.g2.g) AS `c`,overlaps(test.g1.g,test.g2.g) AS `o`,equals(test.g1.g,test.g2.g) AS `e`,disjoint(test.g1.g,test.g2.g) AS `d`,touches(test.g1.g,test.g2.g) AS `t`,intersects(test.g1.g,test.g2.g) AS `i`,crosses(test.g1.g,test.g2.g) AS `r` from test.gis_geometrycollection g1 join test.gis_geometrycollection g2 order by test.g1.fid,test.g2.fid
+DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
+CREATE TABLE t1 (
+gp point,
+ln linestring,
+pg polygon,
+mp multipoint,
+mln multilinestring,
+mpg multipolygon,
+gc geometrycollection,
+gm geometry
+);
+SHOW FIELDS FROM t1;
+Field Type Null Key Default Extra
+gp point YES NULL
+ln linestring YES NULL
+pg polygon YES NULL
+mp multipoint YES NULL
+mln multilinestring YES NULL
+mpg multipolygon YES NULL
+gc geometrycollection YES NULL
+gm geometry YES NULL
+ALTER TABLE t1 ADD fid INT NOT NULL;
+SHOW FIELDS FROM t1;
+Field Type Null Key Default Extra
+gp point YES NULL
+ln linestring YES NULL
+pg polygon YES NULL
+mp multipoint YES NULL
+mln multilinestring YES NULL
+mpg multipolygon YES NULL
+gc geometrycollection YES NULL
+gm geometry YES NULL
+fid int(11) 0
+DROP TABLE t1;
+SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
+AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))
+POINT(1 4)
+explain extended SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
+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 astext(geometryfromwkb(aswkb(geometryfromtext(_latin1'POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))`
+explain extended SELECT AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))));
+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 astext(geometryfromwkb(aswkb(geometryfromtext(_latin1'POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))))`
+SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
+SRID(GeomFromText('LineString(1 1,2 2)',101))
+101
+explain extended SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
+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 srid(geometryfromtext(_latin1'LineString(1 1,2 2)',101)) AS `SRID(GeomFromText('LineString(1 1,2 2)',101))`
+explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6));
+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 issimple(multipoint(point(3,6),point(4,10))) AS `issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,issimple(point(3,6)) AS `issimple(Point(3, 6))`
+create table t1 (a geometry not null);
+insert into t1 values (GeomFromText('Point(1 2)'));
+insert into t1 values ('Garbage');
+ERROR HY000: Unknown error
+insert IGNORE into t1 values ('Garbage');
+ERROR HY000: Unknown error
+alter table t1 add spatial index(a);
+drop table t1;
+create table t1(a geometry not null, spatial index(a));
+insert into t1 values
+(GeomFromText('POINT(1 1)')), (GeomFromText('POINT(3 3)')),
+(GeomFromText('POINT(4 4)')), (GeomFromText('POINT(6 6)'));
+select AsText(a) from t1 where
+MBRContains(GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a)
+or
+MBRContains(GeomFromText('Polygon((2 2, 2 5, 5 5, 5 2, 2 2))'), a);
+AsText(a)
+POINT(1 1)
+POINT(3 3)
+POINT(4 4)
+select AsText(a) from t1 where
+MBRContains(GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a)
+and
+MBRContains(GeomFromText('Polygon((0 0, 0 7, 7 7, 7 0, 0 0))'), a);
+AsText(a)
+POINT(1 1)
+drop table t1;
+CREATE TABLE t1 (Coordinates POINT NOT NULL, SPATIAL INDEX(Coordinates));
+INSERT INTO t1 VALUES(GeomFromText('POINT(383293632 1754448)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(564952612 157516260)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(903994614 180726515)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(98128178 141127631)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(862547902 799334546)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(341989013 850270906)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(803302376 93039099)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(857439153 817431356)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(319757546 343162742)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(826341972 717484432)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(305066789 201736238)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(626068992 616241497)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(55789424 755830108)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(802874458 312435220)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(153795660 551723671)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(242207428 537089292)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(553478119 807160039)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(694605552 457472733)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(987886554 792733729)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(598600363 850434457)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(592068275 940589376)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(700705362 395370650)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(33628474 558144514)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(212802006 353386020)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(901307256 39143977)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(70870451 206374045)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(240880214 696939443)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(822615542 296669638)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(452769551 625489999)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(609104858 606565210)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(177213669 851312285)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(143654501 730691787)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(658472325 838260052)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(188164520 646358878)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(630993781 786764883)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(496793334 223062055)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(727354258 197498696)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(618432704 760982731)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(755643210 831234710)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(114368751 656950466)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(870378686 185239202)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(863324511 111258900)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(882178645 685940052)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(407928538 334948195)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(311430051 17033395)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(941513405 488643719)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(868345680 85167906)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(219335507 526818004)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(923427958 407500026)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(173176882 554421738)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(194264908 669970217)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(777483793 921619165)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(867468912 395916497)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(682601897 623112122)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(227151206 796970647)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(280062588 97529892)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(982209849 143387099)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(208788792 864388493)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(829327151 616717329)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(199336688 140757201)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(633750724 140850093)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(629400920 502096404)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(226017998 848736426)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(28914408 149445955)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(256236452 202091290)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(703867693 450501360)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(872061506 481351486)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(372120524 739530418)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(877267982 54722420)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(362642540 104419188)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(851693067 642705127)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(201949080 833902916)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(786092225 410737872)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(698291409 615419376)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(27455201 897628096)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(756176576 661205925)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(38478189 385577496)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(163302328 264496186)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(234313922 192216735)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(413942141 490550373)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(394308025 117809834)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(941051732 266369530)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(599161319 313172256)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(5899948 476429301)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(367894677 368542487)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(580848489 219587743)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(11247614 782797569)'));
+drop table t1;
+create table t1 select POINT(1,3);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `POINT(1,3)` longblob NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+CREATE TABLE `t1` (`object_id` bigint(20) unsigned NOT NULL default '0', `geo`
+geometry NOT NULL default '') ENGINE=MyISAM ;
+insert into t1 values ('85984',GeomFromText('MULTIPOLYGON(((-115.006363
+36.305435,-114.992394 36.305202,-114.991219 36.305975,-114.991163
+36.306845,-114.989432 36.309452,-114.978275 36.312642,-114.977363
+36.311978,-114.975327 36.312344,-114.96502 36.31597,-114.963364
+36.313629,-114.961723 36.313721,-114.956398 36.316057,-114.951882
+36.320979,-114.947073 36.323475,-114.945207 36.326451,-114.945207
+36.326451,-114.944132 36.326061,-114.94003 36.326588,-114.924017
+36.334484,-114.923281 36.334146,-114.92564 36.331504,-114.94072
+36.319282,-114.945348 36.314812,-114.948091 36.314762,-114.951755
+36.316211,-114.952446 36.313883,-114.952644 36.309488,-114.944725
+36.313083,-114.93706 36.32043,-114.932478 36.323497,-114.924556
+36.327708,-114.922608 36.329715,-114.92009 36.328695,-114.912105
+36.323566,-114.901647 36.317952,-114.897436 36.313968,-114.895344
+36.309573,-114.891699 36.304398,-114.890569 36.303551,-114.886356
+36.302702,-114.885141 36.301351,-114.885709 36.297391,-114.892499
+36.290893,-114.902142 36.288974,-114.904941 36.288838,-114.905308
+36.289845,-114.906325 36.290395,-114.909916 36.289549,-114.914527
+36.287535,-114.918797 36.284423,-114.922982 36.279731,-114.924113
+36.277282,-114.924057 36.275817,-114.927733 36.27053,-114.929354
+36.269029,-114.929354 36.269029,-114.950856 36.268715,-114.950768
+36.264324,-114.960206 36.264293,-114.960301 36.268943,-115.006662
+36.268929,-115.008583 36.265619,-115.00665 36.264247,-115.006659
+36.246873,-115.006659 36.246873,-115.006838 36.247697,-115.010764
+36.247774,-115.015609 36.25113,-115.015765 36.254505,-115.029517
+36.254619,-115.038573 36.249317,-115.038573 36.249317,-115.023403
+36.25841,-115.023873 36.258994,-115.031845 36.259829,-115.03183
+36.261053,-115.025561 36.261095,-115.036417 36.274632,-115.033729
+36.276041,-115.032217 36.274851,-115.029845 36.273959,-115.029934
+36.274966,-115.025763 36.274896,-115.025406 36.281044,-115.028731
+36.284471,-115.036497 36.290377,-115.042071 36.291039,-115.026759
+36.298478,-115.008995 36.301966,-115.006363 36.305435),(-115.079835
+36.244369,-115.079735 36.260186,-115.076435 36.262369,-115.069758
+36.265,-115.070235 36.268757,-115.064542 36.268655,-115.061843
+36.269857,-115.062676 36.270693,-115.06305 36.272344,-115.059051
+36.281023,-115.05918 36.283008,-115.060591 36.285246,-115.061913
+36.290022,-115.062499 36.306353,-115.062499 36.306353,-115.060918
+36.30642,-115.06112 36.289779,-115.05713 36.2825,-115.057314
+36.279446,-115.060779 36.274659,-115.061366 36.27209,-115.057858
+36.26557,-115.055805 36.262883,-115.054688 36.262874,-115.047335
+36.25037,-115.044234 36.24637,-115.052434 36.24047,-115.061734
+36.23507,-115.061934 36.22677,-115.061934 36.22677,-115.061491
+36.225267,-115.062024 36.218194,-115.060134 36.218278,-115.060133
+36.210771,-115.057833 36.210771,-115.057433 36.196271,-115.062233
+36.196271,-115.062233 36.190371,-115.062233 36.190371,-115.065533
+36.190371,-115.071333 36.188571,-115.098331 36.188275,-115.098331
+36.188275,-115.098435 36.237569,-115.097535 36.240369,-115.097535
+36.240369,-115.093235 36.240369,-115.089135 36.240469,-115.083135
+36.240569,-115.083135 36.240569,-115.079835
+36.244369)))')),('85998',GeomFromText('MULTIPOLYGON(((-115.333107
+36.264587,-115.333168 36.280638,-115.333168 36.280638,-115.32226
+36.280643,-115.322538 36.274311,-115.327222 36.274258,-115.32733
+36.263026,-115.330675 36.262984,-115.332132 36.264673,-115.333107
+36.264587),(-115.247239 36.247066,-115.247438 36.218267,-115.247438
+36.218267,-115.278525 36.219263,-115.278525 36.219263,-115.301545
+36.219559,-115.332748 36.219197,-115.332757 36.220041,-115.332757
+36.220041,-115.332895 36.233514,-115.349023 36.233479,-115.351489
+36.234475,-115.353681 36.237021,-115.357106 36.239789,-115.36519
+36.243331,-115.368156 36.243487,-115.367389 36.244902,-115.364553
+36.246014,-115.359219 36.24616,-115.356186 36.248025,-115.353347
+36.248004,-115.350813 36.249507,-115.339673 36.25387,-115.333069
+36.255018,-115.333069 36.255018,-115.333042 36.247767,-115.279039
+36.248666,-115.263639 36.247466,-115.263839 36.252766,-115.261439
+36.252666,-115.261439 36.247366,-115.247239 36.247066)))'));
+select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
+t1 where object_id=85998;
+object_id geometrytype(geo) ISSIMPLE(GEO) ASTEXT(centroid(geo))
+85998 MULTIPOLYGON 0 POINT(115.31877315203 -36.237472821022)
+select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
+t1 where object_id=85984;
+object_id geometrytype(geo) ISSIMPLE(GEO) ASTEXT(centroid(geo))
+85984 MULTIPOLYGON 0 POINT(-114.87787186923 36.33101763469)
+drop table t1;
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 19d83a95c5e..22b34ebef62 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -1,4 +1,5 @@
drop table if exists t1;
+SET NAMES binary;
delete from mysql.user where user='mysqltest_1';
delete from mysql.db where user='mysqltest_1';
flush privileges;
@@ -98,6 +99,8 @@ delete from mysql.db where user='mysqltest_1';
delete from mysql.tables_priv where user='mysqltest_1';
delete from mysql.columns_priv where user='mysqltest_1';
flush privileges;
+show grants for mysqltest_1@localhost;
+ERROR 42000: There is no such grant defined for user 'mysqltest_1' on host 'localhost'
create table t1 (a int);
GRANT select,update,insert on t1 to mysqltest_1@localhost;
GRANT select (a), update (a),insert(a), references(a) on t1 to mysqltest_1@localhost;
@@ -149,7 +152,7 @@ delete from mysql.columns_priv where user='mysqltest_1' or user="mysqltest_2" or
flush privileges;
drop table t1;
GRANT FILE on mysqltest.* to mysqltest_1@localhost;
-Wrong usage of DB GRANT and GLOBAL PRIVILEGES
+ERROR HY000: Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
select 1;
1
1
@@ -172,12 +175,194 @@ GRANT SELECT ON `ab%`.* TO 'test11'@'localhost'
GRANT SELECT ON `a%`.* TO 'test11'@'localhost'
delete from mysql.user where user='test11';
delete from mysql.db where user='test11';
-create database db6123;
-grant usage on db6123.* to test6123 identified by 'magic123';
-select host,db,user,select_priv,insert_priv from mysql.db where db="db6123";
+create database mysqltest1;
+grant usage on mysqltest1.* to test6123 identified by 'magic123';
+select host,db,user,select_priv,insert_priv from mysql.db where db="mysqltest1";
host db user select_priv insert_priv
delete from mysql.user where user='test6123';
-drop database db6123;
+drop database mysqltest1;
+create table t1 (a int);
+grant ALL PRIVILEGES on *.* to drop_user2@localhost with GRANT OPTION;
+show grants for drop_user2@localhost;
+Grants for drop_user2@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user2'@'localhost' WITH GRANT OPTION
+revoke all privileges, grant option from drop_user2@localhost;
+drop user drop_user2@localhost;
+grant ALL PRIVILEGES on *.* to drop_user@localhost with GRANT OPTION;
+grant ALL PRIVILEGES on test.* to drop_user@localhost with GRANT OPTION;
+grant select(a) on test.t1 to drop_user@localhost;
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT ALL PRIVILEGES ON `test`.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT SELECT (a) ON `test`.`t1` TO 'drop_user'@'localhost'
+set sql_mode=ansi_quotes;
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT ALL PRIVILEGES ON "test".* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT SELECT (a) ON "test"."t1" TO 'drop_user'@'localhost'
+set sql_mode=default;
+set sql_quote_show_create=0;
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT ALL PRIVILEGES ON test.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT SELECT (a) ON test.t1 TO 'drop_user'@'localhost'
+set sql_mode="ansi_quotes";
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT ALL PRIVILEGES ON test.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT SELECT (a) ON test.t1 TO 'drop_user'@'localhost'
+set sql_quote_show_create=1;
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT ALL PRIVILEGES ON "test".* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT SELECT (a) ON "test"."t1" TO 'drop_user'@'localhost'
+set sql_mode="";
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT ALL PRIVILEGES ON `test`.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT SELECT (a) ON `test`.`t1` TO 'drop_user'@'localhost'
+revoke all privileges, grant option from drop_user@localhost;
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT USAGE ON *.* TO 'drop_user'@'localhost'
+drop user drop_user@localhost;
+revoke all privileges, grant option from drop_user@localhost;
+ERROR HY000: Can't revoke all privileges, grant for one or more of the requested users
+grant select(a) on test.t1 to drop_user1@localhost;
+grant select on test.t1 to drop_user2@localhost;
+grant select on test.* to drop_user3@localhost;
+grant select on *.* to drop_user4@localhost;
+drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
+drop_user4@localhost;
+ERROR HY000: Can't drop one or more of the requested users
+revoke all privileges, grant option from drop_user1@localhost, drop_user2@localhost,
+drop_user3@localhost, drop_user4@localhost;
+drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
+drop_user4@localhost;
+drop table t1;
+grant usage on *.* to mysqltest_1@localhost identified by "password";
+grant select, update, insert on test.* to mysqltest@localhost;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' IDENTIFIED BY PASSWORD '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19'
+drop user mysqltest_1@localhost;
+SET NAMES koi8r;
+CREATE DATABASE ÂÄ;
+USE ÂÄ;
+CREATE TABLE ÔÁÂ (ËÏÌ int);
+GRANT SELECT ON ÂÄ.* TO ÀÚÅÒ@localhost;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+Grants for ÀÚÅÒ@localhost
+GRANT USAGE ON *.* TO 'ÀÚÅÒ'@'localhost'
+GRANT SELECT ON `ÂÄ`.* TO 'ÀÚÅÒ'@'localhost'
+REVOKE SELECT ON ÂÄ.* FROM ÀÚÅÒ@localhost;
+GRANT SELECT ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+Grants for ÀÚÅÒ@localhost
+GRANT USAGE ON *.* TO 'ÀÚÅÒ'@'localhost'
+GRANT SELECT ON `ÂÄ`.`ÔÁÂ` TO 'ÀÚÅÒ'@'localhost'
+REVOKE SELECT ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
+GRANT SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+Grants for ÀÚÅÒ@localhost
+GRANT USAGE ON *.* TO 'ÀÚÅÒ'@'localhost'
+GRANT SELECT (ËÏÌ) ON `ÂÄ`.`ÔÁÂ` TO 'ÀÚÅÒ'@'localhost'
+REVOKE SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
+DROP DATABASE ÂÄ;
+SET NAMES latin1;
+USE test;
+CREATE TABLE t1 (a int );
+CREATE TABLE t2 LIKE t1;
+CREATE TABLE t3 LIKE t1;
+CREATE TABLE t4 LIKE t1;
+CREATE TABLE t5 LIKE t1;
+CREATE TABLE t6 LIKE t1;
+CREATE TABLE t7 LIKE t1;
+CREATE TABLE t8 LIKE t1;
+CREATE TABLE t9 LIKE t1;
+CREATE TABLE t10 LIKE t1;
+CREATE DATABASE testdb1;
+CREATE DATABASE testdb2;
+CREATE DATABASE testdb3;
+CREATE DATABASE testdb4;
+CREATE DATABASE testdb5;
+CREATE DATABASE testdb6;
+CREATE DATABASE testdb7;
+CREATE DATABASE testdb8;
+CREATE DATABASE testdb9;
+CREATE DATABASE testdb10;
+GRANT ALL ON testdb1.* TO testuser@localhost;
+GRANT ALL ON testdb2.* TO testuser@localhost;
+GRANT ALL ON testdb3.* TO testuser@localhost;
+GRANT ALL ON testdb4.* TO testuser@localhost;
+GRANT ALL ON testdb5.* TO testuser@localhost;
+GRANT ALL ON testdb6.* TO testuser@localhost;
+GRANT ALL ON testdb7.* TO testuser@localhost;
+GRANT ALL ON testdb8.* TO testuser@localhost;
+GRANT ALL ON testdb9.* TO testuser@localhost;
+GRANT ALL ON testdb10.* TO testuser@localhost;
+GRANT SELECT ON test.t1 TO testuser@localhost;
+GRANT SELECT ON test.t2 TO testuser@localhost;
+GRANT SELECT ON test.t3 TO testuser@localhost;
+GRANT SELECT ON test.t4 TO testuser@localhost;
+GRANT SELECT ON test.t5 TO testuser@localhost;
+GRANT SELECT ON test.t6 TO testuser@localhost;
+GRANT SELECT ON test.t7 TO testuser@localhost;
+GRANT SELECT ON test.t8 TO testuser@localhost;
+GRANT SELECT ON test.t9 TO testuser@localhost;
+GRANT SELECT ON test.t10 TO testuser@localhost;
+GRANT SELECT (a) ON test.t1 TO testuser@localhost;
+GRANT SELECT (a) ON test.t2 TO testuser@localhost;
+GRANT SELECT (a) ON test.t3 TO testuser@localhost;
+GRANT SELECT (a) ON test.t4 TO testuser@localhost;
+GRANT SELECT (a) ON test.t5 TO testuser@localhost;
+GRANT SELECT (a) ON test.t6 TO testuser@localhost;
+GRANT SELECT (a) ON test.t7 TO testuser@localhost;
+GRANT SELECT (a) ON test.t8 TO testuser@localhost;
+GRANT SELECT (a) ON test.t9 TO testuser@localhost;
+GRANT SELECT (a) ON test.t10 TO testuser@localhost;
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM testuser@localhost;
+SHOW GRANTS FOR testuser@localhost;
+Grants for testuser@localhost
+GRANT USAGE ON *.* TO 'testuser'@'localhost'
+DROP USER testuser@localhost;
+DROP TABLE t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+DROP DATABASE testdb1;
+DROP DATABASE testdb2;
+DROP DATABASE testdb3;
+DROP DATABASE testdb4;
+DROP DATABASE testdb5;
+DROP DATABASE testdb6;
+DROP DATABASE testdb7;
+DROP DATABASE testdb8;
+DROP DATABASE testdb9;
+DROP DATABASE testdb10;
+create table t1(a int, b int, c int, d int);
+grant insert(b), insert(c), insert(d), insert(a) on t1 to grant_user@localhost;
+show grants for grant_user@localhost;
+Grants for grant_user@localhost
+GRANT USAGE ON *.* TO 'grant_user'@'localhost'
+GRANT INSERT (a, d, c, b) ON `test`.`t1` TO 'grant_user'@'localhost'
+select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv;
+Host Db User Table_name Column_name Column_priv
+localhost test grant_user t1 c Insert
+localhost test grant_user t1 b Insert
+localhost test grant_user t1 a Insert
+localhost test grant_user t1 d Insert
+revoke ALL PRIVILEGES on t1 from grant_user@localhost;
+show grants for grant_user@localhost;
+Grants for grant_user@localhost
+GRANT USAGE ON *.* TO 'grant_user'@'localhost'
+select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv;
+Host Db User Table_name Column_name Column_priv
+drop user grant_user@localhost;
+drop table t1;
create database mysqltest_1;
create database mysqltest_2;
create table mysqltest_1.t1 select 1 a, 2 q;
@@ -196,13 +381,13 @@ GRANT SELECT (c) ON `mysqltest_2`.`t1` TO 'mysqltest_3'@'localhost'
GRANT UPDATE (a) ON `mysqltest_1`.`t1` TO 'mysqltest_3'@'localhost'
GRANT UPDATE (d) ON `mysqltest_2`.`t2` TO 'mysqltest_3'@'localhost'
update mysqltest_1.t1, mysqltest_1.t2 set q=10 where b=1;
-UPDATE command denied to user: 'mysqltest_3@localhost' for column 'q' in table 't1'
+ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for column 'q' in table 't1'
update mysqltest_1.t1, mysqltest_2.t2 set d=20 where d=1;
-select command denied to user: 'mysqltest_3@localhost' for table 't1'
+ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'd' in table 't2'
update mysqltest_2.t1, mysqltest_1.t2 set c=20 where b=1;
-UPDATE command denied to user: 'mysqltest_3@localhost' for column 'c' in table 't1'
+ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1'
update mysqltest_2.t1, mysqltest_2.t2 set d=10 where s=2;
-SELECT command denied to user: 'mysqltest_3@localhost' for column 's' in table 't1'
+ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 's' in table 't1'
update mysqltest_1.t1, mysqltest_2.t2 set a=10,d=10;
update mysqltest_1.t1, mysqltest_2.t1 set a=20 where c=20;
select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2;
@@ -221,14 +406,14 @@ flush privileges;
use mysqltest_1;
update mysqltest_2.t1, mysqltest_2.t2 set c=500,d=600;
update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
-UPDATE command denied to user: 'mysqltest_3@localhost' for column 'a' in table 't1'
+ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for column 'a' in table 't1'
use mysqltest_2;
update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
-Access denied for user: 'mysqltest_3@localhost' to database 'mysqltest_1'
+ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest_1'
update mysqltest_2.t1, mysqltest_1.t2 set c=100,b=200;
-Access denied for user: 'mysqltest_3@localhost' to database 'mysqltest_1'
+ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest_1'
update mysqltest_1.t1, mysqltest_2.t2 set a=100,d=200;
-Access denied for user: 'mysqltest_3@localhost' to database 'mysqltest_1'
+ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest_1'
select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2;
a q b r
10 2 1 2
diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result
new file mode 100644
index 00000000000..a31fa2ac3dc
--- /dev/null
+++ b/mysql-test/r/grant2.result
@@ -0,0 +1,54 @@
+SET NAMES binary;
+drop database if exists mysqltest;
+delete from mysql.user where user like 'mysqltest\_%';
+delete from mysql.db where user like 'mysqltest\_%';
+delete from mysql.tables_priv where user like 'mysqltest\_%';
+delete from mysql.columns_priv where user like 'mysqltest\_%';
+flush privileges;
+grant all privileges on `my\_%`.* to mysqltest_1@localhost with grant option;
+select current_user();
+current_user()
+mysqltest_1@localhost
+select current_user;
+current_user
+mysqltest_1@localhost
+grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option;
+grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option;
+ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'my_%'
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT ALL PRIVILEGES ON `my\_%`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
+show grants for mysqltest_2@localhost;
+Grants for mysqltest_2@localhost
+GRANT USAGE ON *.* TO 'mysqltest_2'@'localhost'
+GRANT ALL PRIVILEGES ON `my\_1`.* TO 'mysqltest_2'@'localhost' WITH GRANT OPTION
+show grants for mysqltest_3@localhost;
+ERROR 42000: There is no such grant defined for user 'mysqltest_3' on host 'localhost'
+delete from mysql.user where user like 'mysqltest\_%';
+delete from mysql.db where user like 'mysqltest\_%';
+flush privileges;
+create database mysqltest;
+grant INSERT, SELECT on mysqltest.* to mysqltest_1@localhost;
+flush privileges;
+use mysqltest;
+create table t1 (id int primary key, data varchar(255));
+show grants for current_user();
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT SELECT, INSERT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+use mysqltest;
+insert into t1 values (1, 'I can''t change it!');
+update t1 set data='I can change it!' where id = 1;
+ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest'
+insert into t1 values (1, 'XXX') on duplicate key update data= 'I can change it!';
+ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest'
+select * from t1;
+id data
+1 I can't change it!
+drop table t1;
+drop database mysqltest;
+use test;
+delete from mysql.user where user like 'mysqltest\_%';
+delete from mysql.db where user like 'mysqltest\_%';
+flush privileges;
diff --git a/mysql-test/r/grant_cache.result b/mysql-test/r/grant_cache.result
index 96eb9d2bc62..892f1d940a6 100644
--- a/mysql-test/r/grant_cache.result
+++ b/mysql-test/r/grant_cache.result
@@ -2,6 +2,12 @@ drop table if exists test.t1,mysqltest.t1,mysqltest.t2;
drop database if exists mysqltest;
reset query cache;
flush status;
+show grants for current_user;
+Grants for root@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
+show grants;
+Grants for root@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
create database if not exists mysqltest;
create table mysqltest.t1 (a int,b int,c int);
create table mysqltest.t2 (a int,b int,c int);
@@ -41,6 +47,10 @@ grant SELECT on mysqltest.* to mysqltest_1@localhost;
grant SELECT on mysqltest.t1 to mysqltest_2@localhost;
grant SELECT on test.t1 to mysqltest_2@localhost;
grant SELECT(a) on mysqltest.t1 to mysqltest_3@localhost;
+show grants for current_user();
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 6
@@ -101,6 +111,9 @@ Qcache_hits 3
show status like "Qcache_not_cached";
Variable_name Value
Qcache_not_cached 1
+show grants for current_user();
+Grants for @localhost
+GRANT USAGE ON *.* TO ''@'localhost'
select "user2";
user2
user2
@@ -121,7 +134,7 @@ a b c a
1 1 1 test.t1
2 2 2 test.t1
select * from t2;
-select command denied to user: 'mysqltest_2@localhost' for table 't2'
+ERROR 42000: select command denied to user 'mysqltest_2'@'localhost' for table 't2'
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 6
@@ -135,17 +148,17 @@ select "user3";
user3
user3
select * from t1;
-select command denied to user: 'mysqltest_3@localhost' for column 'b' in table 't1'
+ERROR 42000: select command denied to user 'mysqltest_3'@'localhost' for column 'b' in table 't1'
select a from t1;
a
1
2
select c from t1;
-SELECT command denied to user: 'mysqltest_3@localhost' for column 'c' in table 't1'
+ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1'
select * from t2;
-select command denied to user: 'mysqltest_3@localhost' for table 't2'
+ERROR 42000: select command denied to user 'mysqltest_3'@'localhost' for table 't2'
select mysqltest.t1.c from test.t1,mysqltest.t1;
-SELECT command denied to user: 'mysqltest_3@localhost' for column 'c' in table 't1'
+ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1'
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 6
@@ -158,8 +171,12 @@ Qcache_not_cached 7
select "user4";
user4
user4
+show grants;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
select a from t1;
-No Database Selected
+ERROR 3D000: No database selected
select * from mysqltest.t1,test.t1;
a b c a
1 1 1 test.t1
@@ -181,6 +198,7 @@ Qcache_hits 8
show status like "Qcache_not_cached";
Variable_name Value
Qcache_not_cached 8
+set names binary;
delete from mysql.user where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
delete from mysql.db where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
delete from mysql.tables_priv where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index f636692c0d9..f92b3ea4f4d 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -1,4 +1,6 @@
drop table if exists t1,t2,t3;
+SELECT 1 FROM (SELECT 1) as a GROUP BY SUM(1);
+ERROR HY000: Invalid use of group function
CREATE TABLE t1 (
spID int(10) unsigned,
userID int(10) unsigned,
@@ -52,10 +54,10 @@ userid MIN(t1.score+0.0)
2 2.0
1 1.0
EXPLAIN SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid ORDER BY NULL;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 4 Using where; Using temporary
-t2 eq_ref PRIMARY PRIMARY 4 t1.userID 1 Using index
-drop table test.t1,test.t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where; Using temporary
+1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.userID 1 Using index
+drop table t1,t2;
CREATE TABLE t1 (
PID int(10) unsigned NOT NULL auto_increment,
payDate date DEFAULT '0000-00-00' NOT NULL,
@@ -77,7 +79,7 @@ KEY payDate (payDate)
);
INSERT INTO t1 VALUES (1,'1970-01-01','1997-10-17 00:00:00',2529,1,21000,11886,'check',0,'F',16200,6);
SELECT COUNT(P.URID),SUM(P.amount),P.method, MIN(PP.recdate+0) > 19980501000000 AS IsNew FROM t1 AS P JOIN t1 as PP WHERE P.URID = PP.URID GROUP BY method,IsNew;
-Can't group on 'IsNew'
+ERROR 42000: Can't group on 'IsNew'
drop table t1;
CREATE TABLE t1 (
cid mediumint(9) NOT NULL auto_increment,
@@ -113,7 +115,7 @@ groupset bigint(20) DEFAULT '0' NOT NULL,
assigned_to mediumint(9) DEFAULT '0' NOT NULL,
bug_file_loc text,
bug_severity enum('blocker','critical','major','normal','minor','trivial','enhancement') DEFAULT 'blocker' NOT NULL,
-bug_status enum('NEW','ASSIGNED','REOPENED','RESOLVED','VERIFIED','CLOSED') DEFAULT 'NEW' NOT NULL,
+bug_status enum('','NEW','ASSIGNED','REOPENED','RESOLVED','VERIFIED','CLOSED') DEFAULT 'NEW' NOT NULL,
creation_ts datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
delta_ts timestamp(14),
short_desc mediumtext,
@@ -250,11 +252,11 @@ key (score)
);
INSERT INTO t1 VALUES (1,1,1),(2,2,2),(2,1,1),(3,3,3),(4,3,3),(5,3,3),(6,3,3),(7,3,3);
explain select userid,count(*) from t1 group by userid desc;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 8 Using temporary; Using filesort
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using temporary; Using filesort
explain select userid,count(*) from t1 group by userid desc order by null;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 8 Using temporary
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using temporary
select userid,count(*) from t1 group by userid desc;
userid count(*)
3 5
@@ -266,14 +268,14 @@ userid count(*)
select userid,count(*) from t1 group by userid desc having 3 IN (1,COUNT(*));
userid count(*)
explain select spid,count(*) from t1 where spid between 1 and 2 group by spid desc;
-table type possible_keys key key_len ref rows Extra
-t1 range spID spID 5 NULL 3 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range spID spID 5 NULL 3 Using where; Using index
explain select spid,count(*) from t1 where spid between 1 and 2 group by spid;
-table type possible_keys key key_len ref rows Extra
-t1 range spID spID 5 NULL 3 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range spID spID 5 NULL 3 Using where; Using index
explain select spid,count(*) from t1 where spid between 1 and 2 group by spid order by null;
-table type possible_keys key key_len ref rows Extra
-t1 range spID spID 5 NULL 3 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range spID spID 5 NULL 3 Using where; Using index
select spid,count(*) from t1 where spid between 1 and 2 group by spid;
spid count(*)
1 1
@@ -282,12 +284,14 @@ select spid,count(*) from t1 where spid between 1 and 2 group by spid desc;
spid count(*)
2 2
1 1
-explain select sql_big_result spid,sum(userid) from t1 group by spid desc;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 8 Using filesort
+explain extended select sql_big_result spid,sum(userid) from t1 group by spid desc;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using filesort
+Warnings:
+Note 1003 select sql_big_result test.t1.spID AS `spid`,sum(test.t1.userID) AS `sum(userid)` from test.t1 group by test.t1.spID desc
explain select sql_big_result spid,sum(userid) from t1 group by spid desc order by null;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 8 Using filesort
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using filesort
select sql_big_result spid,sum(userid) from t1 group by spid desc;
spid sum(userid)
7 3
@@ -298,11 +302,11 @@ spid sum(userid)
2 3
1 1
explain select sql_big_result score,count(*) from t1 group by score desc;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL score 3 NULL 8 Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL score 3 NULL 8 Using index
explain select sql_big_result score,count(*) from t1 group by score desc order by null;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL score 3 NULL 8 Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL score 3 NULL 8 Using index
select sql_big_result score,count(*) from t1 group by score desc;
score count(*)
3 5
@@ -422,7 +426,6 @@ CONCAT(a, b) count(*)
abcdef 1
hijklm 2
DROP TABLE t1;
-drop table if exists t1;
create table t1 (One int unsigned, Two int unsigned, Three int unsigned, Four int unsigned);
insert into t1 values (1,2,1,4),(1,2,2,4),(1,2,3,4),(1,2,4,4),(1,1,1,4),(1,1,2,4),(1,1,3,4),(1,1,4,4),(1,3,1,4),(1,3,2,4),(1,3,3,4),(1,3,4,4);
select One, Two, sum(Four) from t1 group by One,Two;
@@ -473,13 +476,13 @@ c2id int(11) unsigned default NULL,
value int(11) unsigned NOT NULL default '0',
UNIQUE KEY pid2 (pid,c1id,c2id),
UNIQUE KEY pid (pid,value)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1, 1, NULL, 1),(1, 2, NULL, 2),(1, NULL, 3, 3),(1, 4, NULL, 4),(1, 5, NULL, 5);
CREATE TABLE t2 (
id int(11) unsigned NOT NULL default '0',
active enum('Yes','No') NOT NULL default 'Yes',
PRIMARY KEY (id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1, 'Yes'),(2, 'No'),(4, 'Yes'),(5, 'No');
CREATE TABLE t3 (
id int(11) unsigned NOT NULL default '0',
@@ -532,13 +535,13 @@ a b
2 2
1 1
explain select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
-t2 ALL a NULL NULL NULL 3 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
+1 SIMPLE t2 ALL a NULL NULL NULL 3 Using where
explain select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b ORDER BY NULL;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 6 Using temporary
-t2 ALL a NULL NULL NULL 3 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary
+1 SIMPLE t2 ALL a NULL NULL NULL 3 Using where
drop table t1,t2;
create table t1 (a int, b int);
insert into t1 values (1, 4),(10, 40),(1, 4),(10, 43),(1, 4),(10, 41),(1, 4),(10, 43),(1, 4);
@@ -609,8 +612,8 @@ userid count(*)
2 1
1 2
EXPLAIN SELECT userid,count(*) FROM t1 GROUP BY userid DESC;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 8 Using temporary; Using filesort
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using temporary; Using filesort
DROP TABLE t1;
CREATE TABLE t1 (
i int(11) default NULL,
@@ -623,9 +626,18 @@ i COUNT(DISTINCT(i))
2 1
4 4
explain SELECT i, COUNT(DISTINCT(i)) FROM t1 GROUP BY j ORDER BY NULL;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 6 Using filesort
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
DROP TABLE t1;
+create table t1 ( col1 int, col2 int );
+insert into t1 values (1,1),(1,2),(1,3),(2,1),(2,2);
+select group_concat( distinct col1 ) as alias from t1
+group by col2 having alias like '%';
+alias
+1,2
+1,2
+1
+drop table t1;
create table t1 (a int);
insert into t1 values(null);
select min(a) is null from t1;
diff --git a/mysql-test/r/handler.result b/mysql-test/r/handler.result
index 5af153930d5..072d4582cbc 100644
--- a/mysql-test/r/handler.result
+++ b/mysql-test/r/handler.result
@@ -5,6 +5,8 @@ insert into t1 values
(14,"aaa"),(15,"bbb"),(16,"ccc"),(16,"xxx"),
(20,"ggg"),(21,"hhh"),(22,"iii");
handler t1 open as t2;
+handler t2 read a=(SELECT 1);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT 1)' at line 1
handler t2 read a first;
a b
14 aaa
@@ -49,7 +51,7 @@ handler t2 read a=(16);
a b
16 ccc
handler t2 read a=(19,"fff");
-Too many key parts specified. Max 1 parts allowed
+ERROR 42000: Too many key parts specified; max 1 parts allowed
handler t2 read b=(19,"fff");
a b
19 fff
@@ -60,7 +62,7 @@ handler t2 read b=(19);
a b
19 fff
handler t1 read a last;
-Unknown table 't1' in HANDLER
+ERROR 42S02: Unknown table 't1' in HANDLER
handler t2 read a=(11);
a b
handler t2 read a>=(11);
@@ -133,18 +135,18 @@ handler t2 read next;
a b
19 fff
handler t2 read last;
-You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
handler t2 close;
handler t1 open as t2;
drop table t1;
create table t1 (a int);
insert into t1 values (17);
handler t2 read first;
-Unknown table 't2' in HANDLER
+ERROR 42S02: Unknown table 't2' in HANDLER
handler t1 open as t2;
alter table t1 engine=MyISAM;
handler t2 read first;
-Unknown table 't2' in HANDLER
+ERROR 42S02: Unknown table 't2' in HANDLER
drop table t1;
create table t1 (a int);
insert into t1 values (1),(2),(3),(4),(5),(6);
@@ -169,9 +171,9 @@ create table t1(a int, index(a));
insert into t1 values (1), (2), (3);
handler t1 open;
handler t1 read a=(W);
-Unknown column 'W' in 'field list'
+ERROR 42S22: Unknown column 'W' in 'field list'
handler t1 read a=(a);
-Wrong arguments to HANDLER ... READ
+ERROR HY000: Incorrect arguments to HANDLER ... READ
drop table t1;
create table t1 (a char(5));
insert into t1 values ("Ok");
@@ -228,40 +230,36 @@ create table t1(table_id char(20) primary key);
insert into t1 values ('test.t1');
insert into t1 values ('');
handler t1 open;
-Not unique table/alias: 't1'
+ERROR 42000: Not unique table/alias: 't1'
use test;
handler test.t1 read first limit 9;
-Unknown table 'test.t1' in HANDLER
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read first limit 9' at line 1
handler test_test.t1 read first limit 9;
-table_id
-test_test.t1
-
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read first limit 9' at line 1
handler t1 read first limit 9;
table_id
test_test.t1
handler test_test.t2 read first limit 9;
-table_id
-test_test.t2
-
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read first limit 9' at line 1
handler t2 read first limit 9;
table_id
test_test.t2
handler test_test.t1 close;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1
handler t1 close;
-Unknown table 't1' in HANDLER
drop table test_test.t1;
handler test_test.t2 close;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1
handler t2 close;
-Unknown table 't2' in HANDLER
drop table test_test.t2;
drop database test_test;
use test;
handler test.t1 close;
-Unknown table 'test.t1' in HANDLER
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1
handler t1 close;
-Unknown table 't1' in HANDLER
+ERROR 42S02: Unknown table 't1' in HANDLER
drop table test.t1;
drop database if exists test_test;
drop table if exists t1;
@@ -289,20 +287,20 @@ insert into t1 values ('t1');
insert into t2 values ('t2');
insert into t3 values ('t3');
handler t1 open;
-Not unique table/alias: 't1'
+ERROR 42000: Not unique table/alias: 't1'
handler t2 open t1;
-Not unique table/alias: 't1'
+ERROR 42000: Not unique table/alias: 't1'
handler t3 open t1;
-Not unique table/alias: 't1'
+ERROR 42000: Not unique table/alias: 't1'
handler t1 read first limit 9;
c1
test_test.t1
handler test.t1 close;
-Unknown table 'test.t1' in HANDLER
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1
handler test.t1 open h1;
-Not unique table/alias: 'h1'
+ERROR 42000: Not unique table/alias: 'h1'
handler test_test.t1 open h1;
-Not unique table/alias: 'h1'
+ERROR 42000: Not unique table/alias: 'h1'
handler test_test.t3 open h3;
handler test.t1 open h2;
handler t1 read first limit 9;
@@ -317,24 +315,24 @@ t1
handler h3 read first limit 9;
c1
test_test.t3
-handler test.h2 read first limit 9;
+handler h2 read first limit 9;
c1
t1
handler test.h1 close;
-Unknown table 'test.h1' in HANDLER
-handler test_test.t1 close;
-handler test_test.h1 close;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1
+handler t1 close;
+handler h1 close;
handler h2 close;
handler t1 read first limit 9;
-Unknown table 't1' in HANDLER
+ERROR 42S02: Unknown table 't1' in HANDLER
handler h1 read first limit 9;
-Unknown table 'h1' in HANDLER
+ERROR 42S02: Unknown table 'h1' in HANDLER
handler h2 read first limit 9;
-Unknown table 'h2' in HANDLER
+ERROR 42S02: Unknown table 'h2' in HANDLER
handler h3 read first limit 9;
c1
test_test.t3
-handler test_test.h3 read first limit 9;
+handler h3 read first limit 9;
c1
test_test.t3
use test_test;
@@ -342,8 +340,8 @@ handler h3 read first limit 9;
c1
test_test.t3
handler test.h3 read first limit 9;
-Unknown table 'test.h3' in HANDLER
-handler test_test.h3 close;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read first limit 9' at line 1
+handler h3 close;
use test;
drop table t3;
drop table t2;
@@ -381,7 +379,7 @@ c1
t5
alter table t1 engine=MyISAM;
handler h1 read first limit 9;
-Unknown table 'h1' in HANDLER
+ERROR 42S02: Unknown table 'h1' in HANDLER
handler h2 read first limit 9;
c1
t2
@@ -396,7 +394,7 @@ c1
t5
alter table t5 engine=MyISAM;
handler h1 read first limit 9;
-Unknown table 'h1' in HANDLER
+ERROR 42S02: Unknown table 'h1' in HANDLER
handler h2 read first limit 9;
c1
t2
@@ -407,20 +405,20 @@ handler h4 read first limit 9;
c1
t4
handler h5 read first limit 9;
-Unknown table 'h5' in HANDLER
+ERROR 42S02: Unknown table 'h5' in HANDLER
alter table t3 engine=MyISAM;
handler h1 read first limit 9;
-Unknown table 'h1' in HANDLER
+ERROR 42S02: Unknown table 'h1' in HANDLER
handler h2 read first limit 9;
c1
t2
handler h3 read first limit 9;
-Unknown table 'h3' in HANDLER
+ERROR 42S02: Unknown table 'h3' in HANDLER
handler h4 read first limit 9;
c1
t4
handler h5 read first limit 9;
-Unknown table 'h5' in HANDLER
+ERROR 42S02: Unknown table 'h5' in HANDLER
handler h2 close;
handler h4 close;
handler t1 open as h1_1;
@@ -437,11 +435,11 @@ c1
t1
alter table t1 engine=MyISAM;
handler h1_1 read first limit 9;
-Unknown table 'h1_1' in HANDLER
+ERROR 42S02: Unknown table 'h1_1' in HANDLER
handler h1_2 read first limit 9;
-Unknown table 'h1_2' in HANDLER
+ERROR 42S02: Unknown table 'h1_2' in HANDLER
handler h1_3 read first limit 9;
-Unknown table 'h1_3' in HANDLER
+ERROR 42S02: Unknown table 'h1_3' in HANDLER
drop table t1;
drop table t2;
drop table t3;
diff --git a/mysql-test/r/have_archive.require b/mysql-test/r/have_archive.require
new file mode 100644
index 00000000000..c4b4ba24fcd
--- /dev/null
+++ b/mysql-test/r/have_archive.require
@@ -0,0 +1,2 @@
+Variable_name Value
+have_archive YES
diff --git a/mysql-test/r/have_big5.require b/mysql-test/r/have_big5.require
new file mode 100644
index 00000000000..74aacf74b62
--- /dev/null
+++ b/mysql-test/r/have_big5.require
@@ -0,0 +1,2 @@
+Collation Charset Id Default Compiled Sortlen
+big5_chinese_ci big5 1 Yes Yes 1
diff --git a/mysql-test/r/have_compress.require b/mysql-test/r/have_compress.require
new file mode 100644
index 00000000000..8bda2190fbe
--- /dev/null
+++ b/mysql-test/r/have_compress.require
@@ -0,0 +1,2 @@
+Variable_name Value
+have_compress YES
diff --git a/mysql-test/r/have_csv.require b/mysql-test/r/have_csv.require
new file mode 100644
index 00000000000..cc2fb28289c
--- /dev/null
+++ b/mysql-test/r/have_csv.require
@@ -0,0 +1,2 @@
+Variable_name Value
+have_csv YES
diff --git a/mysql-test/r/have_debug.require b/mysql-test/r/have_debug.require
new file mode 100644
index 00000000000..714922cee63
--- /dev/null
+++ b/mysql-test/r/have_debug.require
@@ -0,0 +1,2 @@
+debug
+1
diff --git a/mysql-test/r/have_exampledb.require b/mysql-test/r/have_exampledb.require
new file mode 100644
index 00000000000..29d0cf8b1a6
--- /dev/null
+++ b/mysql-test/r/have_exampledb.require
@@ -0,0 +1,2 @@
+Variable_name Value
+have_example_engine YES
diff --git a/mysql-test/r/have_geometry.require b/mysql-test/r/have_geometry.require
new file mode 100644
index 00000000000..ba515a4bbb6
--- /dev/null
+++ b/mysql-test/r/have_geometry.require
@@ -0,0 +1,2 @@
+Variable_name Value
+have_geometry YES
diff --git a/mysql-test/r/have_ndb.require b/mysql-test/r/have_ndb.require
new file mode 100644
index 00000000000..f0402b72c6a
--- /dev/null
+++ b/mysql-test/r/have_ndb.require
@@ -0,0 +1,2 @@
+Variable_name Value
+have_ndbcluster YES
diff --git a/mysql-test/r/have_openssl_1.require b/mysql-test/r/have_openssl_1.require
index 032b60d544a..b33a1d2854f 100644
--- a/mysql-test/r/have_openssl_1.require
+++ b/mysql-test/r/have_openssl_1.require
@@ -1,2 +1,2 @@
Variable_name Value
-Ssl_cipher EDH-RSA-DES-CBC3-SHA
+Ssl_cipher DHE-RSA-AES256-SHA
diff --git a/mysql-test/r/have_sjis.require b/mysql-test/r/have_sjis.require
new file mode 100644
index 00000000000..72ce8ec88fe
--- /dev/null
+++ b/mysql-test/r/have_sjis.require
@@ -0,0 +1,2 @@
+Collation Charset Id Default Compiled Sortlen
+sjis_japanese_ci sjis 13 Yes Yes 1
diff --git a/mysql-test/r/have_tis620.require b/mysql-test/r/have_tis620.require
new file mode 100644
index 00000000000..a1bf93ac491
--- /dev/null
+++ b/mysql-test/r/have_tis620.require
@@ -0,0 +1,2 @@
+Collation Charset Id Default Compiled Sortlen
+tis620_thai_ci tis620 18 Yes Yes 4
diff --git a/mysql-test/r/have_ucs2.require b/mysql-test/r/have_ucs2.require
new file mode 100644
index 00000000000..c53250aeaef
--- /dev/null
+++ b/mysql-test/r/have_ucs2.require
@@ -0,0 +1,2 @@
+Collation Charset Id Default Compiled Sortlen
+ucs2_general_ci ucs2 35 Yes Yes 1
diff --git a/mysql-test/r/have_ujis.require b/mysql-test/r/have_ujis.require
new file mode 100644
index 00000000000..43a309ad74e
--- /dev/null
+++ b/mysql-test/r/have_ujis.require
@@ -0,0 +1,2 @@
+Collation Charset Id Default Compiled Sortlen
+ujis_japanese_ci ujis 12 Yes Yes 1
diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result
index f0e9172991c..218276406b1 100644
--- a/mysql-test/r/having.result
+++ b/mysql-test/r/having.result
@@ -8,6 +8,11 @@ b
select count(a) as b from t1 where a=0 having b >=0;
b
0
+explain extended select count(a) as b from t1 where a=0 having b >=0;
+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 count(test.t1.a) AS `b` from test.t1 where (test.t1.a = 0) having (count(test.t1.a) >= 0)
drop table t1;
CREATE TABLE t1 (
raw_id int(10) NOT NULL default '0',
@@ -62,6 +67,10 @@ select Fld1, max(Fld2) from t1 group by Fld1 having std(Fld2) is not null;
Fld1 max(Fld2)
1 20
3 50
+select Fld1, max(Fld2) from t1 group by Fld1 having variance(Fld2) is not null;
+Fld1 max(Fld2)
+1 20
+3 50
drop table t1;
create table t1 (id int not null, qty int not null);
insert into t1 values (1,2),(1,3),(2,4),(2,5);
@@ -81,17 +90,17 @@ drop table t1;
CREATE TABLE t1 (
`id` bigint(20) NOT NULL default '0',
`description` text
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
CREATE TABLE t2 (
`id` bigint(20) NOT NULL default '0',
`description` varchar(20)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1, 'test');
INSERT INTO t2 VALUES (1, 'test');
CREATE TABLE t3 (
`id` bigint(20) NOT NULL default '0',
`order_id` bigint(20) NOT NULL default '0'
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
select
a.id, a.description,
count(b.id) as c
@@ -118,3 +127,4 @@ having (a.description is not null) and (c=0);
id description c
1 test 0
2 test2 0
+drop table t1,t2,t3;
diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result
index ef64c3a562f..b1cd17b444c 100644
--- a/mysql-test/r/heap.result
+++ b/mysql-test/r/heap.result
@@ -1,10 +1,10 @@
drop table if exists t1;
-create table t1 (a int not null,b int not null, primary key (a)) type=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100;
+create table t1 (a int not null,b int not null, primary key (a)) engine=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100;
insert into t1 values(1,1),(2,2),(3,3),(4,4);
delete from t1 where a=1 or a=0;
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
-t1 0 PRIMARY 1 a NULL NULL NULL NULL HASH
+t1 0 PRIMARY 1 a NULL 3 NULL NULL HASH
select * from t1;
a b
2 2
@@ -23,15 +23,15 @@ a b
4 6
alter table t1 add c int not null, add key (c,a);
drop table t1;
-create table t1 (a int not null,b int not null, primary key (a)) type=memory comment="testing heaps";
+create table t1 (a int not null,b int not null, primary key (a)) engine=memory comment="testing heaps";
insert into t1 values(1,1),(2,2),(3,3),(4,4);
delete from t1 where a > 0;
select * from t1;
a b
drop table t1;
-create table t1 (a int not null,b int not null, primary key (a)) type=heap comment="testing heaps";
+create table t1 (a int not null,b int not null, primary key (a)) engine=heap comment="testing heaps";
insert into t1 values(1,1),(2,2),(3,3),(4,4);
-alter table t1 modify a int not null auto_increment, type=myisam, comment="new myisam table";
+alter table t1 modify a int not null auto_increment, engine=myisam, comment="new myisam table";
select * from t1;
a b
1 1
@@ -39,7 +39,7 @@ a b
3 3
4 4
drop table t1;
-create table t1 (a int not null) type=heap;
+create table t1 (a int not null) engine=heap;
insert into t1 values (869751),(736494),(226312),(802616);
select * from t1 where a > 736494;
a
@@ -63,13 +63,13 @@ a
736494
802616
869751
-alter table t1 type=myisam;
+alter table t1 engine=myisam;
explain select * from t1 where a in (869751,736494,226312,802616);
-table type possible_keys key key_len ref rows Extra
-t1 range uniq_id uniq_id 4 NULL 4 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range uniq_id uniq_id 4 NULL 4 Using where; Using index
drop table t1;
-create table t1 (x int not null, y int not null, key x(x), unique y(y))
-type=heap;
+create table t1 (x int not null, y int not null, key x (x), unique y (y))
+engine=heap;
insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6);
select * from t1 where x=1;
x y
@@ -84,17 +84,17 @@ x y x y
2 5 2 2
2 6 2 2
explain select * from t1,t1 as t2 where t1.x=t2.y;
-table type possible_keys key key_len ref rows Extra
-t1 ALL x NULL NULL NULL 6
-t2 eq_ref y y 4 t1.x 1
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL x NULL NULL NULL 6
+1 SIMPLE t2 eq_ref y y 4 test.t1.x 1
drop table t1;
-create table t1 (a int) type=heap;
+create table t1 (a int) engine=heap;
insert into t1 values(1);
select max(a) from t1;
max(a)
1
drop table t1;
-CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key(a), key(b) ) TYPE=HEAP;
+CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key(a), key(b) ) ENGINE=HEAP;
insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
select * from t1 where a=1;
a b
@@ -120,7 +120,7 @@ a b
1 2
1 1
drop table t1;
-create table t1 (id int unsigned not null, primary key (id)) type=HEAP;
+create table t1 (id int unsigned not null, primary key (id)) engine=HEAP;
insert into t1 values(1);
select max(id) from t1;
max(id)
@@ -131,12 +131,12 @@ max(id)
2
replace into t1 values(1);
drop table t1;
-create table t1 (n int) type=heap;
+create table t1 (n int) engine=heap;
drop table t1;
-create table t1 (n int) type=heap;
+create table t1 (n int) engine=heap;
drop table if exists t1;
CREATE table t1(f1 int not null,f2 char(20) not
-null,index(f2)) type=heap;
+null,index(f2)) engine=heap;
INSERT into t1 set f1=12,f2="bill";
INSERT into t1 set f1=13,f2="bill";
INSERT into t1 set f1=14,f2="bill";
@@ -155,63 +155,63 @@ f1 f2
12 ted
12 ted
drop table t1;
-create table t1 (btn char(10) not null, key(btn)) type=heap;
+create table t1 (btn char(10) not null, key(btn)) engine=heap;
insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
explain select * from t1 where btn like "q%";
-table type possible_keys key key_len ref rows Extra
-t1 ALL btn NULL NULL NULL 14 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL btn NULL NULL NULL 14 Using where
select * from t1 where btn like "q%";
btn
alter table t1 add column new_col char(1) not null, add key (btn,new_col), drop key btn;
-update t1 set new_col=btn;
+update t1 set new_col=left(btn,1);
explain select * from t1 where btn="a";
-table type possible_keys key key_len ref rows Extra
-t1 ALL btn NULL NULL NULL 11 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL btn NULL NULL NULL 11 Using where
explain select * from t1 where btn="a" and new_col="a";
-table type possible_keys key key_len ref rows Extra
-t1 ref btn btn 11 const,const 10 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref btn btn 11 const,const 2 Using where
drop table t1;
CREATE TABLE t1 (
a int default NULL,
b int default NULL,
KEY a (a),
UNIQUE b (b)
-) type=heap;
+) engine=heap;
INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3);
SELECT * FROM t1 WHERE a=NULL;
a b
explain SELECT * FROM t1 WHERE a IS NULL;
-table type possible_keys key key_len ref rows Extra
-t1 ref a a 5 const 10 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 5 const 1 Using where
SELECT * FROM t1 WHERE a<=>NULL;
a b
NULL 99
SELECT * FROM t1 WHERE b=NULL;
a b
explain SELECT * FROM t1 WHERE b IS NULL;
-table type possible_keys key key_len ref rows Extra
-t1 ref b b 5 const 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref b b 5 const 1 Using where
SELECT * FROM t1 WHERE b<=>NULL;
a b
99 NULL
INSERT INTO t1 VALUES (1,3);
-Duplicate entry '3' for key 1
+ERROR 23000: Duplicate entry '3' for key 1
DROP TABLE t1;
CREATE TABLE t1 (
a int default NULL,
key a (a)
-) TYPE=HEAP;
+) ENGINE=HEAP;
INSERT INTO t1 VALUES (10), (10), (10);
EXPLAIN SELECT * FROM t1 WHERE a=10;
-table type possible_keys key key_len ref rows Extra
-t1 ref a a 5 const 10 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 5 const 3 Using where
SELECT * FROM t1 WHERE a=10;
a
10
10
10
DROP TABLE t1;
-CREATE TABLE t1 (a int not null, primary key(a)) type=heap;
+CREATE TABLE t1 (a int not null, primary key(a)) engine=heap;
INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11);
DELETE from t1 where a < 100;
SELECT * from t1;
@@ -222,12 +222,25 @@ CREATE TABLE `job_titles` (
`job_title` char(18) NOT NULL default '',
PRIMARY KEY (`job_title_id`),
UNIQUE KEY `job_title_id` (`job_title_id`,`job_title`)
-) TYPE=HEAP;
+) ENGINE=HEAP;
SELECT MAX(job_title_id) FROM job_titles;
MAX(job_title_id)
NULL
DROP TABLE job_titles;
-create table t1(a char(2)) type=heap;
+CREATE TABLE t1 (a INT NOT NULL, B INT, KEY(B)) ENGINE=HEAP;
+INSERT INTO t1 VALUES(1,1), (1,NULL);
+SELECT * FROM t1 WHERE B is not null;
+a B
+1 1
+DROP TABLE t1;
+CREATE TABLE t1 (pseudo char(35) PRIMARY KEY, date int(10) unsigned NOT NULL) ENGINE=HEAP;
+INSERT INTO t1 VALUES ('massecot',1101106491),('altec',1101106492),('stitch+',1101106304),('Seb Corgan',1101106305),('beerfilou',1101106263),('flaker',1101106529),('joce8',5),('M4vrick',1101106418),('gabay008',1101106525),('Vamp irX',1101106291),('ZoomZip',1101106546),('rip666',1101106502),('CBP ',1101106397),('guezpard',1101106496);
+DELETE FROM t1 WHERE date<1101106546;
+SELECT * FROM t1;
+pseudo date
+ZoomZip 1101106546
+DROP TABLE t1;
+create table t1(a char(2)) engine=memory;
insert into t1 values (NULL), (NULL);
delete from t1 where a is null;
insert into t1 values ('2'), ('3');
diff --git a/mysql-test/r/heap_auto_increment.result b/mysql-test/r/heap_auto_increment.result
new file mode 100644
index 00000000000..5b04a77e9eb
--- /dev/null
+++ b/mysql-test/r/heap_auto_increment.result
@@ -0,0 +1,41 @@
+drop table if exists t1;
+create table t1 (a int not null auto_increment,b int, primary key (a)) engine=heap auto_increment=3;
+insert into t1 values (1,1),(NULL,3),(NULL,4);
+delete from t1 where a=4;
+insert into t1 values (NULL,5),(NULL,6);
+select * from t1;
+a b
+1 1
+3 3
+5 5
+6 6
+delete from t1 where a=6;
+replace t1 values (3,1);
+ALTER TABLE t1 add c int;
+replace t1 values (3,3,3);
+insert into t1 values (NULL,7,7);
+update t1 set a=8,b=b+1,c=c+1 where a=7;
+insert into t1 values (NULL,9,9);
+select * from t1;
+a b c
+1 1 NULL
+3 3 3
+5 5 NULL
+8 8 8
+9 9 9
+drop table t1;
+create table t1 (
+skey tinyint unsigned NOT NULL auto_increment PRIMARY KEY,
+sval char(20)
+) engine=heap;
+insert into t1 values (NULL, "hello");
+insert into t1 values (NULL, "hey");
+select * from t1;
+skey sval
+1 hello
+2 hey
+select _rowid,t1._rowid,skey,sval from t1;
+_rowid _rowid skey sval
+1 1 1 hello
+2 2 2 hey
+drop table t1;
diff --git a/mysql-test/r/heap_btree.result b/mysql-test/r/heap_btree.result
new file mode 100644
index 00000000000..5c60c97d674
--- /dev/null
+++ b/mysql-test/r/heap_btree.result
@@ -0,0 +1,248 @@
+drop table if exists t1;
+create table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100;
+insert into t1 values(1,1),(2,2),(3,3),(4,4);
+delete from t1 where a=1 or a=0;
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 a A NULL NULL NULL BTREE
+select * from t1;
+a b
+2 2
+3 3
+4 4
+select * from t1 where a=4;
+a b
+4 4
+update t1 set b=5 where a=4;
+update t1 set b=b+1 where a>=3;
+replace t1 values (3,3);
+select * from t1;
+a b
+2 2
+3 3
+4 6
+alter table t1 add c int not null, add key using BTREE (c,a);
+drop table t1;
+create table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps";
+insert into t1 values(-2,-2),(-1,-1),(0,0),(1,1),(2,2),(3,3),(4,4);
+delete from t1 where a > -3;
+select * from t1;
+a b
+drop table t1;
+create table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps";
+insert into t1 values(1,1),(2,2),(3,3),(4,4);
+alter table t1 modify a int not null auto_increment, engine=myisam, comment="new myisam table";
+select * from t1;
+a b
+1 1
+2 2
+3 3
+4 4
+drop table t1;
+create table t1 (a int not null) engine=heap;
+insert into t1 values (869751),(736494),(226312),(802616);
+select * from t1 where a > 736494;
+a
+869751
+802616
+alter table t1 add unique uniq_id using BTREE (a);
+select * from t1 where a > 736494;
+a
+802616
+869751
+select * from t1 where a = 736494;
+a
+736494
+select * from t1 where a=869751 or a=736494;
+a
+736494
+869751
+select * from t1 where a in (869751,736494,226312,802616);
+a
+226312
+736494
+802616
+869751
+alter table t1 engine=myisam;
+explain select * from t1 where a in (869751,736494,226312,802616);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range uniq_id uniq_id 4 NULL 4 Using where; Using index
+drop table t1;
+create table t1 (x int not null, y int not null, key x using BTREE (x,y), unique y using BTREE (y))
+engine=heap;
+insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6);
+explain select * from t1 where x=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref x x 4 const 1 Using where
+select * from t1 where x=1;
+x y
+1 1
+1 3
+select * from t1,t1 as t2 where t1.x=t2.y;
+x y x y
+1 1 1 1
+2 2 2 2
+1 3 1 1
+2 4 2 2
+2 5 2 2
+2 6 2 2
+explain select * from t1,t1 as t2 where t1.x=t2.y;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL x NULL NULL NULL 6
+1 SIMPLE t2 eq_ref y y 4 test.t1.x 1
+drop table t1;
+create table t1 (a int) engine=heap;
+insert into t1 values(1);
+select max(a) from t1;
+max(a)
+1
+drop table t1;
+CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key using BTREE (a,b), key using BTREE (b) ) ENGINE=HEAP;
+insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
+select * from t1 where a=1;
+a b
+1 1
+1 2
+1 3
+1 4
+1 5
+1 6
+insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
+select * from t1 where a=1;
+a b
+1 1
+1 1
+1 2
+1 2
+1 3
+1 3
+1 4
+1 4
+1 5
+1 5
+1 6
+1 6
+explain select * from tx where a=x order by a,b;
+id select_type table type possible_keys key key_len ref rows Extra
+x SIMPLE tx ref a a x const x Using where
+explain select * from tx where a=x order by b;
+id select_type table type possible_keys key key_len ref rows Extra
+x SIMPLE tx ref a a x const x Using where
+select * from t1 where b=1;
+a b
+1 1
+1 1
+explain select * from tx where b=x;
+id select_type table type possible_keys key key_len ref rows Extra
+x SIMPLE tx ref b b x const x Using where
+drop table t1;
+create table t1 (id int unsigned not null, primary key using BTREE (id)) engine=HEAP;
+insert into t1 values(1);
+select max(id) from t1;
+max(id)
+1
+insert into t1 values(2);
+select max(id) from t1;
+max(id)
+2
+replace into t1 values(1);
+drop table t1;
+create table t1 (n int) engine=heap;
+drop table t1;
+create table t1 (n int) engine=heap;
+drop table if exists t1;
+CREATE table t1(f1 int not null,f2 char(20) not
+null,index(f2)) engine=heap;
+INSERT into t1 set f1=12,f2="bill";
+INSERT into t1 set f1=13,f2="bill";
+INSERT into t1 set f1=14,f2="bill";
+INSERT into t1 set f1=15,f2="bill";
+INSERT into t1 set f1=16,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+delete from t1 where f2="bill";
+select * from t1;
+f1 f2
+16 ted
+12 ted
+12 ted
+12 ted
+12 ted
+drop table t1;
+create table t1 (btn char(10) not null, key using BTREE (btn)) engine=heap;
+insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
+explain select * from t1 where btn like "i%";
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range btn btn 10 NULL 1 Using where
+explain select * from t1 where btn like "h%";
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range btn btn 10 NULL # Using where
+explain select * from t1 where btn like "a%";
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range btn btn 10 NULL 1 Using where
+explain select * from t1 where btn like "b%";
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range btn btn 10 NULL 1 Using where
+select * from t1 where btn like "ff%";
+btn
+select * from t1 where btn like " %";
+btn
+select * from t1 where btn like "q%";
+btn
+alter table t1 add column new_col char(1) not null, add key using BTREE (btn,new_col), drop key btn;
+update t1 set new_col=left(btn,1);
+explain select * from t1 where btn="a";
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref btn btn 10 const 1 Using where
+explain select * from t1 where btn="a" and new_col="a";
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref btn btn 11 const,const 1 Using where
+drop table t1;
+CREATE TABLE t1 (
+a int default NULL,
+b int default NULL,
+KEY a using BTREE (a),
+UNIQUE b using BTREE (b)
+) engine=heap;
+INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3);
+SELECT * FROM t1 WHERE a=NULL;
+a b
+explain SELECT * FROM t1 WHERE a IS NULL;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 5 const 1 Using where
+SELECT * FROM t1 WHERE a<=>NULL;
+a b
+NULL 99
+SELECT * FROM t1 WHERE b=NULL;
+a b
+explain SELECT * FROM t1 WHERE b IS NULL;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref b b 5 const 1 Using where
+SELECT * FROM t1 WHERE b<=>NULL;
+a b
+99 NULL
+INSERT INTO t1 VALUES (1,3);
+ERROR 23000: Duplicate entry '3' for key 1
+DROP TABLE t1;
+CREATE TABLE t1 (a int, b int, c int, key using BTREE (a, b, c)) engine=heap;
+INSERT INTO t1 VALUES (1, NULL, NULL), (1, 1, NULL), (1, NULL, 1);
+SELECT * FROM t1 WHERE a=1 and b IS NULL;
+a b c
+1 NULL NULL
+1 NULL 1
+SELECT * FROM t1 WHERE a=1 and c IS NULL;
+a b c
+1 NULL NULL
+1 1 NULL
+SELECT * FROM t1 WHERE a=1 and b IS NULL and c IS NULL;
+a b c
+1 NULL NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a int not null, primary key using BTREE (a)) engine=heap;
+INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11);
+DELETE from t1 where a < 100;
+SELECT * from t1;
+a
+DROP TABLE t1;
diff --git a/mysql-test/r/heap_hash.result b/mysql-test/r/heap_hash.result
new file mode 100644
index 00000000000..4f5de197858
--- /dev/null
+++ b/mysql-test/r/heap_hash.result
@@ -0,0 +1,357 @@
+drop table if exists t1,t2;
+create table t1 (a int not null,b int not null, primary key using HASH (a)) engine=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100;
+insert into t1 values(1,1),(2,2),(3,3),(4,4);
+delete from t1 where a=1 or a=0;
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 a NULL 3 NULL NULL HASH
+select * from t1;
+a b
+2 2
+3 3
+4 4
+select * from t1 where a=4;
+a b
+4 4
+update t1 set b=5 where a=4;
+update t1 set b=b+1 where a>=3;
+replace t1 values (3,3);
+select * from t1;
+a b
+2 2
+3 3
+4 6
+alter table t1 add c int not null, add key using HASH (c,a);
+drop table t1;
+create table t1 (a int not null,b int not null, primary key using HASH (a)) engine=heap comment="testing heaps";
+insert into t1 values(1,1),(2,2),(3,3),(4,4);
+delete from t1 where a > 0;
+select * from t1;
+a b
+drop table t1;
+create table t1 (a int not null,b int not null, primary key using HASH (a)) engine=heap comment="testing heaps";
+insert into t1 values(1,1),(2,2),(3,3),(4,4);
+alter table t1 modify a int not null auto_increment, engine=myisam, comment="new myisam table";
+select * from t1;
+a b
+1 1
+2 2
+3 3
+4 4
+drop table t1;
+create table t1 (a int not null) engine=heap;
+insert into t1 values (869751),(736494),(226312),(802616);
+select * from t1 where a > 736494;
+a
+869751
+802616
+alter table t1 add unique uniq_id using HASH (a);
+select * from t1 where a > 736494;
+a
+869751
+802616
+select * from t1 where a = 736494;
+a
+736494
+select * from t1 where a=869751 or a=736494;
+a
+736494
+869751
+select * from t1 where a in (869751,736494,226312,802616);
+a
+226312
+736494
+802616
+869751
+alter table t1 engine=myisam;
+explain select * from t1 where a in (869751,736494,226312,802616);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range uniq_id uniq_id 4 NULL 4 Using where; Using index
+drop table t1;
+create table t1 (x int not null, y int not null, key x using HASH (x), unique y using HASH (y))
+engine=heap;
+insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6);
+select * from t1 where x=1;
+x y
+1 3
+1 1
+select * from t1,t1 as t2 where t1.x=t2.y;
+x y x y
+1 1 1 1
+2 2 2 2
+1 3 1 1
+2 4 2 2
+2 5 2 2
+2 6 2 2
+explain select * from t1,t1 as t2 where t1.x=t2.y;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL x NULL NULL NULL 6
+1 SIMPLE t2 eq_ref y y 4 test.t1.x 1
+drop table t1;
+create table t1 (a int) engine=heap;
+insert into t1 values(1);
+select max(a) from t1;
+max(a)
+1
+drop table t1;
+CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key using HASH (a), key using HASH (b) ) ENGINE=HEAP;
+insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
+select * from t1 where a=1;
+a b
+1 6
+1 5
+1 4
+1 3
+1 2
+1 1
+insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
+select * from t1 where a=1;
+a b
+1 6
+1 5
+1 4
+1 3
+1 2
+1 1
+1 6
+1 5
+1 4
+1 3
+1 2
+1 1
+drop table t1;
+create table t1 (id int unsigned not null, primary key using HASH (id)) engine=HEAP;
+insert into t1 values(1);
+select max(id) from t1;
+max(id)
+1
+insert into t1 values(2);
+select max(id) from t1;
+max(id)
+2
+replace into t1 values(1);
+drop table t1;
+create table t1 (n int) engine=heap;
+drop table t1;
+create table t1 (n int) engine=heap;
+drop table if exists t1;
+CREATE table t1(f1 int not null,f2 char(20) not
+null,index(f2)) engine=heap;
+INSERT into t1 set f1=12,f2="bill";
+INSERT into t1 set f1=13,f2="bill";
+INSERT into t1 set f1=14,f2="bill";
+INSERT into t1 set f1=15,f2="bill";
+INSERT into t1 set f1=16,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+delete from t1 where f2="bill";
+select * from t1;
+f1 f2
+16 ted
+12 ted
+12 ted
+12 ted
+12 ted
+drop table t1;
+create table t1 (btn char(10) not null, key using HASH (btn)) engine=heap;
+insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
+explain select * from t1 where btn like "q%";
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL btn NULL NULL NULL 14 Using where
+select * from t1 where btn like "q%";
+btn
+alter table t1 add column new_col char(1) not null, add key using HASH (btn,new_col), drop key btn;
+update t1 set new_col=left(btn,1);
+explain select * from t1 where btn="a";
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL btn NULL NULL NULL 11 Using where
+explain select * from t1 where btn="a" and new_col="a";
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref btn btn 11 const,const 2 Using where
+drop table t1;
+CREATE TABLE t1 (
+a int default NULL,
+b int default NULL,
+KEY a using HASH (a),
+UNIQUE b using HASH (b)
+) engine=heap;
+INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3);
+SELECT * FROM t1 WHERE a=NULL;
+a b
+explain SELECT * FROM t1 WHERE a IS NULL;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 5 const 1 Using where
+SELECT * FROM t1 WHERE a<=>NULL;
+a b
+NULL 99
+SELECT * FROM t1 WHERE b=NULL;
+a b
+explain SELECT * FROM t1 WHERE b IS NULL;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref b b 5 const 1 Using where
+SELECT * FROM t1 WHERE b<=>NULL;
+a b
+99 NULL
+INSERT INTO t1 VALUES (1,3);
+ERROR 23000: Duplicate entry '3' for key 1
+DROP TABLE t1;
+CREATE TABLE t1 (a int not null, primary key using HASH (a)) engine=heap;
+INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11);
+DELETE from t1 where a < 100;
+SELECT * from t1;
+a
+DROP TABLE t1;
+create table t1
+(
+a char(8) not null,
+b char(20) not null,
+c int not null,
+key (a)
+) engine=heap;
+insert into t1 values ('aaaa', 'prefill-hash=5',0);
+insert into t1 values ('aaab', 'prefill-hash=0',0);
+insert into t1 values ('aaac', 'prefill-hash=7',0);
+insert into t1 values ('aaad', 'prefill-hash=2',0);
+insert into t1 values ('aaae', 'prefill-hash=1',0);
+insert into t1 values ('aaaf', 'prefill-hash=4',0);
+insert into t1 values ('aaag', 'prefill-hash=3',0);
+insert into t1 values ('aaah', 'prefill-hash=6',0);
+explain select * from t1 where a='aaaa';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+explain select * from t1 where a='aaab';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+explain select * from t1 where a='aaac';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+explain select * from t1 where a='aaad';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+insert into t1 select * from t1;
+explain select * from t1 where a='aaaa';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+explain select * from t1 where a='aaab';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+explain select * from t1 where a='aaac';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+explain select * from t1 where a='aaad';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+flush tables;
+explain select * from t1 where a='aaaa';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 2 Using where
+explain select * from t1 where a='aaab';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 2 Using where
+explain select * from t1 where a='aaac';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 2 Using where
+explain select * from t1 where a='aaad';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 2 Using where
+create table t2 as select * from t1;
+delete from t1;
+insert into t1 select * from t2;
+explain select * from t1 where a='aaaa';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+explain select * from t1 where a='aaab';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+explain select * from t1 where a='aaac';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+explain select * from t1 where a='aaad';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+drop table t1, t2;
+create table t1 (
+id int unsigned not null primary key auto_increment,
+name varchar(20) not null,
+index heap_idx(name),
+index btree_idx using btree(name)
+) engine=heap;
+create table t2 (
+id int unsigned not null primary key auto_increment,
+name varchar(20) not null,
+index btree_idx using btree(name),
+index heap_idx(name)
+) engine=heap;
+insert into t1 (name) values ('Matt'), ('Lilu'), ('Corbin'), ('Carly'),
+('Suzy'), ('Hoppy'), ('Burrito'), ('Mimi'), ('Sherry'), ('Ben'), ('Phil'),
+('Emily'), ('Mike');
+insert into t2 select * from t1;
+explain select * from t1 where name='matt';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 20 const 1 Using where
+explain select * from t2 where name='matt';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where
+explain select * from t1 where name='Lilu';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 20 const 1 Using where
+explain select * from t2 where name='Lilu';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where
+explain select * from t1 where name='Phil';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 20 const 1 Using where
+explain select * from t2 where name='Phil';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where
+explain select * from t1 where name='Lilu';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 20 const 1 Using where
+explain select * from t2 where name='Lilu';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where
+insert into t1 (name) select name from t2;
+insert into t1 (name) select name from t2;
+insert into t1 (name) select name from t2;
+insert into t1 (name) select name from t2;
+insert into t1 (name) select name from t2;
+insert into t1 (name) select name from t2;
+flush tables;
+select count(*) from t1 where name='Matt';
+count(*)
+7
+explain select * from t1 ignore index (btree_idx) where name='matt';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref heap_idx heap_idx 20 const 7 Using where
+show index from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 id NULL 91 NULL NULL HASH
+t1 1 heap_idx 1 name NULL 13 NULL NULL HASH
+t1 1 btree_idx 1 name A NULL NULL NULL BTREE
+show index from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 id NULL 91 NULL NULL HASH
+t1 1 heap_idx 1 name NULL 13 NULL NULL HASH
+t1 1 btree_idx 1 name A NULL NULL NULL BTREE
+create table t3
+(
+a varchar(20) not null,
+b varchar(20) not null,
+key (a,b)
+) engine=heap;
+insert into t3 select name, name from t1;
+show index from t3;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t3 1 a 1 a NULL NULL NULL NULL HASH
+t3 1 a 2 b NULL 15 NULL NULL HASH
+show index from t3;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t3 1 a 1 a NULL NULL NULL NULL HASH
+t3 1 a 2 b NULL 15 NULL NULL HASH
+explain select * from t1 ignore key(btree_idx), t3 where t1.name='matt' and t3.a = concat('',t1.name) and t3.b=t1.name;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref heap_idx heap_idx 20 const 7 Using where
+1 SIMPLE t3 ref a a 40 func,const 6 Using where
+drop table t1, t2, t3;
diff --git a/mysql-test/r/help.result b/mysql-test/r/help.result
new file mode 100644
index 00000000000..edf7d0e91cb
--- /dev/null
+++ b/mysql-test/r/help.result
@@ -0,0 +1,243 @@
+insert into mysql.help_category(help_category_id,name)values(1,'impossible_category_1');
+select @category1_id:= 1;
+@category1_id:= 1
+1
+insert into mysql.help_category(help_category_id,name)values(2,'impossible_category_2');
+select @category2_id:= 2;
+@category2_id:= 2
+2
+insert into mysql.help_category(help_category_id,name,parent_category_id)values(3,'impossible_category_3',@category2_id);
+select @category3_id:= 3;
+@category3_id:= 3
+3
+insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(1,'impossible_function_1',@category1_id,'description of \n impossible_function1\n','example of \n impossible_function1');
+select @topic1_id:= 1;
+@topic1_id:= 1
+1
+insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(2,'impossible_function_2',@category1_id,'description of \n impossible_function2\n','example of \n impossible_function2');
+select @topic2_id:= 2;
+@topic2_id:= 2
+2
+insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(3,'impossible_function_3',@category2_id,'description of \n impossible_function3\n','example of \n impossible_function3');
+select @topic3_id:= 3;
+@topic3_id:= 3
+3
+insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(4,'impossible_function_4',@category2_id,'description of \n impossible_function4\n','example of \n impossible_function4');
+select @topic4_id:= 4;
+@topic4_id:= 4
+4
+insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(5,'impossible_function_7',@category3_id,'description of \n impossible_function5\n','example of \n impossible_function7');
+select @topic5_id:= 5;
+@topic5_id:= 5
+5
+insert into mysql.help_keyword(help_keyword_id,name)values(1,'impossible_function_1');
+select @keyword1_id:= 1;
+@keyword1_id:= 1
+1
+insert into mysql.help_keyword(help_keyword_id,name)values(2,'impossible_function_5');
+select @keyword2_id:= 2;
+@keyword2_id:= 2
+2
+insert into mysql.help_keyword(help_keyword_id,name)values(3,'impossible_function_6');
+select @keyword3_id:= 3;
+@keyword3_id:= 3
+3
+insert into mysql.help_relation(help_keyword_id,help_topic_id)values(@keyword1_id,@topic2_id);
+insert into mysql.help_relation(help_keyword_id,help_topic_id)values(@keyword2_id,@topic1_id);
+insert into mysql.help_relation(help_keyword_id,help_topic_id)values(@keyword3_id,@topic3_id);
+insert into mysql.help_relation(help_keyword_id,help_topic_id)values(@keyword3_id,@topic4_id);
+help 'function_of_my_dream';
+name is_it_category
+help '%possible_f%';
+name is_it_category
+impossible_function_1 N
+impossible_function_2 N
+impossible_function_3 N
+impossible_function_4 N
+impossible_function_7 N
+help 'impossible_func%';
+name is_it_category
+impossible_function_1 N
+impossible_function_2 N
+impossible_function_3 N
+impossible_function_4 N
+impossible_function_7 N
+help 'impossible_category%';
+name is_it_category
+impossible_category_1 Y
+impossible_category_2 Y
+impossible_category_3 Y
+help 'impossible_%';
+name is_it_category
+impossible_function_1 N
+impossible_function_2 N
+impossible_function_3 N
+impossible_function_4 N
+impossible_function_7 N
+impossible_category_1 Y
+impossible_category_2 Y
+impossible_category_3 Y
+help '%function_1';
+name description example
+impossible_function_1 description of
+ impossible_function1
+ example of
+ impossible_function1
+help '%function_2';
+name description example
+impossible_function_2 description of
+ impossible_function2
+ example of
+ impossible_function2
+help '%function_3';
+name description example
+impossible_function_3 description of
+ impossible_function3
+ example of
+ impossible_function3
+help '%function_4';
+name description example
+impossible_function_4 description of
+ impossible_function4
+ example of
+ impossible_function4
+help '%function_5';
+name description example
+impossible_function_1 description of
+ impossible_function1
+ example of
+ impossible_function1
+help '%function_6';
+name is_it_category
+impossible_function_3 N
+impossible_function_4 N
+help '%function_7';
+name description example
+impossible_function_7 description of
+ impossible_function5
+ example of
+ impossible_function7
+help '%category_2';
+source_category_name name is_it_category
+impossible_category_2 impossible_function_3 N
+impossible_category_2 impossible_function_4 N
+impossible_category_2 impossible_category_3 Y
+help 'impossible_function_1';
+name description example
+impossible_function_1 description of
+ impossible_function1
+ example of
+ impossible_function1
+help 'impossible_category_1';
+source_category_name name is_it_category
+impossible_category_1 impossible_function_1 N
+impossible_category_1 impossible_function_2 N
+alter table mysql.help_relation engine=innodb;
+alter table mysql.help_keyword engine=innodb;
+alter table mysql.help_topic engine=innodb;
+alter table mysql.help_category engine=innodb;
+help 'function_of_my_dream';
+name is_it_category
+help '%possible_f%';
+name is_it_category
+impossible_function_1 N
+impossible_function_2 N
+impossible_function_3 N
+impossible_function_4 N
+impossible_function_7 N
+help 'impossible_func%';
+name is_it_category
+impossible_function_1 N
+impossible_function_2 N
+impossible_function_3 N
+impossible_function_4 N
+impossible_function_7 N
+help 'impossible_category%';
+name is_it_category
+impossible_category_1 Y
+impossible_category_2 Y
+impossible_category_3 Y
+help 'impossible_%';
+name is_it_category
+impossible_function_1 N
+impossible_function_2 N
+impossible_function_3 N
+impossible_function_4 N
+impossible_function_7 N
+impossible_category_1 Y
+impossible_category_2 Y
+impossible_category_3 Y
+help '%function_1';
+name description example
+impossible_function_1 description of
+ impossible_function1
+ example of
+ impossible_function1
+help '%function_2';
+name description example
+impossible_function_2 description of
+ impossible_function2
+ example of
+ impossible_function2
+help '%function_3';
+name description example
+impossible_function_3 description of
+ impossible_function3
+ example of
+ impossible_function3
+help '%function_4';
+name description example
+impossible_function_4 description of
+ impossible_function4
+ example of
+ impossible_function4
+help '%function_5';
+name description example
+impossible_function_1 description of
+ impossible_function1
+ example of
+ impossible_function1
+help '%function_6';
+name is_it_category
+impossible_function_3 N
+impossible_function_4 N
+help '%function_7';
+name description example
+impossible_function_7 description of
+ impossible_function5
+ example of
+ impossible_function7
+help '%category_2';
+source_category_name name is_it_category
+impossible_category_2 impossible_function_3 N
+impossible_category_2 impossible_function_4 N
+impossible_category_2 impossible_category_3 Y
+help 'impossible_function_1';
+name description example
+impossible_function_1 description of
+ impossible_function1
+ example of
+ impossible_function1
+help 'impossible_category_1';
+source_category_name name is_it_category
+impossible_category_1 impossible_function_1 N
+impossible_category_1 impossible_function_2 N
+alter table mysql.help_relation engine=myisam;
+alter table mysql.help_keyword engine=myisam;
+alter table mysql.help_topic engine=myisam;
+alter table mysql.help_category engine=myisam;
+delete from mysql.help_topic where help_topic_id=@topic1_id;
+delete from mysql.help_topic where help_topic_id=@topic2_id;
+delete from mysql.help_topic where help_topic_id=@topic3_id;
+delete from mysql.help_topic where help_topic_id=@topic4_id;
+delete from mysql.help_topic where help_topic_id=@topic5_id;
+delete from mysql.help_category where help_category_id=@category3_id;
+delete from mysql.help_category where help_category_id=@category2_id;
+delete from mysql.help_category where help_category_id=@category1_id;
+delete from mysql.help_keyword where help_keyword_id=@keyword1_id;
+delete from mysql.help_keyword where help_keyword_id=@keyword2_id;
+delete from mysql.help_keyword where help_keyword_id=@keyword3_id;
+delete from mysql.help_relation where help_keyword_id=@keyword1_id and help_topic_id=@topic2_id;
+delete from mysql.help_relation where help_keyword_id=@keyword2_id and help_topic_id=@topic1_id;
+delete from mysql.help_relation where help_keyword_id=@keyword3_id and help_topic_id=@topic3_id;
+delete from mysql.help_relation where help_keyword_id=@keyword3_id and help_topic_id=@topic4_id;
diff --git a/mysql-test/r/init_connect.result b/mysql-test/r/init_connect.result
new file mode 100644
index 00000000000..db1e72dfca9
--- /dev/null
+++ b/mysql-test/r/init_connect.result
@@ -0,0 +1,24 @@
+select hex(@a);
+hex(@a)
+NULL
+select hex(@a);
+hex(@a)
+610063
+set global init_connect="set @a=2;set @b=3";
+select @a, @b;
+@a @b
+2 3
+set GLOBAL init_connect=DEFAULT;
+select @a;
+@a
+NULL
+set global init_connect="create table t1(a char(10));\
+insert into t1 values ('\0');insert into t1 values('abc')";
+select hex(a) from t1;
+hex(a)
+00
+616263
+set GLOBAL init_connect="adsfsdfsdfs";
+select @a;
+Got one of the listed errors
+drop table t1;
diff --git a/mysql-test/r/innodb-deadlock.result b/mysql-test/r/innodb-deadlock.result
index 121bfa8c6cb..2ca82101fb4 100644
--- a/mysql-test/r/innodb-deadlock.result
+++ b/mysql-test/r/innodb-deadlock.result
@@ -1,5 +1,5 @@
-drop table if exists t1;
-create table t1 (id integer, x integer) type=INNODB;
+drop table if exists t1,t2;
+create table t1 (id integer, x integer) engine=INNODB;
insert into t1 values(0, 0);
set autocommit=0;
SELECT * from t1 where id = 0 FOR UPDATE;
@@ -18,3 +18,79 @@ id x
0 2
commit;
drop table t1;
+create table t1 (id integer, x integer) engine=INNODB;
+create table t2 (b integer, a integer) engine=INNODB;
+insert into t1 values(0, 0), (300, 300);
+insert into t2 values(0, 10), (1, 20), (2, 30);
+commit;
+set autocommit=0;
+select * from t2;
+b a
+0 10
+1 20
+2 30
+update t2 set a=100 where b=(SELECT x from t1 where id = b FOR UPDATE);
+select * from t2;
+b a
+0 100
+1 20
+2 30
+select * from t1;
+id x
+0 0
+300 300
+set autocommit=0;
+update t1 set x=2 where id = 0;
+update t1 set x=1 where id = 0;
+select * from t1;
+id x
+0 1
+300 300
+commit;
+commit;
+select * from t1;
+id x
+0 2
+300 300
+commit;
+drop table t1, t2;
+create table t1 (id integer, x integer) engine=INNODB;
+create table t2 (b integer, a integer) engine=INNODB;
+insert into t1 values(0, 0), (300, 300);
+insert into t2 values(0, 0), (1, 20), (2, 30);
+commit;
+select a,b from t2 UNION SELECT id, x from t1 FOR UPDATE;
+a b
+0 0
+20 1
+30 2
+300 300
+select * from t2;
+b a
+0 0
+1 20
+2 30
+select * from t1;
+id x
+0 0
+300 300
+update t2 set a=2 where b = 0;
+select * from t2;
+b a
+0 2
+1 20
+2 30
+update t1 set x=2 where id = 0;
+update t1 set x=1 where id = 0;
+select * from t1;
+id x
+0 1
+300 300
+commit;
+commit;
+select * from t1;
+id x
+0 2
+300 300
+commit;
+drop table t1, t2;
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index c282ec68c78..009432ec3ab 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -1,6 +1,6 @@
-drop table if exists t1,t2,t3;
+drop table if exists t1,t2,t3,t4;
drop database if exists mysqltest;
-create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=innodb;
+create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb;
insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt');
select id, code, name from t1 order by id;
id code name
@@ -39,7 +39,7 @@ level tinyint(4) DEFAULT '0' NOT NULL,
PRIMARY KEY (id),
KEY parent_id (parent_id),
KEY level (level)
-) type=innodb;
+) engine=innodb;
INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2);
update t1 set parent_id=parent_id+100;
select * from t1 where parent_id=102;
@@ -139,6 +139,15 @@ id parent_id level
1008 102 2
1010 102 2
1015 102 2
+explain select level from t1 where level=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const # Using where; Using index
+explain select level,id from t1 where level=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const # Using where; Using index
+explain select level,id,parent_id from t1 where level=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const # Using where
select level,id from t1 where level=1;
level id
1 1002
@@ -158,12 +167,17 @@ level id parent_id
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 id A # NULL NULL BTREE
+t1 1 parent_id 1 parent_id A # NULL NULL BTREE
+t1 1 level 1 level A # NULL NULL BTREE
drop table t1;
CREATE TABLE t1 (
gesuchnr int(11) DEFAULT '0' NOT NULL,
benutzer_id int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (gesuchnr,benutzer_id)
-) type=innodb;
+) engine=innodb;
replace into t1 (gesuchnr,benutzer_id) values (2,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
@@ -172,7 +186,7 @@ gesuchnr benutzer_id
1 1
2 1
drop table t1;
-create table t1 (a int) type=innodb;
+create table t1 (a int) engine=innodb;
insert into t1 values (1), (2);
optimize table t1;
Table Op Msg_type Msg_text
@@ -185,7 +199,7 @@ check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
-create table t1 (a int,b varchar(20)) type=innodb;
+create table t1 (a int,b varchar(20)) engine=innodb;
insert into t1 values (1,""), (2,"testing");
delete from t1 where a = 1;
select * from t1;
@@ -196,14 +210,17 @@ insert into t1 values (3,""), (4,"testing");
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 skr 1 a A # NULL NULL YES BTREE
drop table t1;
-create table t1 (a int,b varchar(20),key(a)) type=innodb;
+create table t1 (a int,b varchar(20),key(a)) engine=innodb;
insert into t1 values (1,""), (2,"testing");
select * from t1 where a = 1;
a b
1
drop table t1;
-create table t1 (n int not null primary key) type=innodb;
+create table t1 (n int not null primary key) engine=innodb;
set autocommit=0;
insert into t1 values (4);
rollback;
@@ -217,7 +234,7 @@ n after commit
commit;
insert into t1 values (5);
insert into t1 values (4);
-Duplicate entry '4' for key 1
+ERROR 23000: Duplicate entry '4' for key 1
commit;
select n, "after commit" from t1;
n after commit
@@ -226,7 +243,7 @@ n after commit
set autocommit=1;
insert into t1 values (6);
insert into t1 values (4);
-Duplicate entry '4' for key 1
+ERROR 23000: Duplicate entry '4' for key 1
select n from t1;
n
4
@@ -234,7 +251,18 @@ n
6
rollback;
drop table t1;
-create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) type=innodb;
+create table t1 (n int not null primary key) engine=innodb;
+start transaction;
+insert into t1 values (4);
+flush tables with read lock;
+commit;
+unlock tables;
+commit;
+select * from t1;
+n
+4
+drop table t1;
+create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) engine=innodb;
begin;
insert into t1 values(1,'hamdouni');
select id as afterbegin_id,nom as afterbegin_nom from t1;
@@ -253,10 +281,10 @@ select id as afterrollback_id,nom as afterrollback_nom from t1;
afterrollback_id afterrollback_nom
set autocommit=1;
drop table t1;
-CREATE TABLE t1 (id char(8) not null primary key, val int not null) type=innodb;
+CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=innodb;
insert into t1 values ('pippo', 12);
insert into t1 values ('pippo', 12);
-Duplicate entry 'pippo' for key 1
+ERROR 23000: Duplicate entry 'pippo' for key 1
delete from t1;
delete from t1 where id = 'pippo';
select * from t1;
@@ -273,23 +301,23 @@ commit;
select * from t1;
id val
drop table t1;
-create table t1 (a integer) type=innodb;
+create table t1 (a integer) engine=innodb;
start transaction;
rename table t1 to t2;
-create table t1 (b integer) type=innodb;
+create table t1 (b integer) engine=innodb;
insert into t1 values (1);
rollback;
drop table t1;
rename table t2 to t1;
drop table t1;
set autocommit=1;
-CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) TYPE=innodb;
+CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) ENGINE=innodb;
INSERT INTO t1 VALUES (1, 'Jochen');
select * from t1;
ID NAME
1 Jochen
drop table t1;
-CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) TYPE=innodb;
+CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) ENGINE=innodb;
set autocommit=0;
INSERT INTO t1 SET _userid='marc@anyware.co.uk';
COMMIT;
@@ -308,7 +336,7 @@ phone varchar(100),
ref_email varchar(100) DEFAULT '' NOT NULL,
detail varchar(200),
PRIMARY KEY (user_id,ref_email)
-)type=innodb;
+)engine=innodb;
INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar');
select * from t1 where user_id=10292;
user_id name phone ref_email detail
@@ -336,9 +364,17 @@ user_id name phone ref_email detail
drop table t1;
CREATE TABLE t1 (a int not null, b int not null,c int not null,
key(a),primary key(a,b), unique(c),key(a),unique(b));
+show index from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 a A # NULL NULL BTREE
+t1 0 PRIMARY 2 b A # NULL NULL BTREE
+t1 0 c 1 c A # NULL NULL BTREE
+t1 0 b 1 b A # NULL NULL BTREE
+t1 1 a 1 a A # NULL NULL BTREE
+t1 1 a_2 1 a A # NULL NULL BTREE
drop table t1;
create table t1 (col1 int not null, col2 char(4) not null, primary key(col1));
-alter table t1 type=innodb;
+alter table t1 engine=innodb;
insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4');
select * from t1;
col1 col2
@@ -372,8 +408,8 @@ col1 col2 co3
4 7 0
5 2 0
drop table t1;
-create table t1 (a int not null , b int, primary key (a)) type = innodb;
-create table t2 (a int not null , b int, primary key (a)) type = myisam;
+create table t1 (a int not null , b int, primary key (a)) engine = innodb;
+create table t2 (a int not null , b int, primary key (a)) engine = myisam;
insert into t1 VALUES (1,3) , (2,3), (3,3);
select * from t1;
a b
@@ -408,13 +444,13 @@ email varchar(64) DEFAULT '' NOT NULL,
passwd varchar(32) binary DEFAULT '' NOT NULL,
PRIMARY KEY (id),
UNIQUE ggid (ggid)
-) TYPE=innodb;
+) ENGINE=innodb;
insert into t1 (ggid,passwd) values ('test1','xxx');
insert into t1 (ggid,passwd) values ('test2','yyy');
insert into t1 (ggid,passwd) values ('test2','this will fail');
-Duplicate entry 'test2' for key 2
+ERROR 23000: Duplicate entry 'test2' for key 2
insert into t1 (ggid,id) values ('this will fail',1);
-Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 1
select * from t1 where ggid='test1';
id ggid email passwd
1 test1 xxx
@@ -427,7 +463,7 @@ id ggid email passwd
replace into t1 (ggid,id) values ('this will work',1);
replace into t1 (ggid,passwd) values ('test2','this will work');
update t1 set id=100,ggid='test2' where id=1;
-Duplicate entry 'test2' for key 2
+ERROR 23000: Duplicate entry 'test2' for key 2
select * from t1;
id ggid email passwd
1 this will work
@@ -450,7 +486,7 @@ access_time time,
approved datetime,
dummy_primary_key int(11) NOT NULL auto_increment,
PRIMARY KEY (dummy_primary_key)
-) TYPE=innodb;
+) ENGINE=innodb;
INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1);
INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2);
INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3);
@@ -471,7 +507,7 @@ level tinyint(4) DEFAULT '0' NOT NULL,
KEY (id),
KEY parent_id (parent_id),
KEY level (level)
-) type=innodb;
+) engine=innodb;
INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1);
INSERT INTO t1 values (179,5,2);
update t1 set parent_id=parent_id+100;
@@ -571,6 +607,9 @@ id parent_id level
1009 102 2
1025 102 2
1016 102 2
+explain select level from t1 where level=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const # Using where; Using index
select level,id from t1 where level=1;
level id
1 1004
@@ -642,7 +681,7 @@ sca_sdesc varchar(50),
sca_sch_desc varchar(16),
PRIMARY KEY (sca_code, cat_code, lan_code),
INDEX sca_pic (sca_pic)
-) type = innodb ;
+) engine = innodb ;
INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
select count(*) from t1 where sca_code = 'PD';
count(*)
@@ -675,7 +714,7 @@ update t1 set sca_pic="test" where sca_pic is null;
delete from t1 where sca_code='pd';
drop table t1;
set @a:=now();
-CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) type=innodb;
+CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=innodb;
insert into t1 (a) values(1),(2),(3);
select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a;
a
@@ -689,7 +728,7 @@ a
3
5
drop table t1;
-create table t1 (a varchar(100) not null, primary key(a), b int not null) type=innodb;
+create table t1 (a varchar(100) not null, primary key(a), b int not null) engine=innodb;
insert into t1 values("hello",1),("world",2);
select * from t1 order by b desc;
a b
@@ -698,8 +737,11 @@ hello 1
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 a A # NULL NULL BTREE
drop table t1;
-create table t1 (i int, j int ) TYPE=innodb;
+create table t1 (i int, j int ) ENGINE=innodb;
insert into t1 values (1,2);
select * from t1 where i=1 and j=2;
i j
@@ -713,26 +755,29 @@ CREATE TABLE t1 (
a int3 unsigned NOT NULL,
b int1 unsigned NOT NULL,
UNIQUE (a, b)
-) TYPE = innodb;
+) ENGINE = innodb;
INSERT INTO t1 VALUES (1, 1);
SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1;
MIN(B) MAX(b)
1 1
drop table t1;
-CREATE TABLE t1 (a int unsigned NOT NULL) type=innodb;
+CREATE TABLE t1 (a int unsigned NOT NULL) engine=innodb;
INSERT INTO t1 VALUES (1);
SELECT * FROM t1;
a
1
DROP TABLE t1;
-create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) type = innodb;
+create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) engine = innodb;
insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
+explain select * from t1 where a > 0 and a < 50;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL # Using where
drop table t1;
-create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=innodb;
+create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb;
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
LOCK TABLES t1 WRITE;
insert into t1 values (99,1,2,'D'),(1,1,2,'D');
-Duplicate entry '1-1' for key 1
+ERROR 23000: Duplicate entry '1-1' for key 1
select id from t1;
id
0
@@ -745,12 +790,12 @@ id
2
UNLOCK TABLES;
DROP TABLE t1;
-create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=innodb;
+create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb;
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
LOCK TABLES t1 WRITE;
begin;
insert into t1 values (99,1,2,'D'),(1,1,2,'D');
-Duplicate entry '1-1' for key 1
+ERROR 23000: Duplicate entry '1-1' for key 1
select id from t1;
id
0
@@ -766,7 +811,17 @@ id id3
100 2
UNLOCK TABLES;
DROP TABLE t1;
-create temporary table t1 (a int not null auto_increment, primary key(a)) type=innodb;
+create table t1 (a char(20), unique (a(5))) engine=innodb;
+drop table t1;
+create table t1 (a char(20), index (a(5))) engine=innodb;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(20) default NULL,
+ KEY `a` (`a`(5))
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1;
+create temporary table t1 (a int not null auto_increment, primary key(a)) engine=innodb;
insert into t1 values (NULL),(NULL),(NULL);
delete from t1 where a=3;
insert into t1 values (NULL);
@@ -789,7 +844,7 @@ name varchar(32) not null,
value text not null,
uid int not null,
unique key(name,uid)
-) type=innodb;
+) engine=innodb;
insert into t1 values (1,'one','one value',101),
(2,'two','two value',102),(3,'three','three value',103);
set insert_id=5;
@@ -806,19 +861,21 @@ id name value uid
6 two other value 102
drop table t1;
create database mysqltest;
-create table mysqltest.t1 (a int not null) type= innodb;
+create table mysqltest.t1 (a int not null) engine= innodb;
insert into mysqltest.t1 values(1);
-create table mysqltest.t2 (a int not null) type= myisam;
+create table mysqltest.t2 (a int not null) engine= myisam;
insert into mysqltest.t2 values(1);
-create table mysqltest.t3 (a int not null) type= heap;
+create table mysqltest.t3 (a int not null) engine= heap;
insert into mysqltest.t3 values(1);
commit;
drop database mysqltest;
+show tables from mysqltest;
+Got one of the listed errors
set autocommit=0;
-create table t1 (a int not null) type= innodb;
+create table t1 (a int not null) engine= innodb;
insert into t1 values(1),(2);
truncate table t1;
-Can't execute the given command because you have active locked tables or an active transaction
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
commit;
truncate table t1;
select * from t1;
@@ -830,7 +887,7 @@ a
commit;
drop table t1;
set autocommit=1;
-create table t1 (a int not null) type= innodb;
+create table t1 (a int not null) engine= innodb;
insert into t1 values(1),(2);
truncate table t1;
insert into t1 values(1),(2);
@@ -844,10 +901,34 @@ delete from t1;
select * from t1;
a
drop table t1;
-create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) type=innodb;
+create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=innodb;
insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
+explain select * from t1 order by a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL #
+explain select * from t1 order by b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL b 4 NULL #
+explain select * from t1 order by c;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort
+explain select a from t1 order by a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL # Using index
+explain select b from t1 order by b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL b 4 NULL # Using index
+explain select a,b from t1 order by b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL b 4 NULL # Using index
+explain select a,b from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL b 4 NULL # Using index
+explain select a,b,c from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL #
drop table t1;
-create table t1 (t int not null default 1, key (t)) type=innodb;
+create table t1 (t int not null default 1, key (t)) engine=innodb;
desc t1;
Field Type Null Key Default Extra
t int(11) MUL 1
@@ -864,7 +945,7 @@ last_app_id smallint(6) default '-1',
version smallint(6) NOT NULL default '0',
assigned_scps int(11) default '0',
status tinyint(4) default '0'
-) TYPE=InnoDB;
+) ENGINE=InnoDB;
INSERT INTO t1 VALUES (4077711111,'SeanWheeler',90,2,20020111112846,500,00000000000000,-1,2,3,1);
INSERT INTO t1 VALUES (9197722223,'berry',90,3,20020111112809,500,20020102114532,501,4,10,0);
INSERT INTO t1 VALUES (650,'San Francisco',0,0,20011227111336,342,00000000000000,-1,1,24,1);
@@ -883,38 +964,38 @@ last_app_id smallint(6) default '-1',
version smallint(6) NOT NULL default '0',
assigned_scps int(11) default '0',
status tinyint(4) default '0'
-) TYPE=InnoDB;
+) ENGINE=InnoDB;
INSERT INTO t2 VALUES (4077711111,'SeanWheeler',0,2,20020111112853,500,00000000000000,-1,2,3,1);
INSERT INTO t2 VALUES (9197722223,'berry',90,3,20020111112818,500,20020102114532,501,4,10,0);
INSERT INTO t2 VALUES (650,'San Francisco',90,0,20020109113158,342,00000000000000,-1,1,24,1);
INSERT INTO t2 VALUES (333,'tubs',99,2,20020109113453,501,20020109113453,500,3,10,0);
select * from t1;
number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
-4077711111 SeanWheeler 90 2 20020111112846 500 00000000000000 -1 2 3 1
-9197722223 berry 90 3 20020111112809 500 20020102114532 501 4 10 0
-650 San Francisco 0 0 20011227111336 342 00000000000000 -1 1 24 1
-302467 Sue's Subshop 90 3 20020109113241 500 20020102115111 501 7 24 0
-6014911113 SudzCarwash 520 1 20020102115234 500 20020102115259 501 33 32768 0
-333 tubs 99 2 20020109113440 501 20020109113440 500 3 10 0
+4077711111 SeanWheeler 90 2 2002-01-11 11:28:46 500 0000-00-00 00:00:00 -1 2 3 1
+9197722223 berry 90 3 2002-01-11 11:28:09 500 2002-01-02 11:45:32 501 4 10 0
+650 San Francisco 0 0 2001-12-27 11:13:36 342 0000-00-00 00:00:00 -1 1 24 1
+302467 Sue's Subshop 90 3 2002-01-09 11:32:41 500 2002-01-02 11:51:11 501 7 24 0
+6014911113 SudzCarwash 520 1 2002-01-02 11:52:34 500 2002-01-02 11:52:59 501 33 32768 0
+333 tubs 99 2 2002-01-09 11:34:40 501 2002-01-09 11:34:40 500 3 10 0
select * from t2;
number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
-4077711111 SeanWheeler 0 2 20020111112853 500 00000000000000 -1 2 3 1
-9197722223 berry 90 3 20020111112818 500 20020102114532 501 4 10 0
-650 San Francisco 90 0 20020109113158 342 00000000000000 -1 1 24 1
-333 tubs 99 2 20020109113453 501 20020109113453 500 3 10 0
+4077711111 SeanWheeler 0 2 2002-01-11 11:28:53 500 0000-00-00 00:00:00 -1 2 3 1
+9197722223 berry 90 3 2002-01-11 11:28:18 500 2002-01-02 11:45:32 501 4 10 0
+650 San Francisco 90 0 2002-01-09 11:31:58 342 0000-00-00 00:00:00 -1 1 24 1
+333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0
delete t1, t2 from t1 left join t2 on t1.number=t2.number where (t1.carrier_id=90 and t1.number=t2.number) or (t2.carrier_id=90 and t1.number=t2.number) or (t1.carrier_id=90 and t2.number is null);
select * from t1;
number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
-6014911113 SudzCarwash 520 1 20020102115234 500 20020102115259 501 33 32768 0
-333 tubs 99 2 20020109113440 501 20020109113440 500 3 10 0
+6014911113 SudzCarwash 520 1 2002-01-02 11:52:34 500 2002-01-02 11:52:59 501 33 32768 0
+333 tubs 99 2 2002-01-09 11:34:40 501 2002-01-09 11:34:40 500 3 10 0
select * from t2;
number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
-333 tubs 99 2 20020109113453 501 20020109113453 500 3 10 0
+333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0
select * from t2;
number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
-333 tubs 99 2 20020109113453 501 20020109113453 500 3 10 0
+333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0
drop table t1,t2;
-create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=innodb;
+create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb;
BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SELECT @@tx_isolation,@@global.tx_isolation;
@@ -952,9 +1033,8 @@ id code name
7 4 Matt
COMMIT;
DROP TABLE t1;
-drop table if exists t1,t2;
-create table t1 (n int(10), d int(10)) type=innodb;
-create table t2 (n int(10), d int(10)) type=innodb;
+create table t1 (n int(10), d int(10)) engine=innodb;
+create table t2 (n int(10), d int(10)) engine=innodb;
insert into t1 values(1,1),(1,2);
insert into t2 values(1,10),(2,20);
UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
@@ -967,7 +1047,7 @@ n d
1 30
2 20
drop table t1,t2;
-create table t1 (a int, b int) type=innodb;
+create table t1 (a int, b int) engine=innodb;
insert into t1 values(20,null);
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
t2.b=t3.a;
@@ -984,19 +1064,19 @@ b ifnull(t2.b,"this is null")
NULL this is null
NULL this is null
drop table t1;
-create table t1 (a varchar(10) not null) type=myisam;
-create table t2 (b varchar(10) not null unique) type=innodb;
+create table t1 (a varchar(10) not null) engine=myisam;
+create table t2 (b varchar(10) not null unique) engine=innodb;
select t1.a from t1,t2 where t1.a=t2.b;
a
drop table t1,t2;
-create table t1 (a int not null, b int, primary key (a)) type = innodb;
-create table t2 (a int not null, b int, primary key (a)) type = innodb;
+create table t1 (a int not null, b int, primary key (a)) engine = innodb;
+create table t2 (a int not null, b int, primary key (a)) engine = innodb;
insert into t1 values (10, 20);
insert into t2 values (10, 20);
update t1, t2 set t1.b = 150, t2.b = t1.b where t2.a = t1.a and t1.a = 10;
drop table t1,t2;
-CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) TYPE=INNODB;
-CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE ) TYPE=INNODB;
+CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
+CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE ) ENGINE=INNODB;
insert into t1 set id=1;
insert into t2 set id=1, t1_id=1;
delete t1,t2 from t1,t2 where t1.id=t2.t1_id;
@@ -1005,9 +1085,8 @@ id
select * from t2;
id t1_id
drop table t2,t1;
-DROP TABLE IF EXISTS t1,t2;
-CREATE TABLE t1(id INT NOT NULL, PRIMARY KEY (id)) TYPE=INNODB;
-CREATE TABLE t2(id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id) ) TYPE=INNODB;
+CREATE TABLE t1(id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
+CREATE TABLE t2(id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id) ) ENGINE=INNODB;
INSERT INTO t1 VALUES(1);
INSERT INTO t2 VALUES(1, 1);
SELECT * from t1;
@@ -1023,9 +1102,9 @@ id
3
DROP TABLE t1,t2;
set autocommit=0;
-CREATE TABLE t1 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) TYPE=InnoDB;
-CREATE TABLE t2 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) TYPE=InnoDB;
-CREATE TABLE t3 (id1 CHAR(15) NOT NULL, id2 CHAR(15) NOT NULL, PRIMARY KEY(id1, id2)) TYPE=InnoDB;
+CREATE TABLE t1 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB;
+CREATE TABLE t2 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB;
+CREATE TABLE t3 (id1 CHAR(15) NOT NULL, id2 CHAR(15) NOT NULL, PRIMARY KEY(id1, id2)) ENGINE=InnoDB;
INSERT INTO t3 VALUES("my-test-1", "my-test-2");
COMMIT;
INSERT INTO t1 VALUES("this-key", "will disappear");
@@ -1053,7 +1132,7 @@ my-test-1 my-test-2
COMMIT;
set autocommit=1;
DROP TABLE t1,t2,t3;
-CREATE TABLE t1 (a int not null primary key, b int not null, unique (b)) type=innodb;
+CREATE TABLE t1 (a int not null primary key, b int not null, unique (b)) engine=innodb;
INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
UPDATE t1 set a=a+100 where b between 2 and 3 and a < 1000;
SELECT * from t1;
@@ -1068,8 +1147,8 @@ a b
8 8
9 9
drop table t1;
-CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) type=innodb;
-CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) type=innodb;
+CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) engine=innodb;
+CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) engine=innodb;
INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12);
INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
update t1,t2 set t1.a=t1.a+100;
@@ -1144,17 +1223,18 @@ a b
4 14
5 15
drop table t1,t2;
-CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) TYPE=MyISAM;
-CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) TYPE=InnoDB;
+CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) ENGINE=MyISAM;
+CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
SET AUTOCOMMIT=0;
INSERT INTO t1 ( B_ID ) VALUES ( 1 );
INSERT INTO t2 ( NEXT_T ) VALUES ( 1 );
ROLLBACK;
-Warning: Some non-transactional changed tables couldn't be rolled back
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
SELECT * FROM t1;
B_ID
drop table t1,t2;
-create table t1 ( pk int primary key, parent int not null, child int not null, index (parent) ) type = innodb;
+create table t1 ( pk int primary key, parent int not null, child int not null, index (parent) ) engine = innodb;
insert into t1 values (1,0,4), (2,1,3), (3,2,1), (4,1,2);
select distinct parent,child from t1 order by parent;
parent child
@@ -1163,7 +1243,7 @@ parent child
1 3
2 1
drop table t1;
-create table t1 (a int not null auto_increment primary key, b int, c int, key(c)) type=innodb;
+create table t1 (a int not null auto_increment primary key, b int, c int, key(c)) engine=innodb;
create table t2 (a int not null auto_increment primary key, b int);
insert into t1 (b) values (null),(null),(null),(null),(null),(null),(null);
insert into t2 (a) select b from t1;
@@ -1187,9 +1267,15 @@ insert into t1 (a) select b from t2;
select count(*) from t1;
count(*)
29267
+explain select * from t1 where c between 1 and 10000;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c c 5 NULL # Using where
update t1 set c=a;
+explain select * from t1 where c between 1 and 10000;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL c NULL NULL NULL # Using where
drop table t1,t2;
-create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) type=innodb;
+create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=innodb;
insert into t1 (id) values (null),(null),(null),(null),(null);
update t1 set fk=69 where fk is null order by id limit 1;
SELECT * from t1;
@@ -1222,19 +1308,19 @@ a b
111 100
111 100
drop table t1;
-create table t1 ( c char(8) not null ) type=innodb;
+create table t1 ( c char(8) not null ) engine=innodb;
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
alter table t1 add b char(8) not null;
alter table t1 add a char(8) not null;
alter table t1 add primary key (a,b,c);
update t1 set a=c, b=c;
-create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) type=innodb;
+create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=innodb;
insert into t2 select * from t1;
delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
drop table t1,t2;
SET AUTOCOMMIT=1;
-create table t1 (a integer auto_increment primary key) type=innodb;
+create table t1 (a integer auto_increment primary key) engine=innodb;
insert into t1 (a) values (NULL),(NULL);
truncate table t1;
insert into t1 (a) values (NULL),(NULL);
@@ -1243,31 +1329,322 @@ a
3
4
drop table t1;
-CREATE TABLE t1 (`id 1` INT NOT NULL, PRIMARY KEY (`id 1`)) TYPE=INNODB;
-CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (`t1_id`) REFERENCES `t1`(`id 1`) ON DELETE CASCADE ) TYPE=INNODB;
+CREATE TABLE t1 (`id 1` INT NOT NULL, PRIMARY KEY (`id 1`)) ENGINE=INNODB;
+CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (`t1_id`) REFERENCES `t1`(`id 1`) ON DELETE CASCADE ) ENGINE=INNODB;
drop table t2,t1;
-create table `t1` (`id` int( 11 ) not null ,primary key ( `id` )) type = innodb;
+create table `t1` (`id` int( 11 ) not null ,primary key ( `id` )) engine = innodb;
insert into `t1`values ( 1 ) ;
-create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` ) ,constraint `t1_id_fk` foreign key ( `id` ) references `t1` (`id` )) type = innodb;
+create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` ) ,constraint `t1_id_fk` foreign key ( `id` ) references `t1` (`id` )) engine = innodb;
insert into `t2`values ( 1 ) ;
-create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) type = innodb;
+create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) engine = innodb;
insert into `t3`values ( 1 ) ;
delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
-Cannot delete or update a parent row: a foreign key constraint fails
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
-Cannot delete or update a parent row: a foreign key constraint fails
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
-Unknown table 't1' in where clause
+ERROR 42S02: Unknown table 't1' in where clause
drop table t3,t2,t1;
create table t1(
id int primary key,
pid int,
index(pid),
-foreign key(pid) references t1(id) on delete cascade) type=innodb;
+foreign key(pid) references t1(id) on delete cascade) engine=innodb;
insert into t1 values(0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6),
(8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14);
delete from t1 where id=0;
-Cannot delete or update a parent row: a foreign key constraint fails
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
delete from t1 where id=15;
delete from t1 where id=0;
drop table t1;
+CREATE TABLE t1 (col1 int(1))ENGINE=InnoDB;
+CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP,INDEX stamp_idx
+(stamp))ENGINE=InnoDB;
+insert into t1 values (1),(2),(3);
+insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 ),(5,20020204230000);
+Warnings:
+Warning 1265 Data truncated for column 'stamp' at row 3
+SELECT col1 FROM t1 UNION SELECT col1 FROM t2 WHERE stamp <
+'20020204120000' GROUP BY col1;
+col1
+1
+2
+3
+4
+drop table t1,t2;
+CREATE TABLE t1 (
+`id` int(10) unsigned NOT NULL auto_increment,
+`id_object` int(10) unsigned default '0',
+`id_version` int(10) unsigned NOT NULL default '1',
+label varchar(100) NOT NULL default '',
+`description` text,
+PRIMARY KEY (`id`),
+KEY `id_object` (`id_object`),
+KEY `id_version` (`id_version`)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES("6", "3382", "9", "Test", NULL), ("7", "102", "5", "Le Pekin (Test)", NULL),("584", "1794", "4", "Test de resto", NULL),("837", "1822", "6", "Test 3", NULL),("1119", "3524", "1", "Societe Test", NULL),("1122", "3525", "1", "Fournisseur Test", NULL);
+CREATE TABLE t2 (
+`id` int(10) unsigned NOT NULL auto_increment,
+`id_version` int(10) unsigned NOT NULL default '1',
+PRIMARY KEY (`id`),
+KEY `id_version` (`id_version`)
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES("3524", "1"),("3525", "1"),("1794", "4"),("102", "5"),("1822", "6"),("3382", "9");
+SELECT t2.id, t1.label FROM t2 INNER JOIN
+(SELECT t1.id_object as id_object FROM t1 WHERE t1.label LIKE '%test%') AS lbl
+ON (t2.id = lbl.id_object) INNER JOIN t1 ON (t2.id = t1.id_object);
+id label
+3382 Test
+102 Le Pekin (Test)
+1794 Test de resto
+1822 Test 3
+3524 Societe Test
+3525 Fournisseur Test
+drop table t1,t2;
+create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=innodb;
+select * from t1;
+c1 c2 stamp
+replace delayed into t1 (c1, c2) values ( "text1","11"),( "text2","12");
+ERROR HY000: Table storage engine for 't1' doesn't have this option
+select * from t1;
+c1 c2 stamp
+replace delayed into t1 (c1, c2) values ( "text1","12"),( "text2","13"),( "text3","14", "a" ),( "text4","15", "b" );
+ERROR HY000: Table storage engine for 't1' doesn't have this option
+select * from t1;
+c1 c2 stamp
+drop table t1;
+create table t1 (a int, b varchar(200), c text not null) checksum=1 engine=myisam;
+create table t2 (a int, b varchar(200), c text not null) checksum=0 engine=innodb;
+create table t3 (a int, b varchar(200), c text not null) checksum=1 engine=innodb;
+insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
+insert t2 select * from t1;
+insert t3 select * from t1;
+checksum table t1, t2, t3, t4 quick;
+Table Checksum
+test.t1 968604391
+test.t2 NULL
+test.t3 NULL
+test.t4 NULL
+checksum table t1, t2, t3, t4;
+Table Checksum
+test.t1 968604391
+test.t2 968604391
+test.t3 968604391
+test.t4 NULL
+checksum table t1, t2, t3, t4 extended;
+Table Checksum
+test.t1 968604391
+test.t2 968604391
+test.t3 968604391
+test.t4 NULL
+drop table t1,t2,t3;
+create table t1 (id int, name char(10) not null, name2 char(10) not null) engine=innodb;
+insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt');
+select name2 from t1 union all select name from t1 union all select id from t1;
+name2
+fff
+sss
+ttt
+first
+second
+third
+1
+2
+3
+drop table t1;
+create table t1 (a int) engine=innodb;
+create table t2 like t1;
+drop table t1,t2;
+create table t1 (id int(11) not null, id2 int(11) not null, unique (id,id2)) engine=innodb;
+create table t2 (id int(11) not null, constraint t1_id_fk foreign key ( id ) references t1 (id)) engine = innodb;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL default '0',
+ `id2` int(11) NOT NULL default '0',
+ UNIQUE KEY `id` (`id`,`id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ KEY `t1_id_fk` (`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+create index id on t2 (id);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ KEY `id` (`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+create index id2 on t2 (id);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ KEY `id` (`id`),
+ KEY `id2` (`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop index id2 on t2;
+drop index id on t2;
+Got one of the listed errors
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ KEY `id` (`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) 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 (id,id2) references t1 (id,id2)) engine = innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ `id2` int(11) NOT NULL default '0',
+ KEY `t1_id_fk` (`id`,`id2`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+create unique index id on t2 (id,id2);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ `id2` int(11) NOT NULL default '0',
+ UNIQUE KEY `id` (`id`,`id2`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ `id2` int(11) NOT NULL default '0',
+ UNIQUE KEY `id` (`id`,`id2`),
+ KEY `t1_id_fk` (`id2`,`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2), constraint t1_id_fk foreign key (id) references t1 (id)) engine = innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ `id2` int(11) NOT NULL default '0',
+ UNIQUE KEY `id` (`id`,`id2`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ `id2` int(11) NOT NULL default '0',
+ UNIQUE KEY `id` (`id`,`id2`),
+ KEY `t1_id_fk` (`id2`,`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id), primary key (id), index (id,id2)) engine = innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL auto_increment,
+ `id2` int(11) NOT NULL default '0',
+ PRIMARY KEY (`id`),
+ KEY `id` (`id`,`id2`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id)) engine= innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL auto_increment,
+ `id2` int(11) NOT NULL default '0',
+ KEY `t1_id_fk` (`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+alter table t2 add index id_test (id), add index id_test2 (id,id2);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL auto_increment,
+ `id2` int(11) NOT NULL default '0',
+ KEY `id_test` (`id`),
+ KEY `id_test2` (`id`,`id2`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) 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.frm' (errno: 150)
+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
+t2 CREATE TABLE `t2` (
+ `a` int(11) NOT NULL auto_increment,
+ `b` int(11) default NULL,
+ PRIMARY KEY (`a`),
+ UNIQUE KEY `b_2` (`b`),
+ KEY `b` (`b`),
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (a int auto_increment primary key, b int, foreign key (b) references t1(id), foreign key (b) references t1(id), unique(b)) engine=innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) NOT NULL auto_increment,
+ `b` int(11) default NULL,
+ PRIMARY KEY (`a`),
+ UNIQUE KEY `b` (`b`),
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`),
+ CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`b`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2, t1;
+show status like "binlog_cache_use";
+Variable_name Value
+Binlog_cache_use 24
+show status like "binlog_cache_disk_use";
+Variable_name Value
+Binlog_cache_disk_use 0
+create table t1 (a int) engine=innodb;
+show status like "binlog_cache_use";
+Variable_name Value
+Binlog_cache_use 25
+show status like "binlog_cache_disk_use";
+Variable_name Value
+Binlog_cache_disk_use 1
+begin;
+delete from t1;
+commit;
+show status like "binlog_cache_use";
+Variable_name Value
+Binlog_cache_use 26
+show status like "binlog_cache_disk_use";
+Variable_name Value
+Binlog_cache_disk_use 1
+drop table t1;
+create table t1 (c char(10), index (c,c)) engine=innodb;
+ERROR 42S21: Duplicate column name 'c'
+create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb;
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb;
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10)) engine=innodb;
+alter table t1 add key (c1,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c2,c1,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c1,c2,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c1,c1,c2);
+ERROR 42S21: Duplicate column name 'c1'
+drop table t1;
diff --git a/mysql-test/r/innodb.result.es b/mysql-test/r/innodb.result.es
new file mode 100644
index 00000000000..602a034bc16
--- /dev/null
+++ b/mysql-test/r/innodb.result.es
@@ -0,0 +1,1653 @@
+drop table if exists t1,t2,t3,t4;
+drop database if exists mysqltest;
+create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb;
+insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt');
+select id, code, name from t1 order by id;
+id code name
+1 1 Tim
+2 1 Monty
+3 2 David
+4 2 Erik
+5 3 Sasha
+6 3 Jeremy
+7 4 Matt
+update ignore t1 set id = 8, name = 'Sinisa' where id < 3;
+select id, code, name from t1 order by id;
+id code name
+2 1 Monty
+3 2 David
+4 2 Erik
+5 3 Sasha
+6 3 Jeremy
+7 4 Matt
+8 1 Sinisa
+update ignore t1 set id = id + 10, name = 'Ralph' where id < 4;
+select id, code, name from t1 order by id;
+id code name
+3 2 David
+4 2 Erik
+5 3 Sasha
+6 3 Jeremy
+7 4 Matt
+8 1 Sinisa
+12 1 Ralph
+drop table t1;
+CREATE TABLE t1 (
+id int(11) NOT NULL auto_increment,
+parent_id int(11) DEFAULT '0' NOT NULL,
+level tinyint(4) DEFAULT '0' NOT NULL,
+PRIMARY KEY (id),
+KEY parent_id (parent_id),
+KEY level (level)
+) engine=innodb;
+INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2);
+update t1 set parent_id=parent_id+100;
+select * from t1 where parent_id=102;
+id parent_id level
+8 102 2
+9 102 2
+15 102 2
+update t1 set id=id+1000;
+update t1 set id=1024 where id=1009;
+Got one of the listed errors
+select * from t1;
+id parent_id level
+1001 100 0
+1002 101 1
+1003 101 1
+1004 101 1
+1005 101 1
+1006 101 1
+1007 101 1
+1008 102 2
+1009 102 2
+1015 102 2
+1016 103 2
+1017 103 2
+1018 103 2
+1019 103 2
+1020 103 2
+1021 104 2
+1022 104 2
+1024 104 2
+1025 105 2
+1026 105 2
+1027 105 2
+1028 105 2
+1029 105 2
+1030 105 2
+1031 106 2
+1032 106 2
+1033 106 2
+1034 106 2
+1035 106 2
+1036 107 2
+1037 107 2
+1038 107 2
+1040 107 2
+1157 100 0
+1179 105 2
+1183 104 2
+1193 105 2
+1202 107 2
+1203 107 2
+update ignore t1 set id=id+1;
+select * from t1;
+id parent_id level
+1001 100 0
+1002 101 1
+1003 101 1
+1004 101 1
+1005 101 1
+1006 101 1
+1007 101 1
+1008 102 2
+1010 102 2
+1015 102 2
+1016 103 2
+1017 103 2
+1018 103 2
+1019 103 2
+1020 103 2
+1021 104 2
+1023 104 2
+1024 104 2
+1025 105 2
+1026 105 2
+1027 105 2
+1028 105 2
+1029 105 2
+1030 105 2
+1031 106 2
+1032 106 2
+1033 106 2
+1034 106 2
+1035 106 2
+1036 107 2
+1037 107 2
+1039 107 2
+1041 107 2
+1158 100 0
+1180 105 2
+1184 104 2
+1194 105 2
+1202 107 2
+1204 107 2
+update ignore t1 set id=1023 where id=1010;
+select * from t1 where parent_id=102;
+id parent_id level
+1008 102 2
+1010 102 2
+1015 102 2
+explain select level from t1 where level=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const # Using where; Using index
+explain select level,id from t1 where level=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const # Using where; Using index
+explain select level,id,parent_id from t1 where level=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const # Using where
+select level,id from t1 where level=1;
+level id
+1 1002
+1 1003
+1 1004
+1 1005
+1 1006
+1 1007
+select level,id,parent_id from t1 where level=1;
+level id parent_id
+1 1002 101
+1 1003 101
+1 1004 101
+1 1005 101
+1 1006 101
+1 1007 101
+optimize table t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 id A # NULL NULL BTREE
+t1 1 parent_id 1 parent_id A # NULL NULL BTREE
+t1 1 level 1 level A # NULL NULL BTREE
+drop table t1;
+CREATE TABLE t1 (
+gesuchnr int(11) DEFAULT '0' NOT NULL,
+benutzer_id int(11) DEFAULT '0' NOT NULL,
+PRIMARY KEY (gesuchnr,benutzer_id)
+) engine=innodb;
+replace into t1 (gesuchnr,benutzer_id) values (2,1);
+replace into t1 (gesuchnr,benutzer_id) values (1,1);
+replace into t1 (gesuchnr,benutzer_id) values (1,1);
+select * from t1;
+gesuchnr benutzer_id
+1 1
+2 1
+drop table t1;
+create table t1 (a int) engine=innodb;
+insert into t1 values (1), (2);
+optimize table t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+delete from t1 where a = 1;
+select * from t1;
+a
+2
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+drop table t1;
+create table t1 (a int,b varchar(20)) engine=innodb;
+insert into t1 values (1,""), (2,"testing");
+delete from t1 where a = 1;
+select * from t1;
+a b
+2 testing
+create index skr on t1 (a);
+insert into t1 values (3,""), (4,"testing");
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 skr 1 a A # NULL NULL YES BTREE
+drop table t1;
+create table t1 (a int,b varchar(20),key(a)) engine=innodb;
+insert into t1 values (1,""), (2,"testing");
+select * from t1 where a = 1;
+a b
+1
+drop table t1;
+create table t1 (n int not null primary key) engine=innodb;
+set autocommit=0;
+insert into t1 values (4);
+rollback;
+select n, "after rollback" from t1;
+n after rollback
+insert into t1 values (4);
+commit;
+select n, "after commit" from t1;
+n after commit
+4 after commit
+commit;
+insert into t1 values (5);
+insert into t1 values (4);
+ERROR 23000: Duplicate entry '4' for key 1
+commit;
+select n, "after commit" from t1;
+n after commit
+4 after commit
+5 after commit
+set autocommit=1;
+insert into t1 values (6);
+insert into t1 values (4);
+ERROR 23000: Duplicate entry '4' for key 1
+select n from t1;
+n
+4
+5
+6
+rollback;
+drop table t1;
+create table t1 (n int not null primary key) engine=innodb;
+start transaction;
+insert into t1 values (4);
+flush tables with read lock;
+commit;
+unlock tables;
+commit;
+select * from t1;
+n
+4
+drop table t1;
+create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) engine=innodb;
+begin;
+insert into t1 values(1,'hamdouni');
+select id as afterbegin_id,nom as afterbegin_nom from t1;
+afterbegin_id afterbegin_nom
+1 hamdouni
+rollback;
+select id as afterrollback_id,nom as afterrollback_nom from t1;
+afterrollback_id afterrollback_nom
+set autocommit=0;
+insert into t1 values(2,'mysql');
+select id as afterautocommit0_id,nom as afterautocommit0_nom from t1;
+afterautocommit0_id afterautocommit0_nom
+2 mysql
+rollback;
+select id as afterrollback_id,nom as afterrollback_nom from t1;
+afterrollback_id afterrollback_nom
+set autocommit=1;
+drop table t1;
+CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=innodb;
+insert into t1 values ('pippo', 12);
+insert into t1 values ('pippo', 12);
+ERROR 23000: Duplicate entry 'pippo' for key 1
+delete from t1;
+delete from t1 where id = 'pippo';
+select * from t1;
+id val
+insert into t1 values ('pippo', 12);
+set autocommit=0;
+delete from t1;
+rollback;
+select * from t1;
+id val
+pippo 12
+delete from t1;
+commit;
+select * from t1;
+id val
+drop table t1;
+create table t1 (a integer) engine=innodb;
+start transaction;
+rename table t1 to t2;
+create table t1 (b integer) engine=innodb;
+insert into t1 values (1);
+rollback;
+drop table t1;
+rename table t2 to t1;
+drop table t1;
+set autocommit=1;
+CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) ENGINE=innodb;
+INSERT INTO t1 VALUES (1, 'Jochen');
+select * from t1;
+ID NAME
+1 Jochen
+drop table t1;
+CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) ENGINE=innodb;
+set autocommit=0;
+INSERT INTO t1 SET _userid='marc@anyware.co.uk';
+COMMIT;
+SELECT * FROM t1;
+_userid
+marc@anyware.co.uk
+SELECT _userid FROM t1 WHERE _userid='marc@anyware.co.uk';
+_userid
+marc@anyware.co.uk
+drop table t1;
+set autocommit=1;
+CREATE TABLE t1 (
+user_id int(10) DEFAULT '0' NOT NULL,
+name varchar(100),
+phone varchar(100),
+ref_email varchar(100) DEFAULT '' NOT NULL,
+detail varchar(200),
+PRIMARY KEY (user_id,ref_email)
+)engine=innodb;
+INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar');
+select * from t1 where user_id=10292;
+user_id name phone ref_email detail
+10292 sanjeev 29153373 sansh777@hotmail.com xxx
+10292 shirish 2333604 shirish@yahoo.com ddsds
+10292 sonali 323232 sonali@bolly.com filmstar
+INSERT INTO t1 VALUES (10291,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10293,'shirish','2333604','shirish@yahoo.com','ddsds');
+select * from t1 where user_id=10292;
+user_id name phone ref_email detail
+10292 sanjeev 29153373 sansh777@hotmail.com xxx
+10292 shirish 2333604 shirish@yahoo.com ddsds
+10292 sonali 323232 sonali@bolly.com filmstar
+select * from t1 where user_id>=10292;
+user_id name phone ref_email detail
+10292 sanjeev 29153373 sansh777@hotmail.com xxx
+10292 shirish 2333604 shirish@yahoo.com ddsds
+10292 sonali 323232 sonali@bolly.com filmstar
+10293 shirish 2333604 shirish@yahoo.com ddsds
+select * from t1 where user_id>10292;
+user_id name phone ref_email detail
+10293 shirish 2333604 shirish@yahoo.com ddsds
+select * from t1 where user_id<10292;
+user_id name phone ref_email detail
+10291 sanjeev 29153373 sansh777@hotmail.com xxx
+drop table t1;
+CREATE TABLE t1 (a int not null, b int not null,c int not null,
+key(a),primary key(a,b), unique(c),key(a),unique(b));
+show index from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 a A # NULL NULL BTREE
+t1 0 PRIMARY 2 b A # NULL NULL BTREE
+t1 0 c 1 c A # NULL NULL BTREE
+t1 0 b 1 b A # NULL NULL BTREE
+t1 1 a 1 a A # NULL NULL BTREE
+t1 1 a_2 1 a A # NULL NULL BTREE
+drop table t1;
+create table t1 (col1 int not null, col2 char(4) not null, primary key(col1));
+alter table t1 engine=innodb;
+insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4');
+select * from t1;
+col1 col2
+1 1
+2 3
+3 4
+4 4
+5 2
+update t1 set col2='7' where col1='4';
+select * from t1;
+col1 col2
+1 1
+2 3
+3 4
+4 7
+5 2
+alter table t1 add co3 int not null;
+select * from t1;
+col1 col2 co3
+1 1 0
+2 3 0
+3 4 0
+4 7 0
+5 2 0
+update t1 set col2='9' where col1='2';
+select * from t1;
+col1 col2 co3
+1 1 0
+2 9 0
+3 4 0
+4 7 0
+5 2 0
+drop table t1;
+create table t1 (a int not null , b int, primary key (a)) engine = innodb;
+create table t2 (a int not null , b int, primary key (a)) engine = myisam;
+insert into t1 VALUES (1,3) , (2,3), (3,3);
+select * from t1;
+a b
+1 3
+2 3
+3 3
+insert into t2 select * from t1;
+select * from t2;
+a b
+1 3
+2 3
+3 3
+delete from t1 where b = 3;
+select * from t1;
+a b
+insert into t1 select * from t2;
+select * from t1;
+a b
+1 3
+2 3
+3 3
+select * from t2;
+a b
+1 3
+2 3
+3 3
+drop table t1,t2;
+CREATE TABLE t1 (
+id int(11) NOT NULL auto_increment,
+ggid varchar(32) binary DEFAULT '' NOT NULL,
+email varchar(64) DEFAULT '' NOT NULL,
+passwd varchar(32) binary DEFAULT '' NOT NULL,
+PRIMARY KEY (id),
+UNIQUE ggid (ggid)
+) ENGINE=innodb;
+insert into t1 (ggid,passwd) values ('test1','xxx');
+insert into t1 (ggid,passwd) values ('test2','yyy');
+insert into t1 (ggid,passwd) values ('test2','this will fail');
+ERROR 23000: Duplicate entry 'test2' for key 2
+insert into t1 (ggid,id) values ('this will fail',1);
+ERROR 23000: Duplicate entry '1' for key 1
+select * from t1 where ggid='test1';
+id ggid email passwd
+1 test1 xxx
+select * from t1 where passwd='xxx';
+id ggid email passwd
+1 test1 xxx
+select * from t1 where id=2;
+id ggid email passwd
+2 test2 yyy
+replace into t1 (ggid,id) values ('this will work',1);
+replace into t1 (ggid,passwd) values ('test2','this will work');
+update t1 set id=100,ggid='test2' where id=1;
+ERROR 23000: Duplicate entry 'test2' for key 2
+select * from t1;
+id ggid email passwd
+1 this will work
+3 test2 this will work
+select * from t1 where id=1;
+id ggid email passwd
+1 this will work
+select * from t1 where id=999;
+id ggid email passwd
+drop table t1;
+CREATE TABLE t1 (
+user_name varchar(12),
+password text,
+subscribed char(1),
+user_id int(11) DEFAULT '0' NOT NULL,
+quota bigint(20),
+weight double,
+access_date date,
+access_time time,
+approved datetime,
+dummy_primary_key int(11) NOT NULL auto_increment,
+PRIMARY KEY (dummy_primary_key)
+) ENGINE=innodb;
+INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1);
+INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2);
+INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3);
+INSERT INTO t1 VALUES ('user_3','somepassword','Y',3,3,1.7320508075689,'2000-09-07','23:06:59','2000-09-07 23:06:59',4);
+INSERT INTO t1 VALUES ('user_4','somepassword','N',4,4,2,'2000-09-07','23:06:59','2000-09-07 23:06:59',5);
+select user_name, password , subscribed, user_id, quota, weight, access_date, access_time, approved, dummy_primary_key from t1 order by user_name;
+user_name password subscribed user_id quota weight access_date access_time approved dummy_primary_key
+user_0 somepassword N 0 0 0 2000-09-07 23:06:59 2000-09-07 23:06:59 1
+user_1 somepassword Y 1 1 1 2000-09-07 23:06:59 2000-09-07 23:06:59 2
+user_2 somepassword N 2 2 1.4142135623731 2000-09-07 23:06:59 2000-09-07 23:06:59 3
+user_3 somepassword Y 3 3 1.7320508075689 2000-09-07 23:06:59 2000-09-07 23:06:59 4
+user_4 somepassword N 4 4 2 2000-09-07 23:06:59 2000-09-07 23:06:59 5
+drop table t1;
+CREATE TABLE t1 (
+id int(11) NOT NULL auto_increment,
+parent_id int(11) DEFAULT '0' NOT NULL,
+level tinyint(4) DEFAULT '0' NOT NULL,
+KEY (id),
+KEY parent_id (parent_id),
+KEY level (level)
+) engine=innodb;
+INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1);
+INSERT INTO t1 values (179,5,2);
+update t1 set parent_id=parent_id+100;
+select * from t1 where parent_id=102;
+id parent_id level
+8 102 2
+9 102 2
+15 102 2
+update t1 set id=id+1000;
+update t1 set id=1024 where id=1009;
+select * from t1;
+id parent_id level
+1001 100 0
+1003 101 1
+1004 101 1
+1008 102 2
+1024 102 2
+1017 103 2
+1022 104 2
+1024 104 2
+1028 105 2
+1029 105 2
+1030 105 2
+1031 106 2
+1032 106 2
+1033 106 2
+1203 107 2
+1202 107 2
+1020 103 2
+1157 100 0
+1193 105 2
+1040 107 2
+1002 101 1
+1015 102 2
+1006 101 1
+1034 106 2
+1035 106 2
+1016 103 2
+1007 101 1
+1036 107 2
+1018 103 2
+1026 105 2
+1027 105 2
+1183 104 2
+1038 107 2
+1025 105 2
+1037 107 2
+1021 104 2
+1019 103 2
+1005 101 1
+1179 105 2
+update ignore t1 set id=id+1;
+select * from t1;
+id parent_id level
+1002 100 0
+1004 101 1
+1005 101 1
+1009 102 2
+1025 102 2
+1018 103 2
+1023 104 2
+1025 104 2
+1029 105 2
+1030 105 2
+1031 105 2
+1032 106 2
+1033 106 2
+1034 106 2
+1204 107 2
+1203 107 2
+1021 103 2
+1158 100 0
+1194 105 2
+1041 107 2
+1003 101 1
+1016 102 2
+1007 101 1
+1035 106 2
+1036 106 2
+1017 103 2
+1008 101 1
+1037 107 2
+1019 103 2
+1027 105 2
+1028 105 2
+1184 104 2
+1039 107 2
+1026 105 2
+1038 107 2
+1022 104 2
+1020 103 2
+1006 101 1
+1180 105 2
+update ignore t1 set id=1023 where id=1010;
+select * from t1 where parent_id=102;
+id parent_id level
+1009 102 2
+1025 102 2
+1016 102 2
+explain select level from t1 where level=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const # Using where; Using index
+select level,id from t1 where level=1;
+level id
+1 1004
+1 1005
+1 1003
+1 1007
+1 1008
+1 1006
+select level,id,parent_id from t1 where level=1;
+level id parent_id
+1 1004 101
+1 1005 101
+1 1003 101
+1 1007 101
+1 1008 101
+1 1006 101
+select level,id from t1 where level=1 order by id;
+level id
+1 1003
+1 1004
+1 1005
+1 1006
+1 1007
+1 1008
+delete from t1 where level=1;
+select * from t1;
+id parent_id level
+1002 100 0
+1009 102 2
+1025 102 2
+1018 103 2
+1023 104 2
+1025 104 2
+1029 105 2
+1030 105 2
+1031 105 2
+1032 106 2
+1033 106 2
+1034 106 2
+1204 107 2
+1203 107 2
+1021 103 2
+1158 100 0
+1194 105 2
+1041 107 2
+1016 102 2
+1035 106 2
+1036 106 2
+1017 103 2
+1037 107 2
+1019 103 2
+1027 105 2
+1028 105 2
+1184 104 2
+1039 107 2
+1026 105 2
+1038 107 2
+1022 104 2
+1020 103 2
+1180 105 2
+drop table t1;
+CREATE TABLE t1 (
+sca_code char(6) NOT NULL,
+cat_code char(6) NOT NULL,
+sca_desc varchar(50),
+lan_code char(2) NOT NULL,
+sca_pic varchar(100),
+sca_sdesc varchar(50),
+sca_sch_desc varchar(16),
+PRIMARY KEY (sca_code, cat_code, lan_code),
+INDEX sca_pic (sca_pic)
+) engine = innodb ;
+INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
+select count(*) from t1 where sca_code = 'PD';
+count(*)
+1
+select count(*) from t1 where sca_code <= 'PD';
+count(*)
+1
+select count(*) from t1 where sca_pic is null;
+count(*)
+2
+alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic);
+select count(*) from t1 where sca_code='PD' and sca_pic is null;
+count(*)
+1
+select count(*) from t1 where cat_code='E';
+count(*)
+0
+alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
+select count(*) from t1 where sca_code='PD' and sca_pic is null;
+count(*)
+1
+select count(*) from t1 where sca_pic >= 'n';
+count(*)
+1
+select sca_pic from t1 where sca_pic is null;
+sca_pic
+NULL
+NULL
+update t1 set sca_pic="test" where sca_pic is null;
+delete from t1 where sca_code='pd';
+drop table t1;
+set @a:=now();
+CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=innodb;
+insert into t1 (a) values(1),(2),(3);
+select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a;
+a
+1
+2
+3
+update t1 set a=5 where a=1;
+select a from t1;
+a
+2
+3
+5
+drop table t1;
+create table t1 (a varchar(100) not null, primary key(a), b int not null) engine=innodb;
+insert into t1 values("hello",1),("world",2);
+select * from t1 order by b desc;
+a b
+world 2
+hello 1
+optimize table t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 a A # NULL NULL BTREE
+drop table t1;
+create table t1 (i int, j int ) ENGINE=innodb;
+insert into t1 values (1,2);
+select * from t1 where i=1 and j=2;
+i j
+1 2
+create index ax1 on t1 (i,j);
+select * from t1 where i=1 and j=2;
+i j
+1 2
+drop table t1;
+CREATE TABLE t1 (
+a int3 unsigned NOT NULL,
+b int1 unsigned NOT NULL,
+UNIQUE (a, b)
+) ENGINE = innodb;
+INSERT INTO t1 VALUES (1, 1);
+SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1;
+MIN(B) MAX(b)
+1 1
+drop table t1;
+CREATE TABLE t1 (a int unsigned NOT NULL) engine=innodb;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1;
+a
+1
+DROP TABLE t1;
+create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) engine = innodb;
+insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
+explain select * from t1 where a > 0 and a < 50;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL # Using where
+drop table t1;
+create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb;
+insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
+LOCK TABLES t1 WRITE;
+insert into t1 values (99,1,2,'D'),(1,1,2,'D');
+ERROR 23000: Duplicate entry '1-1' for key 1
+select id from t1;
+id
+0
+1
+2
+select id from t1;
+id
+0
+1
+2
+UNLOCK TABLES;
+DROP TABLE t1;
+create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb;
+insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
+LOCK TABLES t1 WRITE;
+begin;
+insert into t1 values (99,1,2,'D'),(1,1,2,'D');
+ERROR 23000: Duplicate entry '1-1' for key 1
+select id from t1;
+id
+0
+1
+2
+insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D');
+commit;
+select id,id3 from t1;
+id id3
+0 0
+1 1
+2 2
+100 2
+UNLOCK TABLES;
+DROP TABLE t1;
+create table t1 (a char(20), unique (a(5))) engine=innodb;
+drop table t1;
+create table t1 (a char(20), index (a(5))) engine=innodb;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(20) default NULL,
+ KEY `a` (`a`(5))
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1;
+create temporary table t1 (a int not null auto_increment, primary key(a)) engine=innodb;
+insert into t1 values (NULL),(NULL),(NULL);
+delete from t1 where a=3;
+insert into t1 values (NULL);
+select * from t1;
+a
+1
+2
+4
+alter table t1 add b int;
+select * from t1;
+a b
+1 NULL
+2 NULL
+4 NULL
+drop table t1;
+create table t1
+(
+id int auto_increment primary key,
+name varchar(32) not null,
+value text not null,
+uid int not null,
+unique key(name,uid)
+) engine=innodb;
+insert into t1 values (1,'one','one value',101),
+(2,'two','two value',102),(3,'three','three value',103);
+set insert_id=5;
+replace into t1 (value,name,uid) values ('other value','two',102);
+delete from t1 where uid=102;
+set insert_id=5;
+replace into t1 (value,name,uid) values ('other value','two',102);
+set insert_id=6;
+replace into t1 (value,name,uid) values ('other value','two',102);
+select * from t1;
+id name value uid
+1 one one value 101
+3 three three value 103
+6 two other value 102
+drop table t1;
+create database mysqltest;
+create table mysqltest.t1 (a int not null) engine= innodb;
+insert into mysqltest.t1 values(1);
+create table mysqltest.t2 (a int not null) engine= myisam;
+insert into mysqltest.t2 values(1);
+create table mysqltest.t3 (a int not null) engine= heap;
+insert into mysqltest.t3 values(1);
+commit;
+drop database mysqltest;
+show tables from mysqltest;
+Got one of the listed errors
+set autocommit=0;
+create table t1 (a int not null) engine= innodb;
+insert into t1 values(1),(2);
+truncate table t1;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+commit;
+truncate table t1;
+select * from t1;
+a
+insert into t1 values(1),(2);
+delete from t1;
+select * from t1;
+a
+commit;
+drop table t1;
+set autocommit=1;
+create table t1 (a int not null) engine= innodb;
+insert into t1 values(1),(2);
+truncate table t1;
+insert into t1 values(1),(2);
+select * from t1;
+a
+1
+2
+truncate table t1;
+insert into t1 values(1),(2);
+delete from t1;
+select * from t1;
+a
+drop table t1;
+create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=innodb;
+insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
+explain select * from t1 order by a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL #
+explain select * from t1 order by b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL b 4 NULL #
+explain select * from t1 order by c;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort
+explain select a from t1 order by a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL # Using index
+explain select b from t1 order by b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL b 4 NULL # Using index
+explain select a,b from t1 order by b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL b 4 NULL # Using index
+explain select a,b from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL b 4 NULL # Using index
+explain select a,b,c from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL #
+drop table t1;
+create table t1 (t int not null default 1, key (t)) engine=innodb;
+desc t1;
+Field Type Null Key Default Extra
+t int(11) MUL 1
+drop table t1;
+CREATE TABLE t1 (
+number bigint(20) NOT NULL default '0',
+cname char(15) NOT NULL default '',
+carrier_id smallint(6) NOT NULL default '0',
+privacy tinyint(4) NOT NULL default '0',
+last_mod_date timestamp(14) NOT NULL,
+last_mod_id smallint(6) NOT NULL default '0',
+last_app_date timestamp(14) NOT NULL,
+last_app_id smallint(6) default '-1',
+version smallint(6) NOT NULL default '0',
+assigned_scps int(11) default '0',
+status tinyint(4) default '0'
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (4077711111,'SeanWheeler',90,2,20020111112846,500,00000000000000,-1,2,3,1);
+INSERT INTO t1 VALUES (9197722223,'berry',90,3,20020111112809,500,20020102114532,501,4,10,0);
+INSERT INTO t1 VALUES (650,'San Francisco',0,0,20011227111336,342,00000000000000,-1,1,24,1);
+INSERT INTO t1 VALUES (302467,'Sue\'s Subshop',90,3,20020109113241,500,20020102115111,501,7,24,0);
+INSERT INTO t1 VALUES (6014911113,'SudzCarwash',520,1,20020102115234,500,20020102115259,501,33,32768,0);
+INSERT INTO t1 VALUES (333,'tubs',99,2,20020109113440,501,20020109113440,500,3,10,0);
+CREATE TABLE t2 (
+number bigint(20) NOT NULL default '0',
+cname char(15) NOT NULL default '',
+carrier_id smallint(6) NOT NULL default '0',
+privacy tinyint(4) NOT NULL default '0',
+last_mod_date timestamp(14) NOT NULL,
+last_mod_id smallint(6) NOT NULL default '0',
+last_app_date timestamp(14) NOT NULL,
+last_app_id smallint(6) default '-1',
+version smallint(6) NOT NULL default '0',
+assigned_scps int(11) default '0',
+status tinyint(4) default '0'
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (4077711111,'SeanWheeler',0,2,20020111112853,500,00000000000000,-1,2,3,1);
+INSERT INTO t2 VALUES (9197722223,'berry',90,3,20020111112818,500,20020102114532,501,4,10,0);
+INSERT INTO t2 VALUES (650,'San Francisco',90,0,20020109113158,342,00000000000000,-1,1,24,1);
+INSERT INTO t2 VALUES (333,'tubs',99,2,20020109113453,501,20020109113453,500,3,10,0);
+select * from t1;
+number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
+4077711111 SeanWheeler 90 2 2002-01-11 11:28:46 500 0000-00-00 00:00:00 -1 2 3 1
+9197722223 berry 90 3 2002-01-11 11:28:09 500 2002-01-02 11:45:32 501 4 10 0
+650 San Francisco 0 0 2001-12-27 11:13:36 342 0000-00-00 00:00:00 -1 1 24 1
+302467 Sue's Subshop 90 3 2002-01-09 11:32:41 500 2002-01-02 11:51:11 501 7 24 0
+6014911113 SudzCarwash 520 1 2002-01-02 11:52:34 500 2002-01-02 11:52:59 501 33 32768 0
+333 tubs 99 2 2002-01-09 11:34:40 501 2002-01-09 11:34:40 500 3 10 0
+select * from t2;
+number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
+4077711111 SeanWheeler 0 2 2002-01-11 11:28:53 500 0000-00-00 00:00:00 -1 2 3 1
+9197722223 berry 90 3 2002-01-11 11:28:18 500 2002-01-02 11:45:32 501 4 10 0
+650 San Francisco 90 0 2002-01-09 11:31:58 342 0000-00-00 00:00:00 -1 1 24 1
+333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0
+delete t1, t2 from t1 left join t2 on t1.number=t2.number where (t1.carrier_id=90 and t1.number=t2.number) or (t2.carrier_id=90 and t1.number=t2.number) or (t1.carrier_id=90 and t2.number is null);
+select * from t1;
+number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
+6014911113 SudzCarwash 520 1 2002-01-02 11:52:34 500 2002-01-02 11:52:59 501 33 32768 0
+333 tubs 99 2 2002-01-09 11:34:40 501 2002-01-09 11:34:40 500 3 10 0
+select * from t2;
+number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
+333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0
+select * from t2;
+number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
+333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0
+drop table t1,t2;
+create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb;
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+SELECT @@tx_isolation,@@global.tx_isolation;
+@@tx_isolation @@global.tx_isolation
+SERIALIZABLE REPEATABLE-READ
+insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David');
+select id, code, name from t1 order by id;
+id code name
+1 1 Tim
+2 1 Monty
+3 2 David
+COMMIT;
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+insert into t1 (code, name) values (2, 'Erik'), (3, 'Sasha');
+select id, code, name from t1 order by id;
+id code name
+1 1 Tim
+2 1 Monty
+3 2 David
+4 2 Erik
+5 3 Sasha
+COMMIT;
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+insert into t1 (code, name) values (3, 'Jeremy'), (4, 'Matt');
+select id, code, name from t1 order by id;
+id code name
+1 1 Tim
+2 1 Monty
+3 2 David
+4 2 Erik
+5 3 Sasha
+6 3 Jeremy
+7 4 Matt
+COMMIT;
+DROP TABLE t1;
+create table t1 (n int(10), d int(10)) engine=innodb;
+create table t2 (n int(10), d int(10)) engine=innodb;
+insert into t1 values(1,1),(1,2);
+insert into t2 values(1,10),(2,20);
+UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
+select * from t1;
+n d
+1 10
+1 10
+select * from t2;
+n d
+1 30
+2 20
+drop table t1,t2;
+create table t1 (a int, b int) engine=innodb;
+insert into t1 values(20,null);
+select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
+t2.b=t3.a;
+b ifnull(t2.b,"this is null")
+NULL this is null
+select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
+t2.b=t3.a order by 1;
+b ifnull(t2.b,"this is null")
+NULL this is null
+insert into t1 values(10,null);
+select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
+t2.b=t3.a order by 1;
+b ifnull(t2.b,"this is null")
+NULL this is null
+NULL this is null
+drop table t1;
+create table t1 (a varchar(10) not null) engine=myisam;
+create table t2 (b varchar(10) not null unique) engine=innodb;
+select t1.a from t1,t2 where t1.a=t2.b;
+a
+drop table t1,t2;
+create table t1 (a int not null, b int, primary key (a)) engine = innodb;
+create table t2 (a int not null, b int, primary key (a)) engine = innodb;
+insert into t1 values (10, 20);
+insert into t2 values (10, 20);
+update t1, t2 set t1.b = 150, t2.b = t1.b where t2.a = t1.a and t1.a = 10;
+drop table t1,t2;
+CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
+CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE ) ENGINE=INNODB;
+insert into t1 set id=1;
+insert into t2 set id=1, t1_id=1;
+delete t1,t2 from t1,t2 where t1.id=t2.t1_id;
+select * from t1;
+id
+select * from t2;
+id t1_id
+drop table t2,t1;
+CREATE TABLE t1(id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
+CREATE TABLE t2(id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id) ) ENGINE=INNODB;
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2 VALUES(1, 1);
+SELECT * from t1;
+id
+1
+UPDATE t1,t2 SET t1.id=t1.id+1, t2.t1_id=t1.id+1;
+SELECT * from t1;
+id
+2
+UPDATE t1,t2 SET t1.id=t1.id+1 where t1.id!=t2.id;
+SELECT * from t1;
+id
+3
+DROP TABLE t1,t2;
+set autocommit=0;
+CREATE TABLE t1 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB;
+CREATE TABLE t2 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB;
+CREATE TABLE t3 (id1 CHAR(15) NOT NULL, id2 CHAR(15) NOT NULL, PRIMARY KEY(id1, id2)) ENGINE=InnoDB;
+INSERT INTO t3 VALUES("my-test-1", "my-test-2");
+COMMIT;
+INSERT INTO t1 VALUES("this-key", "will disappear");
+INSERT INTO t2 VALUES("this-key", "will also disappear");
+DELETE FROM t3 WHERE id1="my-test-1";
+SELECT * FROM t1;
+id value
+this-key will disappear
+SELECT * FROM t2;
+id value
+this-key will also disappear
+SELECT * FROM t3;
+id1 id2
+ROLLBACK;
+SELECT * FROM t1;
+id value
+SELECT * FROM t2;
+id value
+SELECT * FROM t3;
+id1 id2
+my-test-1 my-test-2
+SELECT * FROM t3 WHERE id1="my-test-1" LOCK IN SHARE MODE;
+id1 id2
+my-test-1 my-test-2
+COMMIT;
+set autocommit=1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (a int not null primary key, b int not null, unique (b)) engine=innodb;
+INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+UPDATE t1 set a=a+100 where b between 2 and 3 and a < 1000;
+SELECT * from t1;
+a b
+1 1
+102 2
+103 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+drop table t1;
+CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) engine=innodb;
+CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) engine=innodb;
+INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12);
+INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+update t1,t2 set t1.a=t1.a+100;
+select * from t1;
+a b
+101 1
+102 2
+103 3
+104 4
+105 5
+106 6
+107 7
+108 8
+109 9
+110 10
+111 11
+112 12
+update t1,t2 set t1.a=t1.a+100 where t1.a=101;
+select * from t1;
+a b
+201 1
+102 2
+103 3
+104 4
+105 5
+106 6
+107 7
+108 8
+109 9
+110 10
+111 11
+112 12
+update t1,t2 set t1.b=t1.b+10 where t1.b=2;
+select * from t1;
+a b
+201 1
+103 3
+104 4
+105 5
+106 6
+107 7
+108 8
+109 9
+110 10
+111 11
+102 12
+112 12
+update t1,t2 set t1.b=t1.b+2,t2.b=t1.b+10 where t1.b between 3 and 5 and t1.a=t2.a+100;
+select * from t1;
+a b
+201 1
+103 5
+104 6
+106 6
+105 7
+107 7
+108 8
+109 9
+110 10
+111 11
+102 12
+112 12
+select * from t2;
+a b
+1 1
+2 2
+6 6
+7 7
+8 8
+9 9
+3 13
+4 14
+5 15
+drop table t1,t2;
+CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) ENGINE=MyISAM;
+CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+SET AUTOCOMMIT=0;
+INSERT INTO t1 ( B_ID ) VALUES ( 1 );
+INSERT INTO t2 ( NEXT_T ) VALUES ( 1 );
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+SELECT * FROM t1;
+B_ID
+drop table t1,t2;
+create table t1 ( pk int primary key, parent int not null, child int not null, index (parent) ) engine = innodb;
+insert into t1 values (1,0,4), (2,1,3), (3,2,1), (4,1,2);
+select distinct parent,child from t1 order by parent;
+parent child
+0 4
+1 2
+1 3
+2 1
+drop table t1;
+create table t1 (a int not null auto_increment primary key, b int, c int, key(c)) engine=innodb;
+create table t2 (a int not null auto_increment primary key, b int);
+insert into t1 (b) values (null),(null),(null),(null),(null),(null),(null);
+insert into t2 (a) select b from t1;
+insert into t1 (b) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+select count(*) from t1;
+count(*)
+29267
+explain select * from t1 where c between 1 and 10000;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c c 5 NULL # Using where
+update t1 set c=a;
+explain select * from t1 where c between 1 and 10000;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL c NULL NULL NULL # Using where
+drop table t1,t2;
+create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=innodb;
+insert into t1 (id) values (null),(null),(null),(null),(null);
+update t1 set fk=69 where fk is null order by id limit 1;
+SELECT * from t1;
+id fk
+2 NULL
+3 NULL
+4 NULL
+5 NULL
+1 69
+drop table t1;
+create table t1 (a int not null, b int not null, key (a));
+insert into t1 values (1,1),(1,2),(1,3),(3,1),(3,2),(3,3),(3,1),(3,2),(3,3),(2,1),(2,2),(2,3);
+SET @tmp=0;
+update t1 set b=(@tmp:=@tmp+1) order by a;
+update t1 set b=99 where a=1 order by b asc limit 1;
+update t1 set b=100 where a=1 order by b desc limit 2;
+update t1 set a=a+10+b where a=1 order by b;
+select * from t1 order by a,b;
+a b
+2 4
+2 5
+2 6
+3 7
+3 8
+3 9
+3 10
+3 11
+3 12
+13 2
+111 100
+111 100
+drop table t1;
+create table t1 ( c char(8) not null ) engine=innodb;
+insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
+insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
+alter table t1 add b char(8) not null;
+alter table t1 add a char(8) not null;
+alter table t1 add primary key (a,b,c);
+update t1 set a=c, b=c;
+create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=innodb;
+insert into t2 select * from t1;
+delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
+drop table t1,t2;
+SET AUTOCOMMIT=1;
+create table t1 (a integer auto_increment primary key) engine=innodb;
+insert into t1 (a) values (NULL),(NULL);
+truncate table t1;
+insert into t1 (a) values (NULL),(NULL);
+SELECT * from t1;
+a
+3
+4
+drop table t1;
+CREATE TABLE t1 (`id 1` INT NOT NULL, PRIMARY KEY (`id 1`)) ENGINE=INNODB;
+CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (`t1_id`) REFERENCES `t1`(`id 1`) ON DELETE CASCADE ) ENGINE=INNODB;
+drop table t2,t1;
+create table `t1` (`id` int( 11 ) not null ,primary key ( `id` )) engine = innodb;
+insert into `t1`values ( 1 ) ;
+create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` ) ,constraint `t1_id_fk` foreign key ( `id` ) references `t1` (`id` )) engine = innodb;
+insert into `t2`values ( 1 ) ;
+create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) engine = innodb;
+insert into `t3`values ( 1 ) ;
+delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
+update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
+update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
+ERROR 42S02: Unknown table 't1' in where clause
+drop table t3,t2,t1;
+create table t1(
+id int primary key,
+pid int,
+index(pid),
+foreign key(pid) references t1(id) on delete cascade) engine=innodb;
+insert into t1 values(0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6),
+(8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14);
+delete from t1 where id=0;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
+delete from t1 where id=15;
+delete from t1 where id=0;
+drop table t1;
+CREATE TABLE t1 (col1 int(1))ENGINE=InnoDB;
+CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP,INDEX stamp_idx
+(stamp))ENGINE=InnoDB;
+insert into t1 values (1),(2),(3);
+insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 ),(5,20020204230000);
+Warnings:
+Warning 1265 Data truncated for column 'stamp' at row 3
+SELECT col1 FROM t1 UNION SELECT col1 FROM t2 WHERE stamp <
+'20020204120000' GROUP BY col1;
+col1
+1
+2
+3
+4
+drop table t1,t2;
+CREATE TABLE t1 (
+`id` int(10) unsigned NOT NULL auto_increment,
+`id_object` int(10) unsigned default '0',
+`id_version` int(10) unsigned NOT NULL default '1',
+label varchar(100) NOT NULL default '',
+`description` text,
+PRIMARY KEY (`id`),
+KEY `id_object` (`id_object`),
+KEY `id_version` (`id_version`)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES("6", "3382", "9", "Test", NULL), ("7", "102", "5", "Le Pekin (Test)", NULL),("584", "1794", "4", "Test de resto", NULL),("837", "1822", "6", "Test 3", NULL),("1119", "3524", "1", "Societe Test", NULL),("1122", "3525", "1", "Fournisseur Test", NULL);
+CREATE TABLE t2 (
+`id` int(10) unsigned NOT NULL auto_increment,
+`id_version` int(10) unsigned NOT NULL default '1',
+PRIMARY KEY (`id`),
+KEY `id_version` (`id_version`)
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES("3524", "1"),("3525", "1"),("1794", "4"),("102", "5"),("1822", "6"),("3382", "9");
+SELECT t2.id, t1.label FROM t2 INNER JOIN
+(SELECT t1.id_object as id_object FROM t1 WHERE t1.label LIKE '%test%') AS lbl
+ON (t2.id = lbl.id_object) INNER JOIN t1 ON (t2.id = t1.id_object);
+id label
+3382 Test
+102 Le Pekin (Test)
+1794 Test de resto
+1822 Test 3
+3524 Societe Test
+3525 Fournisseur Test
+drop table t1,t2;
+create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=innodb;
+select * from t1;
+c1 c2 stamp
+replace delayed into t1 (c1, c2) values ( "text1","11"),( "text2","12");
+select * from t1;
+c1 c2 stamp
+text1 11 2004-12-01 13:23:14
+text2 12 2004-12-01 13:23:14
+replace delayed into t1 (c1, c2) values ( "text1","12"),( "text2","13"),( "text3","14", "a" ),( "text4","15", "b" );
+ERROR 21S01: Column count doesn't match value count at row 3
+select * from t1;
+c1 c2 stamp
+text1 11 2004-12-01 13:23:14
+text2 12 2004-12-01 13:23:14
+drop table t1;
+create table t1 (a int, b varchar(200), c text not null) checksum=1 engine=myisam;
+create table t2 (a int, b varchar(200), c text not null) checksum=0 engine=innodb;
+create table t3 (a int, b varchar(200), c text not null) checksum=1 engine=innodb;
+insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
+insert t2 select * from t1;
+insert t3 select * from t1;
+checksum table t1, t2, t3, t4 quick;
+Table Checksum
+test.t1 968604391
+test.t2 NULL
+test.t3 NULL
+test.t4 NULL
+checksum table t1, t2, t3, t4;
+Table Checksum
+test.t1 968604391
+test.t2 968604391
+test.t3 968604391
+test.t4 NULL
+checksum table t1, t2, t3, t4 extended;
+Table Checksum
+test.t1 968604391
+test.t2 968604391
+test.t3 968604391
+test.t4 NULL
+drop table t1,t2,t3;
+create table t1 (id int, name char(10) not null, name2 char(10) not null) engine=innodb;
+insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt');
+select name2 from t1 union all select name from t1 union all select id from t1;
+name2
+fff
+sss
+ttt
+first
+second
+third
+1
+2
+3
+drop table t1;
+create table t1 (a int) engine=innodb;
+create table t2 like t1;
+drop table t1,t2;
+create table t1 (id int(11) not null, id2 int(11) not null, unique (id,id2)) engine=innodb;
+create table t2 (id int(11) not null, constraint t1_id_fk foreign key ( id ) references t1 (id)) engine = innodb;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL default '0',
+ `id2` int(11) NOT NULL default '0',
+ UNIQUE KEY `id` (`id`,`id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ KEY `t1_id_fk` (`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+create index id on t2 (id);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ KEY `id` (`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+create index id2 on t2 (id);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ KEY `id` (`id`),
+ KEY `id2` (`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop index id2 on t2;
+drop index id on t2;
+Got one of the listed errors
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ KEY `id` (`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) 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 (id,id2) references t1 (id,id2)) engine = innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ `id2` int(11) NOT NULL default '0',
+ KEY `t1_id_fk` (`id`,`id2`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+create unique index id on t2 (id,id2);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ `id2` int(11) NOT NULL default '0',
+ UNIQUE KEY `id` (`id`,`id2`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ `id2` int(11) NOT NULL default '0',
+ UNIQUE KEY `id` (`id`,`id2`),
+ KEY `t1_id_fk` (`id2`,`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2), constraint t1_id_fk foreign key (id) references t1 (id)) engine = innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ `id2` int(11) NOT NULL default '0',
+ UNIQUE KEY `id` (`id`,`id2`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ `id2` int(11) NOT NULL default '0',
+ UNIQUE KEY `id` (`id`,`id2`),
+ KEY `t1_id_fk` (`id2`,`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id), primary key (id), index (id,id2)) engine = innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL auto_increment,
+ `id2` int(11) NOT NULL default '0',
+ PRIMARY KEY (`id`),
+ KEY `id` (`id`,`id2`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id)) engine= innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL auto_increment,
+ `id2` int(11) NOT NULL default '0',
+ KEY `t1_id_fk` (`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+alter table t2 add index id_test (id), add index id_test2 (id,id2);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL auto_increment,
+ `id2` int(11) NOT NULL default '0',
+ KEY `id_test` (`id`),
+ KEY `id_test2` (`id`,`id2`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) 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 '/home/hf/work/mysql-4.1.clean/mysql-test/var/master-data/test/t2.frm' (errno: 150)
+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
+t2 CREATE TABLE `t2` (
+ `a` int(11) NOT NULL auto_increment,
+ `b` int(11) default NULL,
+ PRIMARY KEY (`a`),
+ UNIQUE KEY `b_2` (`b`),
+ KEY `b` (`b`),
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (a int auto_increment primary key, b int, foreign key (b) references t1(id), foreign key (b) references t1(id), unique(b)) engine=innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) NOT NULL auto_increment,
+ `b` int(11) default NULL,
+ PRIMARY KEY (`a`),
+ UNIQUE KEY `b` (`b`),
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`),
+ CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`b`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2, t1;
+show status like "binlog_cache_use";
+Variable_name Value
+Binlog_cache_use 24
+show status like "binlog_cache_disk_use";
+Variable_name Value
+Binlog_cache_disk_use 0
+create table t1 (a int) engine=innodb;
+show status like "binlog_cache_use";
+Variable_name Value
+Binlog_cache_use 25
+show status like "binlog_cache_disk_use";
+Variable_name Value
+Binlog_cache_disk_use 1
+begin;
+delete from t1;
+commit;
+show status like "binlog_cache_use";
+Variable_name Value
+Binlog_cache_use 26
+show status like "binlog_cache_disk_use";
+Variable_name Value
+Binlog_cache_disk_use 1
+drop table t1;
+create table t1 (c char(10), index (c,c)) engine=innodb;
+ERROR 42S21: Duplicate column name 'c'
+create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb;
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb;
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10)) engine=innodb;
+alter table t1 add key (c1,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c2,c1,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c1,c2,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c1,c1,c2);
+ERROR 42S21: Duplicate column name 'c1'
+drop table t1;
diff --git a/mysql-test/r/innodb_cache.result b/mysql-test/r/innodb_cache.result
index 634b9b860c9..ec43cbe10b2 100644
--- a/mysql-test/r/innodb_cache.result
+++ b/mysql-test/r/innodb_cache.result
@@ -1,7 +1,7 @@
-drop table if exists t1, t2, t3;
+drop table if exists t1,t2,t3;
flush status;
set autocommit=0;
-create table t1 (a int not null) type=innodb;
+create table t1 (a int not null) engine=innodb;
insert into t1 values (1),(2),(3);
select * from t1;
a
@@ -15,7 +15,7 @@ drop table t1;
commit;
set autocommit=1;
begin;
-create table t1 (a int not null) type=innodb;
+create table t1 (a int not null) engine=innodb;
insert into t1 values (1),(2),(3);
select * from t1;
a
@@ -27,9 +27,9 @@ Variable_name Value
Qcache_queries_in_cache 0
drop table t1;
commit;
-create table t1 (a int not null) type=innodb;
-create table t2 (a int not null) type=innodb;
-create table t3 (a int not null) type=innodb;
+create table t1 (a int not null) engine=innodb;
+create table t2 (a int not null) engine=innodb;
+create table t3 (a int not null) engine=innodb;
insert into t1 values (1),(2);
insert into t2 values (1),(2);
insert into t3 values (1),(2);
@@ -69,7 +69,7 @@ Variable_name Value
Qcache_queries_in_cache 3
show status like "Qcache_hits";
Variable_name Value
-Qcache_hits 0
+Qcache_hits 3
insert into t1 values (3);
insert into t2 values (3);
insert into t1 values (4);
@@ -90,16 +90,16 @@ a
2
show status like "Qcache_queries_in_cache";
Variable_name Value
-Qcache_queries_in_cache 3
+Qcache_queries_in_cache 1
show status like "Qcache_hits";
Variable_name Value
-Qcache_hits 0
+Qcache_hits 4
commit;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
drop table t3,t2,t1;
-CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) TYPE=InnoDB;
+CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) ENGINE=InnoDB;
select count(*) from t1;
count(*)
0
@@ -109,9 +109,9 @@ count(*)
1
drop table t1;
set GLOBAL query_cache_size=1355776;
-CREATE TABLE t1 ( id int(10) NOT NULL auto_increment, a varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY a (a)) TYPE=innodb;
-CREATE TABLE t2 ( id int(10) NOT NULL auto_increment, b varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY b (b)) TYPE=innodb;
-CREATE TABLE t3 ( id int(10) NOT NULL auto_increment, t1_id int(10) NOT NULL default '0', t2_id int(10) NOT NULL default '0', state int(11) default NULL, PRIMARY KEY (id), UNIQUE KEY t1_id (t1_id,t2_id), KEY t2_id (t2_id,t1_id), CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`), CONSTRAINT `t3_ibfk_2` FOREIGN KEY (`t2_id`) REFERENCES `t2` (`id`)) TYPE=innodb;
+CREATE TABLE t1 ( id int(10) NOT NULL auto_increment, a varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY a (a)) ENGINE=innodb;
+CREATE TABLE t2 ( id int(10) NOT NULL auto_increment, b varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY b (b)) ENGINE=innodb;
+CREATE TABLE t3 ( id int(10) NOT NULL auto_increment, t1_id int(10) NOT NULL default '0', t2_id int(10) NOT NULL default '0', state int(11) default NULL, PRIMARY KEY (id), UNIQUE KEY t1_id (t1_id,t2_id), KEY t2_id (t2_id,t1_id), CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`), CONSTRAINT `t3_ibfk_2` FOREIGN KEY (`t2_id`) REFERENCES `t2` (`id`)) ENGINE=innodb;
INSERT INTO t1 VALUES (1,'me');
INSERT INTO t2 VALUES (1,'you');
INSERT INTO t3 VALUES (2,1,1,2);
@@ -121,7 +121,7 @@ id a
begin;
insert into t3 VALUES ( NULL, 1, 1, 2 );
insert into t3 VALUES ( NULL, 1, 1, 2 );
-Duplicate entry '1-1' for key 2
+ERROR 23000: Duplicate entry '1-1' for key 2
commit;
select t1.* from t1, t2, t3 where t3.state & 1 = 0 and t3.t1_id = t1.id and t3.t2_id = t2.id and t1.id = 1 order by t1.a asc;
id a
diff --git a/mysql-test/r/innodb_handler.result b/mysql-test/r/innodb_handler.result
index 8aa5309308f..7f4960ffa35 100644
--- a/mysql-test/r/innodb_handler.result
+++ b/mysql-test/r/innodb_handler.result
@@ -1,5 +1,5 @@
-drop table if exists t1;
-create table t1 (a int, b char(10), key a(a), key b(a,b)) type=innodb;
+drop table if exists t1,t2;
+create table t1 (a int, b char(10), key a(a), key b(a,b)) engine=innodb;
insert into t1 values
(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"),
(14,"aaa"),(15,"bbb"),(16,"ccc"),(16,"xxx"),
@@ -49,7 +49,7 @@ handler t2 read a=(16);
a b
16 ccc
handler t2 read a=(19,"fff");
-Too many key parts specified. Max 1 parts allowed
+ERROR 42000: Too many key parts specified; max 1 parts allowed
handler t2 read b=(19,"fff");
a b
19 fff
@@ -60,7 +60,7 @@ handler t2 read b=(19);
a b
19 fff
handler t1 read a last;
-Unknown table 't1' in HANDLER
+ERROR 42S02: Unknown table 't1' in HANDLER
handler t2 read a=(11);
a b
handler t2 read a>=(11);
@@ -130,17 +130,17 @@ handler t2 read next;
a b
18 eee
handler t2 read last;
-You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
handler t2 close;
handler t1 open as t2;
handler t2 read first;
a b
17 ddd
-alter table t1 type=innodb;
+alter table t1 engine=innodb;
handler t2 read first;
-Unknown table 't2' in HANDLER
+ERROR 42S02: Unknown table 't2' in HANDLER
drop table t1;
-CREATE TABLE t1 ( no1 smallint(5) NOT NULL default '0', no2 int(10) NOT NULL default '0', PRIMARY KEY (no1,no2)) TYPE=InnoDB;
+CREATE TABLE t1 ( no1 smallint(5) NOT NULL default '0', no2 int(10) NOT NULL default '0', PRIMARY KEY (no1,no2)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,274),(1,275),(2,6),(2,8),(4,1),(4,2);
HANDLER t1 OPEN;
HANDLER t1 READ `primary` = (1, 1000);
diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result
index 7520fd7e6cc..71b10699fa9 100644
--- a/mysql-test/r/insert.result
+++ b/mysql-test/r/insert.result
@@ -60,8 +60,10 @@ test 2
drop table t1;
create table t1 (id int NOT NULL DEFAULT 8);
insert into t1 values(NULL);
-Column 'id' cannot be null
+ERROR 23000: Column 'id' cannot be null
insert into t1 values (1), (NULL), (2);
+Warnings:
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'id' at row 2
select * from t1;
id
1
@@ -84,3 +86,242 @@ use mysqltest;
create table t1 (c int);
insert into mysqltest.t1 set mysqltest.t1.c = '1';
drop database mysqltest;
+use test;
+create table t1(number int auto_increment primary key, original_value varchar(50), f_double double, f_float float, f_double_7_2 double(7,2), f_float_4_3 float (4,3), f_double_u double unsigned, f_float_u float unsigned, f_double_15_1_u double(15,1) unsigned, f_float_3_1_u float (3,1) unsigned);
+set @value= "aa";
+insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+Warnings:
+Warning 1265 Data truncated for column 'f_double' at row 1
+Warning 1265 Data truncated for column 'f_float' at row 1
+Warning 1265 Data truncated for column 'f_double_7_2' at row 1
+Warning 1265 Data truncated for column 'f_float_4_3' at row 1
+Warning 1265 Data truncated for column 'f_double_u' at row 1
+Warning 1265 Data truncated for column 'f_float_u' at row 1
+Warning 1265 Data truncated for column 'f_double_15_1_u' at row 1
+Warning 1265 Data truncated for column 'f_float_3_1_u' at row 1
+select * from t1 where number =last_insert_id();
+number 1
+original_value aa
+f_double 0
+f_float 0
+f_double_7_2 0.00
+f_float_4_3 0.000
+f_double_u 0
+f_float_u 0
+f_double_15_1_u 0.0
+f_float_3_1_u 0.0
+set @value= "1aa";
+insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+Warnings:
+Warning 1265 Data truncated for column 'f_double' at row 1
+Warning 1265 Data truncated for column 'f_float' at row 1
+Warning 1265 Data truncated for column 'f_double_7_2' at row 1
+Warning 1265 Data truncated for column 'f_float_4_3' at row 1
+Warning 1265 Data truncated for column 'f_double_u' at row 1
+Warning 1265 Data truncated for column 'f_float_u' at row 1
+Warning 1265 Data truncated for column 'f_double_15_1_u' at row 1
+Warning 1265 Data truncated for column 'f_float_3_1_u' at row 1
+select * from t1 where number =last_insert_id();
+number 2
+original_value 1aa
+f_double 1
+f_float 1
+f_double_7_2 1.00
+f_float_4_3 1.000
+f_double_u 1
+f_float_u 1
+f_double_15_1_u 1.0
+f_float_3_1_u 1.0
+set @value= "aa1";
+insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+Warnings:
+Warning 1265 Data truncated for column 'f_double' at row 1
+Warning 1265 Data truncated for column 'f_float' at row 1
+Warning 1265 Data truncated for column 'f_double_7_2' at row 1
+Warning 1265 Data truncated for column 'f_float_4_3' at row 1
+Warning 1265 Data truncated for column 'f_double_u' at row 1
+Warning 1265 Data truncated for column 'f_float_u' at row 1
+Warning 1265 Data truncated for column 'f_double_15_1_u' at row 1
+Warning 1265 Data truncated for column 'f_float_3_1_u' at row 1
+select * from t1 where number =last_insert_id();
+number 3
+original_value aa1
+f_double 0
+f_float 0
+f_double_7_2 0.00
+f_float_4_3 0.000
+f_double_u 0
+f_float_u 0
+f_double_15_1_u 0.0
+f_float_3_1_u 0.0
+set @value= "1e+1111111111a";
+insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+Warnings:
+Warning 1265 Data truncated for column 'f_double' at row 1
+Warning 1265 Data truncated for column 'f_float' at row 1
+Warning 1264 Data truncated; out of range for column 'f_float' at row 1
+Warning 1265 Data truncated for column 'f_double_7_2' at row 1
+Warning 1264 Data truncated; out of range for column 'f_double_7_2' at row 1
+Warning 1265 Data truncated for column 'f_float_4_3' at row 1
+Warning 1264 Data truncated; out of range for column 'f_float_4_3' at row 1
+Warning 1265 Data truncated for column 'f_double_u' at row 1
+Warning 1265 Data truncated for column 'f_float_u' at row 1
+Warning 1264 Data truncated; out of range for column 'f_float_u' at row 1
+Warning 1265 Data truncated for column 'f_double_15_1_u' at row 1
+Warning 1264 Data truncated; out of range for column 'f_double_15_1_u' at row 1
+Warning 1265 Data truncated for column 'f_float_3_1_u' at row 1
+Warning 1264 Data truncated; out of range for column 'f_float_3_1_u' at row 1
+select * from t1 where number =last_insert_id();
+number 4
+original_value 1e+1111111111a
+f_double 1.79769313486232e+308
+f_float 3.40282e+38
+f_double_7_2 99999.99
+f_float_4_3 9.999
+f_double_u 1.79769313486232e+308
+f_float_u 3.40282e+38
+f_double_15_1_u 99999999999999.9
+f_float_3_1_u 99.9
+set @value= "-1e+1111111111a";
+insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+Warnings:
+Warning 1265 Data truncated for column 'f_double' at row 1
+Warning 1265 Data truncated for column 'f_float' at row 1
+Warning 1264 Data truncated; out of range for column 'f_float' at row 1
+Warning 1265 Data truncated for column 'f_double_7_2' at row 1
+Warning 1264 Data truncated; out of range for column 'f_double_7_2' at row 1
+Warning 1265 Data truncated for column 'f_float_4_3' at row 1
+Warning 1264 Data truncated; out of range for column 'f_float_4_3' at row 1
+Warning 1265 Data truncated for column 'f_double_u' at row 1
+Warning 1264 Data truncated; out of range for column 'f_double_u' at row 1
+Warning 1265 Data truncated for column 'f_float_u' at row 1
+Warning 1264 Data truncated; out of range for column 'f_float_u' at row 1
+Warning 1265 Data truncated for column 'f_double_15_1_u' at row 1
+Warning 1264 Data truncated; out of range for column 'f_double_15_1_u' at row 1
+Warning 1265 Data truncated for column 'f_float_3_1_u' at row 1
+Warning 1264 Data truncated; out of range for column 'f_float_3_1_u' at row 1
+select * from t1 where number =last_insert_id();
+number 5
+original_value -1e+1111111111a
+f_double -1.79769313486232e+308
+f_float -3.40282e+38
+f_double_7_2 -99999.99
+f_float_4_3 -9.999
+f_double_u 0
+f_float_u 0
+f_double_15_1_u 0.0
+f_float_3_1_u 0.0
+set @value= 1e+1111111111;
+insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+Warnings:
+Warning 1264 Data truncated; out of range for column 'f_float' at row 1
+Warning 1264 Data truncated; out of range for column 'f_double_7_2' at row 1
+Warning 1264 Data truncated; out of range for column 'f_float_4_3' at row 1
+Warning 1264 Data truncated; out of range for column 'f_float_u' at row 1
+Warning 1264 Data truncated; out of range for column 'f_double_15_1_u' at row 1
+Warning 1264 Data truncated; out of range for column 'f_float_3_1_u' at row 1
+select * from t1 where number =last_insert_id();
+number 6
+original_value 1.7976931348623e+308
+f_double 1.79769313486232e+308
+f_float 3.40282e+38
+f_double_7_2 99999.99
+f_float_4_3 9.999
+f_double_u 1.79769313486232e+308
+f_float_u 3.40282e+38
+f_double_15_1_u 99999999999999.9
+f_float_3_1_u 99.9
+set @value= -1e+1111111111;
+insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+Warnings:
+Warning 1264 Data truncated; out of range for column 'f_float' at row 1
+Warning 1264 Data truncated; out of range for column 'f_double_7_2' at row 1
+Warning 1264 Data truncated; out of range for column 'f_float_4_3' at row 1
+Warning 1264 Data truncated; out of range for column 'f_double_u' at row 1
+Warning 1264 Data truncated; out of range for column 'f_float_u' at row 1
+Warning 1264 Data truncated; out of range for column 'f_double_15_1_u' at row 1
+Warning 1264 Data truncated; out of range for column 'f_float_3_1_u' at row 1
+select * from t1 where number =last_insert_id();
+number 7
+original_value -1.7976931348623e+308
+f_double -1.79769313486232e+308
+f_float -3.40282e+38
+f_double_7_2 -99999.99
+f_float_4_3 -9.999
+f_double_u 0
+f_float_u 0
+f_double_15_1_u 0.0
+f_float_3_1_u 0.0
+set @value= 1e+111;
+insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+Warnings:
+Warning 1264 Data truncated; out of range for column 'f_float' at row 1
+Warning 1264 Data truncated; out of range for column 'f_double_7_2' at row 1
+Warning 1264 Data truncated; out of range for column 'f_float_4_3' at row 1
+Warning 1264 Data truncated; out of range for column 'f_float_u' at row 1
+Warning 1264 Data truncated; out of range for column 'f_double_15_1_u' at row 1
+Warning 1264 Data truncated; out of range for column 'f_float_3_1_u' at row 1
+select * from t1 where number =last_insert_id();
+number 8
+original_value 1e+111
+f_double 1e+111
+f_float 3.40282e+38
+f_double_7_2 99999.99
+f_float_4_3 9.999
+f_double_u 1e+111
+f_float_u 3.40282e+38
+f_double_15_1_u 99999999999999.9
+f_float_3_1_u 99.9
+set @value= -1e+111;
+insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+Warnings:
+Warning 1264 Data truncated; out of range for column 'f_float' at row 1
+Warning 1264 Data truncated; out of range for column 'f_double_7_2' at row 1
+Warning 1264 Data truncated; out of range for column 'f_float_4_3' at row 1
+Warning 1264 Data truncated; out of range for column 'f_double_u' at row 1
+Warning 1264 Data truncated; out of range for column 'f_float_u' at row 1
+Warning 1264 Data truncated; out of range for column 'f_double_15_1_u' at row 1
+Warning 1264 Data truncated; out of range for column 'f_float_3_1_u' at row 1
+select * from t1 where number =last_insert_id();
+number 9
+original_value -1e+111
+f_double -1e+111
+f_float -3.40282e+38
+f_double_7_2 -99999.99
+f_float_4_3 -9.999
+f_double_u 0
+f_float_u 0
+f_double_15_1_u 0.0
+f_float_3_1_u 0.0
+set @value= 1;
+insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+select * from t1 where number =last_insert_id();
+number 10
+original_value 1
+f_double 1
+f_float 1
+f_double_7_2 1.00
+f_float_4_3 1.000
+f_double_u 1
+f_float_u 1
+f_double_15_1_u 1.0
+f_float_3_1_u 1.0
+set @value= -1;
+insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+Warnings:
+Warning 1264 Data truncated; out of range for column 'f_double_u' at row 1
+Warning 1264 Data truncated; out of range for column 'f_float_u' at row 1
+Warning 1264 Data truncated; out of range for column 'f_double_15_1_u' at row 1
+Warning 1264 Data truncated; out of range for column 'f_float_3_1_u' at row 1
+select * from t1 where number =last_insert_id();
+number 11
+original_value -1
+f_double -1
+f_float -1
+f_double_7_2 -1.00
+f_float_4_3 -1.000
+f_double_u 0
+f_float_u 0
+f_double_15_1_u 0.0
+f_float_3_1_u 0.0
+drop table t1;
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index ecd26f2d9fb..0a6a34f9a58 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -4,7 +4,7 @@ insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7,
create table t2 (payoutID SMALLINT UNSIGNED NOT NULL PRIMARY KEY);
insert into t2 (payoutID) SELECT DISTINCT payoutID FROM t1;
insert into t2 (payoutID) SELECT payoutID+10 FROM t1;
-Duplicate entry '16' for key 1
+ERROR 23000: Duplicate entry '16' for key 1
insert ignore into t2 (payoutID) SELECT payoutID+10 FROM t1;
select * from t2;
payoutID
@@ -35,7 +35,7 @@ PRIMARY KEY (`numeropost`,`numreponse`)
KEY `date` (`date`),
KEY `pseudo` (`pseudo`),
KEY `numreponse` (`numreponse`)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
CREATE TABLE `t2` (
`numeropost` bigint(20) unsigned NOT NULL default '0',
`icone` tinyint(4) unsigned NOT NULL default '0',
@@ -50,7 +50,7 @@ KEY `ip` (`ip`),
KEY `date` (`date`),
KEY `pseudo` (`pseudo`),
KEY `numreponse` (`numreponse`)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t2
(numeropost,icone,numreponse,contenu,pseudo,date,ip,signature) VALUES
(9,1,56,'test','joce','2001-07-25 13:50:53'
@@ -71,21 +71,24 @@ create table t2(a int);
insert into t2 values(1),(2);
reset master;
insert into t1 select * from t2;
-Duplicate entry '2' for key 1
+ERROR 23000: Duplicate entry '2' for key 1
show binlog events;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
-master-bin.001 79 Query 1 79 use `test`; insert into t1 select * from t2
+master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
+master-bin.000001 79 Query 1 79 use `test`; insert into t1 select * from t2
+select * from t1;
+a
+1
+2
drop table t1, t2;
-drop table if exists t1, t2;
create table t1(a int);
insert into t1 values(1),(1);
reset master;
create table t2(unique(a)) select a from t1;
-Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 1
show binlog events;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
+master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
drop table t1;
create table t1 (a int not null);
create table t2 (a int not null);
@@ -576,14 +579,14 @@ a
5
5
insert into t1 select * from t1,t1;
-Not unique table/alias: 't1'
+ERROR 42000: Not unique table/alias: 't1'
drop table t1,t2;
create table t1 (a int not null primary key, b char(10));
create table t2 (a int not null, b char(10));
insert into t1 values (1,"t1:1"),(3,"t1:3");
insert into t2 values (2,"t2:2"), (3,"t2:3");
insert into t1 select * from t2;
-Duplicate entry '3' for key 1
+ERROR 23000: Duplicate entry '3' for key 1
select * from t1;
a b
1 t1:1
@@ -627,6 +630,9 @@ NULL 1 100
NULL 2 100
create table t2(No int not null, Field int not null, Count int not null);
insert into t2 Select null, Field, Count From t1 Where Month=20030901 and Type=2;
+Warnings:
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'No' at row 1
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'No' at row 2
select * from t2;
No Field Count
0 1 100
diff --git a/mysql-test/r/insert_select.result.es b/mysql-test/r/insert_select.result.es
new file mode 100644
index 00000000000..9e11402733d
--- /dev/null
+++ b/mysql-test/r/insert_select.result.es
@@ -0,0 +1,635 @@
+drop table if exists t1,t2;
+create table t1 (bandID MEDIUMINT UNSIGNED NOT NULL PRIMARY KEY, payoutID SMALLINT UNSIGNED NOT NULL);
+insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7,12),(8,12);
+create table t2 (payoutID SMALLINT UNSIGNED NOT NULL PRIMARY KEY);
+insert into t2 (payoutID) SELECT DISTINCT payoutID FROM t1;
+insert into t2 (payoutID) SELECT payoutID+10 FROM t1;
+ERROR 23000: Duplicate entry '16' for key 1
+insert ignore into t2 (payoutID) SELECT payoutID+10 FROM t1;
+select * from t2;
+payoutID
+1
+4
+6
+9
+10
+11
+12
+14
+16
+19
+20
+22
+drop table t1,t2;
+CREATE TABLE `t1` (
+`numeropost` bigint(20) unsigned NOT NULL default '0',
+`icone` tinyint(4) unsigned NOT NULL default '0',
+`numreponse` bigint(20) unsigned NOT NULL auto_increment,
+`contenu` text NOT NULL,
+`pseudo` varchar(50) NOT NULL default '',
+`date` datetime NOT NULL default '0000-00-00 00:00:00',
+`ip` bigint(11) NOT NULL default '0',
+`signature` tinyint(1) unsigned NOT NULL default '0',
+PRIMARY KEY (`numeropost`,`numreponse`)
+,KEY `ip` (`ip`),
+KEY `date` (`date`),
+KEY `pseudo` (`pseudo`),
+KEY `numreponse` (`numreponse`)
+) ENGINE=MyISAM;
+CREATE TABLE `t2` (
+`numeropost` bigint(20) unsigned NOT NULL default '0',
+`icone` tinyint(4) unsigned NOT NULL default '0',
+`numreponse` bigint(20) unsigned NOT NULL auto_increment,
+`contenu` text NOT NULL,
+`pseudo` varchar(50) NOT NULL default '',
+`date` datetime NOT NULL default '0000-00-00 00:00:00',
+`ip` bigint(11) NOT NULL default '0',
+`signature` tinyint(1) unsigned NOT NULL default '0',
+PRIMARY KEY (`numeropost`,`numreponse`),
+KEY `ip` (`ip`),
+KEY `date` (`date`),
+KEY `pseudo` (`pseudo`),
+KEY `numreponse` (`numreponse`)
+) ENGINE=MyISAM;
+INSERT INTO t2
+(numeropost,icone,numreponse,contenu,pseudo,date,ip,signature) VALUES
+(9,1,56,'test','joce','2001-07-25 13:50:53'
+,3649052399,0);
+INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip)
+SELECT 1618,icone,contenu,pseudo,date,signature,ip FROM t2
+WHERE numeropost=9 ORDER BY numreponse ASC;
+show variables like '%bulk%';
+Variable_name Value
+bulk_insert_buffer_size 8388608
+INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip)
+SELECT 1718,icone,contenu,pseudo,date,signature,ip FROM t2
+WHERE numeropost=9 ORDER BY numreponse ASC;
+DROP TABLE t1,t2;
+create table t1(a int, unique(a));
+insert into t1 values(2);
+create table t2(a int);
+insert into t2 values(1),(2);
+reset master;
+insert into t1 select * from t2;
+ERROR 23000: Duplicate entry '2' for key 1
+show binlog events;
+select * from t1;
+a
+1
+2
+drop table t1, t2;
+create table t1(a int);
+insert into t1 values(1),(1);
+reset master;
+create table t2(unique(a)) select a from t1;
+ERROR 23000: Duplicate entry '1' for key 1
+show binlog events;
+drop table t1;
+create table t1 (a int not null);
+create table t2 (a int not null);
+insert into t1 values (1);
+insert into t1 values (a+2);
+insert into t1 values (a+3);
+insert into t1 values (4),(a+5);
+insert into t1 select * from t1;
+select * from t1;
+a
+1
+2
+3
+4
+5
+1
+2
+3
+4
+5
+insert into t1 select * from t1 as t2;
+select * from t1;
+a
+1
+2
+3
+4
+5
+1
+2
+3
+4
+5
+1
+2
+3
+4
+5
+1
+2
+3
+4
+5
+insert into t2 select * from t1 as t2;
+select * from t1;
+a
+1
+2
+3
+4
+5
+1
+2
+3
+4
+5
+1
+2
+3
+4
+5
+1
+2
+3
+4
+5
+insert into t1 select t2.a from t1,t2;
+select * from t1;
+a
+1
+2
+3
+4
+5
+1
+2
+3
+4
+5
+1
+2
+3
+4
+5
+1
+2
+3
+4
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+insert into t1 select * from t1,t1;
+ERROR 42000: Not unique table/alias: 't1'
+drop table t1,t2;
+create table t1 (a int not null primary key, b char(10));
+create table t2 (a int not null, b char(10));
+insert into t1 values (1,"t1:1"),(3,"t1:3");
+insert into t2 values (2,"t2:2"), (3,"t2:3");
+insert into t1 select * from t2;
+ERROR 23000: Duplicate entry '3' for key 1
+select * from t1;
+a b
+1 t1:1
+3 t1:3
+2 t2:2
+replace into t1 select * from t2;
+select * from t1;
+a b
+1 t1:1
+3 t2:3
+2 t2:2
+drop table t1,t2;
+CREATE TABLE t1 ( USID INTEGER UNSIGNED, ServerID TINYINT UNSIGNED, State ENUM ('unknown', 'Access-Granted', 'Session-Active', 'Session-Closed' ) NOT NULL DEFAULT 'unknown', SessionID CHAR(32), User CHAR(32) NOT NULL DEFAULT '<UNKNOWN>', NASAddr INTEGER UNSIGNED, NASPort INTEGER UNSIGNED, NASPortType INTEGER UNSIGNED, ConnectSpeed INTEGER UNSIGNED, CarrierType CHAR(32), CallingStationID CHAR(32), CalledStationID CHAR(32), AssignedAddr INTEGER UNSIGNED, SessionTime INTEGER UNSIGNED, PacketsIn INTEGER UNSIGNED, OctetsIn INTEGER UNSIGNED, PacketsOut INTEGER UNSIGNED, OctetsOut INTEGER UNSIGNED, TerminateCause INTEGER UNSIGNED, UnauthTime TINYINT UNSIGNED, AccessRequestTime DATETIME, AcctStartTime DATETIME, AcctLastTime DATETIME, LastModification TIMESTAMP NOT NULL);
+CREATE TABLE t2 ( USID INTEGER UNSIGNED AUTO_INCREMENT, ServerID TINYINT UNSIGNED, State ENUM ('unknown', 'Access-Granted', 'Session-Active', 'Session-Closed' ) NOT NULL DEFAULT 'unknown', SessionID CHAR(32), User TEXT NOT NULL, NASAddr INTEGER UNSIGNED, NASPort INTEGER UNSIGNED, NASPortType INTEGER UNSIGNED, ConnectSpeed INTEGER UNSIGNED, CarrierType CHAR(32), CallingStationID CHAR(32), CalledStationID CHAR(32), AssignedAddr INTEGER UNSIGNED, SessionTime INTEGER UNSIGNED, PacketsIn INTEGER UNSIGNED, OctetsIn INTEGER UNSIGNED, PacketsOut INTEGER UNSIGNED, OctetsOut INTEGER UNSIGNED, TerminateCause INTEGER UNSIGNED, UnauthTime TINYINT UNSIGNED, AccessRequestTime DATETIME, AcctStartTime DATETIME, AcctLastTime DATETIME, LastModification TIMESTAMP NOT NULL, INDEX(USID,ServerID,NASAddr,SessionID), INDEX(AssignedAddr));
+INSERT INTO t1 VALUES (39,42,'Access-Granted','46','491721000045',2130706433,17690,NULL,NULL,'Localnet','491721000045','49172200000',754974766,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2003-07-18 00:11:21',NULL,NULL,20030718001121);
+INSERT INTO t2 SELECT USID, ServerID, State, SessionID, User, NASAddr, NASPort, NASPortType, ConnectSpeed, CarrierType, CallingStationID, CalledStationID, AssignedAddr, SessionTime, PacketsIn, OctetsIn, PacketsOut, OctetsOut, TerminateCause, UnauthTime, AccessRequestTime, AcctStartTime, AcctLastTime, LastModification from t1 LIMIT 1;
+drop table t1,t2;
+CREATE TABLE t1(
+Month date NOT NULL,
+Type tinyint(3) unsigned NOT NULL auto_increment,
+Field int(10) unsigned NOT NULL,
+Count int(10) unsigned NOT NULL,
+UNIQUE KEY Month (Month,Type,Field)
+);
+insert into t1 Values
+(20030901, 1, 1, 100),
+(20030901, 1, 2, 100),
+(20030901, 2, 1, 100),
+(20030901, 2, 2, 100),
+(20030901, 3, 1, 100);
+select * from t1;
+Month Type Field Count
+2003-09-01 1 1 100
+2003-09-01 1 2 100
+2003-09-01 2 1 100
+2003-09-01 2 2 100
+2003-09-01 3 1 100
+Select null, Field, Count From t1 Where Month=20030901 and Type=2;
+NULL Field Count
+NULL 1 100
+NULL 2 100
+create table t2(No int not null, Field int not null, Count int not null);
+insert into t2 Select null, Field, Count From t1 Where Month=20030901 and Type=2;
+Warnings:
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'No' at row 1
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'No' at row 2
+select * from t2;
+No Field Count
+0 1 100
+0 2 100
+drop table t1, t2;
diff --git a/mysql-test/r/insert_update.result b/mysql-test/r/insert_update.result
new file mode 100644
index 00000000000..753dc2cd749
--- /dev/null
+++ b/mysql-test/r/insert_update.result
@@ -0,0 +1,169 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT, b INT, c INT, UNIQUE (A), UNIQUE(B));
+INSERT t1 VALUES (1,2,10), (3,4,20);
+INSERT t1 VALUES (5,6,30) ON DUPLICATE KEY UPDATE c=c+100;
+SELECT * FROM t1;
+a b c
+1 2 10
+3 4 20
+5 6 30
+INSERT t1 VALUES (5,7,40) ON DUPLICATE KEY UPDATE c=c+100;
+SELECT * FROM t1;
+a b c
+1 2 10
+3 4 20
+5 6 130
+INSERT t1 VALUES (8,4,50) ON DUPLICATE KEY UPDATE c=c+1000;
+SELECT * FROM t1;
+a b c
+1 2 10
+3 4 1020
+5 6 130
+INSERT t1 VALUES (1,4,60) ON DUPLICATE KEY UPDATE c=c+10000;
+SELECT * FROM t1;
+a b c
+1 2 10010
+3 4 1020
+5 6 130
+INSERT t1 VALUES (1,9,70) ON DUPLICATE KEY UPDATE c=c+100000, b=4;
+ERROR 23000: Duplicate entry '4' for key 2
+SELECT * FROM t1;
+a b c
+1 2 10010
+3 4 1020
+5 6 130
+TRUNCATE TABLE t1;
+INSERT t1 VALUES (1,2,10), (3,4,20);
+INSERT t1 VALUES (5,6,30), (7,4,40), (8,9,60) ON DUPLICATE KEY UPDATE c=c+100;
+SELECT * FROM t1;
+a b c
+1 2 10
+3 4 120
+5 6 30
+8 9 60
+INSERT t1 SET a=5 ON DUPLICATE KEY UPDATE b=0;
+SELECT * FROM t1;
+a b c
+1 2 10
+3 4 120
+5 0 30
+8 9 60
+INSERT t1 VALUES (2,1,11), (7,4,40) ON DUPLICATE KEY UPDATE c=c+VALUES(a);
+SELECT *, VALUES(a) FROM t1;
+a b c VALUES(a)
+1 2 10 NULL
+3 4 127 NULL
+5 0 30 NULL
+8 9 60 NULL
+2 1 11 NULL
+explain extended SELECT *, VALUES(a) FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5
+Warnings:
+Note 1003 select test.t1.a AS `a`,test.t1.b AS `b`,test.t1.c AS `c`,values(test.t1.a) AS `VALUES(a)` from test.t1
+explain extended select * from t1 where values(a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+Warnings:
+Note 1003 select test.t1.a AS `a`,test.t1.b AS `b`,test.t1.c AS `c` from test.t1
+DROP TABLE t1;
+create table t1(a int primary key, b int);
+insert into t1 values(1,1),(2,2),(3,3),(4,4),(5,5);
+select * from t1;
+a b
+1 1
+2 2
+3 3
+4 4
+5 5
+insert into t1 values(4,14),(5,15),(6,16),(7,17),(8,18)
+on duplicate key update b=b+10;
+affected rows: 7
+info: Records: 5 Duplicates: 2 Warnings: 0
+select * from t1;
+a b
+1 1
+2 2
+3 3
+4 14
+5 15
+6 16
+7 17
+8 18
+replace into t1 values(5,25),(6,26),(7,27),(8,28),(9,29);
+affected rows: 9
+info: Records: 5 Duplicates: 4 Warnings: 0
+select * from t1;
+a b
+1 1
+2 2
+3 3
+4 14
+5 25
+6 26
+7 27
+8 28
+9 29
+drop table t1;
+CREATE TABLE t1 (a INT, b INT, c INT, UNIQUE (A), UNIQUE(B));
+INSERT t1 VALUES (1,2,10), (3,4,20);
+INSERT t1 SELECT 5,6,30 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100;
+SELECT * FROM t1;
+a b c
+1 2 10
+3 4 20
+5 6 30
+INSERT t1 SELECT 5,7,40 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100;
+SELECT * FROM t1;
+a b c
+1 2 10
+3 4 20
+5 6 130
+INSERT t1 SELECT 8,4,50 FROM DUAL ON DUPLICATE KEY UPDATE c=c+1000;
+SELECT * FROM t1;
+a b c
+1 2 10
+3 4 1020
+5 6 130
+INSERT t1 SELECT 1,4,60 FROM DUAL ON DUPLICATE KEY UPDATE c=c+10000;
+SELECT * FROM t1;
+a b c
+1 2 10010
+3 4 1020
+5 6 130
+INSERT t1 SELECT 1,9,70 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100000, b=4;
+ERROR 23000: Duplicate entry '4' for key 2
+SELECT * FROM t1;
+a b c
+1 2 10010
+3 4 1020
+5 6 130
+TRUNCATE TABLE t1;
+INSERT t1 VALUES (1,2,10), (3,4,20);
+CREATE TABLE t2 (x INT, y INT, z INT, d INT);
+INSERT t2 VALUES (5,6,30,1), (7,4,40,1), (8,9,60,1);
+INSERT t2 VALUES (2,1,11,2), (7,4,40,2);
+INSERT t1 SELECT x,y,z FROM t2 WHERE d=1 ON DUPLICATE KEY UPDATE c=c+100;
+SELECT * FROM t1;
+a b c
+1 2 10
+3 4 120
+5 6 30
+8 9 60
+INSERT t1 SET a=5 ON DUPLICATE KEY UPDATE b=0;
+SELECT * FROM t1;
+a b c
+1 2 10
+3 4 120
+5 0 30
+8 9 60
+INSERT t1 SELECT x,y,z FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a);
+SELECT *, VALUES(a) FROM t1;
+a b c VALUES(a)
+1 2 10 NULL
+3 4 127 NULL
+5 0 30 NULL
+8 9 60 NULL
+2 1 11 NULL
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/r/isam.result b/mysql-test/r/isam.result
index 680d1d6d322..52eb2d73ed5 100644
--- a/mysql-test/r/isam.result
+++ b/mysql-test/r/isam.result
@@ -1,11 +1,11 @@
drop table if exists t1,t2;
-create table t1 (a tinyint not null auto_increment, b blob not null, primary key (a)) type=isam;
+create table t1 (a tinyint not null auto_increment, b blob not null, primary key (a)) engine=isam;
delete from t1 where (a & 1);
select sum(length(b)) from t1;
sum(length(b))
3274494
drop table t1;
-create table t1 (a int not null auto_increment,b int, primary key (a)) type=isam;
+create table t1 (a int not null auto_increment,b int, primary key (a)) engine=isam;
insert into t1 values (1,1),(NULL,2),(3,3),(NULL,4);
delete from t1 where a=4 or a=2;
insert into t1 values (NULL,4),(NULL,5),(6,6);
@@ -29,32 +29,34 @@ a b c
4 4 NULL
6 6 6
drop table t1;
-create table t1 (a int,b text, index(a)) type=isam;
-Column 'a' is used with UNIQUE or INDEX but is not defined as NOT NULL
-create table t1 (a int,b text, index(b)) type=isam;
-BLOB column 'b' can't be used in key specification with the used table type
-create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=isam;
-Incorrect table definition; There can only be one auto column and it must be defined as a key
-create table t1 (ordid int(8), unique (ordid)) type=isam;
-Column 'ordid' is used with UNIQUE or INDEX but is not defined as NOT NULL
+create table t1 (a int,b text, index(a)) engine=isam;
+ERROR 42000: Column 'a' is used with UNIQUE or INDEX but is not defined as NOT NULL
+create table t1 (a int,b text, index(b)) engine=isam;
+ERROR 42000: BLOB column 'b' can't be used in key specification with the used table type
+create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) engine=isam;
+ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
+create table t1 (ordid int(8), unique (ordid)) engine=isam;
+ERROR 42000: Column 'ordid' is used with UNIQUE or INDEX but is not defined as NOT NULL
drop table if exists t1;
+Warnings:
+Note 1051 Unknown table 't1'
create table t1 (a int not null primary key, b int not null,c int not null, key(b,c));
insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4);
-create table t2 type=isam select * from t1;
+create table t2 engine=isam select * from t1;
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
check table t1,t2;
Table Op Msg_type Msg_text
test.t1 check status OK
-test.t2 check error The handler for the table doesn't support check
+test.t2 check note The storage engine for the table doesn't support check
repair table t1,t2;
Table Op Msg_type Msg_text
test.t1 repair status OK
-test.t2 repair error The handler for the table doesn't support repair
+test.t2 repair note The storage engine for the table doesn't support repair
check table t2,t1;
Table Op Msg_type Msg_text
-test.t2 check error The handler for the table doesn't support check
+test.t2 check note The storage engine for the table doesn't support check
test.t1 check status OK
lock tables t1 write;
check table t2,t1;
@@ -67,10 +69,10 @@ a int(11) PRI 0
b int(11) MUL 0
c int(11) 0
show full columns from t1;
-Field Type Null Key Default Extra Privileges
-a int(11) PRI 0 select,insert,update,references
-b int(11) MUL 0 select,insert,update,references
-c int(11) 0 select,insert,update,references
+Field Type Collation Null Key Default Extra Privileges Comment
+a int(11) NULL PRI 0 select,insert,update,references
+b int(11) NULL MUL 0 select,insert,update,references
+c int(11) NULL 0 select,insert,update,references
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 0 PRIMARY 1 a A 4 NULL NULL BTREE
diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result
index 039b6e1cba3..dc763472b0e 100644
--- a/mysql-test/r/join.result
+++ b/mysql-test/r/join.result
@@ -61,12 +61,12 @@ select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0 where t2.id=75
id id
NULL 75
explain select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0 where t2.id=75 and t1.id is null;
-table type possible_keys key key_len ref rows Extra
-t1 const PRIMARY NULL NULL NULL 1 Impossible ON condition
-t2 ALL NULL NULL NULL NULL 3 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const PRIMARY NULL NULL NULL 1 Impossible ON condition
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
explain select t1.id, t2.id from t1, t2 where t2.id = t1.id and t1.id <0 and t1.id > 0;
-Comment
-Impossible WHERE noticed after reading const tables
+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
drop table t1,t2;
CREATE TABLE t1 (
id int(11) NOT NULL auto_increment,
@@ -126,17 +126,17 @@ a
1
2
select t1.a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a) left join t1 as t32 using (a) left join t1 as t33 using (a) left join t1 as t34 using (a) left join t1 as t35 using (a) left join t1 as t36 using (a) left join t1 as t37 using (a) left join t1 as t38 using (a) left join t1 as t39 using (a) left join t1 as t40 using (a) left join t1 as t41 using (a) left join t1 as t42 using (a) left join t1 as t43 using (a) left join t1 as t44 using (a) left join t1 as t45 using (a) left join t1 as t46 using (a) left join t1 as t47 using (a) left join t1 as t48 using (a) left join t1 as t49 using (a) left join t1 as t50 using (a) left join t1 as t51 using (a) left join t1 as t52 using (a) left join t1 as t53 using (a) left join t1 as t54 using (a) left join t1 as t55 using (a) left join t1 as t56 using (a) left join t1 as t57 using (a) left join t1 as t58 using (a) left join t1 as t59 using (a) left join t1 as t60 using (a) left join t1 as t61 using (a) left join t1 as t62 using (a) left join t1 as t63 using (a) left join t1 as t64 using (a) left join t1 as t65 using (a);
-Too many tables. MySQL can only use XX tables in a join
+ERROR HY000: Too many tables; MySQL can only use XX tables in a join
drop table t1;
CREATE TABLE t1 (
a int(11) NOT NULL,
b int(11) NOT NULL,
PRIMARY KEY (a,b)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(2,3);
CREATE TABLE t2 (
a int(11) default NULL
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t2 VALUES (2),(3);
SELECT t1.a,t2.a,b FROM t1,t2 WHERE t1.a=t2.a AND (t1.a=1 OR t1.a=2) AND b>=1 AND b<=3;
a a b
@@ -236,13 +236,13 @@ min_value double default NULL,
max_value double default NULL,
t3_id int(11) default NULL,
item_id int(11) default NULL
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (12,5,'Percent','Cost',-1,0,-1,-1),(14,4,'Percent','Cost',-1,0,-1,-1),(18,5,'Percent','Cost',-1,0,-1,-1),(19,4,'Percent','Cost',-1,0,-1,-1),(20,5,'Percent','Cost',100,-1,22,291),(21,5,'Percent','Cost',100,-1,18,291),(22,1,'Percent','Cost',100,-1,6,291),(23,1,'Percent','Cost',100,-1,21,291),(24,1,'Percent','Cost',100,-1,9,291),(25,1,'Percent','Cost',100,-1,4,291),(26,1,'Percent','Cost',100,-1,20,291),(27,4,'Percent','Cost',100,-1,7,202),(28,1,'Percent','Cost',50,-1,-1,137),(29,2,'Percent','Cost',100,-1,4,354),(30,2,'Percent','Cost',100,-1,9,137),(93,2,'Cost','Cost',-1,10000000,-1,-1);
CREATE TABLE t2 (
id int(10) unsigned NOT NULL auto_increment,
name varchar(255) default NULL,
PRIMARY KEY (id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,'s1'),(2,'s2'),(3,'s3'),(4,'s4'),(5,'s5');
select t1.*, t2.* from t1, t2 where t2.id=t1.t2_id limit 2;
t1_id t2_id type cost_unit min_value max_value t3_id item_id id name
@@ -255,7 +255,7 @@ emp_id varchar(30) NOT NULL default '',
rate_code varchar(10) default NULL,
UNIQUE KEY site_emp (siteid,emp_id),
KEY siteid (siteid)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('rivercats','psmith','cust'), ('rivercats','KWalker','cust');
CREATE TABLE t2 (
siteid varchar(25) NOT NULL default '',
@@ -263,7 +263,7 @@ rate_code varchar(10) NOT NULL default '',
base_rate float NOT NULL default '0',
PRIMARY KEY (siteid,rate_code),
FULLTEXT KEY rate_code (rate_code)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t2 VALUES ('rivercats','cust',20);
SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE emp.emp_id = 'psmith' AND lr.siteid = 'rivercats';
rate_code base_rate
@@ -277,12 +277,18 @@ CREATE TABLE t2 (ID INTEGER NOT NULL PRIMARY KEY, Value2 VARCHAR(255));
INSERT INTO t1 VALUES (1, 'A');
INSERT INTO t2 VALUES (1, 'B');
SELECT * FROM t1 NATURAL JOIN t2 WHERE 1 AND (Value1 = 'A' AND Value2 <> 'B');
-ID Value1 ID Value2
+ID Value1 Value2
SELECT * FROM t1 NATURAL JOIN t2 WHERE 1 AND Value1 = 'A' AND Value2 <> 'B';
-ID Value1 ID Value2
+ID Value1 Value2
SELECT * FROM t1 NATURAL JOIN t2 WHERE (Value1 = 'A' AND Value2 <> 'B') AND 1;
-ID Value1 ID Value2
+ID Value1 Value2
drop table t1,t2;
+CREATE TABLE t1 (a int);
+CREATE TABLE t2 (b int);
+CREATE TABLE t3 (c int);
+SELECT * FROM t1 NATURAL JOIN t2 NATURAL JOIN t3;
+a b c
+DROP TABLE t1, t2, t3;
create table t1 (i int);
create table t2 (i int);
create table t3 (i int);
diff --git a/mysql-test/r/join_crash.result b/mysql-test/r/join_crash.result
index c7bca9f7497..c1671ea7e20 100644
--- a/mysql-test/r/join_crash.result
+++ b/mysql-test/r/join_crash.result
@@ -10,7 +10,7 @@ billing_contact_ptr int(11) default NULL,
comments mediumtext,
PRIMARY KEY (project_id),
UNIQUE KEY project (client_ptr,project_name)
-) TYPE=MyISAM PACK_KEYS=1;
+) ENGINE=MyISAM PACK_KEYS=1;
INSERT INTO t1 VALUES (1,0,'Rejected Time',1,NULL,NULL,NULL,NULL);
INSERT INTO t1 VALUES (209,0,'MDGRAD Proposal/Investigation',97,NULL,NULL,NULL,'');
INSERT INTO t1 VALUES (208,0,'Font 9 Design',84,NULL,NULL,NULL,'');
@@ -31,7 +31,7 @@ work_load int(11) default NULL,
PRIMARY KEY (period_id),
KEY period_index (period_type,period_key),
KEY date_index (start_date,end_date)
-) TYPE=MyISAM PACK_KEYS=1;
+) ENGINE=MyISAM PACK_KEYS=1;
INSERT INTO t2 VALUES (1,'user_table',98,'2000-01-01 00:00:00',NULL,NULL);
INSERT INTO t2 VALUES (2,'user_table',99,'2000-01-01 00:00:00',NULL,NULL);
INSERT INTO t2 VALUES (3,'user_table',100,'2000-01-01 00:00:00',NULL,NULL);
@@ -57,7 +57,7 @@ amount_received float(10,2) default NULL,
adjustment float(10,2) default NULL,
PRIMARY KEY (budget_id),
UNIQUE KEY po (project_ptr,po_number)
-) TYPE=MyISAM PACK_KEYS=1;
+) ENGINE=MyISAM PACK_KEYS=1;
CREATE TABLE t4 (
client_id int(11) NOT NULL auto_increment,
client_row_lock int(11) NOT NULL default '0',
@@ -66,7 +66,7 @@ contact_ptr int(11) default NULL,
comments mediumtext,
PRIMARY KEY (client_id),
UNIQUE KEY client_name (client_name)
-) TYPE=MyISAM PACK_KEYS=1;
+) ENGINE=MyISAM PACK_KEYS=1;
INSERT INTO t4 VALUES (1,0,'CPS',NULL,NULL);
select distinct
t1.project_id as project_id,
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index 5778b2f9b72..c045aa0d00a 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -3,7 +3,7 @@ CREATE TABLE t1 (
grp int(11) default NULL,
a bigint(20) unsigned default NULL,
c char(10) NOT NULL default ''
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1,'a'),(2,2,'b'),(2,3,'c'),(3,4,'E'),(3,5,'C'),(3,6,'D'),(NULL,NULL,'');
create table t2 (id int, a bigint unsigned not null, c char(10), d int, primary key (a));
insert into t2 values (1,1,"a",1),(3,4,"A",4),(3,5,"B",5),(3,6,"C",6),(4,7,"D",7);
@@ -90,12 +90,12 @@ grp a c id a c d
2 3 c NULL NULL NULL NULL
NULL NULL NULL NULL NULL NULL
explain select t1.*,t2.* from t1,t2 where t1.a=t2.a and isnull(t2.a)=1;
-Comment
-Impossible WHERE
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
explain select t1.*,t2.* from t1 left join t2 on t1.a=t2.a where isnull(t2.a)=1;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 7
-t2 eq_ref PRIMARY PRIMARY 8 t1.a 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 7
+1 SIMPLE t2 eq_ref PRIMARY PRIMARY 8 test.t1.a 1 Using where
select t1.*,t2.*,t3.a from t1 left join t2 on (t1.a=t2.a) left join t1 as t3 on (t2.a=t3.a);
grp a c id a c d a
1 1 a 1 1 a 1 1
@@ -106,11 +106,11 @@ grp a c id a c d a
3 6 D 3 6 C 6 6
NULL NULL NULL NULL NULL NULL NULL
explain select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t1.a=t3.a);
-Cross dependency found in OUTER JOIN. Examine your ON conditions
+ERROR 42000: Cross dependency found in OUTER JOIN; examine your ON conditions
select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t1.a=t3.a);
-Cross dependency found in OUTER JOIN. Examine your ON conditions
+ERROR 42000: Cross dependency found in OUTER JOIN; examine your ON conditions
select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t2.a=t3.a);
-Cross dependency found in OUTER JOIN. Examine your ON conditions
+ERROR 42000: Cross dependency found in OUTER JOIN; examine your ON conditions
select t1.*,t2.* from t1 inner join t2 using (a);
grp a c id a c d
1 1 a 1 1 a 1
@@ -124,8 +124,8 @@ grp a c id a c d
3 5 C 3 5 B 5
3 6 D 3 6 C 6
select t1.*,t2.* from t1 natural join t2;
-grp a c id a c d
-1 1 a 1 1 a 1
+grp a c id d
+1 1 a 1 1
drop table t1,t2;
CREATE TABLE t1 (
usr_id INT unsigned NOT NULL,
@@ -169,7 +169,7 @@ usr_id uniq_id increment usr2_id c_amount max
3 4 84676 NULL NULL NULL
INSERT INTO t2 VALUES (2,3,3000,6000,0,0,746584,837484,'yes');
INSERT INTO t2 VALUES (2,3,3000,6000,0,0,746584,837484,'yes');
-Duplicate entry '2-3' for key 1
+ERROR 23000: Duplicate entry '2-3' for key 1
INSERT INTO t2 VALUES (7,3,1000,2000,0,0,746294,937484,'yes');
SELECT t1.usr_id,t1.uniq_id,t1.increment,t2.usr2_id,t2.c_amount,t2.max FROM t1 LEFT JOIN t2 ON t2.id = t1.uniq_id WHERE t1.uniq_id = 4 ORDER BY t2.c_amount;
usr_id uniq_id increment usr2_id c_amount max
@@ -181,7 +181,6 @@ SELECT t1.usr_id,t1.uniq_id,t1.increment,t2.usr2_id,t2.c_amount,t2.max FROM t1 L
usr_id uniq_id increment usr2_id c_amount max
3 4 84676 NULL NULL NULL
drop table t1,t2;
-drop table if exists t1,t2,t3,t4;
CREATE TABLE t1 (
cod_asig int(11) DEFAULT '0' NOT NULL,
desc_larga_cat varchar(80) DEFAULT '' NOT NULL,
@@ -311,13 +310,13 @@ select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where
name name id
Lilliana Angelovska NULL NULL
explain select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where t2.id is null;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 3
-t2 ALL NULL NULL NULL NULL 3 Using where; Not exists
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where; Not exists
explain select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where t2.name is null;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 3
-t2 ALL NULL NULL NULL NULL 3 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
select count(*) from t1 left join t2 on (t1.id = t2.owner);
count(*)
4
@@ -331,13 +330,13 @@ select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where
name name id
Lilliana Angelovska NULL NULL
explain select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where t2.id is null;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 3
-t2 ALL NULL NULL NULL NULL 3 Using where; Not exists
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where; Not exists
explain select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where t2.name is null;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 3
-t2 ALL NULL NULL NULL NULL 3 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
select count(*) from t2 right join t1 on (t1.id = t2.owner);
count(*)
4
@@ -407,7 +406,7 @@ insert into t3 values (1);
insert into t4 values (1,1);
insert into t5 values (1,1);
explain select * from t3 left join t4 on t4.seq_1_id = t2.t2_id left join t1 on t1.t1_id = t4.seq_0_id left join t5 on t5.seq_0_id = t1.t1_id left join t2 on t2.t2_id = t5.seq_1_id where t3.t3_id = 23;
-Cross dependency found in OUTER JOIN. Examine your ON conditions
+ERROR 42000: Cross dependency found in OUTER JOIN; examine your ON conditions
drop table t1,t2,t3,t4,t5;
create table t1 (n int, m int, o int, key(n));
create table t2 (n int not null, m int, o int, primary key(n));
@@ -468,10 +467,10 @@ count color
15 white
7 green
select * from t2 natural join t1;
-count color color name
-10 green green lime
-7 green green lime
-5 black black grape
+count color name
+10 green lime
+7 green lime
+5 black grape
select t2.count, t1.name from t2 natural join t1;
count name
10 lime
@@ -613,9 +612,9 @@ UNIQUE id (id,idx)
);
INSERT INTO t2 VALUES (1,1);
explain SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 2
-t2 ref id id 4 t1.id 1 Using where; Using index; Not exists
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2
+1 SIMPLE t2 ref id id 4 test.t1.id 1 Using where; Using index; Not exists
SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL;
id name id idx
2 no NULL NULL
@@ -633,9 +632,9 @@ create table t2 (fooID smallint unsigned not null, barID smallint unsigned not n
insert into t1 (fooID) values (10),(20),(30);
insert into t2 values (10,1),(20,2),(30,3);
explain select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30;
-table type possible_keys key key_len ref rows Extra
-t2 index NULL PRIMARY 4 NULL 3 Using index
-t1 eq_ref PRIMARY PRIMARY 2 const 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL PRIMARY 4 NULL 3 Using index
+1 SIMPLE t1 const PRIMARY PRIMARY 2 const 1 Using where; Using index
select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30;
fooID barID fooID
10 1 NULL
@@ -647,7 +646,6 @@ fooID barID fooID
20 2 NULL
30 3 30
drop table t1,t2;
-drop table if exists t3;
create table t1 (i int);
create table t2 (i int);
create table t3 (i int);
@@ -665,7 +663,7 @@ create table t3 (f3 integer,f5 integer);
select * from t1
left outer join t2 using (f2)
left outer join t3 using (f3);
-Unknown column 'test.t2.f3' in 'on clause'
+ERROR 42S22: Unknown column 'test.t2.f3' in 'on clause'
drop table t1,t2,t3;
create table t1 (a1 int, a2 int);
create table t2 (b1 int not null, b2 int);
@@ -679,8 +677,142 @@ a1 a2 b1 b2 c1 c2
2 2 2 3 NULL NULL
3 2 NULL NULL 3 4
explain select * from t1 left join t2 on b1 = a1 left join t3 on c1 = a1 and b1 is null;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 3
-t2 ALL NULL NULL NULL NULL 2
-t3 ALL NULL NULL NULL NULL 2
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2
drop table t1, t2, t3;
+create table t1 (
+match_id tinyint(3) unsigned not null auto_increment,
+home tinyint(3) unsigned default '0',
+unique key match_id (match_id),
+key match_id_2 (match_id)
+);
+insert into t1 values("1", "2");
+create table t2 (
+player_id tinyint(3) unsigned default '0',
+match_1_h tinyint(3) unsigned default '0',
+key player_id (player_id)
+);
+insert into t2 values("1", "5");
+insert into t2 values("2", "9");
+insert into t2 values("3", "3");
+insert into t2 values("4", "7");
+insert into t2 values("5", "6");
+insert into t2 values("6", "8");
+insert into t2 values("7", "4");
+insert into t2 values("8", "12");
+insert into t2 values("9", "11");
+insert into t2 values("10", "10");
+explain select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
+(t2 s left join t1 m on m.match_id = 1)
+order by m.match_id desc;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE s ALL NULL NULL NULL NULL 10
+1 SIMPLE m const match_id,match_id_2 match_id 1 const 1 Using where
+explain select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
+(t2 s left join t1 m on m.match_id = 1)
+order by UUX desc;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE s ALL NULL NULL NULL NULL 10 Using temporary; Using filesort
+1 SIMPLE m const match_id,match_id_2 match_id 1 const 1 Using where
+select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
+(t2 s left join t1 m on m.match_id = 1)
+order by UUX desc;
+player_id match_1_h * match_id home UUX
+8 12 * 1 2 10
+9 11 * 1 2 9
+10 10 * 1 2 8
+2 9 * 1 2 7
+6 8 * 1 2 6
+4 7 * 1 2 5
+5 6 * 1 2 4
+1 5 * 1 2 3
+7 4 * 1 2 2
+3 3 * 1 2 1
+explain select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
+t2 s straight_join t1 m where m.match_id = 1
+order by UUX desc;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE s ALL NULL NULL NULL NULL 10 Using temporary; Using filesort
+1 SIMPLE m const match_id,match_id_2 match_id 1 const 1 Using where
+select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
+t2 s straight_join t1 m where m.match_id = 1
+order by UUX desc;
+player_id match_1_h * match_id home UUX
+8 12 * 1 2 10
+9 11 * 1 2 9
+10 10 * 1 2 8
+2 9 * 1 2 7
+6 8 * 1 2 6
+4 7 * 1 2 5
+5 6 * 1 2 4
+1 5 * 1 2 3
+7 4 * 1 2 2
+3 3 * 1 2 1
+drop table t1, t2;
+create table t1 (a int, b int, unique index idx (a, b));
+create table t2 (a int, b int, c int, unique index idx (a, b));
+insert into t1 values (1, 10), (1,11), (2,10), (2,11);
+insert into t2 values (1,10,3);
+select t1.a, t1.b, t2.c from t1 left join t2
+on t1.a=t2.a and t1.b=t2.b and t2.c=3
+where t1.a=1 and t2.c is null;
+a b c
+1 11 NULL
+drop table t1, t2;
+CREATE TABLE t1 (
+ts_id bigint(20) default NULL,
+inst_id tinyint(4) default NULL,
+flag_name varchar(64) default NULL,
+flag_value text,
+UNIQUE KEY ts_id (ts_id,inst_id,flag_name)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ts_id bigint(20) default NULL,
+inst_id tinyint(4) default NULL,
+flag_name varchar(64) default NULL,
+flag_value text,
+UNIQUE KEY ts_id (ts_id,inst_id,flag_name)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES
+(111056548820001, 0, 'flag1', NULL),
+(111056548820001, 0, 'flag2', NULL),
+(2, 0, 'other_flag', NULL);
+INSERT INTO t2 VALUES
+(111056548820001, 3, 'flag1', 'sss');
+SELECT t1.flag_name,t2.flag_value
+FROM t1 LEFT JOIN t2
+ON (t1.ts_id = t2.ts_id AND t1.flag_name = t2.flag_name AND
+t2.inst_id = 3)
+WHERE t1.inst_id = 0 AND t1.ts_id=111056548820001 AND
+t2.flag_value IS NULL;
+flag_name flag_value
+flag2 NULL
+DROP TABLE t1,t2;
+CREATE TABLE invoice (
+id int(11) unsigned NOT NULL auto_increment,
+text_id int(10) unsigned default NULL,
+PRIMARY KEY (id)
+);
+INSERT INTO invoice VALUES("1", "0");
+INSERT INTO invoice VALUES("2", "10");
+CREATE TABLE text_table (
+text_id char(3) NOT NULL default '',
+language_id char(3) NOT NULL default '',
+text_data text,
+PRIMARY KEY (text_id,language_id)
+);
+INSERT INTO text_table VALUES("0", "EN", "0-EN");
+INSERT INTO text_table VALUES("0", "SV", "0-SV");
+INSERT INTO text_table VALUES("10", "EN", "10-EN");
+INSERT INTO text_table VALUES("10", "SV", "10-SV");
+SELECT invoice.id, invoice.text_id, text_table.text_data
+FROM invoice LEFT JOIN text_table
+ON invoice.text_id = text_table.text_id
+AND text_table.language_id = 'SV'
+ WHERE (invoice.id LIKE '%' OR text_table.text_data LIKE '%');
+id text_id text_data
+1 0 0-SV
+2 10 10-SV
+DROP TABLE invoice, text_table;
diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result
index 31d35a681aa..cceaf393a60 100644
--- a/mysql-test/r/key.result
+++ b/mysql-test/r/key.result
@@ -1,4 +1,5 @@
drop table if exists t1,t2,t3;
+SET SQL_WARNINGS=1;
CREATE TABLE t1 (
ID CHAR(32) NOT NULL,
name CHAR(32) NOT NULL,
@@ -32,6 +33,11 @@ KEY price (price,area,type,transityes,shopsyes,schoolsyes,petsyes)
INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','N','N','N','N');
INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','N','N','N','N');
INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','','','','');
+Warnings:
+Warning 1265 Data truncated for column 'transityes' at row 1
+Warning 1265 Data truncated for column 'shopsyes' at row 1
+Warning 1265 Data truncated for column 'schoolsyes' at row 1
+Warning 1265 Data truncated for column 'petsyes' at row 1
INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','Y','Y','Y','Y');
INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','Y','Y','Y','Y');
INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','Y','Y','Y','Y');
@@ -70,13 +76,12 @@ CCident varchar(50) DEFAULT '' NOT NULL,
PRIMARY KEY (name,author,category)
);
INSERT INTO t1 VALUES
-('patnom','patauteur',0,'p.favre@cryo-networks.fr',NULL,NULL,'#p2sndnq6ae5g1u6t','essai\nsalut','scol://195.242.78.119:patauteur.patnom',NULL,NULL,NULL,950036174,-882087474,NULL,3,0,3,'1','Pub/patnom/futur_divers.scs',NULL,'pat','CC1');
+('patnom','patauteur',0,'p.favre@cryo-networks.fr',NULL,NULL,'#p2sndnq6ae5g1u6t','essai salut','scol://195.242.78.119:patauteur.patnom',NULL,NULL,NULL,950036174,-882087474,NULL,3,0,3,'1','Pub/patnom/futur_divers.scs',NULL,'pat','CC1');
INSERT INTO t1 VALUES
('LeNomDeMonSite','Marc',0,'m.barilley@cryo-networks.fr',NULL,NULL,NULL,NULL,'scol://195.242.78.119:Marc.LeNomDeMonSite',NULL,NULL,NULL,950560434,-881563214,NULL,3,0,3,'1','Pub/LeNomDeMonSite/domus_hibere.scs',NULL,'Marq','CC1');
select * from t1 where name='patnom' and author='patauteur' and category=0;
name author category email password proxy bitmap msg urlscol urlhttp timeout nbcnx creation livinguntil lang type subcat subtype reg scs capacity userISP CCident
-patnom patauteur 0 p.favre@cryo-networks.fr NULL NULL #p2sndnq6ae5g1u6t essai
-salut scol://195.242.78.119:patauteur.patnom NULL NULL NULL 950036174 -882087474 NULL 3 0 3 1 Pub/patnom/futur_divers.scs NULL pat CC1
+patnom patauteur 0 p.favre@cryo-networks.fr NULL NULL #p2sndnq6ae5g1u6t essai salut scol://195.242.78.119:patauteur.patnom NULL NULL NULL 950036174 -882087474 NULL 3 0 3 1 Pub/patnom/futur_divers.scs NULL pat CC1
drop table t1;
create table t1
(
@@ -118,13 +123,13 @@ primary key (SEQNO, MOTYPEID, MOINSTANCEID, ATTRID, VALUE )
INSERT INTO t1 VALUES (1, 1, 1, 1, 'a');
INSERT INTO t1 VALUES (1, 1, 1, 1, 'b');
INSERT INTO t1 VALUES (1, 1, 1, 1, 'a');
-Duplicate entry '1-1-1-1-a' for key 1
+ERROR 23000: Duplicate entry '1-1-1-1-a' for key 1
drop table t1;
CREATE TABLE t1 (
a tinytext NOT NULL,
b tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (a(32),b)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('a',1),('a',2);
SELECT * FROM t1 WHERE a='a' AND b=2;
a b
@@ -146,10 +151,12 @@ t1 0 e 1 e A 0 NULL NULL BTREE
t1 0 b 1 b A NULL NULL NULL YES BTREE
t1 1 c 1 c A NULL NULL NULL YES BTREE
drop table t1;
-DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c CHAR(10) NOT NULL,i INT NOT NULL AUTO_INCREMENT,
UNIQUE (c,i));
INSERT INTO t1 (c) VALUES (NULL),(NULL);
+Warnings:
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'c' at row 1
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'c' at row 2
SELECT * FROM t1;
c i
1
@@ -177,3 +184,144 @@ NULL 2
a 1
a 2
drop table t1;
+create table t1 (i int, a char(200), b text, unique (a), unique (b(300))) charset utf8;
+insert t1 values (1, repeat('a',210), repeat('b', 310));
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+insert t1 values (2, repeat(0xD0B1,215), repeat(0xD0B1, 310));
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+select i, length(a), length(b), char_length(a), char_length(b) from t1;
+i length(a) length(b) char_length(a) char_length(b)
+1 200 310 200 310
+2 400 620 200 310
+select i from t1 where a=repeat(_utf8 'a',200);
+i
+1
+select i from t1 where a=repeat(_utf8 0xD0B1,200);
+i
+2
+select i from t1 where b=repeat(_utf8 'b',310);
+i
+1
+drop table t1;
+CREATE TABLE t1 (id int unsigned auto_increment, name char(50), primary key (id)) engine=myisam;
+insert into t1 (name) values ('a'), ('b'),('c'),('d'),('e'),('f'),('g');
+explain select 1 from t1 where id =2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
+explain select 1 from t1 where id =2 or id=3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
+explain select name from t1 where id =2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
+ALTER TABLE t1 DROP PRIMARY KEY, ADD INDEX (id);
+explain select 1 from t1 where id =2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref id id 4 const 1 Using where; Using index
+drop table t1;
+CREATE TABLE t1 (numeropost mediumint(8) unsigned NOT NULL default '0', numreponse int(10) unsigned NOT NULL auto_increment, PRIMARY KEY (numeropost,numreponse), UNIQUE KEY numreponse (numreponse));
+INSERT INTO t1 (numeropost,numreponse) VALUES ('1','1'),('1','2'),('2','3'),('2','4');
+SELECT numeropost FROM t1 WHERE numreponse='1';
+numeropost
+1
+EXPLAIN SELECT numeropost FROM t1 WHERE numreponse='1';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const numreponse numreponse 4 const 1 Using index
+FLUSH TABLES;
+SELECT numeropost FROM t1 WHERE numreponse='1';
+numeropost
+1
+drop table t1;
+create table t1 (c varchar(30) character set utf8, t text character set utf8, unique (c(2)), unique (t(3))) engine=myisam;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` varchar(30) character set utf8 default NULL,
+ `t` text character set utf8,
+ UNIQUE KEY `c` (`c`(2)),
+ UNIQUE KEY `t` (`t`(3))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert t1 values ('cccc', 'tttt'),
+(0xD0B1212223D0B1D0B1D0B1D0B1D0B1, 0xD0B1D0B1212223D0B1D0B1D0B1D0B1),
+(0xD0B1222123D0B1D0B1D0B1D0B1D0B1, 0xD0B1D0B1222123D0B1D0B1D0B1D0B1);
+insert t1 (c) values ('cc22');
+ERROR 23000: Duplicate entry 'cc22' for key 1
+insert t1 (t) values ('ttt22');
+ERROR 23000: Duplicate entry 'ttt22' for key 2
+insert t1 (c) values (0xD0B1212322D0B1D0B1D0B1D0B1D0B1);
+ERROR 23000: Duplicate entry 'б!#"Ð' for key 1
+insert t1 (t) values (0xD0B1D0B1212322D0B1D0B1D0B1D0B1);
+ERROR 23000: Duplicate entry 'бб!#"б' for key 2
+select c from t1 where c='cccc';
+c
+cccc
+select t from t1 where t='tttt';
+t
+tttt
+select c from t1 where c=0xD0B1212223D0B1D0B1D0B1D0B1D0B1;
+c
+?!"#?????
+select t from t1 where t=0xD0B1D0B1212223D0B1D0B1D0B1D0B1;
+t
+??!"#????
+drop table t1;
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1 (
+c1 int,
+c2 varbinary(240),
+UNIQUE KEY (c1),
+KEY (c2)
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,'\Z\Z\Z\Z');
+INSERT INTO t1 VALUES (2,'\Z\Z\Z\Z\Z\Z');
+INSERT INTO t1 VALUES (3,'\Z\Z\Z\Z');
+select c1 from t1 where c2='\Z\Z\Z\Z';
+c1
+1
+3
+DELETE FROM t1 WHERE (c1 = 1);
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+select c1 from t1 where c2='\Z\Z\Z\Z';
+c1
+3
+DELETE FROM t1 WHERE (c1 = 3);
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+select c1 from t1 where c2='\Z\Z\Z\Z';
+c1
+truncate table t1;
+insert into t1 values(1,"aaaa"),(2,"aaab"),(3,"aaac"),(4,"aaccc");
+delete from t1 where c1=3;
+delete from t1 where c1=1;
+delete from t1 where c1=4;
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+drop table t1;
+create table t1 (c char(10), index (c(0)));
+ERROR HY000: Key part 'c' length cannot be 0
+create table t1 (c char(10), index (c,c));
+ERROR 42S21: Duplicate column name 'c'
+create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1));
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2));
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1));
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10));
+alter table t1 add key (c1,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c2,c1,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c1,c2,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c1,c1,c2);
+ERROR 42S21: Duplicate column name 'c1'
+drop table t1;
diff --git a/mysql-test/r/key_cache.result b/mysql-test/r/key_cache.result
new file mode 100644
index 00000000000..79b5a6e84b2
--- /dev/null
+++ b/mysql-test/r/key_cache.result
@@ -0,0 +1,289 @@
+drop table if exists t1, t2, t3;
+SET @save_key_buffer=@@key_buffer_size;
+SELECT @@key_buffer_size, @@small.key_buffer_size;
+@@key_buffer_size @@small.key_buffer_size
+2097152 131072
+SET @@global.key_buffer_size=16*1024*1024;
+SET @@global.default.key_buffer_size=16*1024*1024;
+SET @@global.default.key_buffer_size=16*1024*1024;
+SET @@global.small.key_buffer_size=1*1024*1024;
+SET @@global.medium.key_buffer_size=4*1024*1024;
+SET @@global.medium.key_buffer_size=0;
+SET @@global.medium.key_buffer_size=0;
+SHOW VARIABLES like "key_buffer_size";
+Variable_name Value
+key_buffer_size 16777216
+SELECT @@key_buffer_size;
+@@key_buffer_size
+16777216
+SELECT @@global.key_buffer_size;
+@@global.key_buffer_size
+16777216
+SELECT @@global.default.key_buffer_size;
+@@global.default.key_buffer_size
+16777216
+SELECT @@global.default.`key_buffer_size`;
+@@global.default.key_buffer_size
+16777216
+SELECT @@global.`default`.`key_buffer_size`;
+@@global.default.key_buffer_size
+16777216
+SELECT @@`default`.key_buffer_size;
+@@default.key_buffer_size
+16777216
+SELECT @@small.key_buffer_size;
+@@small.key_buffer_size
+1048576
+SELECT @@medium.key_buffer_size;
+@@medium.key_buffer_size
+0
+SET @@global.key_buffer_size=@save_key_buffer;
+SELECT @@default.key_buffer_size;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'default.key_buffer_size' at line 1
+SELECT @@skr.storage_engine="test";
+ERROR HY000: Variable 'storage_engine' is not a variable component (can't be used as XXXX.variable_name)
+select @@keycache1.key_cache_block_size;
+@@keycache1.key_cache_block_size
+0
+select @@keycache1.key_buffer_size;
+@@keycache1.key_buffer_size
+0
+set global keycache1.key_cache_block_size=2048;
+select @@keycache1.key_buffer_size;
+@@keycache1.key_buffer_size
+0
+select @@keycache1.key_cache_block_size;
+@@keycache1.key_cache_block_size
+2048
+set global keycache1.key_buffer_size=1*1024*1024;
+select @@keycache1.key_buffer_size;
+@@keycache1.key_buffer_size
+1048576
+select @@keycache1.key_cache_block_size;
+@@keycache1.key_cache_block_size
+2048
+set global keycache2.key_buffer_size=4*1024*1024;
+select @@keycache2.key_buffer_size;
+@@keycache2.key_buffer_size
+4194304
+select @@keycache2.key_cache_block_size;
+@@keycache2.key_cache_block_size
+1024
+set global keycache1.key_buffer_size=0;
+select @@keycache1.key_buffer_size;
+@@keycache1.key_buffer_size
+0
+select @@keycache1.key_cache_block_size;
+@@keycache1.key_cache_block_size
+2048
+select @@key_buffer_size;
+@@key_buffer_size
+2097152
+select @@key_cache_block_size;
+@@key_cache_block_size
+1024
+set global keycache1.key_buffer_size=1024*1024;
+create table t1 (p int primary key, a char(10)) delay_key_write=1;
+create table t2 (p int primary key, i int, a char(10), key k1(i), key k2(a));
+show status like 'key_blocks_used';
+Variable_name Value
+Key_blocks_used 0
+show status like 'key_blocks_unused';
+Variable_name Value
+Key_blocks_unused KEY_BLOCKS_UNUSED
+insert into t1 values (1, 'qqqq'), (11, 'yyyy');
+insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'),
+(3, 1, 'yyyy'), (4, 3, 'zzzz');
+select * from t1;
+p a
+1 qqqq
+11 yyyy
+select * from t2;
+p i a
+1 1 qqqq
+2 1 pppp
+3 1 yyyy
+4 3 zzzz
+update t1 set p=2 where p=1;
+update t2 set i=2 where i=1;
+show status like 'key_blocks_used';
+Variable_name Value
+Key_blocks_used 4
+show status like 'key_blocks_unused';
+Variable_name Value
+Key_blocks_unused KEY_BLOCKS_UNUSED
+cache index t1 key (`primary`) in keycache1;
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache status OK
+explain select p from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 2 Using index
+select p from t1;
+p
+2
+11
+explain select i from t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL k1 5 NULL 4 Using index
+select i from t2;
+i
+2
+2
+2
+3
+explain select count(*) from t1, t2 where t1.p = t2.i;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 2 Using index
+1 SIMPLE t2 ref k1 k1 5 test.t1.p 2 Using where; Using index
+select count(*) from t1, t2 where t1.p = t2.i;
+count(*)
+3
+cache index t2 in keycache1;
+Table Op Msg_type Msg_text
+test.t2 assign_to_keycache status OK
+update t2 set p=p+1000, i=2 where a='qqqq';
+cache index t2 in keycache2;
+Table Op Msg_type Msg_text
+test.t2 assign_to_keycache status OK
+insert into t2 values (2000, 3, 'yyyy');
+cache index t2 in keycache1;
+Table Op Msg_type Msg_text
+test.t2 assign_to_keycache status OK
+update t2 set p=3000 where a='zzzz';
+select * from t2;
+p i a
+1001 2 qqqq
+2 2 pppp
+3 2 yyyy
+3000 3 zzzz
+2000 3 yyyy
+explain select p from t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL PRIMARY 4 NULL 5 Using index
+select p from t2;
+p
+2
+3
+1001
+2000
+3000
+explain select i from t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL k1 5 NULL 5 Using index
+select i from t2;
+i
+2
+2
+2
+3
+3
+explain select a from t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL k2 11 NULL 5 Using index
+select a from t2;
+a
+pppp
+qqqq
+yyyy
+yyyy
+zzzz
+cache index t1 in unknown_key_cache;
+ERROR HY000: Unknown key cache 'unknown_key_cache'
+cache index t1 key (unknown_key) in keycache1;
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache error Key column 'unknown_key' doesn't exist in table
+test.t1 assign_to_keycache status Operation failed
+select @@keycache2.key_buffer_size;
+@@keycache2.key_buffer_size
+4194304
+select @@keycache2.key_cache_block_size;
+@@keycache2.key_cache_block_size
+1024
+set global keycache2.key_buffer_size=0;
+select @@keycache2.key_buffer_size;
+@@keycache2.key_buffer_size
+0
+select @@keycache2.key_cache_block_size;
+@@keycache2.key_cache_block_size
+1024
+set global keycache2.key_buffer_size=1024*1024;
+select @@keycache2.key_buffer_size;
+@@keycache2.key_buffer_size
+1048576
+update t2 set p=4000 where a='zzzz';
+update t1 set p=p+1;
+set global keycache1.key_buffer_size=0;
+select * from t2;
+p i a
+1001 2 qqqq
+2 2 pppp
+3 2 yyyy
+4000 3 zzzz
+2000 3 yyyy
+select p from t2;
+p
+2
+3
+1001
+2000
+4000
+explain select i from t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL k1 5 NULL 5 Using index
+select i from t2;
+i
+2
+2
+2
+3
+3
+explain select a from t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL k2 11 NULL 5 Using index
+select a from t2;
+a
+pppp
+qqqq
+yyyy
+yyyy
+zzzz
+select * from t1;
+p a
+3 qqqq
+12 yyyy
+select p from t1;
+p
+3
+12
+create table t3 (like t1);
+cache index t3 in small;
+Table Op Msg_type Msg_text
+test.t3 assign_to_keycache status OK
+insert into t3 select * from t1;
+cache index t3 in keycache2;
+Table Op Msg_type Msg_text
+test.t3 assign_to_keycache status OK
+cache index t1,t2 in default;
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache status OK
+test.t2 assign_to_keycache status OK
+drop table t1,t2,t3;
+show status like 'key_blocks_used';
+Variable_name Value
+Key_blocks_used 4
+show status like 'key_blocks_unused';
+Variable_name Value
+Key_blocks_unused KEY_BLOCKS_UNUSED
+set global keycache2.key_buffer_size=0;
+set global keycache3.key_buffer_size=100;
+set global keycache3.key_buffer_size=0;
+create table t1 (mytext text, FULLTEXT (mytext));
+insert t1 values ('aaabbb');
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+set GLOBAL key_cache_block_size=2048;
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+drop table t1;
diff --git a/mysql-test/r/key_diff.result b/mysql-test/r/key_diff.result
index 2d4bc19474f..c3f4f743967 100644
--- a/mysql-test/r/key_diff.result
+++ b/mysql-test/r/key_diff.result
@@ -34,9 +34,9 @@ C c a a
D E a a
a a a a
explain select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B;
-table type possible_keys key key_len ref rows Extra
-t1 ALL a NULL NULL NULL 5
-t2 ALL b NULL NULL NULL 4 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL a NULL NULL NULL 5
+1 SIMPLE t2 ALL b NULL NULL NULL 4 Using where
select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B order by binary t1.a,t2.a;
a b a b
A B a a
diff --git a/mysql-test/r/key_primary.result b/mysql-test/r/key_primary.result
index 3216ead667b..7726a8e1d63 100644
--- a/mysql-test/r/key_primary.result
+++ b/mysql-test/r/key_primary.result
@@ -12,9 +12,9 @@ select * from t1 where t1 like "a_\%";
t1
AB%
describe select * from t1 where t1="ABC";
-table type possible_keys key key_len ref rows Extra
-t1 const PRIMARY PRIMARY 3 const 1 Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const PRIMARY PRIMARY 3 const 1 Using index
describe select * from t1 where t1="ABCD";
-Comment
-Impossible WHERE noticed after reading const tables
+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
drop table t1;
diff --git a/mysql-test/r/keywords.result b/mysql-test/r/keywords.result
index 2ca36425841..c218379110f 100644
--- a/mysql-test/r/keywords.result
+++ b/mysql-test/r/keywords.result
@@ -3,7 +3,7 @@ create table t1 (time time, date date, timestamp timestamp);
insert into t1 values ("12:22:22","97:02:03","1997-01-02");
select * from t1;
time date timestamp
-12:22:22 1997-02-03 19970102000000
+12:22:22 1997-02-03 1997-01-02 00:00:00
select t1.time+0,t1.date+0,t1.timestamp+0,concat(date," ",time) from t1;
t1.time+0 t1.date+0 t1.timestamp+0 concat(date," ",time)
122222 19970203 19970102000000 1997-02-03 12:22:22
diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
index 1730d7b5c25..c0baabcc507 100644
--- a/mysql-test/r/loaddata.result
+++ b/mysql-test/r/loaddata.result
@@ -1,6 +1,13 @@
drop table if exists t1;
create table t1 (a date, b date, c date not null, d date);
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',';
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'c' at row 1
+Warning 1265 Data truncated for column 'd' at row 1
+Warning 1265 Data truncated for column 'a' at row 2
+Warning 1265 Data truncated for column 'b' at row 2
+Warning 1265 Data truncated for column 'd' at row 2
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
SELECT * from t1;
a b c d
@@ -10,6 +17,11 @@ a b c d
2003-03-03 2003-03-03 2003-03-03 NULL
truncate table t1;
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
+Warnings:
+Warning 1265 Data truncated for column 'c' at row 1
+Warning 1265 Data truncated for column 'd' at row 1
+Warning 1265 Data truncated for column 'b' at row 2
+Warning 1265 Data truncated for column 'd' at row 2
SELECT * from t1;
a b c d
NULL NULL 0000-00-00 0000-00-00
@@ -18,6 +30,8 @@ NULL 2003-03-03 2003-03-03 NULL
drop table t1;
create table t1 (a text, b text);
load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
+Warnings:
+Warning 1261 Row 3 doesn't contain data for all columns
select concat('|',a,'|'), concat('|',b,'|') from t1;
concat('|',a,'|') concat('|',b,'|')
|Field A| |Field B|
@@ -28,6 +42,11 @@ Field 3,'Field 4|
drop table t1;
create table t1 (a int, b char(10));
load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 3
+Warning 1262 Row 3 was truncated; it contained more data than there were input columns
+Warning 1265 Data truncated for column 'a' at row 5
+Warning 1262 Row 5 was truncated; it contained more data than there were input columns
select * from t1;
a b
1 row 1
@@ -37,6 +56,9 @@ a b
0 1234567890
truncate table t1;
load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 4
+Warning 1261 Row 4 doesn't contain data for all columns
select * from t1;
a b
1 row 1
diff --git a/mysql-test/r/lock.result b/mysql-test/r/lock.result
index 31a18fe6cec..429bc5ed352 100644
--- a/mysql-test/r/lock.result
+++ b/mysql-test/r/lock.result
@@ -1,5 +1,5 @@
drop table if exists t1,t2;
-CREATE TABLE t1 ( `id` int(11) NOT NULL default '0', `id2` int(11) NOT NULL default '0', `id3` int(11) NOT NULL default '0', `dummy1` char(30) default NULL, PRIMARY KEY (`id`,`id2`), KEY `index_id3` (`id3`)) TYPE=MyISAM;
+CREATE TABLE t1 ( `id` int(11) NOT NULL default '0', `id2` int(11) NOT NULL default '0', `id3` int(11) NOT NULL default '0', `dummy1` char(30) default NULL, PRIMARY KEY (`id`,`id2`), KEY `index_id3` (`id3`)) ENGINE=MyISAM;
insert into t1 (id,id2) values (1,1),(1,2),(1,3);
LOCK TABLE t1 WRITE;
select dummy1,count(distinct id) from t1 group by dummy1;
@@ -8,9 +8,9 @@ NULL 1
update t1 set id=-1 where id=1;
LOCK TABLE t1 READ;
update t1 set id=1 where id=1;
-Table 't1' was locked with a READ lock and can't be updated
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
create table t2 SELECT * from t1;
-Table 't2' was not locked with LOCK TABLES
+ERROR HY000: Table 't2' was not locked with LOCK TABLES
create temporary table t2 SELECT * from t1;
drop table if exists t2;
unlock tables;
@@ -23,11 +23,11 @@ CREATE TABLE t1 (
index1 smallint(6) default NULL,
nr smallint(6) default NULL,
KEY index1(index1)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
CREATE TABLE t2 (
nr smallint(6) default NULL,
name varchar(20) default NULL
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,'item1');
INSERT INTO t2 VALUES (2,'item2');
lock tables t1 write, t2 read;
@@ -42,7 +42,7 @@ check table t2;
Table Op Msg_type Msg_text
test.t2 check error Table 't2' was not locked with LOCK TABLES
insert into t1 select nr from t1;
-Table 't1' was not locked with LOCK TABLES
+ERROR HY000: Table 't1' was not locked with LOCK TABLES
unlock tables;
lock tables t1 write, t1 as t1_alias read;
insert into t1 select index1,nr from t1 as t1_alias;
diff --git a/mysql-test/r/lock_multi.result b/mysql-test/r/lock_multi.result
index b5672fe1791..9eedbf50064 100644
--- a/mysql-test/r/lock_multi.result
+++ b/mysql-test/r/lock_multi.result
@@ -34,5 +34,5 @@ create table t2 (a int);
lock table t1 write, t2 write;
insert t1 select * from t2;
drop table t2;
-Table 'test.t2' doesn't exist
+ERROR 42S02: Table 'test.t2' doesn't exist
drop table t1;
diff --git a/mysql-test/r/lock_tables_lost_commit.result b/mysql-test/r/lock_tables_lost_commit.result
index ccf56793f45..22885d93d40 100644
--- a/mysql-test/r/lock_tables_lost_commit.result
+++ b/mysql-test/r/lock_tables_lost_commit.result
@@ -1,5 +1,5 @@
drop table if exists t1;
-create table t1(a int) type=innodb;
+create table t1(a int) engine=innodb;
lock tables t1 write;
insert into t1 values(10);
select * from t1;
diff --git a/mysql-test/r/lowercase_table.result b/mysql-test/r/lowercase_table.result
index 43d24b1ab17..a30ec0f160c 100644
--- a/mysql-test/r/lowercase_table.result
+++ b/mysql-test/r/lowercase_table.result
@@ -1,4 +1,5 @@
-drop table if exists t1,t2,t3,t4,T1;
+drop table if exists t1,t2,t3,t4;
+drop table if exists t0,t5,t6,t7,t8,t9;
drop database if exists mysqltest;
create table T1 (id int primary key, Word varchar(40) not null, Index(Word));
create table t4 (id int primary key, Word varchar(40) not null);
@@ -19,7 +20,8 @@ SELECT * from t1 left join t4 on (test.t1.id= TEST.t4.id) where TEST.t1.id >= te
id Word id Word
1 a 1 match
SELECT T2.id from t1 as t2 LIMIT 1;
-Unknown table 'T2' in field list
+id
+1
RENAME TABLE T1 TO T2;
ALTER TABLE T2 ADD new_col int not null;
ALTER TABLE T2 RENAME T3;
@@ -36,9 +38,11 @@ select count(*) from t1;
count(*)
0
select count(T1.a) from t1;
-Unknown table 'T1' in field list
+count(T1.a)
+0
select count(bags.a) from t1 as Bags;
-Unknown table 'bags' in field list
+count(bags.a)
+0
drop table t1;
create database mysqltest;
use MYSQLTEST;
@@ -46,7 +50,7 @@ create table t1 (a int);
select T1.a from MYSQLTEST.T1;
a
select t1.a from MYSQLTEST.T1;
-Unknown table 't1' in field list
+a
select mysqltest.t1.* from MYSQLTEST.t1;
a
select MYSQLTEST.t1.* from MYSQLTEST.t1;
@@ -59,3 +63,20 @@ alter table t1 rename to T1;
select MYSQLTEST.t1.* from MYSQLTEST.t1;
a
drop database mysqltest;
+use test;
+create table t1 (a int);
+create table t2 (a int);
+delete p1.*,P2.* from t1 as p1, t2 as p2 where p1.a=P2.a;
+delete P1.*,p2.* from t1 as P1, t2 as P2 where P1.a=p2.a;
+update t1 as p1, t2 as p2 SET p1.a=1,P2.a=1 where p1.a=P2.a;
+update t1 as P1, t2 as P2 SET P1.a=1,p2.a=1 where P1.a=p2.a;
+drop table t1,t2;
+create table t1 (a int);
+create table t2 (a int);
+select * from t1 c, t2 C;
+ERROR 42000: Not unique table/alias: 'C'
+select C.a, c.a from t1 c, t2 C;
+ERROR 42000: Not unique table/alias: 'C'
+drop table t1, t2;
+show tables;
+Tables_in_test
diff --git a/mysql-test/r/lowercase_table2.result b/mysql-test/r/lowercase_table2.result
index 929cedb2ee3..3be73f6cc6a 100644
--- a/mysql-test/r/lowercase_table2.result
+++ b/mysql-test/r/lowercase_table2.result
@@ -13,7 +13,7 @@ SHOW CREATE TABLE T1;
Table Create Table
T1 CREATE TABLE `T1` (
`a` int(11) default NULL
-) TYPE=MyISAM
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
RENAME TABLE T1 TO T2;
SHOW TABLES LIKE "T2";
Tables_in_test (T2)
@@ -68,7 +68,7 @@ SHOW CREATE TABLE T1;
Table Create Table
T1 CREATE TABLE `T1` (
`a` int(11) default NULL
-) TYPE=InnoDB
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
RENAME TABLE T1 TO T2;
SHOW TABLES LIKE "T2";
Tables_in_test (T2)
diff --git a/mysql-test/r/lowercase_table3.result b/mysql-test/r/lowercase_table3.result
index 362d17e0461..8182d07c26b 100644
--- a/mysql-test/r/lowercase_table3.result
+++ b/mysql-test/r/lowercase_table3.result
@@ -4,7 +4,7 @@ SELECT * from T1;
a
drop table t1;
flush tables;
-CREATE TABLE t1 (a int) type=INNODB;
+CREATE TABLE t1 (a int) ENGINE=INNODB;
SELECT * from T1;
-Can't open file: 'T1.InnoDB'. (errno: 1)
+ERROR HY000: Can't open file: 'T1.ibd' (errno: 1)
drop table t1;
diff --git a/mysql-test/r/lowercase_table_qcache.result b/mysql-test/r/lowercase_table_qcache.result
new file mode 100644
index 00000000000..f8d34e0f592
--- /dev/null
+++ b/mysql-test/r/lowercase_table_qcache.result
@@ -0,0 +1,24 @@
+set GLOBAL query_cache_size=1355776;
+drop database if exists MySQLtesT;
+create database MySQLtesT;
+create table MySQLtesT.t1 (a int);
+select * from MySQLtesT.t1;
+a
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+drop database mysqltest;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+use MySQL;
+select * from db;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+use test;
+select * from MySQL.db;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+set GLOBAL query_cache_size=0;
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index 3585b8b0018..f71626221cb 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -1,9 +1,10 @@
drop table if exists t1,t2,t3,t4,t5,t6;
+drop database if exists mysqltest;
create table t1 (a int not null primary key auto_increment, message char(20));
create table t2 (a int not null primary key auto_increment, message char(20));
INSERT INTO t1 (message) VALUES ("Testing"),("table"),("t1");
INSERT INTO t2 (message) VALUES ("Testing"),("table"),("t2");
-create table t3 (a int not null, b char(20), key(a)) type=MERGE UNION=(t1,t2);
+create table t3 (a int not null, b char(20), key(a)) engine=MERGE UNION=(t1,t2);
select * from t3;
a b
1 Testing
@@ -32,13 +33,13 @@ insert into t2 select NULL,message from t1;
insert into t1 select NULL,message from t2;
insert into t2 select NULL,message from t1;
insert into t1 select NULL,message from t2;
-create table t3 (a int not null, b char(20), key(a)) type=MERGE UNION=(test.t1,test.t2);
+create table t3 (a int not null, b char(20), key(a)) engine=MERGE UNION=(test.t1,test.t2);
explain select * from t3 where a < 10;
-table type possible_keys key key_len ref rows Extra
-t3 range a a 4 NULL 18 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 range a a 4 NULL 18 Using where
explain select * from t3 where a > 10 and a < 20;
-table type possible_keys key key_len ref rows Extra
-t3 range a a 4 NULL 16 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 range a a 4 NULL 16 Using where
select * from t3 where a = 10;
a b
10 Testing
@@ -84,8 +85,8 @@ a b
19 Testing
19 Testing
explain select a from t3 order by a desc limit 10;
-table type possible_keys key key_len ref rows Extra
-t3 index NULL a 4 NULL 1131 Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 index NULL a 4 NULL 1131 Using index
select a from t3 order by a desc limit 10;
a
699
@@ -174,16 +175,29 @@ t3 CREATE TABLE `t3` (
`a` int(11) NOT NULL default '0',
`b` char(20) default NULL,
KEY `a` (`a`)
-) TYPE=MRG_MyISAM UNION=(t1,t2)
-create table t4 (a int not null, b char(10), key(a)) type=MERGE UNION=(t1,t2);
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`)
+create table t4 (a int not null, b char(10), key(a)) engine=MERGE UNION=(t1,t2);
select * from t4;
-Can't open file: 't4.MRG'. (errno: 143)
-create table t5 (a int not null, b char(10), key(a)) type=MERGE UNION=(test.t1,test_2.t2);
-Incorrect table definition; All MERGE tables must be in the same database
-drop table if exists t5,t4,t3,t1,t2;
-create table t1 (c char(10)) type=myisam;
-create table t2 (c char(10)) type=myisam;
-create table t3 (c char(10)) union=(t1,t2) type=merge;
+ERROR HY000: Can't open file: 't4.MRG' (errno: 143)
+alter table t4 add column c int;
+ERROR HY000: Can't open file: 't4.MRG' (errno: 143)
+create database mysqltest;
+create table mysqltest.t6 (a int not null primary key auto_increment, message char(20));
+create table t5 (a int not null, b char(20), key(a)) engine=MERGE UNION=(test.t1,mysqltest.t6);
+show create table t5;
+Table Create Table
+t5 CREATE TABLE `t5` (
+ `a` int(11) NOT NULL default '0',
+ `b` char(20) default NULL,
+ KEY `a` (`a`)
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`mysqltest`.`t6`)
+alter table t5 engine=myisam;
+drop table t5, mysqltest.t6;
+drop database mysqltest;
+drop table t4,t3,t1,t2;
+create table t1 (c char(10)) engine=myisam;
+create table t2 (c char(10)) engine=myisam;
+create table t3 (c char(10)) union=(t1,t2) engine=merge;
insert into t1 (c) values ('test1');
insert into t1 (c) values ('test1');
insert into t1 (c) values ('test1');
@@ -215,7 +229,7 @@ drop table t3,t2,t1;
CREATE TABLE t1 (incr int not null, othr int not null, primary key(incr));
CREATE TABLE t2 (incr int not null, othr int not null, primary key(incr));
CREATE TABLE t3 (incr int not null, othr int not null, primary key(incr))
-TYPE=MERGE UNION=(t1,t2);
+ENGINE=MERGE UNION=(t1,t2);
SELECT * from t3;
incr othr
INSERT INTO t1 VALUES ( 1,10),( 3,53),( 5,21),( 7,12),( 9,17);
@@ -236,36 +250,35 @@ alter table t3 UNION=(t1,t2);
select count(*) from t3;
count(*)
20
-alter table t3 TYPE=MYISAM;
+alter table t3 ENGINE=MYISAM;
select count(*) from t3;
count(*)
20
drop table t3;
CREATE TABLE t3 (incr int not null, othr int not null, primary key(incr))
-TYPE=MERGE UNION=(t1,t2);
+ENGINE=MERGE UNION=(t1,t2);
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`incr` int(11) NOT NULL default '0',
`othr` int(11) NOT NULL default '0',
PRIMARY KEY (`incr`)
-) TYPE=MRG_MyISAM UNION=(t1,t2)
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`)
alter table t3 drop primary key;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`incr` int(11) NOT NULL default '0',
`othr` int(11) NOT NULL default '0'
-) TYPE=MRG_MyISAM UNION=(t1,t2)
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`)
drop table t3,t2,t1;
-create table t1 (a int not null, key(a)) type=merge;
+create table t1 (a int not null, key(a)) engine=merge;
select * from t1;
a
drop table t1;
-drop table if exists t3, t2, t1;
create table t1 (a int not null, b int not null, key(a,b));
create table t2 (a int not null, b int not null, key(a,b));
-create table t3 (a int not null, b int not null, key(a,b)) TYPE=MERGE UNION=(t1,t2);
+create table t3 (a int not null, b int not null, key(a,b)) ENGINE=MERGE UNION=(t1,t2);
insert into t1 values (1,2),(2,1),(0,0),(4,4),(5,5),(6,6);
insert into t2 values (1,1),(2,2),(0,0),(4,4),(5,5),(6,6);
flush tables;
@@ -274,41 +287,40 @@ a b
1 1
1 2
drop table t3,t1,t2;
-drop table if exists t6, t5, t4, t3, t2, t1;
create table t1 (a int not null, b int not null auto_increment, primary key(a,b));
create table t2 (a int not null, b int not null auto_increment, primary key(a,b));
create table t3 (a int not null, b int not null, key(a,b)) UNION=(t1,t2) INSERT_METHOD=NO;
-create table t4 (a int not null, b int not null, key(a,b)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=NO;
-create table t5 (a int not null, b int not null auto_increment, primary key(a,b)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST;
-create table t6 (a int not null, b int not null auto_increment, primary key(a,b)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST;
+create table t4 (a int not null, b int not null, key(a,b)) ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=NO;
+create table t5 (a int not null, b int not null auto_increment, primary key(a,b)) ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST;
+create table t6 (a int not null, b int not null auto_increment, primary key(a,b)) ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` int(11) NOT NULL default '0',
`b` int(11) NOT NULL default '0',
KEY `a` (`a`,`b`)
-) TYPE=MyISAM
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create table t4;
Table Create Table
t4 CREATE TABLE `t4` (
`a` int(11) NOT NULL default '0',
`b` int(11) NOT NULL default '0',
KEY `a` (`a`,`b`)
-) TYPE=MRG_MyISAM UNION=(t1,t2)
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`)
show create table t5;
Table Create Table
t5 CREATE TABLE `t5` (
`a` int(11) NOT NULL default '0',
`b` int(11) NOT NULL auto_increment,
PRIMARY KEY (`a`,`b`)
-) TYPE=MRG_MyISAM INSERT_METHOD=FIRST UNION=(t1,t2)
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`,`t2`)
show create table t6;
Table Create Table
t6 CREATE TABLE `t6` (
`a` int(11) NOT NULL default '0',
`b` int(11) NOT NULL auto_increment,
PRIMARY KEY (`a`,`b`)
-) TYPE=MRG_MyISAM INSERT_METHOD=LAST UNION=(t1,t2)
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
insert into t1 values (1,NULL),(1,NULL),(1,NULL),(1,NULL);
insert into t2 values (2,NULL),(2,NULL),(2,NULL),(2,NULL);
select * from t3 order by b,a limit 3;
@@ -373,7 +385,7 @@ t4 CREATE TABLE `t4` (
`a` int(11) NOT NULL default '0',
`b` int(11) NOT NULL default '0',
KEY `a` (`a`,`b`)
-) TYPE=MRG_MyISAM UNION=(t1,t2,t3)
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`,`t3`)
select * from t4 order by a,b;
a b
1 1
@@ -399,7 +411,7 @@ t4 CREATE TABLE `t4` (
`a` int(11) NOT NULL default '0',
`b` int(11) NOT NULL default '0',
KEY `a` (`a`,`b`)
-) TYPE=MRG_MyISAM INSERT_METHOD=FIRST UNION=(t1,t2,t3)
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`,`t2`,`t3`)
insert into t4 values (4,1),(4,2);
select * from t1 order by a,b;
a b
@@ -528,25 +540,46 @@ a b
6 1
6 2
6 3
-drop table if exists t6, t5, t4, t3, t2, t1;
-CREATE TABLE t1 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) TYPE=MyISAM;
+insert into t1 values (99,NULL);
+select * from t4 where a+0 > 90;
+a b
+99 1
+insert t5 values (1,1);
+ERROR 23000: Duplicate entry '1-1' for key 1
+insert t6 values (2,1);
+ERROR 23000: Duplicate entry '2-1' for key 1
+insert t5 values (1,1) on duplicate key update b=b+10;
+insert t6 values (2,1) on duplicate key update b=b+20;
+select * from t5 where a < 3;
+a b
+1 2
+1 3
+1 4
+1 5
+1 11
+2 2
+2 3
+2 4
+2 5
+2 21
+drop table t6, t5, t4, t3, t2, t1;
+CREATE TABLE t1 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1), (2,1);
-CREATE TABLE t2 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) TYPE=MyISAM;
+CREATE TABLE t2 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,2), (2,2);
-CREATE TABLE t ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', KEY a (a,b)) TYPE=MRG_MyISAM UNION=(t1,t2);
-select max(b) from t where a = 2;
+CREATE TABLE t3 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', KEY a (a,b)) ENGINE=MRG_MyISAM UNION=(t1,t2);
+select max(b) from t3 where a = 2;
max(b)
2
select max(b) from t1 where a = 2;
max(b)
1
-drop table if exists t,t1,t2;
-drop table if exists t1, t2, t3, t4, t5, t6;
+drop table t3,t1,t2;
create table t1 (a int not null);
create table t2 (a int not null);
insert into t1 values (1);
insert into t2 values (2);
-create temporary table t3 (a int not null) TYPE=MERGE UNION=(t1,t2);
+create temporary table t3 (a int not null) ENGINE=MERGE UNION=(t1,t2);
select * from t3;
a
1
@@ -555,20 +588,19 @@ create temporary table t4 (a int not null);
create temporary table t5 (a int not null);
insert into t4 values (1);
insert into t5 values (2);
-create temporary table t6 (a int not null) TYPE=MERGE UNION=(t4,t5);
+create temporary table t6 (a int not null) ENGINE=MERGE UNION=(t4,t5);
select * from t6;
a
1
2
-drop table if exists t6, t5, t4, t3, t2, t1;
-DROP TABLE IF EXISTS t1, t2;
+drop table t6, t3, t1, t2, t4, t5;
CREATE TABLE t1 (
fileset_id tinyint(3) unsigned NOT NULL default '0',
file_code varchar(32) NOT NULL default '',
fileset_root_id tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (fileset_id,file_code),
KEY files (fileset_id,fileset_root_id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (2, '0000000111', 1), (2, '0000000112', 1), (2, '0000000113', 1),
(2, '0000000114', 1), (2, '0000000115', 1), (2, '0000000116', 1), (2, '0000000117', 1),
(2, '0000000118', 1), (2, '0000000119', 1), (2, '0000000120', 1);
@@ -578,27 +610,27 @@ file_code varchar(32) NOT NULL default '',
fileset_root_id tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (fileset_id,file_code),
KEY files (fileset_id,fileset_root_id)
-) TYPE=MRG_MyISAM UNION=(t1);
+) ENGINE=MRG_MyISAM UNION=(t1);
EXPLAIN SELECT * FROM t2 IGNORE INDEX (files) WHERE fileset_id = 2
AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1;
-table type possible_keys key key_len ref rows Extra
-t2 range PRIMARY PRIMARY 33 NULL 5 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range PRIMARY PRIMARY 33 NULL 5 Using where
EXPLAIN SELECT * FROM t2 WHERE fileset_id = 2
AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1;
-table type possible_keys key key_len ref rows Extra
-t2 range PRIMARY,files PRIMARY 33 NULL 5 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range PRIMARY,files PRIMARY 33 NULL 5 Using where
EXPLAIN SELECT * FROM t1 WHERE fileset_id = 2
AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1;
-table type possible_keys key key_len ref rows Extra
-t1 range PRIMARY,files PRIMARY 33 NULL 5 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range PRIMARY,files PRIMARY 33 NULL 5 Using where
EXPLAIN SELECT * FROM t2 WHERE fileset_id = 2
AND file_code = '0000000115' LIMIT 1;
-table type possible_keys key key_len ref rows Extra
-t2 const PRIMARY,files PRIMARY 33 const,const 1
-DROP TABLE IF EXISTS t1, t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 const PRIMARY,files PRIMARY 33 const,const 1
+DROP TABLE t2, t1;
create table t1 (x int, y int, index xy(x, y));
create table t2 (x int, y int, index xy(x, y));
-create table t3 (x int, y int, index xy(x, y)) type=merge union=(t1,t2);
+create table t3 (x int, y int, index xy(x, y)) engine=merge union=(t1,t2);
insert into t1 values(1, 2);
insert into t2 values(1, 3);
select * from t3 where x = 1 and y < 5 order by y;
@@ -615,7 +647,32 @@ create table t2 (a int);
insert into t1 values (0);
insert into t2 values (1);
create table t3 engine=merge union=(t1, t2) select * from t1;
-INSERT TABLE 't1' isn't allowed in FROM table list
+ERROR HY000: You can't specify target table 't1' for update in FROM clause
create table t3 engine=merge union=(t1, t2) select * from t2;
-INSERT TABLE 't2' isn't allowed in FROM table list
+ERROR HY000: You can't specify target table 't2' for update in FROM clause
drop table t1, t2;
+create table t1 (a int,b int,c int, index (a,b,c));
+create table t2 (a int,b int,c int, index (a,b,c));
+create table t3 (a int,b int,c int, index (a,b,c))
+engine=merge union=(t1 ,t2);
+insert into t1 (a,b,c) values (1,1,0),(1,2,0);
+insert into t2 (a,b,c) values (1,1,1),(1,2,1);
+explain select a,b,c from t3 force index (a) where a=1 order by a,b,c;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 ref a a 5 const 2 Using where; Using index
+select a,b,c from t3 force index (a) where a=1 order by a,b,c;
+a b c
+1 1 0
+1 1 1
+1 2 0
+1 2 1
+explain select a,b,c from t3 force index (a) where a=1 order by a desc, b desc, c desc;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 ref a a 5 const 2 Using where; Using index
+select a,b,c from t3 force index (a) where a=1 order by a desc, b desc, c desc;
+a b c
+1 2 1
+1 2 0
+1 1 1
+1 1 0
+drop table t1, t2, t3;
diff --git a/mysql-test/r/metadata.result b/mysql-test/r/metadata.result
new file mode 100644
index 00000000000..3c7cf60db7a
--- /dev/null
+++ b/mysql-test/r/metadata.result
@@ -0,0 +1,62 @@
+drop table if exists t1,t2;
+select 1, 1.0, -1, "hello", NULL;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def 1 8 1 1 N 32769 0 8
+def 1.0 5 3 3 N 32769 1 8
+def -1 8 2 2 N 32769 0 8
+def hello 254 5 5 N 1 31 8
+def NULL 6 0 0 Y 32896 0 63
+1 1.0 -1 hello NULL
+1 1.0 -1 hello NULL
+create table t1 (a tinyint, b smallint, c mediumint, d int, e bigint, f float(3,2), g double(4,3), h decimal(5,4), i year, j date, k timestamp, l datetime, m enum('a','b'), n set('a','b'), o char(10));
+select * from t1;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t1 t1 a a 1 4 0 Y 32768 0 63
+def test t1 t1 b b 2 6 0 Y 32768 0 63
+def test t1 t1 c c 9 9 0 Y 32768 0 63
+def test t1 t1 d d 3 11 0 Y 32768 0 63
+def test t1 t1 e e 8 20 0 Y 32768 0 63
+def test t1 t1 f f 4 3 0 Y 32768 2 63
+def test t1 t1 g g 5 4 0 Y 32768 3 63
+def test t1 t1 h h 0 7 0 Y 32768 4 63
+def test t1 t1 i i 13 4 0 Y 32864 0 63
+def test t1 t1 j j 10 10 0 Y 128 0 63
+def test t1 t1 k k 7 19 0 N 1249 0 63
+def test t1 t1 l l 12 19 0 Y 128 0 63
+def test t1 t1 m m 254 1 0 Y 256 0 8
+def test t1 t1 n n 254 3 0 Y 2048 0 8
+def test t1 t1 o o 254 10 0 Y 0 0 8
+a b c d e f g h i j k l m n o
+select a b, b c from t1 as t2;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t1 t2 a b 1 4 0 Y 32768 0 63
+def test t1 t2 b c 2 6 0 Y 32768 0 63
+b c
+drop table t1;
+CREATE TABLE t1 (id tinyint(3) default NULL, data varchar(255) default NULL);
+INSERT INTO t1 VALUES (1,'male'),(2,'female');
+CREATE TABLE t2 (id tinyint(3) unsigned default NULL, data char(3) default '0');
+INSERT INTO t2 VALUES (1,'yes'),(2,'no');
+select t1.id, t1.data, t2.data from t1, t2 where t1.id = t2.id;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t1 t1 id id 1 3 1 Y 32768 0 63
+def test t1 t1 data data 253 255 6 Y 0 0 8
+def test t2 t2 data data 254 3 3 Y 0 0 8
+id data data
+1 male yes
+2 female no
+select t1.id, t1.data, t2.data from t1, t2 where t1.id = t2.id order by t1.id;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t1 t1 id id 1 3 1 Y 32768 0 63
+def test t1 t1 data data 253 255 6 Y 0 0 8
+def test t2 t2 data data 254 3 3 Y 0 0 8
+id data data
+1 male yes
+2 female no
+select t1.id from t1 union select t2.id from t2;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t1 t1 id id 1 3 1 Y 32768 0 63
+id
+1
+2
+drop table t1,t2;
diff --git a/mysql-test/r/mix_innodb_myisam_binlog.result b/mysql-test/r/mix_innodb_myisam_binlog.result
index 93a647f673c..72288d1027b 100644
--- a/mysql-test/r/mix_innodb_myisam_binlog.result
+++ b/mysql-test/r/mix_innodb_myisam_binlog.result
@@ -1,6 +1,6 @@
drop table if exists t1, t2;
-create table t1 (a int) type=innodb;
-create table t2 (a int) type=myisam;
+create table t1 (a int) engine=innodb;
+create table t2 (a int) engine=myisam;
reset master;
begin;
insert into t1 values(1);
@@ -8,10 +8,10 @@ insert into t2 select * from t1;
commit;
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.001 79 Query 1 79 use `test`; BEGIN
-master-bin.001 119 Query 1 79 use `test`; insert into t1 values(1)
-master-bin.001 178 Query 1 79 use `test`; insert into t2 select * from t1
-master-bin.001 244 Query 1 244 use `test`; COMMIT
+master-bin.000001 79 Query 1 79 use `test`; BEGIN
+master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(1)
+master-bin.000001 178 Query 1 79 use `test`; insert into t2 select * from t1
+master-bin.000001 244 Query 1 244 use `test`; COMMIT
delete from t1;
delete from t2;
reset master;
@@ -19,13 +19,14 @@ begin;
insert into t1 values(2);
insert into t2 select * from t1;
rollback;
-Warning: Some non-transactional changed tables couldn't be rolled back
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.001 79 Query 1 79 use `test`; BEGIN
-master-bin.001 119 Query 1 79 use `test`; insert into t1 values(2)
-master-bin.001 178 Query 1 79 use `test`; insert into t2 select * from t1
-master-bin.001 244 Query 1 244 use `test`; ROLLBACK
+master-bin.000001 79 Query 1 79 use `test`; BEGIN
+master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(2)
+master-bin.000001 178 Query 1 79 use `test`; insert into t2 select * from t1
+master-bin.000001 244 Query 1 244 use `test`; ROLLBACK
delete from t1;
delete from t2;
reset master;
@@ -35,17 +36,18 @@ savepoint my_savepoint;
insert into t1 values(4);
insert into t2 select * from t1;
rollback to savepoint my_savepoint;
-Warning: Some non-transactional changed tables couldn't be rolled back
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
commit;
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.001 79 Query 1 79 use `test`; BEGIN
-master-bin.001 119 Query 1 79 use `test`; insert into t1 values(3)
-master-bin.001 178 Query 1 79 use `test`; savepoint my_savepoint
-master-bin.001 235 Query 1 79 use `test`; insert into t1 values(4)
-master-bin.001 294 Query 1 79 use `test`; insert into t2 select * from t1
-master-bin.001 360 Query 1 79 use `test`; rollback to savepoint my_savepoint
-master-bin.001 429 Query 1 429 use `test`; COMMIT
+master-bin.000001 79 Query 1 79 use `test`; BEGIN
+master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(3)
+master-bin.000001 178 Query 1 79 use `test`; savepoint my_savepoint
+master-bin.000001 235 Query 1 79 use `test`; insert into t1 values(4)
+master-bin.000001 294 Query 1 79 use `test`; insert into t2 select * from t1
+master-bin.000001 360 Query 1 79 use `test`; rollback to savepoint my_savepoint
+master-bin.000001 429 Query 1 429 use `test`; COMMIT
delete from t1;
delete from t2;
reset master;
@@ -55,7 +57,8 @@ savepoint my_savepoint;
insert into t1 values(6);
insert into t2 select * from t1;
rollback to savepoint my_savepoint;
-Warning: Some non-transactional changed tables couldn't be rolled back
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
insert into t1 values(7);
commit;
select a from t1 order by a;
@@ -64,14 +67,14 @@ a
7
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.001 79 Query 1 79 use `test`; BEGIN
-master-bin.001 119 Query 1 79 use `test`; insert into t1 values(5)
-master-bin.001 178 Query 1 79 use `test`; savepoint my_savepoint
-master-bin.001 235 Query 1 79 use `test`; insert into t1 values(6)
-master-bin.001 294 Query 1 79 use `test`; insert into t2 select * from t1
-master-bin.001 360 Query 1 79 use `test`; rollback to savepoint my_savepoint
-master-bin.001 429 Query 1 79 use `test`; insert into t1 values(7)
-master-bin.001 488 Query 1 488 use `test`; COMMIT
+master-bin.000001 79 Query 1 79 use `test`; BEGIN
+master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(5)
+master-bin.000001 178 Query 1 79 use `test`; savepoint my_savepoint
+master-bin.000001 235 Query 1 79 use `test`; insert into t1 values(6)
+master-bin.000001 294 Query 1 79 use `test`; insert into t2 select * from t1
+master-bin.000001 360 Query 1 79 use `test`; rollback to savepoint my_savepoint
+master-bin.000001 429 Query 1 79 use `test`; insert into t1 values(7)
+master-bin.000001 488 Query 1 488 use `test`; COMMIT
delete from t1;
delete from t2;
reset master;
@@ -86,10 +89,10 @@ get_lock("a",10)
1
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.001 79 Query 1 79 use `test`; BEGIN
-master-bin.001 119 Query 1 79 use `test`; insert into t1 values(8)
-master-bin.001 178 Query 1 79 use `test`; insert into t2 select * from t1
-master-bin.001 244 Query 1 244 use `test`; ROLLBACK
+master-bin.000001 79 Query 1 79 use `test`; BEGIN
+master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(8)
+master-bin.000001 178 Query 1 79 use `test`; insert into t2 select * from t1
+master-bin.000001 244 Query 1 244 use `test`; ROLLBACK
delete from t1;
delete from t2;
reset master;
@@ -97,8 +100,8 @@ insert into t1 values(9);
insert into t2 select * from t1;
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.001 79 Query 1 79 use `test`; insert into t1 values(9)
-master-bin.001 138 Query 1 138 use `test`; insert into t2 select * from t1
+master-bin.000001 79 Query 1 79 use `test`; insert into t1 values(9)
+master-bin.000001 138 Query 1 138 use `test`; insert into t2 select * from t1
delete from t1;
delete from t2;
reset master;
@@ -107,18 +110,18 @@ begin;
insert into t2 select * from t1;
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.001 79 Query 1 79 use `test`; insert into t1 values(10)
-master-bin.001 139 Query 1 139 use `test`; insert into t2 select * from t1
+master-bin.000001 79 Query 1 79 use `test`; insert into t1 values(10)
+master-bin.000001 139 Query 1 139 use `test`; insert into t2 select * from t1
insert into t1 values(11);
commit;
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.001 79 Query 1 79 use `test`; insert into t1 values(10)
-master-bin.001 139 Query 1 139 use `test`; insert into t2 select * from t1
-master-bin.001 205 Query 1 205 use `test`; BEGIN
-master-bin.001 245 Query 1 205 use `test`; insert into t1 values(11)
-master-bin.001 305 Query 1 305 use `test`; COMMIT
-alter table t2 type=INNODB;
+master-bin.000001 79 Query 1 79 use `test`; insert into t1 values(10)
+master-bin.000001 139 Query 1 139 use `test`; insert into t2 select * from t1
+master-bin.000001 205 Query 1 205 use `test`; BEGIN
+master-bin.000001 245 Query 1 205 use `test`; insert into t1 values(11)
+master-bin.000001 305 Query 1 305 use `test`; COMMIT
+alter table t2 engine=INNODB;
delete from t1;
delete from t2;
reset master;
@@ -128,10 +131,10 @@ insert into t2 select * from t1;
commit;
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.001 79 Query 1 79 use `test`; BEGIN
-master-bin.001 119 Query 1 79 use `test`; insert into t1 values(12)
-master-bin.001 179 Query 1 79 use `test`; insert into t2 select * from t1
-master-bin.001 245 Query 1 245 use `test`; COMMIT
+master-bin.000001 79 Query 1 79 use `test`; BEGIN
+master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(12)
+master-bin.000001 179 Query 1 79 use `test`; insert into t2 select * from t1
+master-bin.000001 245 Query 1 245 use `test`; COMMIT
delete from t1;
delete from t2;
reset master;
@@ -153,9 +156,9 @@ rollback to savepoint my_savepoint;
commit;
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.001 79 Query 1 79 use `test`; BEGIN
-master-bin.001 119 Query 1 79 use `test`; insert into t1 values(14)
-master-bin.001 179 Query 1 179 use `test`; COMMIT
+master-bin.000001 79 Query 1 79 use `test`; BEGIN
+master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(14)
+master-bin.000001 179 Query 1 179 use `test`; COMMIT
delete from t1;
delete from t2;
reset master;
@@ -173,10 +176,10 @@ a
18
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.001 79 Query 1 79 use `test`; BEGIN
-master-bin.001 119 Query 1 79 use `test`; insert into t1 values(16)
-master-bin.001 179 Query 1 79 use `test`; insert into t1 values(18)
-master-bin.001 239 Query 1 239 use `test`; COMMIT
+master-bin.000001 79 Query 1 79 use `test`; BEGIN
+master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(16)
+master-bin.000001 179 Query 1 79 use `test`; insert into t1 values(18)
+master-bin.000001 239 Query 1 239 use `test`; COMMIT
delete from t1;
delete from t2;
alter table t2 type=MyISAM;
@@ -191,7 +194,7 @@ select (@before:=unix_timestamp())*0;
begin;
select * from t1 for update;
insert into t2 values (20);
-Lock wait timeout exceeded; Try restarting transaction
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select (@after:=unix_timestamp())*0;
(@after:=unix_timestamp())*0
0
diff --git a/mysql-test/r/multi_statement.result b/mysql-test/r/multi_statement.result
new file mode 100644
index 00000000000..4451b0a355e
--- /dev/null
+++ b/mysql-test/r/multi_statement.result
@@ -0,0 +1,33 @@
+select 1;
+1
+1
+select 2;
+select 3;
+select 4||||
+2
+2
+3
+3
+4
+4
+select 5;
+select 6;
+select 50, 'abc';'abcd'
+5
+5
+6
+6
+50 abc
+50 abc
+select "abcd'";'abcd'
+abcd'
+abcd'
+select "'abcd";'abcd'
+'abcd
+'abcd
+select 5'abcd'
+5
+5
+select 'finish';
+finish
+finish
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index 5e7b392b503..dba10296063 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -1,4 +1,8 @@
drop table if exists t1,t2,t3;
+drop database if exists mysqltest;
+revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
+revoke all privileges on mysqltest.* from mysqltest_1@localhost;
+delete from mysql.user where user=_binary'mysqltest_1';
create table t1(id1 int not null auto_increment primary key, t char(12));
create table t2(id2 int not null, t char(12));
create table t3(id3 int not null, t char(12), index(id3));
@@ -74,19 +78,19 @@ CREATE TABLE t1 (
id int(11) NOT NULL default '0',
name varchar(10) default NULL,
PRIMARY KEY (id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,'aaa'),(2,'aaa'),(3,'aaa');
CREATE TABLE t2 (
id int(11) NOT NULL default '0',
name varchar(10) default NULL,
PRIMARY KEY (id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t2 VALUES (2,'bbb'),(3,'bbb'),(4,'bbb');
CREATE TABLE t3 (
id int(11) NOT NULL default '0',
mydate datetime default NULL,
PRIMARY KEY (id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t3 VALUES (1,'2002-02-04 00:00:00'),(3,'2002-05-12 00:00:00'),(5,'2002-05-12 00:00:00'),(6,'2002-06-22
00:00:00'),(7,'2002-07-22 00:00:00');
delete t1,t2,t3 from t1,t2,t3 where to_days(now())-to_days(t3.mydate)>=30 and t3.id=t1.id and t3.id=t2.id;
@@ -96,13 +100,13 @@ id mydate
5 2002-05-12 00:00:00
6 2002-06-22 00:00:00
7 2002-07-22 00:00:00
-DROP TABLE IF EXISTS t1,t2,t3;
+DROP TABLE t1,t2,t3;
CREATE TABLE IF NOT EXISTS `t1` (
`id` int(11) NOT NULL auto_increment,
`tst` text,
`tst1` text,
PRIMARY KEY (`id`)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
CREATE TABLE IF NOT EXISTS `t2` (
`ID` int(11) NOT NULL auto_increment,
`ParId` int(11) default NULL,
@@ -111,7 +115,7 @@ CREATE TABLE IF NOT EXISTS `t2` (
PRIMARY KEY (`ID`),
KEY `IX_ParId_t2` (`ParId`),
FOREIGN KEY (`ParId`) REFERENCES `t1` (`id`)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1(tst,tst1) VALUES("MySQL","MySQL AB"), ("MSSQL","Microsoft"), ("ORACLE","ORACLE");
INSERT INTO t2(ParId) VALUES(1), (2), (3);
select * from t2;
@@ -125,7 +129,7 @@ ID ParId tst tst1
1 1 MySQL MySQL AB
2 2 MSSQL Microsoft
3 3 ORACLE ORACLE
-drop table if exists t1, t2 ;
+drop table t1, t2 ;
create table t1 (n numeric(10));
create table t2 (n numeric(10));
insert into t2 values (1),(2),(4),(8),(16),(32);
@@ -147,9 +151,9 @@ insert into t1 values(1,1);
insert into t2 values(1,10),(2,20);
LOCK TABLES t1 write, t2 read;
DELETE t1.*, t2.* FROM t1,t2 where t1.n=t2.n;
-Table 't2' was locked with a READ lock and can't be updated
+ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
-Table 't2' was locked with a READ lock and can't be updated
+ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n;
unlock tables;
LOCK TABLES t1 write, t2 write;
@@ -171,7 +175,7 @@ create table t2 (n int(10), d int(10));
insert into t1 values(1,1);
insert into t2 values(1,10),(2,20);
UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n;
-You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
+ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
set sql_safe_updates=0;
drop table t1,t2;
set timestamp=1038401397;
@@ -189,7 +193,7 @@ n d unix_timestamp(t)
1 10 1038401397
2 20 1038401397
UPDATE t1,t2 SET 1=2 WHERE t1.n=t2.n;
-You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '1=2 WHERE t1.n=t2.n' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1=2 WHERE t1.n=t2.n' at line 1
drop table t1,t2;
set timestamp=0;
set sql_safe_updates=0;
@@ -234,17 +238,31 @@ select * from t2;
n d
1 30
1 30
+UPDATE t1 a ,t2 b SET a.d=b.d,b.d=30 WHERE a.n=b.n;
+select * from t1;
+n d
+1 30
+3 2
+select * from t2;
+n d
+1 30
+1 30
+DELETE a, b FROM t1 a,t2 b where a.n=b.n;
+select * from t1;
+n d
+3 2
+select * from t2;
+n d
drop table t1,t2;
-drop table if exists t1,t2,t3;
-CREATE TABLE t1 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM;
+CREATE TABLE t1 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a'),(10,''),(11,''),(12,''),(13,'');
-CREATE TABLE t2 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM;
+CREATE TABLE t2 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a');
-CREATE TABLE t3 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM;
+CREATE TABLE t3 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) ENGINE=MyISAM;
INSERT INTO t3 VALUES (1,'jedan'),(2,'dva');
update t1,t2 set t1.naziv="aaaa" where t1.broj=t2.broj;
update t1,t2,t3 set t1.naziv="bbbb", t2.naziv="aaaa" where t1.broj=t2.broj and t2.broj=t3.broj;
-drop table if exists t1,t2,t3;
+drop table t1,t2,t3;
CREATE TABLE t1 (a int not null primary key, b int not null, key (b));
CREATE TABLE t2 (a int not null primary key, b int not null, key (b));
INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
@@ -308,8 +326,9 @@ a b
7 7
8 8
9 9
+update t1,t2 set t1.b=t2.b, t1.a=t2.a where t1.a=t2.a and not exists (select * from t2 where t2.a > 10);
drop table t1,t2;
-CREATE TABLE t3 ( KEY1 varchar(50) NOT NULL default '', PARAM_CORR_DISTANCE_RUSH double default NULL, PARAM_CORR_DISTANCE_GEM double default NULL, PARAM_AVG_TARE double default NULL, PARAM_AVG_NB_DAYS double default NULL, PARAM_DEFAULT_PROP_GEM_SRVC varchar(50) default NULL, PARAM_DEFAULT_PROP_GEM_NO_ETIK varchar(50) default NULL, PARAM_SCENARIO_COSTS varchar(50) default NULL, PARAM_DEFAULT_WAGON_COST double default NULL, tmp int(11) default NULL, PRIMARY KEY (KEY1)) TYPE=MyISAM;
+CREATE TABLE t3 ( KEY1 varchar(50) NOT NULL default '', PARAM_CORR_DISTANCE_RUSH double default NULL, PARAM_CORR_DISTANCE_GEM double default NULL, PARAM_AVG_TARE double default NULL, PARAM_AVG_NB_DAYS double default NULL, PARAM_DEFAULT_PROP_GEM_SRVC varchar(50) default NULL, PARAM_DEFAULT_PROP_GEM_NO_ETIK varchar(50) default NULL, PARAM_SCENARIO_COSTS varchar(50) default NULL, PARAM_DEFAULT_WAGON_COST double default NULL, tmp int(11) default NULL, PRIMARY KEY (KEY1)) ENGINE=MyISAM;
INSERT INTO t3 VALUES ('A',1,1,22,3.2,'R','R','BASE2',0.24,NULL);
create table t1 (A varchar(1));
insert into t1 values ("A") ,("B"),("C"),("D");
@@ -336,7 +355,6 @@ a b
3 4
4 5
drop table t1;
-drop table if exists t1, t2;
create table t1(id1 smallint(5), field char(5));
create table t2(id2 smallint(5), field char(5));
insert into t1 values (1, 'a'), (2, 'aa');
@@ -359,31 +377,53 @@ where 0=1;
delete t1, t2 from t2,t1
where t1.id1=t2.id2 and 0=1;
drop table t1,t2;
+create table t1 ( a int not null, b int not null) ;
+alter table t1 add index i1(a);
+delete from t1 where a > 2000000;
+create table t2 like t1;
+insert into t2 select * from t1;
+select 't2 rows before small delete', count(*) from t1;
+t2 rows before small delete count(*)
+t2 rows before small delete 2000000
+delete t1,t2 from t1,t2 where t1.b=t2.a and t1.a < 2;
+select 't2 rows after small delete', count(*) from t2;
+t2 rows after small delete count(*)
+t2 rows after small delete 1999999
+select 't1 rows after small delete', count(*) from t1;
+t1 rows after small delete count(*)
+t1 rows after small delete 1999999
+delete t1,t2 from t1,t2 where t1.b=t2.a and t1.a < 100*1000;
+select 't2 rows after big delete', count(*) from t2;
+t2 rows after big delete count(*)
+t2 rows after big delete 1900001
+select 't1 rows after big delete', count(*) from t1;
+t1 rows after big delete count(*)
+t1 rows after big delete 1900001
+drop table t1,t2;
CREATE TABLE t1 ( a int );
CREATE TABLE t2 ( a int );
DELETE t1 FROM t1, t2 AS t3;
DELETE t4 FROM t1, t1 AS t4;
-Not unique table/alias: 't4'
DELETE t3 FROM t1 AS t3, t1 AS t4;
-Not unique table/alias: 't3'
DELETE t1 FROM t1 AS t3, t2 AS t4;
+ERROR 42S02: Unknown table 't1' in MULTI DELETE
INSERT INTO t1 values (1),(2);
INSERT INTO t2 values (1),(2);
DELETE t1 FROM t1 AS t2, t2 AS t1 where t1.a=t2.a and t1.a=1;
SELECT * from t1;
a
+1
2
SELECT * from t2;
a
-1
2
DELETE t2 FROM t1 AS t2, t2 AS t1 where t1.a=t2.a and t1.a=2;
SELECT * from t1;
a
-2
+1
SELECT * from t2;
a
-1
+2
DROP TABLE t1,t2;
create table `t1` (`p_id` int(10) unsigned NOT NULL auto_increment, `p_code` varchar(20) NOT NULL default '', `p_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`p_id`) );
create table `t2` (`c2_id` int(10) unsigned NULL auto_increment, `c2_p_id` int(10) unsigned NOT NULL default '0', `c2_note` text NOT NULL, `c2_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`c2_id`), KEY `c2_p_id` (`c2_p_id`) );
@@ -399,9 +439,39 @@ select * from t2;
c2_id c2_p_id c2_note c2_active
1 1 A Note 1
drop table t1, t2;
-drop table if exists t2, t1;
-create table t1(aclid bigint not null primary key, status tinyint(1) not null ) type = innodb;
-create table t2(refid bigint not null primary key, aclid bigint, index idx_acl(aclid) )type = innodb;
+create database mysqltest;
+create table mysqltest.t1 (a int, b int, primary key (a));
+create table mysqltest.t2 (a int, b int, primary key (a));
+create table mysqltest.t3 (a int, b int, primary key (a));
+grant select on mysqltest.* to mysqltest_1@localhost;
+grant update on mysqltest.t1 to mysqltest_1@localhost;
+update t1, t2 set t1.b=1 where t1.a=t2.a;
+update t1, t2 set t1.b=(select t3.b from t3 where t1.a=t3.a) where t1.a=t2.a;
+revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
+revoke all privileges on mysqltest.* from mysqltest_1@localhost;
+delete from mysql.user where user=_binary'mysqltest_1';
+drop database mysqltest;
+create table t1 (a int, primary key (a));
+create table t2 (a int, primary key (a));
+create table t3 (a int, primary key (a));
+delete t1,t3 from t1,t2 where t1.a=t2.a and t2.a=(select t3.a from t3 where t1.a=t3.a);
+ERROR 42S02: Unknown table 't3' in MULTI DELETE
+drop table t1, t2, t3;
+create table t1 (col1 int);
+create table t2 (col1 int);
+update t1,t2 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1;
+ERROR HY000: You can't specify target table 't1' for update in FROM clause
+delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2.col1;
+ERROR HY000: You can't specify target table 't1' for update in FROM clause
+drop table t1,t2;
+create table t1 (
+aclid bigint not null primary key,
+status tinyint(1) not null
+) engine = innodb;
+create table t2 (
+refid bigint not null primary key,
+aclid bigint, index idx_acl(aclid)
+) engine = innodb;
insert into t2 values(1,null);
-delete t2, t1 from t2 as a left join t1 as b on (a.aclid=b.aclid) where a.refid='1';
+delete t2, t1 from t2 left join t1 on (t2.aclid=t1.aclid) where t2.refid='1';
drop table t1, t2;
diff --git a/mysql-test/r/myisam-blob.result b/mysql-test/r/myisam-blob.result
index 743d4dac254..43db7c8badd 100644
--- a/mysql-test/r/myisam-blob.result
+++ b/mysql-test/r/myisam-blob.result
@@ -24,4 +24,21 @@ delete from t1 where left(data,1)='c';
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
+INSERT INTO t1 set data=repeat('a',18*1024*1024);
+select length(data) from t1;
+length(data)
+18874368
+alter table t1 modify data blob;
+select length(data) from t1;
+length(data)
+0
+drop table t1;
+CREATE TABLE t1 (data BLOB) ENGINE=myisam;
+INSERT INTO t1 (data) VALUES (NULL);
+UPDATE t1 set data=repeat('a',18*1024*1024);
+Warnings:
+Warning 1265 Data truncated for column 'data' at row 1
+select length(data) from t1;
+length(data)
+65535
drop table t1;
diff --git a/mysql-test/r/myisam-blob.result.es b/mysql-test/r/myisam-blob.result.es
new file mode 100644
index 00000000000..4031b9cfd1c
--- /dev/null
+++ b/mysql-test/r/myisam-blob.result.es
@@ -0,0 +1,59 @@
+drop table if exists t1;
+CREATE TABLE t1 (data LONGBLOB) ENGINE=myisam;
+INSERT INTO t1 (data) VALUES (NULL);
+UPDATE t1 set data=repeat('a',18*1024*1024);
+Warnings:
+Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
+select length(data) from t1;
+length(data)
+NULL
+delete from t1 where left(data,1)='a';
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+truncate table t1;
+INSERT INTO t1 (data) VALUES (repeat('a',1*1024*1024));
+Warnings:
+Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
+INSERT INTO t1 (data) VALUES (repeat('b',16*1024*1024-1024));
+Warnings:
+Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
+delete from t1 where left(data,1)='b';
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+UPDATE t1 set data=repeat('c',17*1024*1024);
+Warnings:
+Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
+Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+delete from t1 where left(data,1)='c';
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t1 set data=repeat('a',18*1024*1024);
+Warnings:
+Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
+select length(data) from t1;
+length(data)
+NULL
+NULL
+NULL
+alter table t1 modify data blob;
+select length(data) from t1;
+length(data)
+NULL
+NULL
+NULL
+drop table t1;
+CREATE TABLE t1 (data BLOB) ENGINE=myisam;
+INSERT INTO t1 (data) VALUES (NULL);
+UPDATE t1 set data=repeat('a',18*1024*1024);
+Warnings:
+Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
+select length(data) from t1;
+length(data)
+NULL
+drop table t1;
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index c55bacdd371..d155a14bb60 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -1,8 +1,9 @@
drop table if exists t1,t2;
+SET SQL_WARNINGS=1;
CREATE TABLE t1 (
STRING_DATA char(255) default NULL,
-KEY STRING_DATA (STRING_DATA)
-) TYPE=MyISAM;
+KEY string_data (STRING_DATA)
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA');
INSERT INTO t1 VALUES ('DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD');
INSERT INTO t1 VALUES ('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF');
@@ -48,32 +49,32 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par
t1 0 PRIMARY 1 a A 5 NULL NULL BTREE
t1 1 b 1 b A 1 NULL NULL BTREE
drop table t1;
-create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) type=myisam;
+create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=myisam;
insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
explain select * from t1 order by a;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 4 Using filesort
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort
explain select * from t1 order by b;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 4 Using filesort
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort
explain select * from t1 order by c;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 4 Using filesort
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort
explain select a from t1 order by a;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL PRIMARY 4 NULL 4 Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index
explain select b from t1 order by b;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL b 4 NULL 4 Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL b 4 NULL 4 Using index
explain select a,b from t1 order by b;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 4 Using filesort
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort
explain select a,b from t1;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 4
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4
explain select a,b,c from t1;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 4
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4
drop table t1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1), (2), (3);
@@ -289,6 +290,12 @@ update t1 set i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
+delete from t1 where i8=1;
+select i1,i2 from t1;
+i1 i2
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
drop table t1;
CREATE TABLE `t1` (
`post_id` mediumint(8) unsigned NOT NULL auto_increment,
@@ -306,7 +313,7 @@ KEY `ip` (`ip`),
KEY `poster_login` (`poster_login`),
KEY `topic_id` (`topic_id`),
FULLTEXT KEY `post_text` (`post_text`)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 (post_text) VALUES ('ceci est un test'),('ceci est un test'),('ceci est un test'),('ceci est un test'),('ceci est un test');
REPAIR TABLE t1;
Table Op Msg_type Msg_text
@@ -315,11 +322,11 @@ CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
-CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255), KEY t1 (a, b, c));
-Specified key was too long. Max key length is 500
-CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255));
-ALTER TABLE t1 ADD INDEX t1 (a, b, c);
-Specified key was too long. Max key length is 500
+CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255), d varchar(255), e varchar(255), KEY t1 (a, b, c, d, e));
+ERROR 42000: Specified key was too long; max key length is 1000 bytes
+CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255), d varchar(255), e varchar(255));
+ALTER TABLE t1 ADD INDEX t1 (a, b, c, d, e);
+ERROR 42000: Specified key was too long; max key length is 1000 bytes
DROP TABLE t1;
CREATE TABLE t1 (a int not null, b int, c int, key(b), key(c), key(a,b), key(c,a));
INSERT into t1 values (0, null, 0), (0, null, 1), (0, null, 2), (0, null,3), (1,1,4);
@@ -337,31 +344,37 @@ t1 1 a 2 b A 5 NULL NULL YES BTREE
t1 1 c_2 1 c A 5 NULL NULL YES BTREE
t1 1 c_2 2 a A 5 NULL NULL BTREE
explain select * from t1,t2 where t1.a=t2.a;
-table type possible_keys key key_len ref rows Extra
-t2 ALL a NULL NULL NULL 2
-t1 ALL a NULL NULL NULL 4 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL a NULL NULL NULL 2
+1 SIMPLE t1 ALL a NULL NULL NULL 4 Using where
explain select * from t1,t2 force index(a) where t1.a=t2.a;
-table type possible_keys key key_len ref rows Extra
-t2 ALL a NULL NULL NULL 2
-t1 ALL a NULL NULL NULL 4 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL a NULL NULL NULL 2
+1 SIMPLE t1 ALL a NULL NULL NULL 4 Using where
explain select * from t1 force index(a),t2 force index(a) where t1.a=t2.a;
-table type possible_keys key key_len ref rows Extra
-t2 ALL a NULL NULL NULL 2
-t1 ref a a 4 t2.a 3
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL a NULL NULL NULL 2
+1 SIMPLE t1 ref a a 4 test.t2.a 3
explain select * from t1,t2 where t1.b=t2.b;
-table type possible_keys key key_len ref rows Extra
-t2 ALL b NULL NULL NULL 2
-t1 ref b b 5 t2.b 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL b NULL NULL NULL 2
+1 SIMPLE t1 ref b b 5 test.t2.b 1 Using where
explain select * from t1,t2 force index(c) where t1.a=t2.a;
-table type possible_keys key key_len ref rows Extra
-t2 ALL NULL NULL NULL NULL 2
-t1 ALL a NULL NULL NULL 4 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2
+1 SIMPLE t1 ALL a NULL NULL NULL 4 Using where
explain select * from t1 where a=0 or a=2;
-table type possible_keys key key_len ref rows Extra
-t1 ALL a NULL NULL NULL 5 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL a NULL NULL NULL 5 Using where
explain select * from t1 force index (a) where a=0 or a=2;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 4 NULL 4 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 4 NULL 4 Using where
+explain select * from t1 where c=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref c,c_2 c 5 const 1 Using where
+explain select * from t1 use index() where c=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
drop table t1,t2;
create table t1 (a int not null auto_increment primary key, b varchar(255));
insert into t1 (b) values (repeat('a',100)),(repeat('b',100)),(repeat('c',100));
@@ -415,6 +428,38 @@ select * from t1 where a='807780' and b='477' and c='165';
a b c
807780 477 165
drop table t1;
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1 (a varchar(150) NOT NULL, KEY (a));
+INSERT t1 VALUES ("can \tcan");
+INSERT t1 VALUES ("can can");
+INSERT t1 VALUES ("can");
+SELECT * FROM t1;
+a
+can can
+can
+can can
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1;
+create table t1 (a blob);
+insert into t1 values('a '),('a');
+select concat(a,'.') from t1 where a='a';
+concat(a,'.')
+a.
+select concat(a,'.') from t1 where a='a ';
+concat(a,'.')
+a .
+alter table t1 add key(a(2));
+select concat(a,'.') from t1 where a='a';
+concat(a,'.')
+a.
+select concat(a,'.') from t1 where a='a ';
+concat(a,'.')
+a .
+drop table t1;
create table t1 (a int not null auto_increment primary key, b text not null, unique b (b(20)));
insert into t1 (b) values ('a'),('a '),('a ');
select concat(b,'.') from t1;
@@ -424,7 +469,7 @@ a .
a .
update t1 set b='b ' where a=2;
update t1 set b='b ' where a > 1;
-Duplicate entry 'b ' for key 2
+ERROR 23000: Duplicate entry 'b ' for key 2
delete from t1 where b='b';
select a,concat(b,'.') from t1;
a concat(b,'.')
@@ -445,19 +490,67 @@ select sql_big_result distinct t1.a from t1,t2;
a
1
explain select sql_big_result distinct t1.a from t1,t2 order by t2.a;
-table type possible_keys key key_len ref rows Extra
-t1 system NULL NULL NULL NULL 1 Using temporary
-t2 index NULL PRIMARY 4 NULL 2 Using index; Distinct
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 1 Using temporary
+1 SIMPLE t2 index NULL PRIMARY 4 NULL 2 Using index; Distinct
explain select distinct t1.a from t1,t2 order by t2.a;
-table type possible_keys key key_len ref rows Extra
-t1 system NULL NULL NULL NULL 1 Using temporary
-t2 index NULL PRIMARY 4 NULL 2 Using index; Distinct
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 1 Using temporary
+1 SIMPLE t2 index NULL PRIMARY 4 NULL 2 Using index; Distinct
+drop table t1,t2;
+CREATE TABLE t1 (`a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', UNIQUE KEY `a` USING RTREE (`a`,`b`)) ENGINE=MyISAM;
+ERROR 42000: This version of MySQL doesn't yet support 'RTREE INDEX'
+create table t1 (a int, b varchar(200), c text not null) checksum=1;
+create table t2 (a int, b varchar(200), c text not null) checksum=0;
+insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
+insert t2 select * from t1;
+checksum table t1, t2, t3 quick;
+Table Checksum
+test.t1 968604391
+test.t2 NULL
+test.t3 NULL
+checksum table t1, t2, t3;
+Table Checksum
+test.t1 968604391
+test.t2 968604391
+test.t3 NULL
+checksum table t1, t2, t3 extended;
+Table Checksum
+test.t1 968604391
+test.t2 968604391
+test.t3 NULL
+drop table t1,t2;
+create table t1 (a int, key (a));
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 a 1 a A NULL NULL NULL YES BTREE
+alter table t1 disable keys;
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 a 1 a A NULL NULL NULL YES BTREE disabled
+create table t2 (a int);
+set @@rand_seed1=31415926,@@rand_seed2=2718281828;
+insert t1 select * from t2;
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 a 1 a A NULL NULL NULL YES BTREE disabled
+alter table t1 enable keys;
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 a 1 a A 1000 NULL NULL YES BTREE
+alter table t1 engine=heap;
+alter table t1 disable keys;
+Warnings:
+Note 1031 Table storage engine for 't1' doesn't have this option
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 a 1 a NULL 1000 NULL NULL YES HASH
drop table t1,t2;
create table t1 ( a tinytext, b char(1), index idx (a(1),b) );
insert into t1 values (null,''), (null,'');
explain select count(*) from t1 where a is null;
-table type possible_keys key key_len ref rows Extra
-t1 ref idx idx 4 const 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx idx 4 const 1 Using where
select count(*) from t1 where a is null;
count(*)
2
diff --git a/mysql-test/r/mysql_protocols.result b/mysql-test/r/mysql_protocols.result
new file mode 100644
index 00000000000..cbead9254a2
--- /dev/null
+++ b/mysql-test/r/mysql_protocols.result
@@ -0,0 +1,9 @@
+<default>
+ ok
+TCP
+ ok
+SOCKET
+ ok
+ERROR 2047 (HY000): Wrong or unknown protocol
+ERROR 2047 (HY000): Wrong or unknown protocol
+Unknown option to protocol: NullS
diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
index 79bf46280dd..e88ece6b361 100644
--- a/mysql-test/r/mysqlbinlog.result
+++ b/mysql-test/r/mysqlbinlog.result
@@ -1,5 +1,5 @@
-drop table if exists t1,t2;
set timestamp=1000000000;
+drop table if exists t1,t2;
create table t1 (word varchar(20));
create table t2 (id int auto_increment not null primary key);
insert into t1 values ("abirvalg");
@@ -17,6 +17,8 @@ flush logs;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
use test;
SET TIMESTAMP=1000000000;
+drop table if exists t1,t2;
+SET TIMESTAMP=1000000000;
create table t1 (word varchar(20));
SET TIMESTAMP=1000000000;
create table t2 (id int auto_increment not null primary key);
@@ -51,6 +53,8 @@ insert into t1 values ("Alas");
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
use test;
SET TIMESTAMP=1000000000;
+drop table if exists t1,t2;
+SET TIMESTAMP=1000000000;
create table t1 (word varchar(20));
SET TIMESTAMP=1000000000;
create table t2 (id int auto_increment not null primary key);
@@ -64,9 +68,6 @@ LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-2-1' INTO TABLE `t1` FI
LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-3-1' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-4-1' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-5-1' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
-LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-6-1' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
-SET TIMESTAMP=1000000000;
-insert into t1 values ("Alas");
--- Broken LOAD DATA --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
@@ -83,4 +84,4 @@ SET INSERT_ID=1;
use test;
SET TIMESTAMP=1000000000;
insert into t1 values ("Alas");
-drop table t1;
+drop table t1, t2;
diff --git a/mysql-test/r/mysqlbinlog2.result b/mysql-test/r/mysqlbinlog2.result
new file mode 100644
index 00000000000..3c1b85e05a1
--- /dev/null
+++ b/mysql-test/r/mysqlbinlog2.result
@@ -0,0 +1,446 @@
+drop table if exists t1;
+reset master;
+set @a=UNIX_TIMESTAMP("2020-01-21 15:32:22");
+set timestamp=@a;
+create table t1 (a int auto_increment not null primary key, b char(3));
+insert into t1 values(null, "a");
+insert into t1 values(null, "b");
+set timestamp=@a+2;
+insert into t1 values(null, "c");
+set timestamp=@a+4;
+insert into t1 values(null, "d");
+insert into t1 values(null, "e");
+flush logs;
+set timestamp=@a+1;
+insert into t1 values(null, "f");
+
+--- Local --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+use test;
+SET TIMESTAMP=1579609942;
+create table t1 (a int auto_increment not null primary key, b char(3));
+SET INSERT_ID=1;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "a");
+SET INSERT_ID=2;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "b");
+SET INSERT_ID=3;
+SET TIMESTAMP=1579609944;
+insert into t1 values(null, "c");
+SET INSERT_ID=4;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "d");
+SET INSERT_ID=5;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "e");
+
+--- offset --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+SET INSERT_ID=1;
+use test;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "a");
+SET INSERT_ID=2;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "b");
+SET INSERT_ID=3;
+SET TIMESTAMP=1579609944;
+insert into t1 values(null, "c");
+SET INSERT_ID=4;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "d");
+SET INSERT_ID=5;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "e");
+
+--- start-position --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+use test;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "d");
+SET INSERT_ID=5;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "e");
+
+--- stop-position --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+use test;
+SET TIMESTAMP=1579609942;
+create table t1 (a int auto_increment not null primary key, b char(3));
+SET INSERT_ID=1;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "a");
+SET INSERT_ID=2;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "b");
+SET INSERT_ID=3;
+SET TIMESTAMP=1579609944;
+insert into t1 values(null, "c");
+SET INSERT_ID=4;
+
+--- start-datetime --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+SET INSERT_ID=3;
+use test;
+SET TIMESTAMP=1579609944;
+insert into t1 values(null, "c");
+SET INSERT_ID=4;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "d");
+SET INSERT_ID=5;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "e");
+
+--- stop-datetime --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+use test;
+SET TIMESTAMP=1579609942;
+create table t1 (a int auto_increment not null primary key, b char(3));
+SET INSERT_ID=1;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "a");
+SET INSERT_ID=2;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "b");
+
+--- Local with 2 binlogs on command line --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+use test;
+SET TIMESTAMP=1579609942;
+create table t1 (a int auto_increment not null primary key, b char(3));
+SET INSERT_ID=1;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "a");
+SET INSERT_ID=2;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "b");
+SET INSERT_ID=3;
+SET TIMESTAMP=1579609944;
+insert into t1 values(null, "c");
+SET INSERT_ID=4;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "d");
+SET INSERT_ID=5;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "e");
+SET INSERT_ID=6;
+use test;
+SET TIMESTAMP=1579609943;
+insert into t1 values(null, "f");
+
+--- offset --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+SET INSERT_ID=1;
+use test;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "a");
+SET INSERT_ID=2;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "b");
+SET INSERT_ID=3;
+SET TIMESTAMP=1579609944;
+insert into t1 values(null, "c");
+SET INSERT_ID=4;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "d");
+SET INSERT_ID=5;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "e");
+SET INSERT_ID=6;
+use test;
+SET TIMESTAMP=1579609943;
+insert into t1 values(null, "f");
+
+--- start-position --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+use test;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "d");
+SET INSERT_ID=5;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "e");
+SET INSERT_ID=6;
+use test;
+SET TIMESTAMP=1579609943;
+insert into t1 values(null, "f");
+
+--- stop-position --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+use test;
+SET TIMESTAMP=1579609942;
+create table t1 (a int auto_increment not null primary key, b char(3));
+SET INSERT_ID=1;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "a");
+SET INSERT_ID=2;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "b");
+SET INSERT_ID=3;
+SET TIMESTAMP=1579609944;
+insert into t1 values(null, "c");
+SET INSERT_ID=4;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "d");
+SET INSERT_ID=5;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "e");
+SET INSERT_ID=6;
+
+--- start-datetime --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+SET INSERT_ID=3;
+use test;
+SET TIMESTAMP=1579609944;
+insert into t1 values(null, "c");
+SET INSERT_ID=4;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "d");
+SET INSERT_ID=5;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "e");
+SET INSERT_ID=6;
+use test;
+SET TIMESTAMP=1579609943;
+insert into t1 values(null, "f");
+
+--- stop-datetime --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+use test;
+SET TIMESTAMP=1579609942;
+create table t1 (a int auto_increment not null primary key, b char(3));
+SET INSERT_ID=1;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "a");
+SET INSERT_ID=2;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "b");
+
+--- Remote --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+use test;
+SET TIMESTAMP=1579609942;
+create table t1 (a int auto_increment not null primary key, b char(3));
+SET INSERT_ID=1;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "a");
+SET INSERT_ID=2;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "b");
+SET INSERT_ID=3;
+SET TIMESTAMP=1579609944;
+insert into t1 values(null, "c");
+SET INSERT_ID=4;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "d");
+SET INSERT_ID=5;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "e");
+
+--- offset --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+SET INSERT_ID=1;
+use test;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "a");
+SET INSERT_ID=2;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "b");
+SET INSERT_ID=3;
+SET TIMESTAMP=1579609944;
+insert into t1 values(null, "c");
+SET INSERT_ID=4;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "d");
+SET INSERT_ID=5;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "e");
+
+--- start-position --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+use test;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "d");
+SET INSERT_ID=5;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "e");
+
+--- stop-position --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+use test;
+SET TIMESTAMP=1579609942;
+create table t1 (a int auto_increment not null primary key, b char(3));
+SET INSERT_ID=1;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "a");
+SET INSERT_ID=2;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "b");
+SET INSERT_ID=3;
+SET TIMESTAMP=1579609944;
+insert into t1 values(null, "c");
+SET INSERT_ID=4;
+
+--- start-datetime --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+SET INSERT_ID=3;
+use test;
+SET TIMESTAMP=1579609944;
+insert into t1 values(null, "c");
+SET INSERT_ID=4;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "d");
+SET INSERT_ID=5;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "e");
+
+--- stop-datetime --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+use test;
+SET TIMESTAMP=1579609942;
+create table t1 (a int auto_increment not null primary key, b char(3));
+SET INSERT_ID=1;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "a");
+SET INSERT_ID=2;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "b");
+
+--- Remote with 2 binlogs on command line --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+use test;
+SET TIMESTAMP=1579609942;
+create table t1 (a int auto_increment not null primary key, b char(3));
+SET INSERT_ID=1;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "a");
+SET INSERT_ID=2;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "b");
+SET INSERT_ID=3;
+SET TIMESTAMP=1579609944;
+insert into t1 values(null, "c");
+SET INSERT_ID=4;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "d");
+SET INSERT_ID=5;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "e");
+SET INSERT_ID=6;
+use test;
+SET TIMESTAMP=1579609943;
+insert into t1 values(null, "f");
+
+--- offset --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+SET INSERT_ID=1;
+use test;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "a");
+SET INSERT_ID=2;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "b");
+SET INSERT_ID=3;
+SET TIMESTAMP=1579609944;
+insert into t1 values(null, "c");
+SET INSERT_ID=4;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "d");
+SET INSERT_ID=5;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "e");
+SET INSERT_ID=6;
+use test;
+SET TIMESTAMP=1579609943;
+insert into t1 values(null, "f");
+
+--- start-position --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+use test;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "d");
+SET INSERT_ID=5;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "e");
+SET INSERT_ID=6;
+use test;
+SET TIMESTAMP=1579609943;
+insert into t1 values(null, "f");
+
+--- stop-position --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+use test;
+SET TIMESTAMP=1579609942;
+create table t1 (a int auto_increment not null primary key, b char(3));
+SET INSERT_ID=1;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "a");
+SET INSERT_ID=2;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "b");
+SET INSERT_ID=3;
+SET TIMESTAMP=1579609944;
+insert into t1 values(null, "c");
+SET INSERT_ID=4;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "d");
+SET INSERT_ID=5;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "e");
+SET INSERT_ID=6;
+
+--- start-datetime --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+SET INSERT_ID=3;
+use test;
+SET TIMESTAMP=1579609944;
+insert into t1 values(null, "c");
+SET INSERT_ID=4;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "d");
+SET INSERT_ID=5;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "e");
+SET INSERT_ID=6;
+use test;
+SET TIMESTAMP=1579609943;
+insert into t1 values(null, "f");
+
+--- stop-datetime --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+use test;
+SET TIMESTAMP=1579609942;
+create table t1 (a int auto_increment not null primary key, b char(3));
+SET INSERT_ID=1;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "a");
+SET INSERT_ID=2;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "b");
+
+--- to-last-log --
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+use test;
+SET TIMESTAMP=1579609942;
+create table t1 (a int auto_increment not null primary key, b char(3));
+SET INSERT_ID=1;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "a");
+SET INSERT_ID=2;
+SET TIMESTAMP=1579609942;
+insert into t1 values(null, "b");
+SET INSERT_ID=3;
+SET TIMESTAMP=1579609944;
+insert into t1 values(null, "c");
+SET INSERT_ID=4;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "d");
+SET INSERT_ID=5;
+SET TIMESTAMP=1579609946;
+insert into t1 values(null, "e");
+SET INSERT_ID=6;
+SET TIMESTAMP=1579609943;
+insert into t1 values(null, "f");
+
+--- end of test --
+drop table t1;
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 714cb42af5e..57e04d38fc1 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -1,51 +1,482 @@
-DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t1, `"t"1`;
CREATE TABLE t1(a int);
INSERT INTO t1 VALUES (1), (2);
<?xml version="1.0"?>
<mysqldump>
<database name="test">
- <table name="t1">
+ <table_structure name="t1">
+ <field Field="a" Type="int(11)" Null="YES" Key="" Extra="" />
+ </table_structure>
+ <table_data name="t1">
<row>
<field name="a">1</field>
</row>
<row>
<field name="a">2</field>
</row>
- </table>
+ </table_data>
</database>
</mysqldump>
DROP TABLE t1;
CREATE TABLE t1 (a decimal(240, 20));
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
("0987654321098765432109876543210987654321");
-CREATE TABLE t1 (
- a decimal(240,20) default NULL
-) TYPE=MyISAM;
-
-INSERT INTO t1 VALUES ('1234567890123456789012345678901234567890.00000000000000000000');
-INSERT INTO t1 VALUES ('0987654321098765432109876543210987654321.00000000000000000000');
-
+CREATE TABLE `t1` (
+ `a` decimal(240,20) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('0987654321098765432109876543210987654321.00000000000000000000');
DROP TABLE t1;
CREATE TABLE t1 (a double);
INSERT INTO t1 VALUES (-9e999999);
-CREATE TABLE t1 (
- a double default NULL
-) TYPE=MyISAM;
-
-INSERT INTO t1 VALUES (RES);
-
+CREATE TABLE `t1` (
+ `a` double default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO `t1` VALUES (RES);
DROP TABLE t1;
CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT);
INSERT INTO t1 VALUES (1.2345, 2.3456);
INSERT INTO t1 VALUES ('1.2345', 2.3456);
INSERT INTO t1 VALUES ("1.2345", 2.3456);
-CREATE TABLE t1 (
- a decimal(10,5) default NULL,
- b float default NULL
+SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI_QUOTES';
+INSERT INTO t1 VALUES (1.2345, 2.3456);
+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;
+CREATE TABLE `t1` (
+ `a` decimal(10,5) default NULL,
+ `b` float default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
+CREATE TABLE `t1` (
+ `a` decimal(10,5) default NULL,
+ `b` float default NULL
+);
+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 */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `a` decimal(10,5) default NULL,
+ `b` float default NULL
+);
+
+
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
+CREATE TABLE `t1` (
+ `a` decimal(10,5) default NULL,
+ `b` float default NULL
+);
+
+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 SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+
+DROP TABLE t1;
+CREATE TABLE t1(a int, b text, c varchar(3));
+INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES");
+<?xml version="1.0"?>
+<mysqldump>
+<database name="test">
+ <table_structure name="t1">
+ <field Field="a" Type="int(11)" Null="YES" Key="" Extra="" />
+ <field Field="b" Type="text" Null="YES" Key="" Extra="" />
+ <field Field="c" Type="char(3)" Null="YES" Key="" Extra="" />
+ </table_structure>
+ <table_data name="t1">
+ <row>
+ <field name="a">1</field>
+ <field name="b">test</field>
+ <field name="c">tes</field>
+ </row>
+ <row>
+ <field name="a">2</field>
+ <field name="b">TEST</field>
+ <field name="c">TES</field>
+ </row>
+ </table_data>
+</database>
+</mysqldump>
+DROP TABLE t1;
+CREATE TABLE t1 (`a"b"` char(2));
+INSERT INTO t1 VALUES ("1\""), ("\"2");
+<?xml version="1.0"?>
+<mysqldump>
+<database name="test">
+ <table_structure name="t1">
+ <field Field="a&quot;b&quot;" Type="char(2)" Null="YES" Key="" Extra="" />
+ </table_structure>
+ <table_data name="t1">
+ <row>
+ <field name="a&quot;b&quot;">1&quot;</field>
+ </row>
+ <row>
+ <field name="a&quot;b&quot;">&quot;2</field>
+ </row>
+ </table_data>
+</database>
+</mysqldump>
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
+INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL);
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `a` varchar(255) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=koi8r;
+
+
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+INSERT INTO `t1` VALUES ('абцЎе');
+INSERT INTO `t1` VALUES (NULL);
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+
+DROP TABLE t1;
+CREATE TABLE t1 (a int) ENGINE=MYISAM;
+INSERT INTO t1 VALUES (1), (2);
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO,MYSQL40" */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `a` int(11) default NULL
+) TYPE=MyISAM;
+
+
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+INSERT INTO `t1` VALUES (1),(2);
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO,MYSQL323" */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `a` int(11) default NULL
+) TYPE=MyISAM;
+
+
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+INSERT INTO `t1` VALUES (1),(2);
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+
+DROP TABLE t1;
+create table ```a` (i int);
+CREATE TABLE ```a` (
+ `i` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+drop table ```a`;
+create table t1(a int);
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `a` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO,ANSI" */;
+DROP TABLE IF EXISTS "t1";
+CREATE TABLE "t1" (
+ "a" int(11) default NULL
+);
+
+
+/*!40000 ALTER TABLE "t1" DISABLE KEYS */;
+LOCK TABLES "t1" WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE "t1" ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+
+set global sql_mode='ANSI_QUOTES';
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `a` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO,ANSI" */;
+DROP TABLE IF EXISTS "t1";
+CREATE TABLE "t1" (
+ "a" int(11) default NULL
+);
+
+
+/*!40000 ALTER TABLE "t1" DISABLE KEYS */;
+LOCK TABLES "t1" WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE "t1" ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+
+set global sql_mode='';
+drop table t1;
+create table t1(a int);
+insert into t1 values (1),(2),(3);
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="" */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `a` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+
+1
+2
+3
+drop table t1;
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
+
+CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */;
+
+USE `test`;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+
+create database mysqldump_test_db character set latin2 collate latin2_bin;
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
+
+CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_test_db` /*!40100 DEFAULT CHARACTER SET latin2 COLLATE latin2_bin */;
+
+USE `mysqldump_test_db`;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+
+drop database mysqldump_test_db;
+CREATE TABLE t1 (a CHAR(10));
+INSERT INTO t1 VALUES (_latin1 'ÄÖÜß');
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `a` char(10) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+INSERT INTO `t1` VALUES ('ÄÖÜß');
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO,MYSQL323" */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `a` char(10) default NULL
+) TYPE=MyISAM;
+
+
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+INSERT INTO `t1` VALUES ('ÄÖÜß');
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO,MYSQL323" */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `a` char(10) default NULL
+) TYPE=MyISAM;
+
+
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+INSERT INTO `t1` VALUES ('Ž™šá');
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO,MYSQL323" */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `a` char(10) default NULL
) TYPE=MyISAM;
-INSERT INTO t1 VALUES ('1.23450',2.3456);
-INSERT INTO t1 VALUES ('1.23450',2.3456);
-INSERT INTO t1 VALUES ('1.23450',2.3456);
+
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+INSERT INTO `t1` VALUES ('Ž™šá');
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO,MYSQL323" */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `a` char(10) default NULL
+) TYPE=MyISAM;
+
+
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+INSERT INTO `t1` VALUES ('ÄÖÜß');
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
DROP TABLE t1;
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
new file mode 100644
index 00000000000..d75dbd5d00c
--- /dev/null
+++ b/mysql-test/r/mysqltest.result
@@ -0,0 +1,144 @@
+select -1 as "before_use_test" ;
+before_use_test
+-1
+select otto from (select 1 as otto) as t1;
+otto
+1
+select otto from (select 1 as otto) as t1;
+otto
+1
+select friedrich from (select 1 as otto) as t1;
+ERROR 42S22: Unknown column 'friedrich' in 'field list'
+select otto from (select 1 as otto) as t1;
+otto
+1
+select otto from (select 1 as otto) as t1;
+otto
+1
+select friedrich from (select 1 as otto) as t1;
+ERROR 42S22: Unknown column 'friedrich' in 'field list'
+select friedrich from (select 1 as otto) as t1;
+ERROR 42S22: Unknown column 'friedrich' in 'field list'
+select otto from (select 1 as otto) as t1;
+otto
+1
+select 0 as "after_successful_stmt_errno" ;
+after_successful_stmt_errno
+0
+garbage ;
+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 'garbage' at line 1
+select 1064 as "after_wrong_syntax_errno" ;
+after_wrong_syntax_errno
+1064
+garbage ;
+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 'garbage' at line 1
+select 1064 as "after_let_var_equal_value" ;
+after_let_var_equal_value
+1064
+garbage ;
+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 'garbage' at line 1
+set @my_var= 'abc' ;
+select 0 as "after_set_var_equal_value" ;
+after_set_var_equal_value
+0
+garbage ;
+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 'garbage' at line 1
+select 1064 as "after_disable_warnings_command" ;
+after_disable_warnings_command
+1064
+drop table if exists t1 ;
+garbage ;
+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 'garbage' at line 1
+drop table if exists t1 ;
+select 0 as "after_disable_warnings" ;
+after_disable_warnings
+0
+garbage ;
+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 'garbage' at line 1
+select 3 from t1 ;
+ERROR 42S02: Table 'test.t1' doesn't exist
+select 1146 as "after_minus_masked" ;
+after_minus_masked
+1146
+garbage ;
+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 'garbage' at line 1
+select 3 from t1 ;
+ERROR 42S02: Table 'test.t1' doesn't exist
+select 1146 as "after_!_masked" ;
+after_!_masked
+1146
+garbage ;
+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 'garbage' at line 1
+select -1 as "after_let_errno_equal_value" ;
+after_let_errno_equal_value
+-1
+garbage ;
+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 'garbage' at line 1
+prepare stmt from "select 3 from t1" ;
+ERROR 42S02: Table 'test.t1' doesn't exist
+select 1146 as "after_failing_prepare" ;
+after_failing_prepare
+1146
+create table t1 ( f1 char(10));
+garbage ;
+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 'garbage' at line 1
+prepare stmt from "select 3 from t1" ;
+select 0 as "after_successful_prepare" ;
+after_successful_prepare
+0
+garbage ;
+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 'garbage' at line 1
+execute stmt;
+3
+select 0 as "after_successful_execute" ;
+after_successful_execute
+0
+drop table t1;
+garbage ;
+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 'garbage' at line 1
+execute stmt;
+ERROR 42S02: Table 'test.t1' doesn't exist
+select 1146 as "after_failing_execute" ;
+after_failing_execute
+1146
+garbage ;
+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 'garbage' at line 1
+execute __stmt_;
+ERROR HY000: Unknown prepared statement handler (__stmt_) given to EXECUTE
+select 1243 as "after_failing_execute" ;
+after_failing_execute
+1243
+garbage ;
+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 'garbage' at line 1
+deallocate prepare stmt;
+select 0 as "after_successful_deallocate" ;
+after_successful_deallocate
+0
+garbage ;
+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 'garbage' at line 1
+deallocate prepare __stmt_;
+ERROR HY000: Unknown prepared statement handler (__stmt_) given to DEALLOCATE PREPARE
+select 1243 as "after_failing_deallocate" ;
+after_failing_deallocate
+1243
+garbage ;
+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 'garbage' at line 1
+select 1064 as "after_--disable_abort_on_error" ;
+after_--disable_abort_on_error
+1064
+select 3 from t1 ;
+ERROR 42S02: Table 'test.t1' doesn't exist
+select 3 from t1 ;
+ERROR 42S02: Table 'test.t1' doesn't exist
+select 3 from t1 ;
+ERROR 42S02: Table 'test.t1' doesn't exist
+select 1146 as "after_!errno_masked_error" ;
+after_!errno_masked_error
+1146
+garbage ;
+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 'garbage' at line 1
+select 1064 as "after_--enable_abort_on_error" ;
+after_--enable_abort_on_error
+1064
+select 3 from t1 ;
+ERROR 42S02: Table 'test.t1' doesn't exist
diff --git a/mysql-test/r/ndb_alter_table.result b/mysql-test/r/ndb_alter_table.result
new file mode 100644
index 00000000000..f899d254243
--- /dev/null
+++ b/mysql-test/r/ndb_alter_table.result
@@ -0,0 +1,172 @@
+DROP TABLE IF EXISTS t1;
+drop database if exists mysqltest;
+CREATE TABLE t1 (
+a INT NOT NULL,
+b INT NOT NULL
+) ENGINE=ndbcluster;
+INSERT INTO t1 VALUES (9410,9412);
+ALTER TABLE t1 ADD COLUMN c int not null;
+SELECT * FROM t1;
+a b c
+9410 9412 0
+DROP TABLE t1;
+CREATE DATABASE mysqltest;
+USE mysqltest;
+CREATE TABLE t1 (
+a INT NOT NULL,
+b INT NOT NULL
+) ENGINE=ndbcluster;
+RENAME TABLE t1 TO test.t1;
+SHOW TABLES;
+Tables_in_mysqltest
+DROP DATABASE mysqltest;
+USE test;
+SHOW TABLES;
+Tables_in_test
+t1
+DROP TABLE t1;
+create table t1 (
+col1 int not null auto_increment primary key,
+col2 varchar(30) not null,
+col3 varchar (20) not null,
+col4 varchar(4) not null,
+col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null,
+col6 int not null, to_be_deleted int) ENGINE=ndbcluster;
+show table status;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t1 ndbcluster 9 Dynamic 0 0 0 NULL 0 0 1 NULL NULL NULL latin1_swedish_ci NULL
+SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
+insert into t1 values
+(0,4,3,5,"PENDING",1,7),(NULL,4,3,5,"PENDING",1,7),(31,4,3,5,"PENDING",1,7), (7,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (100,4,3,5,"PENDING",1,7), (99,4,3,5,"PENDING",1,7), (8,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7);
+show table status;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t1 ndbcluster 9 Dynamic 9 0 0 NULL 0 0 102 NULL NULL NULL latin1_swedish_ci NULL
+select * from t1 order by col1;
+col1 col2 col3 col4 col5 col6 to_be_deleted
+0 4 3 5 PENDING 1 7
+1 4 3 5 PENDING 1 7
+7 4 3 5 PENDING 1 7
+8 4 3 5 PENDING 1 7
+31 4 3 5 PENDING 1 7
+32 4 3 5 PENDING 1 7
+99 4 3 5 PENDING 1 7
+100 4 3 5 PENDING 1 7
+101 4 3 5 PENDING 1 7
+alter table t1
+add column col4_5 varchar(20) not null after col4,
+add column col7 varchar(30) not null after col5,
+add column col8 datetime not null, drop column to_be_deleted,
+change column col2 fourth varchar(30) not null after col3,
+modify column col6 int not null first;
+show table status;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t1 ndbcluster 9 Dynamic 9 0 0 NULL 0 0 102 NULL NULL NULL latin1_swedish_ci NULL
+select * from t1 order by col1;
+col6 col1 col3 fourth col4 col4_5 col5 col7 col8
+1 0 3 4 5 PENDING 0000-00-00 00:00:00
+1 1 3 4 5 PENDING 0000-00-00 00:00:00
+1 7 3 4 5 PENDING 0000-00-00 00:00:00
+1 8 3 4 5 PENDING 0000-00-00 00:00:00
+1 31 3 4 5 PENDING 0000-00-00 00:00:00
+1 32 3 4 5 PENDING 0000-00-00 00:00:00
+1 99 3 4 5 PENDING 0000-00-00 00:00:00
+1 100 3 4 5 PENDING 0000-00-00 00:00:00
+1 101 3 4 5 PENDING 0000-00-00 00:00:00
+insert into t1 values (2, NULL,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
+show table status;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t1 ndbcluster 9 Dynamic 10 0 0 NULL 0 0 103 NULL NULL NULL latin1_swedish_ci NULL
+select * from t1 order by col1;
+col6 col1 col3 fourth col4 col4_5 col5 col7 col8
+1 0 3 4 5 PENDING 0000-00-00 00:00:00
+1 1 3 4 5 PENDING 0000-00-00 00:00:00
+1 7 3 4 5 PENDING 0000-00-00 00:00:00
+1 8 3 4 5 PENDING 0000-00-00 00:00:00
+1 31 3 4 5 PENDING 0000-00-00 00:00:00
+1 32 3 4 5 PENDING 0000-00-00 00:00:00
+1 99 3 4 5 PENDING 0000-00-00 00:00:00
+1 100 3 4 5 PENDING 0000-00-00 00:00:00
+1 101 3 4 5 PENDING 0000-00-00 00:00:00
+2 102 4 3 5 99 PENDING EXTRA 2004-01-01 00:00:00
+delete from t1;
+insert into t1 values (0,0,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
+SET SQL_MODE='';
+insert into t1 values (1,0,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
+select * from t1 order by col1;
+col6 col1 col3 fourth col4 col4_5 col5 col7 col8
+0 0 4 3 5 99 PENDING EXTRA 2004-01-01 00:00:00
+1 103 4 3 5 99 PENDING EXTRA 2004-01-01 00:00:00
+alter table t1 drop column col4_5;
+insert into t1 values (2,0,4,3,5,"PENDING","EXTRA",'2004-01-01 00:00:00');
+select * from t1 order by col1;
+col6 col1 col3 fourth col4 col5 col7 col8
+0 0 4 3 5 PENDING EXTRA 2004-01-01 00:00:00
+1 103 4 3 5 PENDING EXTRA 2004-01-01 00:00:00
+2 104 4 3 5 PENDING EXTRA 2004-01-01 00:00:00
+drop table t1;
+CREATE TABLE t1 (
+a INT NOT NULL,
+b INT NOT NULL
+) ENGINE=ndbcluster;
+INSERT INTO t1 VALUES (9410,9412);
+ALTER TABLE t1 ADD COLUMN c int not null;
+select * from t1 order by a;
+a b c
+9410 9412 0
+select * from t1 order by a;
+a b c
+9410 9412 0
+alter table t1 drop c;
+select * from t1 order by a;
+a b
+9410 9412
+drop table t1;
+select * from t1 order by a;
+ERROR 42S02: Table 'test.t1' doesn't exist
+CREATE TABLE t1 (
+a INT NOT NULL PRIMARY KEY,
+b INT NOT NULL
+) ENGINE=ndbcluster;
+INSERT INTO t1 VALUES (0,1),(17,18);
+select * from t1 order by a;
+a b
+0 1
+17 18
+SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
+alter table t1 modify column a int not null auto_increment;
+SET SQL_MODE='';
+select * from t1 order by a;
+a b
+0 1
+17 18
+INSERT INTO t1 VALUES (0,19),(20,21);
+select * from t1 order by a;
+a b
+0 1
+17 18
+18 19
+20 21
+drop table t1;
+CREATE TABLE t1 (
+a INT NOT NULL PRIMARY KEY,
+b INT NOT NULL
+) ENGINE=ndbcluster;
+INSERT INTO t1 VALUES (0,1),(17,18);
+select * from t1 order by a;
+a b
+0 1
+17 18
+alter table t1 add c int not null unique auto_increment;
+select c from t1 order by c;
+c
+1
+2
+INSERT INTO t1 VALUES (1,2,0),(18,19,4),(20,21,0);
+select c from t1 order by c;
+c
+1
+2
+3
+4
+5
+drop table t1;
diff --git a/mysql-test/r/ndb_autodiscover.result b/mysql-test/r/ndb_autodiscover.result
new file mode 100644
index 00000000000..b7afb5918a4
--- /dev/null
+++ b/mysql-test/r/ndb_autodiscover.result
@@ -0,0 +1,370 @@
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+flush status;
+create table t1(
+id int not null primary key,
+name char(20)
+) engine=ndb;
+insert into t1 values(1, "Autodiscover");
+flush tables;
+select * from t1;
+id name
+1 Autodiscover
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 1
+flush tables;
+insert into t1 values (2, "Auto 2");
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 2
+insert into t1 values (3, "Discover 3");
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 2
+flush tables;
+select * from t1 order by id;
+id name
+1 Autodiscover
+2 Auto 2
+3 Discover 3
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 3
+flush tables;
+update t1 set name="Autodiscover" where id = 2;
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 4
+select * from t1 order by id;
+id name
+1 Autodiscover
+2 Autodiscover
+3 Discover 3
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 4
+flush tables;
+delete from t1 where id = 3;
+select * from t1 order by id;
+id name
+1 Autodiscover
+2 Autodiscover
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 5
+drop table t1;
+flush status;
+create table t2(
+id int not null primary key,
+name char(22)
+) engine=ndb;
+insert into t2 values (1, "Discoverer");
+select * from t2;
+id name
+1 Discoverer
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 0
+flush tables;
+select * from t2;
+id name
+1 Discoverer
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 1
+drop table t2;
+flush status;
+create table t3(
+id int not null primary key,
+name char(255)
+) engine=ndb;
+insert into t3 values (1, "Explorer");
+select * from t3;
+id name
+1 Explorer
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 0
+flush tables;
+create table t3(
+id int not null primary key,
+name char(20), a int, b float, c char(24)
+) engine=ndb;
+ERROR 42S01: Table 't3' already exists
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 1
+create table IF NOT EXISTS t3(
+id int not null primary key,
+id2 int not null,
+name char(20)
+) engine=ndb;
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 2
+SHOW CREATE TABLE t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `id` int(11) NOT NULL default '0',
+ `name` char(255) default NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+select * from t3;
+id name
+1 Explorer
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 2
+drop table t3;
+flush status;
+create table t7(
+id int not null primary key,
+name char(255)
+) engine=ndb;
+create table t6(
+id int not null primary key,
+name char(255)
+) engine=MyISAM;
+insert into t7 values (1, "Explorer");
+insert into t6 values (2, "MyISAM table");
+select * from t7;
+id name
+1 Explorer
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 0
+flush tables;
+show tables from test;
+Tables_in_test
+t6
+t7
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 1
+flush tables;
+show table status;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t6 MyISAM 9 Fixed 1 260 # # # 0 NULL # # NULL # NULL
+t7 ndbcluster 9 Fixed 1 0 # # # 0 NULL # # NULL # NULL
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 2
+drop table t6, t7;
+flush status;
+create table t4(
+id int not null primary key,
+name char(27)
+) engine=ndb;
+insert into t4 values (1, "Automatic");
+select * from t4;
+id name
+1 Automatic
+select * from t4;
+ERROR 42S02: Table 'test.t4' doesn't exist
+select * from t4;
+ERROR 42S02: Table 'test.t4' doesn't exist
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 0
+drop table t4;
+flush status;
+create table t4(
+id int not null primary key,
+id2 int,
+name char(27)
+) engine=ndb;
+insert into t4 values (1, 76, "Automatic2");
+select * from t4;
+id id2 name
+1 76 Automatic2
+flush tables;
+SHOW TABLES;
+Tables_in_test
+select * from t4;
+ERROR 42S02: Table 'test.t4' doesn't exist
+flush status;
+create table t1(id int) engine=ndbcluster;
+create table t2(id int, b char(255)) engine=myisam;
+create table t3(id int, c char(255)) engine=ndbcluster;
+create table t4(id int) engine=myisam;
+create table t5(id int, d char(56)) engine=ndbcluster;
+create table t6(id int) engine=ndbcluster;
+create table t7(id int) engine=ndbcluster;
+create table t8(id int, e char(34)) engine=myisam;
+create table t9(id int) engine=myisam;
+insert into t2 values (2, "myisam table 2");
+insert into t3 values (3, "ndb table 3");
+insert into t5 values (5, "ndb table 5");
+insert into t6 values (6);
+insert into t8 values (8, "myisam table 8");
+insert into t9 values (9);
+SHOW TABLES;
+Tables_in_test
+t1
+t2
+t4
+t8
+t9
+t7
+t6
+select * from t6;
+id
+6
+select * from t7;
+id
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 2
+drop table t1, t2, t4, t6, t7, t8, t9;
+flush status;
+create table t1(id int) engine=ndbcluster;
+create table t2(id int, b char(255)) engine=myisam;
+create table t3(id int, c char(255)) engine=ndbcluster;
+create table t4(id int) engine=myisam;
+create table t5(id int, d char(56)) engine=ndbcluster;
+create table t6(id int) engine=ndbcluster;
+create table t7(id int) engine=ndbcluster;
+create table t8(id int, e char(34)) engine=myisam;
+create table t9(id int) engine=myisam;
+insert into t2 values (2, "myisam table 2");
+insert into t3 values (3, "ndb table 3");
+insert into t5 values (5, "ndb table 5");
+insert into t6 values (6);
+insert into t8 values (8, "myisam table 8");
+insert into t9 values (9);
+SHOW TABLES LIKE 't6';
+Tables_in_test (t6)
+t6
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 1
+create table t3(a int);
+ERROR 42S01: Table 't3' already exists
+create table t5(a int);
+ERROR 42S01: Table 't5' already exists
+SHOW TABLES LIKE 't%';
+Tables_in_test (t%)
+t1
+t2
+t4
+t6
+t8
+t9
+t7
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 2
+drop table t1, t2, t4, t6, t7, t8, t9;
+flush status;
+create table t1(id int) engine=ndbcluster;
+create table t2(id int, b char(255)) engine=ndbcluster;
+create table t3(id int, c char(255)) engine=ndbcluster;
+create table t4(id int) engine=myisam;
+insert into t1 values (1);
+insert into t2 values (2, "table 2");
+insert into t3 values (3, "ndb table 3");
+insert into t4 values (4);
+flush tables;
+select * from t1, t2, t3, t4;
+id id b id c id
+1 2 table 2 3 ndb table 3 4
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 3
+drop table t1, t2, t3, t4;
+flush status;
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 0
+create table t5(
+id int not null primary key,
+name char(200)
+) engine=ndb;
+insert into t5 values (1, "Magnus");
+select * from t5;
+id name
+1 Magnus
+ALTER TABLE t5 ADD COLUMN adress char(255) FIRST;
+select * from t5;
+adress id name
+NULL 1 Magnus
+insert into t5 values
+("Adress for record 2", 2, "Carl-Gustav"),
+("Adress for record 3", 3, "Karl-Emil");
+update t5 set name="Bertil" where id = 2;
+select * from t5 order by id;
+adress id name
+NULL 1 Magnus
+Adress for record 2 2 Bertil
+Adress for record 3 3 Karl-Emil
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 0
+drop table t5;
+flush status;
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 0
+create table t6(
+id int not null primary key,
+name char(20)
+) engine=ndb;
+insert into t6 values (1, "Magnus");
+select * from t6;
+id name
+1 Magnus
+ALTER TABLE t6 ADD COLUMN adress char(255) FIRST;
+select * from t6;
+adress id name
+NULL 1 Magnus
+insert into t6 values
+("Adress for record 2", 2, "Carl-Gustav"),
+("Adress for record 3", 3, "Karl-Emil");
+update t6 set name="Bertil" where id = 2;
+select * from t6 order by id;
+adress id name
+NULL 1 Magnus
+Adress for record 2 2 Bertil
+Adress for record 3 3 Karl-Emil
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 0
+drop table t6;
+show tables;
+Tables_in_test
+create table t1 (a int,b longblob) engine=ndb;
+show tables;
+Tables_in_test
+t1
+create database test2;
+use test2;
+show tables;
+Tables_in_test2
+select * from t1;
+ERROR 42S02: Table 'test2.t1' doesn't exist
+create table t2 (b int,c longblob) engine=ndb;
+use test;
+select * from t1;
+a b
+show tables;
+Tables_in_test
+t1
+drop table t1;
+use test2;
+drop table t2;
+drop database test2;
+show databases;
+Database
+mysql
+test
+use test;
+CREATE TABLE t9 (
+a int NOT NULL PRIMARY KEY,
+b int
+) engine=ndb;
+insert t9 values(1, 2), (2,3), (3, 4), (4, 5);
+create table t10 (
+a int not null primary key,
+b blob
+) engine=ndb;
+insert into t10 values (1, 'kalle');
diff --git a/mysql-test/r/ndb_autodiscover2.result b/mysql-test/r/ndb_autodiscover2.result
new file mode 100644
index 00000000000..91f018b5d02
--- /dev/null
+++ b/mysql-test/r/ndb_autodiscover2.result
@@ -0,0 +1,13 @@
+select * from t9 order by a;
+a b
+1 2
+2 3
+3 4
+4 5
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 1
+drop table t9;
+select * from t10;
+ERROR HY000: Got error 4263 'Invalid blob attributes or invalid blob parts table' from ndbcluster
+drop table t10;
diff --git a/mysql-test/r/ndb_basic.result b/mysql-test/r/ndb_basic.result
new file mode 100644
index 00000000000..6ec5338acbe
--- /dev/null
+++ b/mysql-test/r/ndb_basic.result
@@ -0,0 +1,575 @@
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
+drop database if exists mysqltest;
+CREATE TABLE t1 (
+pk1 INT NOT NULL PRIMARY KEY,
+attr1 INT NOT NULL,
+attr2 INT,
+attr3 VARCHAR(10)
+) ENGINE=ndbcluster;
+SHOW INDEX FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 pk1 A 0 NULL NULL BTREE
+INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9411,9413, 17, '9413');
+SHOW INDEX FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 pk1 A 2 NULL NULL BTREE
+SELECT pk1 FROM t1 ORDER BY pk1;
+pk1
+9410
+9411
+SELECT * FROM t1 ORDER BY pk1;
+pk1 attr1 attr2 attr3
+9410 9412 NULL 9412
+9411 9413 17 9413
+SELECT t1.* FROM t1 ORDER BY pk1;
+pk1 attr1 attr2 attr3
+9410 9412 NULL 9412
+9411 9413 17 9413
+UPDATE t1 SET attr1=1 WHERE pk1=9410;
+SELECT * FROM t1 ORDER BY pk1;
+pk1 attr1 attr2 attr3
+9410 1 NULL 9412
+9411 9413 17 9413
+UPDATE t1 SET pk1=2 WHERE attr1=1;
+SELECT * FROM t1 ORDER BY pk1;
+pk1 attr1 attr2 attr3
+2 1 NULL 9412
+9411 9413 17 9413
+UPDATE t1 SET pk1=pk1 + 1;
+SELECT * FROM t1 ORDER BY pk1;
+pk1 attr1 attr2 attr3
+3 1 NULL 9412
+9412 9413 17 9413
+UPDATE t1 SET pk1=4 WHERE pk1 = 3;
+SELECT * FROM t1 ORDER BY pk1;
+pk1 attr1 attr2 attr3
+4 1 NULL 9412
+9412 9413 17 9413
+DELETE FROM t1;
+SELECT * FROM t1;
+pk1 attr1 attr2 attr3
+INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9408, 8765, NULL, '8765'),
+(7,8, NULL, NULL), (8,9, NULL, NULL), (9,10, NULL, NULL), (10,11, NULL, NULL), (11,12, NULL, NULL), (12,13, NULL, NULL), (13,14, NULL, NULL);
+UPDATE t1 SET attr1 = 9999;
+SELECT * FROM t1 ORDER BY pk1;
+pk1 attr1 attr2 attr3
+7 9999 NULL NULL
+8 9999 NULL NULL
+9 9999 NULL NULL
+10 9999 NULL NULL
+11 9999 NULL NULL
+12 9999 NULL NULL
+13 9999 NULL NULL
+9408 9999 NULL 8765
+9410 9999 NULL 9412
+UPDATE t1 SET attr1 = 9998 WHERE pk1 < 1000;
+SELECT * FROM t1 ORDER BY pk1;
+pk1 attr1 attr2 attr3
+7 9998 NULL NULL
+8 9998 NULL NULL
+9 9998 NULL NULL
+10 9998 NULL NULL
+11 9998 NULL NULL
+12 9998 NULL NULL
+13 9998 NULL NULL
+9408 9999 NULL 8765
+9410 9999 NULL 9412
+UPDATE t1 SET attr1 = 9997 WHERE attr1 = 9999;
+SELECT * FROM t1 ORDER BY pk1;
+pk1 attr1 attr2 attr3
+7 9998 NULL NULL
+8 9998 NULL NULL
+9 9998 NULL NULL
+10 9998 NULL NULL
+11 9998 NULL NULL
+12 9998 NULL NULL
+13 9998 NULL NULL
+9408 9997 NULL 8765
+9410 9997 NULL 9412
+DELETE FROM t1 WHERE pk1 = 9410;
+SELECT * FROM t1 ORDER BY pk1;
+pk1 attr1 attr2 attr3
+7 9998 NULL NULL
+8 9998 NULL NULL
+9 9998 NULL NULL
+10 9998 NULL NULL
+11 9998 NULL NULL
+12 9998 NULL NULL
+13 9998 NULL NULL
+9408 9997 NULL 8765
+DELETE FROM t1;
+SELECT * FROM t1;
+pk1 attr1 attr2 attr3
+INSERT INTO t1 values (1, 4, NULL, NULL), (2, 4, NULL, NULL), (3, 5, NULL, NULL), (4, 4, NULL, NULL), (5, 5, NULL, NULL);
+DELETE FROM t1 WHERE attr1=4;
+SELECT * FROM t1 order by pk1;
+pk1 attr1 attr2 attr3
+3 5 NULL NULL
+5 5 NULL NULL
+DELETE FROM t1;
+INSERT INTO t1 VALUES (9410,9412, NULL, NULL), (9411, 9413, NULL, NULL);
+DELETE FROM t1 WHERE pk1 = 9410;
+SELECT * FROM t1;
+pk1 attr1 attr2 attr3
+9411 9413 NULL NULL
+DROP TABLE t1;
+CREATE TABLE t1 (id INT, id2 int) engine=ndbcluster;
+INSERT INTO t1 values(3456, 7890);
+SELECT * FROM t1;
+id id2
+3456 7890
+UPDATE t1 SET id=2 WHERE id2=12;
+SELECT * FROM t1;
+id id2
+3456 7890
+UPDATE t1 SET id=1234 WHERE id2=7890;
+SELECT * FROM t1;
+id id2
+1234 7890
+DELETE FROM t1;
+INSERT INTO t1 values(3456, 7890), (3456, 7890), (3456, 7890), (3454, 7890);
+SELECT * FROM t1 ORDER BY id;
+id id2
+3454 7890
+3456 7890
+3456 7890
+3456 7890
+DELETE FROM t1 WHERE id = 3456;
+SELECT * FROM t1 ORDER BY id;
+id id2
+3454 7890
+DROP TABLE t1;
+CREATE TABLE t1 (
+pk1 INT NOT NULL PRIMARY KEY,
+attr1 INT NOT NULL
+) ENGINE=NDBCLUSTER;
+INSERT INTO t1 values(1, 9999);
+DROP TABLE t1;
+CREATE TABLE t1 (
+pk1 INT NOT NULL PRIMARY KEY,
+attr1 INT NOT NULL
+) ENGINE=NDB;
+INSERT INTO t1 values(1, 9999);
+DROP TABLE t1;
+CREATE TABLE t2 (
+a bigint unsigned NOT NULL PRIMARY KEY,
+b int unsigned not null,
+c int unsigned
+) engine=ndbcluster;
+CREATE TABLE t3 (
+a bigint unsigned NOT NULL,
+b bigint unsigned not null,
+c bigint unsigned,
+PRIMARY KEY(a)
+) engine=ndbcluster;
+CREATE TABLE t4 (
+a bigint unsigned NOT NULL,
+b bigint unsigned not null,
+c bigint unsigned NOT NULL,
+d int unsigned,
+PRIMARY KEY(a, b, c)
+) engine=ndbcluster;
+select * from t2 where a = 7 order by b;
+a b c
+7 16 5
+select * from t2 where a = 7 order by a;
+a b c
+7 16 5
+select * from t2 where a = 7 order by 2;
+a b c
+7 16 5
+select * from t2 where a = 7 order by c;
+a b c
+7 16 5
+select * from t2 where a = 7 and b = 16 order by b;
+a b c
+7 16 5
+select * from t2 where a = 7 and b = 16 order by a;
+a b c
+7 16 5
+select * from t2 where a = 7 and b = 17 order by a;
+a b c
+select * from t2 where a = 7 and b != 16 order by b;
+a b c
+select * from t2 where a = 7 and b = 16 and c = 5 order by b;
+a b c
+7 16 5
+select * from t2 where a = 7 and b = 16 and c = 5 order by a;
+a b c
+7 16 5
+select * from t2 where a = 7 and b = 16 and c = 6 order by a;
+a b c
+select * from t2 where a = 7 and b != 16 and c = 5 order by b;
+a b c
+select * from t3 where a = 7 order by b;
+a b c
+7 16 5
+select * from t3 where a = 7 order by a;
+a b c
+7 16 5
+select * from t3 where a = 7 order by 2;
+a b c
+7 16 5
+select * from t3 where a = 7 order by c;
+a b c
+7 16 5
+select * from t3 where a = 7 and b = 16 order by b;
+a b c
+7 16 5
+select * from t3 where a = 7 and b = 16 order by a;
+a b c
+7 16 5
+select * from t3 where a = 7 and b = 17 order by a;
+a b c
+select * from t3 where a = 7 and b != 16 order by b;
+a b c
+select * from t4 where a = 7 order by b;
+a b c d
+7 16 5 26007
+select * from t4 where a = 7 order by a;
+a b c d
+7 16 5 26007
+select * from t4 where a = 7 order by 2;
+a b c d
+7 16 5 26007
+select * from t4 where a = 7 order by c;
+a b c d
+7 16 5 26007
+select * from t4 where a = 7 and b = 16 order by b;
+a b c d
+7 16 5 26007
+select * from t4 where a = 7 and b = 16 order by a;
+a b c d
+7 16 5 26007
+select * from t4 where a = 7 and b = 17 order by a;
+a b c d
+select * from t4 where a = 7 and b != 16 order by b;
+a b c d
+delete from t2 where a > 5;
+select x1.a, x1.b from t2 x1, t2 x2 where x1.b = x2.b order by x1.a;
+a b
+1 10
+3 12
+5 14
+select a, b FROM t2 outer_table where
+a = (select a from t2 where b = outer_table.b ) order by a;
+a b
+1 10
+3 12
+5 14
+delete from t2;
+delete from t3;
+delete from t4;
+drop table t2;
+drop table t3;
+drop table t4;
+CREATE TABLE t5 (
+a bigint unsigned NOT NULL,
+b bigint unsigned not null,
+c bigint unsigned NOT NULL,
+d int unsigned,
+PRIMARY KEY(a, b, c)
+) engine=ndbcluster;
+insert into t5 values(10, 19, 5, 26010);
+delete from t5 where a=10 and b=19 and c=5;
+select * from t5;
+a b c d
+insert into t5 values(10, 19, 5, 26010);
+update t5 set d=21997 where a=10 and b=19 and c=5;
+select * from t5;
+a b c d
+10 19 5 21997
+delete from t5;
+drop table t5;
+CREATE TABLE t6 (
+adress char(255),
+a int NOT NULL PRIMARY KEY,
+b int
+) engine = NDB;
+insert into t6 values
+("Nice road 3456", 1, 23),
+("Street Road 78", 3, 92),
+("Road street 89C", 5, 71),
+(NULL, 7, NULL);
+select * from t6 order by a;
+adress a b
+Nice road 3456 1 23
+Street Road 78 3 92
+Road street 89C 5 71
+NULL 7 NULL
+select a, b from t6 order by a;
+a b
+1 23
+3 92
+5 71
+7 NULL
+update t6 set adress="End of road 09" where a=3;
+update t6 set b=181, adress="Street 76" where a=7;
+select * from t6 order by a;
+adress a b
+Nice road 3456 1 23
+End of road 09 3 92
+Road street 89C 5 71
+Street 76 7 181
+select * from t6 where a=1;
+adress a b
+Nice road 3456 1 23
+delete from t6 where a=1;
+select * from t6 order by a;
+adress a b
+End of road 09 3 92
+Road street 89C 5 71
+Street 76 7 181
+delete from t6 where b=71;
+select * from t6 order by a;
+adress a b
+End of road 09 3 92
+Street 76 7 181
+drop table t6;
+CREATE TABLE t7 (
+adress char(255),
+a int NOT NULL,
+b int,
+c int NOT NULL,
+PRIMARY KEY(a, c)
+) engine = NDB;
+insert into t7 values
+("Highway 3456", 1, 23, 2),
+("Street Road 78", 3, 92, 3),
+("Main street 89C", 5, 71, 4),
+(NULL, 8, NULL, 12);
+select * from t7 order by a;
+adress a b c
+Highway 3456 1 23 2
+Street Road 78 3 92 3
+Main street 89C 5 71 4
+NULL 8 NULL 12
+select a, b from t7 order by a;
+a b
+1 23
+3 92
+5 71
+8 NULL
+update t7 set adress="End of road 09" where a=3;
+update t7 set adress="GatuvÀgen 90C" where a=5 and c=4;
+update t7 set adress="No adress" where adress is NULL;
+select * from t7 order by a;
+adress a b c
+Highway 3456 1 23 2
+End of road 09 3 92 3
+GatuvÀgen 90C 5 71 4
+No adress 8 NULL 12
+select * from t7 where a=1 and c=2;
+adress a b c
+Highway 3456 1 23 2
+delete from t7 where a=1;
+delete from t7 where a=3 and c=3;
+delete from t7 where a=5 and c=4;
+select * from t7;
+adress a b c
+No adress 8 NULL 12
+delete from t7 where b=23;
+select * from t7;
+adress a b c
+No adress 8 NULL 12
+drop table t7;
+CREATE TABLE t1 (
+pk1 INT NOT NULL PRIMARY KEY,
+attr1 INT NOT NULL,
+attr2 INT,
+attr3 VARCHAR(10)
+) ENGINE=ndbcluster;
+INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9411,9413, 17, '9413');
+create database mysqltest;
+use mysqltest;
+CREATE TABLE t2 (
+a bigint unsigned NOT NULL PRIMARY KEY,
+b int unsigned not null,
+c int unsigned
+) engine=ndbcluster;
+insert into t2 select pk1,attr1,attr2 from test.t1;
+select * from t2 order by a;
+a b c
+9410 9412 NULL
+9411 9413 17
+select b from test.t1, t2 where c = test.t1.attr2;
+b
+9413
+select b,test.t1.attr1 from test.t1, t2 where test.t1.pk1 < a;
+b attr1
+9413 9412
+drop table test.t1, t2;
+drop database mysqltest;
+drop database if exists ndbtest1;
+create database ndbtest1;
+use ndbtest1;
+create table t1(id int) engine=ndbcluster;
+drop database ndbtest1;
+drop database ndbtest1;
+ERROR HY000: Can't drop database 'ndbtest1'; database doesn't exist
+use test;
+create table t1 (a int primary key, b char(0));
+insert into t1 values (1,"");
+insert into t1 values (2,NULL);
+select * from t1 order by a;
+a b
+1
+2 NULL
+select * from t1 order by b;
+a b
+2 NULL
+1
+select * from t1 where b IS NULL;
+a b
+2 NULL
+select * from t1 where b IS NOT NULL;
+a b
+1
+drop table t1;
+create table t1 (
+c1 int,
+c2 int,
+c3 int,
+c4 int,
+c5 int,
+c6 int,
+c7 int,
+c8 int,
+c9 int,
+c10 int,
+c11 int,
+c12 int,
+c13 int,
+c14 int,
+c15 int,
+c16 int,
+c17 int,
+c18 int,
+c19 int,
+c20 int,
+c21 int,
+c22 int,
+c23 int,
+c24 int,
+c25 int,
+c26 int,
+c27 int,
+c28 int,
+c29 int,
+c30 int,
+c31 int,
+c32 int,
+c33 int,
+c34 int,
+c35 int,
+c36 int,
+c37 int,
+c38 int,
+c39 int,
+c40 int,
+c41 int,
+c42 int,
+c43 int,
+c44 int,
+c45 int,
+c46 int,
+c47 int,
+c48 int,
+c49 int,
+c50 int,
+c51 int,
+c52 int,
+c53 int,
+c54 int,
+c55 int,
+c56 int,
+c57 int,
+c58 int,
+c59 int,
+c60 int,
+c61 int,
+c62 int,
+c63 int,
+c64 int,
+c65 int,
+c66 int,
+c67 int,
+c68 int,
+c69 int,
+c70 int,
+c71 int,
+c72 int,
+c73 int,
+c74 int,
+c75 int,
+c76 int,
+c77 int,
+c78 int,
+c79 int,
+c80 int,
+c81 int,
+c82 int,
+c83 int,
+c84 int,
+c85 int,
+c86 int,
+c87 int,
+c88 int,
+c89 int,
+c90 int,
+c91 int,
+c92 int,
+c93 int,
+c94 int,
+c95 int,
+c96 int,
+c97 int,
+c98 int,
+c99 int,
+c100 int,
+c101 int,
+c102 int,
+c103 int,
+c104 int,
+c105 int,
+c106 int,
+c107 int,
+c108 int,
+c109 int,
+c110 int,
+c111 int,
+c112 int,
+c113 int,
+c114 int,
+c115 int,
+c116 int,
+c117 int,
+c118 int,
+c119 int,
+c120 int,
+c121 int,
+c122 int,
+c123 int,
+c124 int,
+c125 int,
+c126 int,
+c127 int,
+c128 int,
+primary key(c1)) engine=ndb;
+drop table t1;
+create table t1 (
+a1234567890123456789012345678901234567890 int primary key,
+a12345678901234567890123456789a1234567890 int,
+index(a12345678901234567890123456789a1234567890)
+) engine=ndb;
+show tables;
+Tables_in_test
+t1
+insert into t1 values (1,1),(2,1),(3,1),(4,1),(5,2),(6,1),(7,1);
+explain select * from t1 where a12345678901234567890123456789a1234567890=2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a12345678901234567890123456789a1234567890 a12345678901234567890123456789a1234567890 5 const 10 Using where
+select * from t1 where a12345678901234567890123456789a1234567890=2;
+a1234567890123456789012345678901234567890 a12345678901234567890123456789a1234567890
+5 2
+drop table t1;
diff --git a/mysql-test/r/ndb_blob.result b/mysql-test/r/ndb_blob.result
new file mode 100644
index 00000000000..6f25ec95c80
--- /dev/null
+++ b/mysql-test/r/ndb_blob.result
@@ -0,0 +1,487 @@
+drop table if exists t1;
+drop database if exists test2;
+set autocommit=0;
+create table t1 (
+a int not null primary key,
+b text not null,
+c int not null,
+d longblob,
+key (c)
+) engine=ndbcluster;
+set @x0 = '01234567012345670123456701234567';
+set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0);
+set @b1 = 'b1';
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@x0);
+set @d1 = 'dd1';
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @b2 = 'b2';
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @d2 = 'dd2';
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+select length(@x0),length(@b1),length(@d1) from dual;
+length(@x0) length(@b1) length(@d1)
+256 2256 3000
+select length(@x0),length(@b2),length(@d2) from dual;
+length(@x0) length(@b2) length(@d2)
+256 20000 30000
+insert into t1 values(1,@b1,111,@d1);
+insert into t1 values(2,@b2,222,@d2);
+commit;
+explain select * from t1 where a = 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 where a=1;
+a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
+1 2256 b1 3000 dd1
+select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
+from t1 where a=2;
+a length(b) substr(b,1+2*9000,2) length(d) substr(d,1+3*9000,3)
+2 20000 b2 30000 dd2
+update t1 set b=@b2,d=@d2 where a=1;
+update t1 set b=@b1,d=@d1 where a=2;
+commit;
+select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
+from t1 where a=1;
+a length(b) substr(b,1+2*9000,2) length(d) substr(d,1+3*9000,3)
+1 20000 b2 30000 dd2
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 where a=2;
+a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
+2 2256 b1 3000 dd1
+update t1 set b=concat(b,b),d=concat(d,d) where a=1;
+update t1 set b=concat(b,b),d=concat(d,d) where a=2;
+commit;
+select a,length(b),substr(b,1+4*9000,2),length(d),substr(d,1+6*9000,3)
+from t1 where a=1;
+a length(b) substr(b,1+4*9000,2) length(d) substr(d,1+6*9000,3)
+1 40000 b2 60000 dd2
+select a,length(b),substr(b,1+4*900,2),length(d),substr(d,1+6*900,3)
+from t1 where a=2;
+a length(b) substr(b,1+4*900,2) length(d) substr(d,1+6*900,3)
+2 4512 b1 6000 dd1
+update t1 set d=null where a=1;
+commit;
+select a from t1 where d is null;
+a
+1
+delete from t1 where a=1;
+delete from t1 where a=2;
+commit;
+select count(*) from t1;
+count(*)
+0
+replace t1 set a=1,b=@b1,c=111,d=@d1;
+replace t1 set a=2,b=@b2,c=222,d=@d2;
+commit;
+explain select * from t1 where a = 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 where a=1;
+a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
+1 2256 b1 3000 dd1
+select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
+from t1 where a=2;
+a length(b) substr(b,1+2*9000,2) length(d) substr(d,1+3*9000,3)
+2 20000 b2 30000 dd2
+replace t1 set a=1,b=@b2,c=111,d=@d2;
+replace t1 set a=2,b=@b1,c=222,d=@d1;
+commit;
+select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
+from t1 where a=1;
+a length(b) substr(b,1+2*9000,2) length(d) substr(d,1+3*9000,3)
+1 20000 b2 30000 dd2
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 where a=2;
+a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
+2 2256 b1 3000 dd1
+replace t1 set a=1,b=concat(@b2,@b2),c=111,d=concat(@d2,@d2);
+replace t1 set a=2,b=concat(@b1,@b1),c=222,d=concat(@d1,@d1);
+commit;
+select a,length(b),substr(b,1+4*9000,2),length(d),substr(d,1+6*9000,3)
+from t1 where a=1;
+a length(b) substr(b,1+4*9000,2) length(d) substr(d,1+6*9000,3)
+1 40000 b2 60000 dd2
+select a,length(b),substr(b,1+4*900,2),length(d),substr(d,1+6*900,3)
+from t1 where a=2;
+a length(b) substr(b,1+4*900,2) length(d) substr(d,1+6*900,3)
+2 4512 b1 6000 dd1
+replace t1 set a=1,b='xyz',c=111,d=null;
+commit;
+select a,b from t1 where d is null;
+a b
+1 xyz
+delete from t1 where a=1;
+delete from t1 where a=2;
+commit;
+select count(*) from t1;
+count(*)
+0
+insert into t1 values(1,@b1,111,@d1);
+insert into t1 values(2,@b2,222,@d2);
+commit;
+explain select * from t1 where c = 111;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref c c 4 const 10 Using where
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 where c=111;
+a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
+1 2256 b1 3000 dd1
+select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
+from t1 where c=222;
+a length(b) substr(b,1+2*9000,2) length(d) substr(d,1+3*9000,3)
+2 20000 b2 30000 dd2
+update t1 set b=@b2,d=@d2 where c=111;
+update t1 set b=@b1,d=@d1 where c=222;
+commit;
+select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
+from t1 where c=111;
+a length(b) substr(b,1+2*9000,2) length(d) substr(d,1+3*9000,3)
+1 20000 b2 30000 dd2
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 where c=222;
+a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
+2 2256 b1 3000 dd1
+update t1 set d=null where c=111;
+commit;
+select a from t1 where d is null;
+a
+1
+delete from t1 where c=111;
+delete from t1 where c=222;
+commit;
+select count(*) from t1;
+count(*)
+0
+insert into t1 values(1,'b1',111,'dd1');
+insert into t1 values(2,'b2',222,'dd2');
+insert into t1 values(3,'b3',333,'dd3');
+insert into t1 values(4,'b4',444,'dd4');
+insert into t1 values(5,'b5',555,'dd5');
+insert into t1 values(6,'b6',666,'dd6');
+insert into t1 values(7,'b7',777,'dd7');
+insert into t1 values(8,'b8',888,'dd8');
+insert into t1 values(9,'b9',999,'dd9');
+commit;
+explain select * from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 9
+select * from t1 order by a;
+a b c d
+1 b1 111 dd1
+2 b2 222 dd2
+3 b3 333 dd3
+4 b4 444 dd4
+5 b5 555 dd5
+6 b6 666 dd6
+7 b7 777 dd7
+8 b8 888 dd8
+9 b9 999 dd9
+update t1 set b=concat(a,'x',b),d=concat(a,'x',d);
+commit;
+select * from t1 order by a;
+a b c d
+1 1xb1 111 1xdd1
+2 2xb2 222 2xdd2
+3 3xb3 333 3xdd3
+4 4xb4 444 4xdd4
+5 5xb5 555 5xdd5
+6 6xb6 666 6xdd6
+7 7xb7 777 7xdd7
+8 8xb8 888 8xdd8
+9 9xb9 999 9xdd9
+delete from t1;
+commit;
+select count(*) from t1;
+count(*)
+0
+insert into t1 values(1,@b1,111,@d1);
+insert into t1 values(2,@b2,222,@d2);
+commit;
+explain select * from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 order by a;
+a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
+1 2256 b1 3000 dd1
+2 20000 b2 30000 dd2
+update t1 set b=concat(b,b),d=concat(d,d);
+commit;
+select a,length(b),substr(b,1+4*9000,2),length(d),substr(d,1+6*9000,3)
+from t1 order by a;
+a length(b) substr(b,1+4*9000,2) length(d) substr(d,1+6*9000,3)
+1 4512 6000
+2 40000 b2 60000 dd2
+delete from t1;
+commit;
+select count(*) from t1;
+count(*)
+0
+insert into t1 values(1,'b1',111,'dd1');
+insert into t1 values(2,'b2',222,'dd2');
+insert into t1 values(3,'b3',333,'dd3');
+insert into t1 values(4,'b4',444,'dd4');
+insert into t1 values(5,'b5',555,'dd5');
+insert into t1 values(6,'b6',666,'dd6');
+insert into t1 values(7,'b7',777,'dd7');
+insert into t1 values(8,'b8',888,'dd8');
+insert into t1 values(9,'b9',999,'dd9');
+commit;
+explain select * from t1 where c >= 100 order by a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c c 4 NULL 10 Using where; Using filesort
+select * from t1 where c >= 100 order by a;
+a b c d
+1 b1 111 dd1
+2 b2 222 dd2
+3 b3 333 dd3
+4 b4 444 dd4
+5 b5 555 dd5
+6 b6 666 dd6
+7 b7 777 dd7
+8 b8 888 dd8
+9 b9 999 dd9
+update t1 set b=concat(a,'x',b),d=concat(a,'x',d)
+where c >= 100;
+commit;
+select * from t1 where c >= 100 order by a;
+a b c d
+1 1xb1 111 1xdd1
+2 2xb2 222 2xdd2
+3 3xb3 333 3xdd3
+4 4xb4 444 4xdd4
+5 5xb5 555 5xdd5
+6 6xb6 666 6xdd6
+7 7xb7 777 7xdd7
+8 8xb8 888 8xdd8
+9 9xb9 999 9xdd9
+delete from t1 where c >= 100;
+commit;
+select count(*) from t1;
+count(*)
+0
+insert into t1 values(1,@b1,111,@d1);
+insert into t1 values(2,@b2,222,@d2);
+commit;
+explain select * from t1 where c >= 100 order by a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c c 4 NULL 10 Using where; Using filesort
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 where c >= 100 order by a;
+a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
+1 2256 b1 3000 dd1
+2 20000 b2 30000 dd2
+update t1 set b=concat(b,b),d=concat(d,d);
+commit;
+select a,length(b),substr(b,1+4*9000,2),length(d),substr(d,1+6*9000,3)
+from t1 where c >= 100 order by a;
+a length(b) substr(b,1+4*9000,2) length(d) substr(d,1+6*9000,3)
+1 4512 6000
+2 40000 b2 60000 dd2
+delete from t1 where c >= 100;
+commit;
+select count(*) from t1;
+count(*)
+0
+insert into t1 values(1,@b1,111,@d1);
+insert into t1 values(2,@b2,222,@d2);
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 where a = 0;
+a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 where a = 1;
+a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
+1 2256 b1 3000 dd1
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 where a = 2;
+a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
+2 20000 b2 30000 dd2
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 order by a;
+a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
+1 2256 b1 3000 dd1
+2 20000 b2 30000 dd2
+rollback;
+select count(*) from t1;
+count(*)
+0
+insert into t1 values(1,'b1',111,'dd1');
+insert into t1 values(2,'b2',222,'dd2');
+insert into t1 values(3,'b3',333,'dd3');
+insert into t1 values(4,'b4',444,'dd4');
+insert into t1 values(5,'b5',555,'dd5');
+insert into t1 values(6,'b6',666,'dd6');
+insert into t1 values(7,'b7',777,'dd7');
+insert into t1 values(8,'b8',888,'dd8');
+insert into t1 values(9,'b9',999,'dd9');
+commit;
+select * from t1 order by a;
+a b c d
+1 b1 111 dd1
+2 b2 222 dd2
+3 b3 333 dd3
+4 b4 444 dd4
+5 b5 555 dd5
+6 b6 666 dd6
+7 b7 777 dd7
+8 b8 888 dd8
+9 b9 999 dd9
+alter table t1 add x int;
+select * from t1 order by a;
+a b c d x
+1 b1 111 dd1 NULL
+2 b2 222 dd2 NULL
+3 b3 333 dd3 NULL
+4 b4 444 dd4 NULL
+5 b5 555 dd5 NULL
+6 b6 666 dd6 NULL
+7 b7 777 dd7 NULL
+8 b8 888 dd8 NULL
+9 b9 999 dd9 NULL
+alter table t1 drop x;
+select * from t1 order by a;
+a b c d
+1 b1 111 dd1
+2 b2 222 dd2
+3 b3 333 dd3
+4 b4 444 dd4
+5 b5 555 dd5
+6 b6 666 dd6
+7 b7 777 dd7
+8 b8 888 dd8
+9 b9 999 dd9
+create database test2;
+use test2;
+CREATE TABLE t2 (
+a bigint unsigned NOT NULL PRIMARY KEY,
+b int unsigned not null,
+c int unsigned
+) engine=ndbcluster;
+insert into t2 values (1,1,1),(2,2,2);
+select * from test.t1,t2 where test.t1.a = t2.a order by test.t1.a;
+a b c d a b c
+1 b1 111 dd1 1 1 1
+2 b2 222 dd2 2 2 2
+drop table t2;
+use test;
+select * from t1 order by a;
+a b c d
+1 b1 111 dd1
+2 b2 222 dd2
+3 b3 333 dd3
+4 b4 444 dd4
+5 b5 555 dd5
+6 b6 666 dd6
+7 b7 777 dd7
+8 b8 888 dd8
+9 b9 999 dd9
+alter table t1 add x int;
+select * from t1 order by a;
+a b c d x
+1 b1 111 dd1 NULL
+2 b2 222 dd2 NULL
+3 b3 333 dd3 NULL
+4 b4 444 dd4 NULL
+5 b5 555 dd5 NULL
+6 b6 666 dd6 NULL
+7 b7 777 dd7 NULL
+8 b8 888 dd8 NULL
+9 b9 999 dd9 NULL
+alter table t1 drop x;
+select * from t1 order by a;
+a b c d
+1 b1 111 dd1
+2 b2 222 dd2
+3 b3 333 dd3
+4 b4 444 dd4
+5 b5 555 dd5
+6 b6 666 dd6
+7 b7 777 dd7
+8 b8 888 dd8
+9 b9 999 dd9
+drop table t1;
+drop database test2;
+set autocommit=0;
+create table t1 (
+a int not null primary key,
+b tinytext
+) engine=ndbcluster;
+insert into t1 values(1, 'x');
+update t1 set b = 'y';
+select * from t1;
+a b
+1 y
+delete from t1;
+select * from t1;
+a b
+commit;
+drop table t1;
+set autocommit=0;
+create table t1 (
+a int not null primary key,
+b text not null
+) engine=ndbcluster;
+insert into t1 values(1, '');
+select * from t1;
+a b
+1
+commit;
+drop table t1;
+set autocommit=1;
+use test;
+CREATE TABLE t1 (
+a int,
+b text,
+PRIMARY KEY (a)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES
+(1,'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA');
+INSERT INTO t1 VALUES
+(2,'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB');
+select * from t1 order by a;
+a b
+1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+2 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
+alter table t1 engine=ndb;
+select * from t1 order by a;
+a b
+1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+2 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
+set autocommit=1;
+alter table t1 engine=myisam;
+select * from t1 order by a;
+a b
+1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+2 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
+drop table t1;
+create table t1 (
+id int(11) unsigned primary key NOT NULL auto_increment,
+msg text NOT NULL
+) engine=ndbcluster default charset=utf8;
+insert into t1 (msg) values(
+'Tries to validate (8 byte length + inline bytes) as UTF8 :(
+Fast fix: removed validation for Text. It is not yet indexable
+so bad data will not crash kernel.
+Proper fix: Set inline bytes to multiple of mbmaxlen and
+validate it (after the 8 byte length).');
+select * from t1;
+id msg
+1 Tries to validate (8 byte length + inline bytes) as UTF8 :(
+Fast fix: removed validation for Text. It is not yet indexable
+so bad data will not crash kernel.
+Proper fix: Set inline bytes to multiple of mbmaxlen and
+validate it (after the 8 byte length).
+drop table t1;
diff --git a/mysql-test/r/ndb_cache.result b/mysql-test/r/ndb_cache.result
new file mode 100644
index 00000000000..714e1831267
--- /dev/null
+++ b/mysql-test/r/ndb_cache.result
@@ -0,0 +1,43 @@
+set GLOBAL query_cache_size=1355776;
+reset query cache;
+flush status;
+drop table if exists t1,t2;
+CREATE TABLE t1 (a int) ENGINE=ndbcluster;
+CREATE TABLE t2 (a int);
+select * from t1;
+a
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 0
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 0
+select * from t2;
+a
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 0
+select * from t1;
+a
+select * from t2;
+a
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 1
+drop table t1, t2;
+SET GLOBAL query_cache_size=0;
diff --git a/mysql-test/r/ndb_charset.result b/mysql-test/r/ndb_charset.result
new file mode 100644
index 00000000000..00bc36a7c0d
--- /dev/null
+++ b/mysql-test/r/ndb_charset.result
@@ -0,0 +1,201 @@
+drop table if exists t1;
+create table t1 (
+a char(3) character set latin1 collate latin1_bin primary key
+) engine=ndb;
+insert into t1 values('aAa');
+insert into t1 values('aaa');
+insert into t1 values('AAA');
+select * from t1 order by a;
+a
+AAA
+aAa
+aaa
+select * from t1 where a = 'aAa';
+a
+aAa
+select * from t1 where a = 'aaa';
+a
+aaa
+select * from t1 where a = 'AaA';
+a
+select * from t1 where a = 'AAA';
+a
+AAA
+drop table t1;
+create table t1 (
+a char(3) character set latin1 collate latin1_swedish_ci primary key
+) engine=ndb;
+insert into t1 values('aAa');
+insert into t1 values('aaa');
+ERROR 23000: Duplicate entry 'aaa' for key 1
+insert into t1 values('AAA');
+ERROR 23000: Duplicate entry 'AAA' for key 1
+select * from t1 order by a;
+a
+aAa
+select * from t1 where a = 'aAa';
+a
+aAa
+select * from t1 where a = 'aaa';
+a
+aAa
+select * from t1 where a = 'AaA';
+a
+aAa
+select * from t1 where a = 'AAA';
+a
+aAa
+drop table t1;
+create table t1 (
+p int primary key,
+a char(3) character set latin1 collate latin1_bin not null,
+unique key(a)
+) engine=ndb;
+insert into t1 values(1, 'aAa');
+insert into t1 values(2, 'aaa');
+insert into t1 values(3, 'AAA');
+select * from t1 order by p;
+p a
+1 aAa
+2 aaa
+3 AAA
+select * from t1 where a = 'aAa';
+p a
+1 aAa
+select * from t1 where a = 'aaa';
+p a
+2 aaa
+select * from t1 where a = 'AaA';
+p a
+select * from t1 where a = 'AAA';
+p a
+3 AAA
+drop table t1;
+create table t1 (
+p int primary key,
+a char(3) character set latin1 collate latin1_swedish_ci not null,
+unique key(a)
+) engine=ndb;
+insert into t1 values(1, 'aAa');
+insert into t1 values(2, 'aaa');
+ERROR 23000: Duplicate entry '2' for key 1
+insert into t1 values(3, 'AAA');
+ERROR 23000: Duplicate entry '3' for key 1
+select * from t1 order by p;
+p a
+1 aAa
+select * from t1 where a = 'aAa';
+p a
+1 aAa
+select * from t1 where a = 'aaa';
+p a
+1 aAa
+select * from t1 where a = 'AaA';
+p a
+1 aAa
+select * from t1 where a = 'AAA';
+p a
+1 aAa
+drop table t1;
+create table t1 (
+p int primary key,
+a char(3) character set latin1 collate latin1_bin not null,
+index(a)
+) engine=ndb;
+insert into t1 values(1, 'aAa');
+insert into t1 values(2, 'aaa');
+insert into t1 values(3, 'AAA');
+insert into t1 values(4, 'aAa');
+insert into t1 values(5, 'aaa');
+insert into t1 values(6, 'AAA');
+select * from t1 order by p;
+p a
+1 aAa
+2 aaa
+3 AAA
+4 aAa
+5 aaa
+6 AAA
+explain select * from t1 where a = 'zZz' order by p;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 3 const 10 Using where; Using filesort
+select * from t1 where a = 'aAa' order by p;
+p a
+1 aAa
+4 aAa
+select * from t1 where a = 'aaa' order by p;
+p a
+2 aaa
+5 aaa
+select * from t1 where a = 'AaA' order by p;
+p a
+select * from t1 where a = 'AAA' order by p;
+p a
+3 AAA
+6 AAA
+drop table t1;
+create table t1 (
+p int primary key,
+a char(3) character set latin1 collate latin1_swedish_ci not null,
+index(a)
+) engine=ndb;
+insert into t1 values(1, 'aAa');
+insert into t1 values(2, 'aaa');
+insert into t1 values(3, 'AAA');
+insert into t1 values(4, 'aAa');
+insert into t1 values(5, 'aaa');
+insert into t1 values(6, 'AAA');
+select * from t1 order by p;
+p a
+1 aAa
+2 aaa
+3 AAA
+4 aAa
+5 aaa
+6 AAA
+explain select * from t1 where a = 'zZz' order by p;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 3 const 10 Using where; Using filesort
+select * from t1 where a = 'aAa' order by p;
+p a
+1 aAa
+2 aaa
+3 AAA
+4 aAa
+5 aaa
+6 AAA
+select * from t1 where a = 'aaa' order by p;
+p a
+1 aAa
+2 aaa
+3 AAA
+4 aAa
+5 aaa
+6 AAA
+select * from t1 where a = 'AaA' order by p;
+p a
+1 aAa
+2 aaa
+3 AAA
+4 aAa
+5 aaa
+6 AAA
+select * from t1 where a = 'AAA' order by p;
+p a
+1 aAa
+2 aaa
+3 AAA
+4 aAa
+5 aaa
+6 AAA
+drop table t1;
+create table t1 (
+a varchar(10) primary key
+) engine=ndb;
+insert into t1 values ('jonas % ');
+replace into t1 values ('jonas % ');
+replace into t1 values ('jonas % ');
+select * from t1;
+a
+jonas %
+drop table t1;
diff --git a/mysql-test/r/ndb_grant.result b/mysql-test/r/ndb_grant.result
new file mode 100644
index 00000000000..6583065a0c4
--- /dev/null
+++ b/mysql-test/r/ndb_grant.result
@@ -0,0 +1,416 @@
+drop table if exists t1;
+SET NAMES binary;
+use mysql;
+alter table columns_priv engine=ndb;
+alter table db engine=ndb;
+alter table func engine=ndb;
+alter table help_category engine=ndb;
+alter table help_keyword engine=ndb;
+alter table help_relation engine=ndb;
+alter table help_topic engine=ndb;
+alter table host engine=ndb;
+alter table tables_priv engine=ndb;
+alter table time_zone engine=ndb;
+alter table time_zone_leap_second engine=ndb;
+alter table time_zone_name engine=ndb;
+alter table time_zone_transition engine=ndb;
+alter table time_zone_transition_type engine=ndb;
+alter table user engine=ndb;
+use test;
+delete from mysql.user where user='mysqltest_1';
+delete from mysql.db where user='mysqltest_1';
+flush privileges;
+begin;
+grant select on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA";
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
+GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+begin;
+grant delete on mysqltest.* to mysqltest_1@localhost;
+commit;
+select * from mysql.user where user="mysqltest_1";
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections
+localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N SPECIFIED EDH-RSA-DES-CBC3-SHA 0 0 0
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
+GRANT SELECT, DELETE ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+begin;
+revoke delete on mysqltest.* from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
+GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+begin;
+grant select on mysqltest.* to mysqltest_1@localhost require NONE;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+begin;
+grant USAGE on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "testsubject" ISSUER "MySQL AB";
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE ISSUER 'MySQL AB' SUBJECT 'testsubject' CIPHER 'EDH-RSA-DES-CBC3-SHA'
+GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+begin;
+revoke all privileges on mysqltest.* from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE ISSUER 'MySQL AB' SUBJECT 'testsubject' CIPHER 'EDH-RSA-DES-CBC3-SHA'
+delete from mysql.user where user='mysqltest_1';
+flush privileges;
+begin;
+grant CREATE TEMPORARY TABLES, LOCK TABLES on mysqltest.* to mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT CREATE TEMPORARY TABLES, LOCK TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+flush privileges;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT CREATE TEMPORARY TABLES, LOCK TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+begin;
+revoke CREATE TEMPORARY TABLES on mysqltest.* from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT LOCK TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+begin;
+grant ALL PRIVILEGES on mysqltest.* to mysqltest_1@localhost with GRANT OPTION;
+commit;
+flush privileges;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
+begin;
+revoke LOCK TABLES, ALTER on mysqltest.* from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, CREATE TEMPORARY TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
+begin;
+revoke all privileges on mysqltest.* from mysqltest_1@localhost;
+commit;
+delete from mysql.user where user='mysqltest_1';
+flush privileges;
+begin;
+grant usage on test.* to mysqltest_1@localhost with grant option;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT USAGE ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
+GRANT USAGE ON `test`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
+delete from mysql.user where user='mysqltest_1';
+delete from mysql.db where user='mysqltest_1';
+delete from mysql.tables_priv where user='mysqltest_1';
+delete from mysql.columns_priv where user='mysqltest_1';
+flush privileges;
+show grants for mysqltest_1@localhost;
+ERROR 42000: There is no such grant defined for user 'mysqltest_1' on host 'localhost'
+create table t1 (a int);
+begin;
+GRANT select,update,insert on t1 to mysqltest_1@localhost;
+GRANT select (a), update (a),insert(a), references(a) on t1 to mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT SELECT, SELECT (a), INSERT, INSERT (a), UPDATE, UPDATE (a), REFERENCES (a) ON `test`.`t1` TO 'mysqltest_1'@'localhost'
+select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1";
+table_priv column_priv
+Select,Insert,Update Select,Insert,Update,References
+begin;
+REVOKE select (a), update on t1 from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT SELECT, INSERT, INSERT (a), REFERENCES (a) ON `test`.`t1` TO 'mysqltest_1'@'localhost'
+begin;
+REVOKE select,update,insert,insert (a) on t1 from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT REFERENCES (a) ON `test`.`t1` TO 'mysqltest_1'@'localhost'
+begin;
+GRANT select,references on t1 to mysqltest_1@localhost;
+commit;
+select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1";
+table_priv column_priv
+Select,References References
+begin;
+grant all on test.* to mysqltest_3@localhost with grant option;
+revoke all on test.* from mysqltest_3@localhost;
+commit;
+show grants for mysqltest_3@localhost;
+Grants for mysqltest_3@localhost
+GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost'
+GRANT USAGE ON `test`.* TO 'mysqltest_3'@'localhost' WITH GRANT OPTION
+begin;
+revoke grant option on test.* from mysqltest_3@localhost;
+commit;
+show grants for mysqltest_3@localhost;
+Grants for mysqltest_3@localhost
+GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost'
+begin;
+grant all on test.t1 to mysqltest_2@localhost with grant option;
+revoke all on test.t1 from mysqltest_2@localhost;
+commit;
+show grants for mysqltest_2@localhost;
+Grants for mysqltest_2@localhost
+GRANT USAGE ON *.* TO 'mysqltest_2'@'localhost'
+GRANT USAGE ON `test`.`t1` TO 'mysqltest_2'@'localhost' WITH GRANT OPTION
+begin;
+revoke grant option on test.t1 from mysqltest_2@localhost;
+commit;
+show grants for mysqltest_2@localhost;
+Grants for mysqltest_2@localhost
+GRANT USAGE ON *.* TO 'mysqltest_2'@'localhost'
+delete from mysql.user where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
+delete from mysql.db where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
+delete from mysql.tables_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
+delete from mysql.columns_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
+flush privileges;
+drop table t1;
+begin;
+GRANT FILE on mysqltest.* to mysqltest_1@localhost;
+ERROR HY000: Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
+commit;
+select 1;
+1
+1
+create database mysqltest1;
+begin;
+grant usage on mysqltest1.* to test6123 identified by 'magic123';
+commit;
+select host,db,user,select_priv,insert_priv from mysql.db where db="mysqltest1";
+host db user select_priv insert_priv
+delete from mysql.user where user='test6123';
+drop database mysqltest1;
+create table t1 (a int);
+begin;
+grant ALL PRIVILEGES on *.* to drop_user2@localhost with GRANT OPTION;
+commit;
+show grants for drop_user2@localhost;
+Grants for drop_user2@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user2'@'localhost' WITH GRANT OPTION
+begin;
+revoke all privileges, grant option from drop_user2@localhost;
+commit;
+drop user drop_user2@localhost;
+begin;
+grant ALL PRIVILEGES on *.* to drop_user@localhost with GRANT OPTION;
+grant ALL PRIVILEGES on test.* to drop_user@localhost with GRANT OPTION;
+grant select(a) on test.t1 to drop_user@localhost;
+commit;
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT ALL PRIVILEGES ON `test`.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT SELECT (a) ON `test`.`t1` TO 'drop_user'@'localhost'
+set sql_mode=ansi_quotes;
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT ALL PRIVILEGES ON "test".* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT SELECT (a) ON "test"."t1" TO 'drop_user'@'localhost'
+set sql_mode=default;
+set sql_quote_show_create=0;
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT ALL PRIVILEGES ON test.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT SELECT (a) ON test.t1 TO 'drop_user'@'localhost'
+set sql_mode="ansi_quotes";
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT ALL PRIVILEGES ON test.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT SELECT (a) ON test.t1 TO 'drop_user'@'localhost'
+set sql_quote_show_create=1;
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT ALL PRIVILEGES ON "test".* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT SELECT (a) ON "test"."t1" TO 'drop_user'@'localhost'
+set sql_mode="";
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT ALL PRIVILEGES ON `test`.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT SELECT (a) ON `test`.`t1` TO 'drop_user'@'localhost'
+revoke all privileges, grant option from drop_user@localhost;
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT USAGE ON *.* TO 'drop_user'@'localhost'
+drop user drop_user@localhost;
+begin;
+revoke all privileges, grant option from drop_user@localhost;
+ERROR HY000: Can't revoke all privileges, grant for one or more of the requested users
+commit;
+begin;
+grant select(a) on test.t1 to drop_user1@localhost;
+commit;
+flush privileges;
+begin;
+grant select on test.t1 to drop_user2@localhost;
+grant select on test.* to drop_user3@localhost;
+grant select on *.* to drop_user4@localhost;
+commit;
+drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
+drop_user4@localhost;
+ERROR HY000: Can't drop one or more of the requested users
+begin;
+revoke all privileges, grant option from drop_user1@localhost, drop_user2@localhost,
+drop_user3@localhost, drop_user4@localhost;
+commit;
+drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
+drop_user4@localhost;
+drop table t1;
+begin;
+grant usage on *.* to mysqltest_1@localhost identified by "password";
+grant select, update, insert on test.* to mysqltest@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' IDENTIFIED BY PASSWORD '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19'
+drop user mysqltest_1@localhost;
+SET NAMES koi8r;
+CREATE DATABASE ÂÄ;
+USE ÂÄ;
+CREATE TABLE ÔÁÂ (ËÏÌ int);
+begin;
+GRANT SELECT ON ÂÄ.* TO ÀÚÅÒ@localhost;
+commit;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+Grants for ÀÚÅÒ@localhost
+GRANT USAGE ON *.* TO 'ÀÚÅÒ'@'localhost'
+GRANT SELECT ON `ÂÄ`.* TO 'ÀÚÅÒ'@'localhost'
+begin;
+REVOKE SELECT ON ÂÄ.* FROM ÀÚÅÒ@localhost;
+commit;
+begin;
+GRANT SELECT ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
+commit;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+Grants for ÀÚÅÒ@localhost
+GRANT USAGE ON *.* TO 'ÀÚÅÒ'@'localhost'
+GRANT SELECT ON `ÂÄ`.`ÔÁÂ` TO 'ÀÚÅÒ'@'localhost'
+begin;
+REVOKE SELECT ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
+commit;
+begin;
+GRANT SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
+commit;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+Grants for ÀÚÅÒ@localhost
+GRANT USAGE ON *.* TO 'ÀÚÅÒ'@'localhost'
+GRANT SELECT (ËÏÌ) ON `ÂÄ`.`ÔÁÂ` TO 'ÀÚÅÒ'@'localhost'
+begin;
+REVOKE SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
+commit;
+DROP DATABASE ÂÄ;
+SET NAMES latin1;
+USE test;
+CREATE TABLE t1 (a int );
+CREATE TABLE t2 LIKE t1;
+CREATE TABLE t3 LIKE t1;
+CREATE TABLE t4 LIKE t1;
+CREATE TABLE t5 LIKE t1;
+CREATE TABLE t6 LIKE t1;
+CREATE TABLE t7 LIKE t1;
+CREATE TABLE t8 LIKE t1;
+CREATE TABLE t9 LIKE t1;
+CREATE TABLE t10 LIKE t1;
+CREATE DATABASE testdb1;
+CREATE DATABASE testdb2;
+CREATE DATABASE testdb3;
+CREATE DATABASE testdb4;
+CREATE DATABASE testdb5;
+CREATE DATABASE testdb6;
+CREATE DATABASE testdb7;
+CREATE DATABASE testdb8;
+CREATE DATABASE testdb9;
+CREATE DATABASE testdb10;
+begin;
+GRANT ALL ON testdb1.* TO testuser@localhost;
+GRANT ALL ON testdb2.* TO testuser@localhost;
+GRANT ALL ON testdb3.* TO testuser@localhost;
+GRANT ALL ON testdb4.* TO testuser@localhost;
+GRANT ALL ON testdb5.* TO testuser@localhost;
+GRANT ALL ON testdb6.* TO testuser@localhost;
+GRANT ALL ON testdb7.* TO testuser@localhost;
+GRANT ALL ON testdb8.* TO testuser@localhost;
+GRANT ALL ON testdb9.* TO testuser@localhost;
+GRANT ALL ON testdb10.* TO testuser@localhost;
+GRANT SELECT ON test.t1 TO testuser@localhost;
+GRANT SELECT ON test.t2 TO testuser@localhost;
+GRANT SELECT ON test.t3 TO testuser@localhost;
+GRANT SELECT ON test.t4 TO testuser@localhost;
+GRANT SELECT ON test.t5 TO testuser@localhost;
+GRANT SELECT ON test.t6 TO testuser@localhost;
+GRANT SELECT ON test.t7 TO testuser@localhost;
+GRANT SELECT ON test.t8 TO testuser@localhost;
+GRANT SELECT ON test.t9 TO testuser@localhost;
+GRANT SELECT ON test.t10 TO testuser@localhost;
+GRANT SELECT (a) ON test.t1 TO testuser@localhost;
+GRANT SELECT (a) ON test.t2 TO testuser@localhost;
+GRANT SELECT (a) ON test.t3 TO testuser@localhost;
+GRANT SELECT (a) ON test.t4 TO testuser@localhost;
+GRANT SELECT (a) ON test.t5 TO testuser@localhost;
+GRANT SELECT (a) ON test.t6 TO testuser@localhost;
+GRANT SELECT (a) ON test.t7 TO testuser@localhost;
+GRANT SELECT (a) ON test.t8 TO testuser@localhost;
+GRANT SELECT (a) ON test.t9 TO testuser@localhost;
+GRANT SELECT (a) ON test.t10 TO testuser@localhost;
+commit;
+begin;
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM testuser@localhost;
+commit;
+SHOW GRANTS FOR testuser@localhost;
+Grants for testuser@localhost
+GRANT USAGE ON *.* TO 'testuser'@'localhost'
+DROP USER testuser@localhost;
+DROP TABLE t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+DROP DATABASE testdb1;
+DROP DATABASE testdb2;
+DROP DATABASE testdb3;
+DROP DATABASE testdb4;
+DROP DATABASE testdb5;
+DROP DATABASE testdb6;
+DROP DATABASE testdb7;
+DROP DATABASE testdb8;
+DROP DATABASE testdb9;
+DROP DATABASE testdb10;
+use mysql;
+alter table columns_priv engine=myisam;
+alter table db engine=myisam;
+alter table func engine=myisam;
+alter table help_category engine=myisam;
+alter table help_keyword engine=myisam;
+alter table help_relation engine=myisam;
+alter table help_topic engine=myisam;
+alter table host engine=myisam;
+alter table tables_priv engine=myisam;
+alter table time_zone engine=myisam;
+alter table time_zone_leap_second engine=myisam;
+alter table time_zone_name engine=myisam;
+alter table time_zone_transition engine=myisam;
+alter table time_zone_transition_type engine=myisam;
+alter table user engine=myisam;
+use test;
+flush privileges;
diff --git a/mysql-test/r/ndb_index.result b/mysql-test/r/ndb_index.result
new file mode 100644
index 00000000000..5702552b0b5
--- /dev/null
+++ b/mysql-test/r/ndb_index.result
@@ -0,0 +1,154 @@
+drop table if exists t1;
+CREATE TABLE t1 (
+PORT varchar(16) NOT NULL,
+ACCESSNODE varchar(16) NOT NULL,
+POP varchar(48) NOT NULL,
+ACCESSTYPE int unsigned NOT NULL,
+CUSTOMER_ID varchar(20) collate latin1_bin NOT NULL,
+PROVIDER varchar(16),
+TEXPIRE int unsigned,
+NUM_IP int unsigned,
+LEASED_NUM_IP int unsigned,
+LOCKED_IP int unsigned,
+STATIC_DNS int unsigned,
+SUSPENDED_SERVICE int unsigned,
+SUSPENDED_REASON int unsigned,
+BGP_COMMUNITY int unsigned,
+INDEX CUSTOMER_ID_INDEX(CUSTOMER_ID),
+INDEX FQPN_INDEX(POP,ACCESSNODE,PORT),
+PRIMARY KEY(POP,ACCESSNODE,PORT,ACCESSTYPE)
+) engine=ndbcluster;
+INSERT INTO t1 VALUES ('port67', 'node78', 'pop98', 1, 'kllopmn', 'pr_43', 121212, 1, 2, 3, 8, NULL, NULL, NULL);
+INSERT INTO t1 VALUES ('port67', 'node78', 'pop99', 2, 'klkighh', 'pr_44', 121213, 3, 3, 6, 7, NULL, NULL, NULL);
+INSERT INTO t1 VALUES ('port79', 'node79', 'pop79', 2, 'kpongfaa', 'pr_44', 981213, 2, 4, 10, 11, 2, 99, 1278);
+select port, accessnode, pop, accesstype from t1 where port='port67' order by accesstype;
+port accessnode pop accesstype
+port67 node78 pop98 1
+port67 node78 pop99 2
+select port, accessnode, pop, accesstype from t1 where port='foo';
+port accessnode pop accesstype
+select port, accessnode, pop, accesstype from t1 where accessnode='node78' order by accesstype;
+port accessnode pop accesstype
+port67 node78 pop98 1
+port67 node78 pop99 2
+select port, accessnode, pop, accesstype from t1 where accessnode='foo';
+port accessnode pop accesstype
+select port, accessnode, pop, accesstype from t1 where pop='pop98';
+port accessnode pop accesstype
+port67 node78 pop98 1
+select port, accessnode, pop, accesstype from t1 where pop='pop98';
+port accessnode pop accesstype
+port67 node78 pop98 1
+select port, accessnode, pop, accesstype from t1 where pop='pop98';
+port accessnode pop accesstype
+port67 node78 pop98 1
+select port, accessnode, pop, accesstype from t1 where pop='pop98' order by accesstype;
+port accessnode pop accesstype
+port67 node78 pop98 1
+select port, accessnode, pop, accesstype from t1 where pop='foo';
+port accessnode pop accesstype
+select port, accessnode, pop, accesstype from t1 where accesstype=1;
+port accessnode pop accesstype
+port67 node78 pop98 1
+select port, accessnode, pop, accesstype from t1 where accesstype=2 order by port;
+port accessnode pop accesstype
+port67 node78 pop99 2
+port79 node79 pop79 2
+select port, accessnode, pop, accesstype from t1 where accesstype=98 order by port;
+port accessnode pop accesstype
+select port, accessnode, pop, accesstype from t1 where customer_id='kllopmn';
+port accessnode pop accesstype
+port67 node78 pop98 1
+select port, accessnode, pop, accesstype from t1 where customer_id='KLLOPMN';
+port accessnode pop accesstype
+select port, accessnode, pop, accesstype from t1 where customer_id='kLLoPMn';
+port accessnode pop accesstype
+select port, accessnode, pop, accesstype from t1 where customer_id='foo';
+port accessnode pop accesstype
+select port, accessnode, pop, accesstype from t1 where provider='pr_43';
+port accessnode pop accesstype
+port67 node78 pop98 1
+select port, accessnode, pop, accesstype from t1 where provider='foo';
+port accessnode pop accesstype
+select port, accessnode from t1 where texpire=121212;
+port accessnode
+port67 node78
+select port, accessnode from t1 where texpire=2323;
+port accessnode
+select port, accessnode, pop, accesstype from t1 where num_ip=1;
+port accessnode pop accesstype
+port67 node78 pop98 1
+select port, accessnode, pop, accesstype from t1 where num_ip=89;
+port accessnode pop accesstype
+select port, accessnode, pop, accesstype from t1 where leased_num_ip=2;
+port accessnode pop accesstype
+port67 node78 pop98 1
+select port, accessnode, pop, accesstype from t1 where leased_num_ip=89;
+port accessnode pop accesstype
+select port, accessnode, pop, accesstype from t1 where locked_ip=3;
+port accessnode pop accesstype
+port67 node78 pop98 1
+select port, accessnode, pop, accesstype from t1 where locked_ip=89;
+port accessnode pop accesstype
+select port, accessnode, pop, accesstype from t1 where static_dns=8;
+port accessnode pop accesstype
+port67 node78 pop98 1
+select port, accessnode, pop, accesstype from t1 where static_dns=89;
+port accessnode pop accesstype
+select port, accessnode, pop, accesstype from t1 where suspended_service=8;
+port accessnode pop accesstype
+select port, accessnode, pop, accesstype from t1 where suspended_service=89;
+port accessnode pop accesstype
+select port, accessnode, pop, accesstype from t1 where suspended_reason=NULL;
+port accessnode pop accesstype
+select port, accessnode, pop, accesstype from t1 where suspended_reason=89;
+port accessnode pop accesstype
+select port, accessnode, pop, accesstype from t1 where suspended_reason=0;
+port accessnode pop accesstype
+select port, accessnode, pop, accesstype from t1 where bgp_community=NULL;
+port accessnode pop accesstype
+select port, accessnode, pop, accesstype from t1 where bgp_community=89;
+port accessnode pop accesstype
+select port, accessnode, pop, accesstype from t1 where bgp_community=0;
+port accessnode pop accesstype
+select port, accessnode, pop, accesstype from t1 where port='port67' and accessnode='node78' and pop='pop98' and accesstype=1;
+port accessnode pop accesstype
+port67 node78 pop98 1
+select port, accessnode, pop, accesstype from t1 where port='port67' and accesstype=1 and accessnode='node78' and pop='pop98';
+port accessnode pop accesstype
+port67 node78 pop98 1
+select port, accessnode, pop, accesstype from t1 where pop='pop98' and port='port67' and accesstype=1 and accessnode='node78';
+port accessnode pop accesstype
+port67 node78 pop98 1
+select port, accessnode from t1 where port='foo' and accessnode='foo' and pop='foo' and accesstype=99;
+port accessnode
+select port, accessnode, pop, accesstype from t1 where port='port67' and pop='pop98' and accesstype=1;
+port accessnode pop accesstype
+port67 node78 pop98 1
+select port, accessnode, pop, accesstype from t1 where accesstype=1 and accessnode='node78' and pop='pop98';
+port accessnode pop accesstype
+port67 node78 pop98 1
+select port, accessnode, pop, accesstype from t1 where port='port67' and accesstype=1 and accessnode='node78';
+port accessnode pop accesstype
+port67 node78 pop98 1
+select port, accessnode from t1 where port='foo' and accessnode='foo' and pop='foo';
+port accessnode
+select port, accessnode, pop, accesstype from t1 where customer_id='kllopmn';
+port accessnode pop accesstype
+port67 node78 pop98 1
+select port, accessnode, pop, accesstype from t1 where customer_id='kllopmn' and accesstype=1;
+port accessnode pop accesstype
+port67 node78 pop98 1
+select port, accessnode, pop, accesstype from t1 where customer_id='kllopmn' and accesstype=2;
+port accessnode pop accesstype
+select port, accessnode, pop, accesstype from t1 where accesstype=2 and customer_id='kllopmn';
+port accessnode pop accesstype
+select port, accessnode, pop, accesstype from t1 where pop='pop98' and accessnode='node78' and port='port67';
+port accessnode pop accesstype
+port67 node78 pop98 1
+select port, accessnode, pop, accesstype from t1 where pop='pop98' and accessnode='node78' and port='port67' and customer_id='kllopmn';
+port accessnode pop accesstype
+port67 node78 pop98 1
+select port, accessnode, pop, accesstype from t1 where pop='pop98' and accessnode='node78' and port='port67' and customer_id='foo';
+port accessnode pop accesstype
+drop table t1;
diff --git a/mysql-test/r/ndb_index_ordered.result b/mysql-test/r/ndb_index_ordered.result
new file mode 100644
index 00000000000..50f904af750
--- /dev/null
+++ b/mysql-test/r/ndb_index_ordered.result
@@ -0,0 +1,312 @@
+drop table if exists t1, test1, test2;
+CREATE TABLE t1 (
+a int unsigned NOT NULL PRIMARY KEY,
+b int unsigned not null,
+c int unsigned,
+KEY(b)
+) engine=ndbcluster;
+insert t1 values(1, 2, 3), (2,3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
+select * from t1 order by b;
+a b c
+1 2 3
+2 3 5
+3 4 6
+4 5 8
+5 6 2
+6 7 2
+select * from t1 where b >= 4 order by b;
+a b c
+3 4 6
+4 5 8
+5 6 2
+6 7 2
+select * from t1 where b = 4 order by b;
+a b c
+3 4 6
+select * from t1 where b > 4 order by b;
+a b c
+4 5 8
+5 6 2
+6 7 2
+select * from t1 where b < 4 order by b;
+a b c
+1 2 3
+2 3 5
+select * from t1 where b <= 4 order by b;
+a b c
+1 2 3
+2 3 5
+3 4 6
+select tt1.* from t1 as tt1, t1 as tt2 use index(b) where tt1.b = tt2.b order by tt1.b;
+a b c
+1 2 3
+2 3 5
+3 4 6
+4 5 8
+5 6 2
+6 7 2
+select a, b, c from t1 where a!=2 and c=6;
+a b c
+3 4 6
+select a, b, c from t1 where a!=2 order by a;
+a b c
+1 2 3
+3 4 6
+4 5 8
+5 6 2
+6 7 2
+update t1 set c = 3 where b = 3;
+select * from t1 order by a;
+a b c
+1 2 3
+2 3 3
+3 4 6
+4 5 8
+5 6 2
+6 7 2
+update t1 set c = 10 where b >= 6;
+select * from t1 order by a;
+a b c
+1 2 3
+2 3 3
+3 4 6
+4 5 8
+5 6 10
+6 7 10
+update t1 set c = 11 where b < 5;
+select * from t1 order by a;
+a b c
+1 2 11
+2 3 11
+3 4 11
+4 5 8
+5 6 10
+6 7 10
+update t1 set c = 12 where b > 0;
+select * from t1 order by a;
+a b c
+1 2 12
+2 3 12
+3 4 12
+4 5 12
+5 6 12
+6 7 12
+update t1 set c = 13 where b <= 3;
+select * from t1 order by a;
+a b c
+1 2 13
+2 3 13
+3 4 12
+4 5 12
+5 6 12
+6 7 12
+update t1 set b = b + 1 where b > 4 and b < 7;
+select * from t1 order by a;
+a b c
+1 2 13
+2 3 13
+3 4 12
+4 6 12
+5 7 12
+6 7 12
+update t1 set a = a + 10 where b > 1 and b < 7;
+select * from t1 order by a;
+a b c
+5 7 12
+6 7 12
+11 2 13
+12 3 13
+13 4 12
+14 6 12
+drop table t1;
+CREATE TABLE t1 (
+a int unsigned NOT NULL PRIMARY KEY,
+b int unsigned not null,
+c int unsigned,
+KEY(b)
+) engine=ndbcluster;
+insert t1 values(1, 2, 13), (2,3, 13), (3, 4, 12), (4, 5, 12), (5,6, 12), (6,7, 12);
+delete from t1 where b = 3;
+select * from t1 order by a;
+a b c
+1 2 13
+3 4 12
+4 5 12
+5 6 12
+6 7 12
+delete from t1 where b >= 6;
+select * from t1 order by a;
+a b c
+1 2 13
+3 4 12
+4 5 12
+delete from t1 where b < 4;
+select * from t1 order by a;
+a b c
+3 4 12
+4 5 12
+delete from t1 where b > 5;
+select * from t1 order by a;
+a b c
+3 4 12
+4 5 12
+delete from t1 where b <= 4;
+select * from t1 order by a;
+a b c
+4 5 12
+drop table t1;
+CREATE TABLE t1 (
+a int unsigned NOT NULL PRIMARY KEY,
+b int unsigned not null,
+c int unsigned not null
+) engine = ndb;
+create index a1 on t1 (b, c);
+insert into t1 values (1, 2, 13);
+insert into t1 values (2,3, 13);
+insert into t1 values (3, 4, 12);
+insert into t1 values (4, 5, 12);
+insert into t1 values (5,6, 12);
+insert into t1 values (6,7, 12);
+insert into t1 values (7, 2, 1);
+insert into t1 values (8,3, 6);
+insert into t1 values (9, 4, 12);
+insert into t1 values (14, 5, 4);
+insert into t1 values (15,5,5);
+insert into t1 values (16,5, 6);
+insert into t1 values (17,4,4);
+insert into t1 values (18,1, 7);
+select * from t1 order by a;
+a b c
+1 2 13
+2 3 13
+3 4 12
+4 5 12
+5 6 12
+6 7 12
+7 2 1
+8 3 6
+9 4 12
+14 5 4
+15 5 5
+16 5 6
+17 4 4
+18 1 7
+select * from t1 where b<=5 order by a;
+a b c
+1 2 13
+2 3 13
+3 4 12
+4 5 12
+7 2 1
+8 3 6
+9 4 12
+14 5 4
+15 5 5
+16 5 6
+17 4 4
+18 1 7
+select * from t1 where b<=5 and c=0;
+a b c
+insert into t1 values (19,4, 0);
+select * from t1 where b<=5 and c=0;
+a b c
+19 4 0
+select * from t1 where b=4 and c<=5 order by a;
+a b c
+17 4 4
+19 4 0
+select * from t1 where b<=4 and c<=5 order by a;
+a b c
+7 2 1
+17 4 4
+19 4 0
+select * from t1 where b<=5 and c=0 or b<=5 and c=2;
+a b c
+19 4 0
+select count(*) from t1 where b = 0;
+count(*)
+0
+select count(*) from t1 where b = 1;
+count(*)
+1
+drop table t1;
+CREATE TABLE t1 (
+a int unsigned NOT NULL PRIMARY KEY,
+b int unsigned,
+c int unsigned,
+KEY bc(b,c)
+) engine = ndb;
+insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL);
+select * from t1 use index (bc) where b IS NULL order by a;
+a b c
+2 NULL 2
+3 NULL NULL
+select * from t1 use index (bc)order by a;
+a b c
+1 1 1
+2 NULL 2
+3 NULL NULL
+4 4 NULL
+select * from t1 use index (bc) order by a;
+a b c
+1 1 1
+2 NULL 2
+3 NULL NULL
+4 4 NULL
+select * from t1 use index (PRIMARY) where b IS NULL order by a;
+a b c
+2 NULL 2
+3 NULL NULL
+select * from t1 use index (bc) where b IS NULL order by a;
+a b c
+2 NULL 2
+3 NULL NULL
+select * from t1 use index (bc) where b IS NULL and c IS NULL order by a;
+a b c
+3 NULL NULL
+select * from t1 use index (bc) where b IS NULL and c = 2 order by a;
+a b c
+2 NULL 2
+select * from t1 use index (bc) where b < 4 order by a;
+a b c
+1 1 1
+select * from t1 use index (bc) where b IS NOT NULL order by a;
+a b c
+1 1 1
+4 4 NULL
+drop table t1;
+CREATE TABLE test1 (
+SubscrID int(11) NOT NULL auto_increment,
+UsrID int(11) NOT NULL default '0',
+PRIMARY KEY (SubscrID),
+KEY idx_usrid (UsrID)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO test1 VALUES (2,224),(3,224),(1,224);
+CREATE TABLE test2 (
+SbclID int(11) NOT NULL auto_increment,
+SbcrID int(11) NOT NULL default '0',
+PRIMARY KEY (SbclID),
+KEY idx_sbcrid (SbcrID)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO test2 VALUES (3,2),(1,1),(2,1),(4,2);
+select * from test1 order by 1;
+SubscrID UsrID
+1 224
+2 224
+3 224
+select * from test2 order by 1;
+SbclID SbcrID
+1 1
+2 1
+3 2
+4 2
+SELECT s.SubscrID,l.SbclID FROM test1 s left JOIN test2 l ON
+l.SbcrID=s.SubscrID WHERE s.UsrID=224 order by 1, 2;
+SubscrID SbclID
+1 1
+1 2
+2 3
+2 4
+3 NULL
+drop table test1;
+drop table test2;
diff --git a/mysql-test/r/ndb_index_unique.result b/mysql-test/r/ndb_index_unique.result
new file mode 100644
index 00000000000..f9cc89ee4cc
--- /dev/null
+++ b/mysql-test/r/ndb_index_unique.result
@@ -0,0 +1,614 @@
+drop table if exists t1, t2, t3, t4, t5, t6, t7;
+CREATE TABLE t1 (
+a int unsigned NOT NULL PRIMARY KEY,
+b int unsigned not null,
+c int unsigned,
+UNIQUE(b)
+) engine=ndbcluster;
+insert t1 values(1, 2, 3), (2, 3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
+select * from t1 order by b;
+a b c
+1 2 3
+2 3 5
+3 4 6
+4 5 8
+5 6 2
+6 7 2
+select * from t1 where b = 4 order by b;
+a b c
+3 4 6
+insert into t1 values(7,8,3);
+select * from t1 where b = 4 order by a;
+a b c
+3 4 6
+insert into t1 values(8, 2, 3);
+ERROR 23000: Duplicate entry '8' for key 1
+select * from t1 order by a;
+a b c
+1 2 3
+2 3 5
+3 4 6
+4 5 8
+5 6 2
+6 7 2
+7 8 3
+delete from t1 where a = 1;
+insert into t1 values(8, 2, 3);
+select * from t1 order by a;
+a b c
+2 3 5
+3 4 6
+4 5 8
+5 6 2
+6 7 2
+7 8 3
+8 2 3
+drop table t1;
+CREATE TABLE t1 (
+a int unsigned NOT NULL PRIMARY KEY,
+b int unsigned,
+c int unsigned,
+UNIQUE bc(b,c)
+) engine = ndb;
+insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL);
+select * from t1 use index (bc) where b IS NULL order by a;
+a b c
+2 NULL 2
+3 NULL NULL
+select * from t1 use index (bc)order by a;
+a b c
+1 1 1
+2 NULL 2
+3 NULL NULL
+4 4 NULL
+select * from t1 use index (bc) order by a;
+a b c
+1 1 1
+2 NULL 2
+3 NULL NULL
+4 4 NULL
+select * from t1 use index (PRIMARY) where b IS NULL order by a;
+a b c
+2 NULL 2
+3 NULL NULL
+select * from t1 use index (bc) where b IS NULL order by a;
+a b c
+2 NULL 2
+3 NULL NULL
+select * from t1 use index (bc) where b IS NULL and c IS NULL order by a;
+a b c
+3 NULL NULL
+select * from t1 use index (bc) where b IS NULL and c = 2 order by a;
+a b c
+2 NULL 2
+select * from t1 use index (bc) where b < 4 order by a;
+a b c
+1 1 1
+select * from t1 use index (bc) where b IS NOT NULL order by a;
+a b c
+1 1 1
+4 4 NULL
+insert into t1 values(5,1,1);
+ERROR 23000: Duplicate entry '5' for key 1
+drop table t1;
+CREATE TABLE t2 (
+a int unsigned NOT NULL PRIMARY KEY,
+b int unsigned not null,
+c int unsigned not null,
+UNIQUE USING HASH (b, c)
+) engine=ndbcluster;
+insert t2 values(1, 2, 3), (2, 3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
+select * from t2 where a = 3;
+a b c
+3 4 6
+select * from t2 where b = 4;
+a b c
+3 4 6
+select * from t2 where c = 6;
+a b c
+3 4 6
+insert into t2 values(7,8,3);
+select * from t2 where b = 4 order by a;
+a b c
+3 4 6
+insert into t2 values(8, 2, 3);
+ERROR 23000: Duplicate entry '8' for key 1
+select * from t2 order by a;
+a b c
+1 2 3
+2 3 5
+3 4 6
+4 5 8
+5 6 2
+6 7 2
+7 8 3
+delete from t2 where a = 1;
+insert into t2 values(8, 2, 3);
+select * from t2 order by a;
+a b c
+2 3 5
+3 4 6
+4 5 8
+5 6 2
+6 7 2
+7 8 3
+8 2 3
+drop table t2;
+CREATE TABLE t2 (
+a int unsigned NOT NULL PRIMARY KEY,
+b int unsigned not null,
+c int unsigned,
+UNIQUE USING HASH (b, c)
+) engine=ndbcluster;
+ERROR 42000: Column 'c' is used with UNIQUE or INDEX but is not defined as NOT NULL
+CREATE TABLE t3 (
+a int unsigned NOT NULL,
+b int unsigned not null,
+c int unsigned,
+PRIMARY KEY USING HASH (a, b)
+) engine=ndbcluster;
+insert t3 values(1, 2, 3), (2, 3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
+select * from t3 where a = 3;
+a b c
+3 4 6
+select * from t3 where b = 4;
+a b c
+3 4 6
+select * from t3 where c = 6;
+a b c
+3 4 6
+insert into t3 values(7,8,3);
+select * from t3 where b = 4 order by a;
+a b c
+3 4 6
+drop table t3;
+CREATE TABLE t1 (
+pk int NOT NULL PRIMARY KEY,
+a int unsigned,
+UNIQUE KEY (a)
+) engine=ndbcluster;
+insert into t1 values (-1,NULL), (0,0), (1,NULL),(2,2),(3,NULL),(4,4);
+select * from t1 order by pk;
+pk a
+-1 NULL
+0 0
+1 NULL
+2 2
+3 NULL
+4 4
+insert into t1 values (5,0);
+ERROR 23000: Duplicate entry '5' for key 1
+select * from t1 order by pk;
+pk a
+-1 NULL
+0 0
+1 NULL
+2 2
+3 NULL
+4 4
+delete from t1 where a = 0;
+insert into t1 values (5,0);
+select * from t1 order by pk;
+pk a
+-1 NULL
+1 NULL
+2 2
+3 NULL
+4 4
+5 0
+CREATE TABLE t2 (
+pk int NOT NULL PRIMARY KEY,
+a int unsigned,
+b tinyint NOT NULL,
+c VARCHAR(10),
+UNIQUE KEY si(a, c)
+) engine=ndbcluster;
+insert into t2 values (-1,1,17,NULL),(0,NULL,18,NULL),(1,3,19,'abc');
+select * from t2 order by pk;
+pk a b c
+-1 1 17 NULL
+0 NULL 18 NULL
+1 3 19 abc
+insert into t2 values(2,3,19,'abc');
+ERROR 23000: Duplicate entry '2' for key 1
+select * from t2 order by pk;
+pk a b c
+-1 1 17 NULL
+0 NULL 18 NULL
+1 3 19 abc
+delete from t2 where c IS NOT NULL;
+insert into t2 values(2,3,19,'abc');
+select * from t2 order by pk;
+pk a b c
+-1 1 17 NULL
+0 NULL 18 NULL
+2 3 19 abc
+drop table t1, t2;
+CREATE TABLE t1 (
+cid smallint(5) unsigned NOT NULL default '0',
+cv varchar(250) NOT NULL default '',
+PRIMARY KEY (cid),
+UNIQUE KEY cv (cv)
+) engine=ndbcluster;
+INSERT INTO t1 VALUES (8,'dummy');
+CREATE TABLE t2 (
+cid bigint(20) unsigned NOT NULL auto_increment,
+cap varchar(255) NOT NULL default '',
+PRIMARY KEY (cid),
+UNIQUE KEY (cid, cap)
+) engine=ndbcluster;
+INSERT INTO t2 VALUES (NULL,'another dummy');
+CREATE TABLE t3 (
+gid bigint(20) unsigned NOT NULL auto_increment,
+gn varchar(255) NOT NULL default '',
+must tinyint(4) default NULL,
+PRIMARY KEY (gid)
+) engine=ndbcluster;
+INSERT INTO t3 VALUES (1,'V1',NULL);
+CREATE TABLE t4 (
+uid bigint(20) unsigned NOT NULL default '0',
+gid bigint(20) unsigned NOT NULL,
+rid bigint(20) unsigned NOT NULL default '-1',
+cid bigint(20) unsigned NOT NULL default '-1',
+UNIQUE KEY m (uid,gid,rid,cid)
+) engine=ndbcluster;
+INSERT INTO t4 VALUES (1,1,2,4);
+INSERT INTO t4 VALUES (1,1,2,3);
+INSERT INTO t4 VALUES (1,1,5,7);
+INSERT INTO t4 VALUES (1,1,10,8);
+CREATE TABLE t5 (
+rid bigint(20) unsigned NOT NULL auto_increment,
+rl varchar(255) NOT NULL default '',
+PRIMARY KEY (rid)
+) engine=ndbcluster;
+CREATE TABLE t6 (
+uid bigint(20) unsigned NOT NULL auto_increment,
+un varchar(250) NOT NULL default '',
+uc smallint(5) unsigned NOT NULL default '0',
+PRIMARY KEY (uid),
+UNIQUE KEY nc (un,uc)
+) engine=ndbcluster;
+INSERT INTO t6 VALUES (1,'test',8);
+INSERT INTO t6 VALUES (2,'test2',9);
+INSERT INTO t6 VALUES (3,'tre',3);
+CREATE TABLE t7 (
+mid bigint(20) unsigned NOT NULL PRIMARY KEY,
+uid bigint(20) unsigned NOT NULL default '0',
+gid bigint(20) unsigned NOT NULL,
+rid bigint(20) unsigned NOT NULL default '-1',
+cid bigint(20) unsigned NOT NULL default '-1',
+UNIQUE KEY m (uid,gid,rid,cid)
+) engine=ndbcluster;
+INSERT INTO t7 VALUES(1, 1, 1, 1, 1);
+INSERT INTO t7 VALUES(2, 2, 1, 1, 1);
+INSERT INTO t7 VALUES(3, 3, 1, 1, 1);
+INSERT INTO t7 VALUES(4, 4, 1, 1, 1);
+INSERT INTO t7 VALUES(5, 5, 1, 1, 1);
+INSERT INTO t7 VALUES(6, 1, 1, 1, 6);
+INSERT INTO t7 VALUES(7, 2, 1, 1, 7);
+INSERT INTO t7 VALUES(8, 3, 1, 1, 8);
+INSERT INTO t7 VALUES(9, 4, 1, 1, 9);
+INSERT INTO t7 VALUES(10, 5, 1, 1, 10);
+select * from t1 where cv = 'dummy';
+cid cv
+8 dummy
+select * from t1 where cv = 'test';
+cid cv
+select * from t2 where cap = 'another dummy';
+cid cap
+1 another dummy
+select * from t4 where uid = 1 and gid=1 and rid=2 and cid=4;
+uid gid rid cid
+1 1 2 4
+select * from t4 where uid = 1 and gid=1 and rid=1 and cid=4;
+uid gid rid cid
+select * from t4 where uid = 1 order by cid;
+uid gid rid cid
+1 1 2 3
+1 1 2 4
+1 1 5 7
+1 1 10 8
+select * from t4 where rid = 2 order by cid;
+uid gid rid cid
+1 1 2 3
+1 1 2 4
+select * from t6 where un='test' and uc=8;
+uid un uc
+1 test 8
+select * from t6 where un='test' and uc=7;
+uid un uc
+select * from t6 where un='test';
+uid un uc
+1 test 8
+select * from t7 where mid = 8;
+mid uid gid rid cid
+8 3 1 1 8
+select * from t7 where uid = 8;
+mid uid gid rid cid
+select * from t7 where uid = 1 order by mid;
+mid uid gid rid cid
+1 1 1 1 1
+6 1 1 1 6
+select * from t7 where uid = 4 order by mid;
+mid uid gid rid cid
+4 4 1 1 1
+9 4 1 1 9
+select * from t7 where gid = 4;
+mid uid gid rid cid
+select * from t7 where gid = 1 order by mid;
+mid uid gid rid cid
+1 1 1 1 1
+2 2 1 1 1
+3 3 1 1 1
+4 4 1 1 1
+5 5 1 1 1
+6 1 1 1 6
+7 2 1 1 7
+8 3 1 1 8
+9 4 1 1 9
+10 5 1 1 10
+select * from t7 where cid = 4;
+mid uid gid rid cid
+select * from t7 where cid = 8;
+mid uid gid rid cid
+8 3 1 1 8
+select * from t4 where uid = 1 and gid=1 and rid=2 and cid=4;
+uid gid rid cid
+1 1 2 4
+select * from t4 where uid = 1 and gid=1 and rid=1 and cid=4;
+uid gid rid cid
+select * from t4 where uid = 1 order by gid,cid;
+uid gid rid cid
+1 1 2 3
+1 1 2 4
+1 1 5 7
+1 1 10 8
+1 1 5 12
+1 2 5 12
+1 3 9 11
+1 3 5 12
+1 4 5 12
+1 5 5 12
+1 6 5 12
+1 7 5 12
+1 8 5 12
+1 9 5 12
+1 10 5 12
+1 11 5 12
+1 12 5 12
+1 13 5 12
+1 14 5 12
+1 15 5 12
+1 16 5 12
+1 17 5 12
+1 18 5 12
+1 19 5 12
+1 20 5 12
+1 21 5 12
+1 22 5 12
+1 23 5 12
+1 24 5 12
+1 25 5 12
+1 26 5 12
+1 27 5 12
+1 28 5 12
+1 29 5 12
+1 30 5 12
+1 31 5 12
+1 32 5 12
+1 33 5 12
+1 34 5 12
+1 35 5 12
+1 36 5 12
+1 37 5 12
+1 38 5 12
+1 39 5 12
+1 40 5 12
+1 41 5 12
+1 42 5 12
+1 43 5 12
+1 44 5 12
+1 45 5 12
+1 46 5 12
+1 47 5 12
+1 48 5 12
+1 49 5 12
+1 50 5 12
+1 51 5 12
+1 52 5 12
+1 53 5 12
+1 54 5 12
+1 55 5 12
+1 56 5 12
+1 57 5 12
+1 58 5 12
+1 59 5 12
+1 60 5 12
+1 61 5 12
+1 62 5 12
+1 63 5 12
+1 64 5 12
+1 65 5 12
+1 66 5 12
+1 67 5 12
+1 68 5 12
+1 69 5 12
+1 70 5 12
+1 71 5 12
+1 72 5 12
+1 73 5 12
+1 74 5 12
+1 75 5 12
+1 76 5 12
+1 77 5 12
+1 78 5 12
+1 79 5 12
+1 80 5 12
+1 81 5 12
+1 82 5 12
+1 83 5 12
+1 84 5 12
+1 85 5 12
+1 86 5 12
+1 87 5 12
+1 88 5 12
+1 89 5 12
+1 90 5 12
+1 91 5 12
+1 92 5 12
+1 93 5 12
+1 94 5 12
+1 95 5 12
+1 96 5 12
+1 97 5 12
+1 98 5 12
+1 99 5 12
+1 100 5 12
+select * from t4 where uid = 1 order by gid,cid;
+uid gid rid cid
+1 1 2 3
+1 1 2 4
+1 1 5 7
+1 1 10 8
+1 1 5 12
+1 2 5 12
+1 3 9 11
+1 3 5 12
+1 4 5 12
+1 5 5 12
+1 6 5 12
+1 7 5 12
+1 8 5 12
+1 9 5 12
+1 10 5 12
+1 11 5 12
+1 12 5 12
+1 13 5 12
+1 14 5 12
+1 15 5 12
+1 16 5 12
+1 17 5 12
+1 18 5 12
+1 19 5 12
+1 20 5 12
+1 21 5 12
+1 22 5 12
+1 23 5 12
+1 24 5 12
+1 25 5 12
+1 26 5 12
+1 27 5 12
+1 28 5 12
+1 29 5 12
+1 30 5 12
+1 31 5 12
+1 32 5 12
+1 33 5 12
+1 34 5 12
+1 35 5 12
+1 36 5 12
+1 37 5 12
+1 38 5 12
+1 39 5 12
+1 40 5 12
+1 41 5 12
+1 42 5 12
+1 43 5 12
+1 44 5 12
+1 45 5 12
+1 46 5 12
+1 47 5 12
+1 48 5 12
+1 49 5 12
+1 50 5 12
+1 51 5 12
+1 52 5 12
+1 53 5 12
+1 54 5 12
+1 55 5 12
+1 56 5 12
+1 57 5 12
+1 58 5 12
+1 59 5 12
+1 60 5 12
+1 61 5 12
+1 62 5 12
+1 63 5 12
+1 64 5 12
+1 65 5 12
+1 66 5 12
+1 67 5 12
+1 68 5 12
+1 69 5 12
+1 70 5 12
+1 71 5 12
+1 72 5 12
+1 73 5 12
+1 74 5 12
+1 75 5 12
+1 76 5 12
+1 77 5 12
+1 78 5 12
+1 79 5 12
+1 80 5 12
+1 81 5 12
+1 82 5 12
+1 83 5 12
+1 84 5 12
+1 85 5 12
+1 86 5 12
+1 87 5 12
+1 88 5 12
+1 89 5 12
+1 90 5 12
+1 91 5 12
+1 92 5 12
+1 93 5 12
+1 94 5 12
+1 95 5 12
+1 96 5 12
+1 97 5 12
+1 98 5 12
+1 99 5 12
+1 100 5 12
+select * from t4 where rid = 2 order by cid;
+uid gid rid cid
+1 1 2 3
+1 1 2 4
+drop table t1,t2,t3,t4,t5,t6,t7;
+CREATE TABLE t1 (
+a int unsigned NOT NULL PRIMARY KEY,
+b int unsigned,
+c int unsigned,
+UNIQUE bc(b,c) ) engine = ndb;
+insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL);
+select * from t1 where b=1 and c=1;
+a b c
+1 1 1
+select * from t1 where b is null and c is null;
+a b c
+3 NULL NULL
+select * from t1 where b is null and c = 2;
+a b c
+2 NULL 2
+select * from t1 where b = 4 and c is null;
+a b c
+4 4 NULL
+create table t8 as
+select * from t1 where (b = 1 and c = 1)
+or (b is null and c is null)
+or (b is null and c = 2)
+or (b = 4 and c is null);
+select * from t8 order by a;
+a b c
+1 1 1
+2 NULL 2
+3 NULL NULL
+4 4 NULL
+select * from t1 order by a;
+a b c
+1 1 1
+2 NULL 2
+3 NULL NULL
+4 4 NULL
+drop table t1, t8;
diff --git a/mysql-test/r/ndb_insert.result b/mysql-test/r/ndb_insert.result
new file mode 100644
index 00000000000..7503010a66b
--- /dev/null
+++ b/mysql-test/r/ndb_insert.result
@@ -0,0 +1,607 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+pk1 INT NOT NULL PRIMARY KEY,
+b INT NOT NULL,
+c INT NOT NULL
+) ENGINE=ndbcluster;
+INSERT INTO t1 VALUES (0, 0, 0);
+SELECT * FROM t1;
+pk1 b c
+0 0 0
+INSERT INTO t1 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10),
+(11,11,11),(12,12,12),(13,13,13),(14,14,14),(15,15,15),
+(16,16,16),(17,17,17),(18,18,18),(19,19,19),(20,20,20),
+(21,21,21),(22,22,22),(23,23,23),(24,24,24),(25,25,25),
+(26,26,26),(27,27,27),(28,28,28),(29,29,29),(30,30,30),
+(31,31,31),(32,32,32),(33,33,33),(34,34,34),(35,35,35),
+(36,36,36),(37,37,37),(38,38,38),(39,39,39),(40,40,40),
+(41,41,41),(42,42,42),(43,43,43),(44,44,44),(45,45,45),
+(46,46,46),(47,47,47),(48,48,48),(49,49,49),(50,50,50),
+(51,51,51),(52,52,52),(53,53,53),(54,54,54),(55,55,55),
+(56,56,56),(57,57,57),(58,58,58),(59,59,59),(60,60,60),
+(61,61,61),(62,62,62),(63,63,63),(64,64,64),(65,65,65),
+(66,66,66),(67,67,67),(68,68,68),(69,69,69),(70,70,70),
+(71,71,71),(72,72,72),(73,73,73),(74,74,74),(75,75,75),
+(76,76,76),(77,77,77),(78,78,78),(79,79,79),(80,80,80),
+(81,81,81),(82,82,82),(83,83,83),(84,84,84),(85,85,85),
+(86,86,86),(87,87,87),(88,88,88),(89,89,89),(90,90,90),
+(91,91,91),(92,92,92),(93,93,93),(94,94,94),(95,95,95),
+(96,96,96),(97,97,97),(98,98,98),(99,99,99),(100,100,100),
+(101,101,101),(102,102,102),(103,103,103),(104,104,104),(105,105,105),
+(106,106,106),(107,107,107),(108,108,108),(109,109,109),(110,110,110),
+(111,111,111),(112,112,112),(113,113,113),(114,114,114),(115,115,115),
+(116,116,116),(117,117,117),(118,118,118),(119,119,119),(120,120,120),
+(121,121,121),(122,122,122),(123,123,123),(124,124,124),(125,125,125),
+(126,126,126),(127,127,127),(128,128,128),(129,129,129),(130,130,130),
+(131,131,131),(132,132,132),(133,133,133),(134,134,134),(135,135,135),
+(136,136,136),(137,137,137),(138,138,138),(139,139,139),(140,140,140),
+(141,141,141),(142,142,142),(143,143,143),(144,144,144),(145,145,145),
+(146,146,146),(147,147,147),(148,148,148),(149,149,149),(150,150,150),
+(151,151,151),(152,152,152),(153,153,153),(154,154,154),(155,155,155),
+(156,156,156),(157,157,157),(158,158,158),(159,159,159),(160,160,160),
+(161,161,161),(162,162,162),(163,163,163),(164,164,164),(165,165,165),
+(166,166,166),(167,167,167),(168,168,168),(169,169,169),(170,170,170),
+(171,171,171),(172,172,172),(173,173,173),(174,174,174),(175,175,175),
+(176,176,176),(177,177,177),(178,178,178),(179,179,179),(180,180,180),
+(181,181,181),(182,182,182),(183,183,183),(184,184,184),(185,185,185),
+(186,186,186),(187,187,187),(188,188,188),(189,189,189),(190,190,190),
+(191,191,191),(192,192,192),(193,193,193),(194,194,194),(195,195,195),
+(196,196,196),(197,197,197),(198,198,198),(199,199,199),(200,200,200),
+(201,201,201),(202,202,202),(203,203,203),(204,204,204),(205,205,205),
+(206,206,206),(207,207,207),(208,208,208),(209,209,209),(210,210,210),
+(211,211,211),(212,212,212),(213,213,213),(214,214,214),(215,215,215),
+(216,216,216),(217,217,217),(218,218,218),(219,219,219),(220,220,220),
+(221,221,221),(222,222,222),(223,223,223),(224,224,224),(225,225,225),
+(226,226,226),(227,227,227),(228,228,228),(229,229,229),(230,230,230),
+(231,231,231),(232,232,232),(233,233,233),(234,234,234),(235,235,235),
+(236,236,236),(237,237,237),(238,238,238),(239,239,239),(240,240,240),
+(241,241,241),(242,242,242),(243,243,243),(244,244,244),(245,245,245),
+(246,246,246),(247,247,247),(248,248,248),(249,249,249),(250,250,250),
+(251,251,251),(252,252,252),(253,253,253),(254,254,254),(255,255,255),
+(256,256,256),(257,257,257),(258,258,258),(259,259,259),(260,260,260),
+(261,261,261),(262,262,262),(263,263,263),(264,264,264),(265,265,265),
+(266,266,266),(267,267,267),(268,268,268),(269,269,269),(270,270,270),
+(271,271,271),(272,272,272),(273,273,273),(274,274,274),(275,275,275),
+(276,276,276),(277,277,277),(278,278,278),(279,279,279),(280,280,280),
+(281,281,281),(282,282,282),(283,283,283),(284,284,284),(285,285,285),
+(286,286,286),(287,287,287),(288,288,288),(289,289,289),(290,290,290),
+(291,291,291),(292,292,292),(293,293,293),(294,294,294),(295,295,295),
+(296,296,296),(297,297,297),(298,298,298),(299,299,299),(300,300,300),
+(301,301,301),(302,302,302),(303,303,303),(304,304,304),(305,305,305),
+(306,306,306),(307,307,307),(308,308,308),(309,309,309),(310,310,310),
+(311,311,311),(312,312,312),(313,313,313),(314,314,314),(315,315,315),
+(316,316,316),(317,317,317),(318,318,318),(319,319,319),(320,320,320),
+(321,321,321),(322,322,322),(323,323,323),(324,324,324),(325,325,325),
+(326,326,326),(327,327,327),(328,328,328),(329,329,329),(330,330,330),
+(331,331,331),(332,332,332),(333,333,333),(334,334,334),(335,335,335),
+(336,336,336),(337,337,337),(338,338,338),(339,339,339),(340,340,340),
+(341,341,341),(342,342,342),(343,343,343),(344,344,344),(345,345,345),
+(346,346,346),(347,347,347),(348,348,348),(349,349,349),(350,350,350),
+(351,351,351),(352,352,352),(353,353,353),(354,354,354),(355,355,355),
+(356,356,356),(357,357,357),(358,358,358),(359,359,359),(360,360,360),
+(361,361,361),(362,362,362),(363,363,363),(364,364,364),(365,365,365),
+(366,366,366),(367,367,367),(368,368,368),(369,369,369),(370,370,370),
+(371,371,371),(372,372,372),(373,373,373),(374,374,374),(375,375,375),
+(376,376,376),(377,377,377),(378,378,378),(379,379,379),(380,380,380),
+(381,381,381),(382,382,382),(383,383,383),(384,384,384),(385,385,385),
+(386,386,386),(387,387,387),(388,388,388),(389,389,389),(390,390,390),
+(391,391,391),(392,392,392),(393,393,393),(394,394,394),(395,395,395),
+(396,396,396),(397,397,397),(398,398,398),(399,399,399),(400,400,400),
+(401,401,401),(402,402,402),(403,403,403),(404,404,404),(405,405,405),
+(406,406,406),(407,407,407),(408,408,408),(409,409,409),(410,410,410),
+(411,411,411),(412,412,412),(413,413,413),(414,414,414),(415,415,415),
+(416,416,416),(417,417,417),(418,418,418),(419,419,419),(420,420,420),
+(421,421,421),(422,422,422),(423,423,423),(424,424,424),(425,425,425),
+(426,426,426),(427,427,427),(428,428,428),(429,429,429),(430,430,430),
+(431,431,431),(432,432,432),(433,433,433),(434,434,434),(435,435,435),
+(436,436,436),(437,437,437),(438,438,438),(439,439,439),(440,440,440),
+(441,441,441),(442,442,442),(443,443,443),(444,444,444),(445,445,445),
+(446,446,446),(447,447,447),(448,448,448),(449,449,449),(450,450,450),
+(451,451,451),(452,452,452),(453,453,453),(454,454,454),(455,455,455),
+(456,456,456),(457,457,457),(458,458,458),(459,459,459),(460,460,460),
+(461,461,461),(462,462,462),(463,463,463),(464,464,464),(465,465,465),
+(466,466,466),(467,467,467),(468,468,468),(469,469,469),(470,470,470),
+(471,471,471),(472,472,472),(473,473,473),(474,474,474),(475,475,475),
+(476,476,476),(477,477,477),(478,478,478),(479,479,479),(480,480,480),
+(481,481,481),(482,482,482),(483,483,483),(484,484,484),(485,485,485),
+(486,486,486),(487,487,487),(488,488,488),(489,489,489),(490,490,490),
+(491,491,491),(492,492,492),(493,493,493),(494,494,494),(495,495,495),
+(496,496,496),(497,497,497),(498,498,498),(499,499,499),(500, 500, 500);
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+501
+INSERT INTO t1 VALUES
+(501,501,501),(502,502,502),(503,503,503),(504,504,504),(505,505,505),
+(506,506,506),(507,507,507),(508,508,508),(509,509,509),(510,510,510),
+(511,511,511),(512,512,512),(513,513,513),(514,514,514),(515,515,515),
+(516,516,516),(517,517,517),(518,518,518),(519,519,519),(520,520,520),
+(521,521,521),(522,522,522),(523,523,523),(524,524,524),(525,525,525),
+(526,526,526),(527,527,527),(528,528,528),(529,529,529),(530,530,530),
+(531,531,531),(532,532,532),(533,533,533),(534,534,534),(535,535,535),
+(536,536,536),(537,537,537),(538,538,538),(539,539,539),(540,540,540),
+(541,541,541),(542,542,542),(543,543,543),(544,544,544),(545,545,545),
+(546,546,546),(547,547,547),(548,548,548),(549,549,549),(550,550,550),
+(551,551,551),(552,552,552),(553,553,553),(554,554,554),(555,555,555),
+(556,556,556),(557,557,557),(558,558,558),(559,559,559),(560,560,560),
+(561,561,561),(562,562,562),(563,563,563),(564,564,564),(565,565,565),
+(566,566,566),(567,567,567),(568,568,568),(569,569,569),(570,570,570),
+(571,571,571),(572,572,572),(573,573,573),(574,574,574),(575,575,575),
+(576,576,576),(577,577,577),(578,578,578),(579,579,579),(580,580,580),
+(581,581,581),(582,582,582),(583,583,583),(584,584,584),(585,585,585),
+(586,586,586),(587,587,587),(588,588,588),(589,589,589),(590,590,590),
+(591,591,591),(592,592,592),(593,593,593),(594,594,594),(595,595,595),
+(596,596,596),(597,597,597),(598,598,598),(599,599,599),(600,600,600),
+(601,601,601),(602,602,602),(603,603,603),(604,604,604),(605,605,605),
+(606,606,606),(607,607,607),(608,608,608),(609,609,609),(610,610,610),
+(611,611,611),(612,612,612),(613,613,613),(614,614,614),(615,615,615),
+(616,616,616),(617,617,617),(618,618,618),(619,619,619),(620,620,620),
+(621,621,621),(622,622,622),(623,623,623),(624,624,624),(625,625,625),
+(626,626,626),(627,627,627),(628,628,628),(629,629,629),(630,630,630),
+(631,631,631),(632,632,632),(633,633,633),(634,634,634),(635,635,635),
+(636,636,636),(637,637,637),(638,638,638),(639,639,639),(640,640,640),
+(641,641,641),(642,642,642),(643,643,643),(644,644,644),(645,645,645),
+(646,646,646),(647,647,647),(648,648,648),(649,649,649),(650,650,650),
+(651,651,651),(652,652,652),(653,653,653),(654,654,654),(655,655,655),
+(656,656,656),(657,657,657),(658,658,658),(659,659,659),(660,660,660),
+(661,661,661),(662,662,662),(663,663,663),(664,664,664),(665,665,665),
+(666,666,666),(667,667,667),(668,668,668),(669,669,669),(670,670,670),
+(671,671,671),(672,672,672),(673,673,673),(674,674,674),(675,675,675),
+(676,676,676),(677,677,677),(678,678,678),(679,679,679),(680,680,680),
+(681,681,681),(682,682,682),(683,683,683),(684,684,684),(685,685,685),
+(686,686,686),(687,687,687),(688,688,688),(689,689,689),(690,690,690),
+(691,691,691),(692,692,692),(693,693,693),(694,694,694),(695,695,695),
+(696,696,696),(697,697,697),(698,698,698),(699,699,699),(700,700,700),
+(701,701,701),(702,702,702),(703,703,703),(704,704,704),(705,705,705),
+(706,706,706),(707,707,707),(708,708,708),(709,709,709),(710,710,710),
+(711,711,711),(712,712,712),(713,713,713),(714,714,714),(715,715,715),
+(716,716,716),(717,717,717),(718,718,718),(719,719,719),(720,720,720),
+(721,721,721),(722,722,722),(723,723,723),(724,724,724),(725,725,725),
+(726,726,726),(727,727,727),(728,728,728),(729,729,729),(730,730,730),
+(731,731,731),(732,732,732),(733,733,733),(734,734,734),(735,735,735),
+(736,736,736),(737,737,737),(738,738,738),(739,739,739),(740,740,740),
+(741,741,741),(742,742,742),(743,743,743),(744,744,744),(745,745,745),
+(746,746,746),(747,747,747),(748,748,748),(749,749,749),(750,750,750),
+(751,751,751),(752,752,752),(753,753,753),(754,754,754),(755,755,755),
+(756,756,756),(757,757,757),(758,758,758),(759,759,759),(760,760,760),
+(761,761,761),(762,762,762),(763,763,763),(764,764,764),(765,765,765),
+(766,766,766),(767,767,767),(768,768,768),(769,769,769),(770,770,770),
+(771,771,771),(772,772,772),(773,773,773),(774,774,774),(775,775,775),
+(776,776,776),(777,777,777),(778,778,778),(779,779,779),(780,780,780),
+(781,781,781),(782,782,782),(783,783,783),(784,784,784),(785,785,785),
+(786,786,786),(787,787,787),(788,788,788),(789,789,789),(790,790,790),
+(791,791,791),(792,792,792),(793,793,793),(794,794,794),(795,795,795),
+(796,796,796),(797,797,797),(798,798,798),(799,799,799),(800,800,800),
+(801,801,801),(802,802,802),(803,803,803),(804,804,804),(805,805,805),
+(806,806,806),(807,807,807),(808,808,808),(809,809,809),(810,810,810),
+(811,811,811),(812,812,812),(813,813,813),(814,814,814),(815,815,815),
+(816,816,816),(817,817,817),(818,818,818),(819,819,819),(820,820,820),
+(821,821,821),(822,822,822),(823,823,823),(824,824,824),(825,825,825),
+(826,826,826),(827,827,827),(828,828,828),(829,829,829),(830,830,830),
+(831,831,831),(832,832,832),(833,833,833),(834,834,834),(835,835,835),
+(836,836,836),(837,837,837),(838,838,838),(839,839,839),(840,840,840),
+(841,841,841),(842,842,842),(843,843,843),(844,844,844),(845,845,845),
+(846,846,846),(847,847,847),(848,848,848),(849,849,849),(850,850,850),
+(851,851,851),(852,852,852),(853,853,853),(854,854,854),(855,855,855),
+(856,856,856),(857,857,857),(858,858,858),(859,859,859),(860,860,860),
+(861,861,861),(862,862,862),(863,863,863),(864,864,864),(865,865,865),
+(866,866,866),(867,867,867),(868,868,868),(869,869,869),(870,870,870),
+(871,871,871),(872,872,872),(873,873,873),(874,874,874),(875,875,875),
+(876,876,876),(877,877,877),(878,878,878),(879,879,879),(880,880,880),
+(881,881,881),(882,882,882),(883,883,883),(884,884,884),(885,885,885),
+(886,886,886),(887,887,887),(888,888,888),(889,889,889),(890,890,890),
+(891,891,891),(892,892,892),(893,893,893),(894,894,894),(895,895,895),
+(896,896,896),(897,897,897),(898,898,898),(899,899,899),(900,900,900),
+(901,901,901),(902,902,902),(903,903,903),(904,904,904),(905,905,905),
+(906,906,906),(907,907,907),(908,908,908),(909,909,909),(910,910,910),
+(911,911,911),(912,912,912),(913,913,913),(914,914,914),(915,915,915),
+(916,916,916),(917,917,917),(918,918,918),(919,919,919),(920,920,920),
+(921,921,921),(922,922,922),(923,923,923),(924,924,924),(925,925,925),
+(926,926,926),(927,927,927),(928,928,928),(929,929,929),(930,930,930),
+(931,931,931),(932,932,932),(933,933,933),(934,934,934),(935,935,935),
+(936,936,936),(937,937,937),(938,938,938),(939,939,939),(940,940,940),
+(941,941,941),(942,942,942),(943,943,943),(944,944,944),(945,945,945),
+(946,946,946),(947,947,947),(948,948,948),(949,949,949),(950,950,950),
+(951,951,951),(952,952,952),(953,953,953),(954,954,954),(955,955,955),
+(956,956,956),(957,957,957),(958,958,958),(959,959,959),(960,960,960),
+(961,961,961),(962,962,962),(963,963,963),(964,964,964),(965,965,965),
+(966,966,966),(967,967,967),(968,968,968),(969,969,969),(970,970,970),
+(971,971,971),(972,972,972),(973,973,973),(974,974,974),(975,975,975),
+(976,976,976),(977,977,977),(978,978,978),(979,979,979),(980,980,980),
+(981,981,981),(982,982,982),(983,983,983),(984,984,984),(985,985,985),
+(986,986,986),(987,987,987),(988,988,988),(989,989,989),(990,990,990),
+(991,991,991),(992,992,992),(993,993,993),(994,994,994),(995,995,995),
+(996,996,996),(997,997,997),(998,998,998),(999,999,999),(1000,1000,1000),
+(1001,1001,1001),(1002,1002,1002),(1003,1003,1003),(1004,1004,1004),(1005,1005,1005),
+(1006,1006,1006),(1007,1007,1007),(1008,1008,1008),(1009,1009,1009),(1010,1010,1010),
+(1011,1011,1011),(1012,1012,1012),(1013,1013,1013),(1014,1014,1014),(1015,1015,1015),
+(1016,1016,1016),(1017,1017,1017),(1018,1018,1018),(1019,1019,1019),(1020,1020,1020),
+(1021,1021,1021),(1022,1022,1022),(1023,1023,1023),(1024,1024,1024),(1025,1025,1025),
+(1026,1026,1026),(1027,1027,1027),(1028,1028,1028),(1029,1029,1029),(1030,1030,1030),
+(1031,1031,1031),(1032,1032,1032),(1033,1033,1033),(1034,1034,1034),(1035,1035,1035),
+(1036,1036,1036),(1037,1037,1037),(1038,1038,1038),(1039,1039,1039),(1040,1040,1040),
+(1041,1041,1041),(1042,1042,1042),(1043,1043,1043),(1044,1044,1044),(1045,1045,1045),
+(1046,1046,1046),(1047,1047,1047),(1048,1048,1048),(1049,1049,1049),(1050,1050,1050),
+(1051,1051,1051),(1052,1052,1052),(1053,1053,1053),(1054,1054,1054),(1055,1055,1055),
+(1056,1056,1056),(1057,1057,1057),(1058,1058,1058),(1059,1059,1059),(1060,1060,1060),
+(1061,1061,1061),(1062,1062,1062),(1063,1063,1063),(1064,1064,1064),(1065,1065,1065),
+(1066,1066,1066),(1067,1067,1067),(1068,1068,1068),(1069,1069,1069),(1070,1070,1070),
+(1071,1071,1071),(1072,1072,1072),(1073,1073,1073),(1074,1074,1074),(1075,1075,1075),
+(1076,1076,1076),(1077,1077,1077),(1078,1078,1078),(1079,1079,1079),(1080,1080,1080),
+(1081,1081,1081),(1082,1082,1082),(1083,1083,1083),(1084,1084,1084),(1085,1085,1085),
+(1086,1086,1086),(1087,1087,1087),(1088,1088,1088),(1089,1089,1089),(1090,1090,1090),
+(1091,1091,1091),(1092,1092,1092),(1093,1093,1093),(1094,1094,1094),(1095,1095,1095),
+(1096,1096,1096),(1097,1097,1097),(1098,1098,1098),(1099,1099,1099),(1100,1100,1100),
+(1101,1101,1101),(1102,1102,1102),(1103,1103,1103),(1104,1104,1104),(1105,1105,1105),
+(1106,1106,1106),(1107,1107,1107),(1108,1108,1108),(1109,1109,1109),(1110,1110,1110),
+(1111,1111,1111),(1112,1112,1112),(1113,1113,1113),(1114,1114,1114),(1115,1115,1115),
+(1116,1116,1116),(1117,1117,1117),(1118,1118,1118),(1119,1119,1119),(1120,1120,1120),
+(1121,1121,1121),(1122,1122,1122),(1123,1123,1123),(1124,1124,1124),(1125,1125,1125),
+(1126,1126,1126),(1127,1127,1127),(1128,1128,1128),(1129,1129,1129),(1130,1130,1130),
+(1131,1131,1131),(1132,1132,1132),(1133,1133,1133),(1134,1134,1134),(1135,1135,1135),
+(1136,1136,1136),(1137,1137,1137),(1138,1138,1138),(1139,1139,1139),(1140,1140,1140),
+(1141,1141,1141),(1142,1142,1142),(1143,1143,1143),(1144,1144,1144),(1145,1145,1145),
+(1146,1146,1146),(1147,1147,1147),(1148,1148,1148),(1149,1149,1149),(1150,1150,1150),
+(1151,1151,1151),(1152,1152,1152),(1153,1153,1153),(1154,1154,1154),(1155,1155,1155),
+(1156,1156,1156),(1157,1157,1157),(1158,1158,1158),(1159,1159,1159),(1160,1160,1160),
+(1161,1161,1161),(1162,1162,1162),(1163,1163,1163),(1164,1164,1164),(1165,1165,1165),
+(1166,1166,1166),(1167,1167,1167),(1168,1168,1168),(1169,1169,1169),(1170,1170,1170),
+(1171,1171,1171),(1172,1172,1172),(1173,1173,1173),(1174,1174,1174),(1175,1175,1175),
+(1176,1176,1176),(1177,1177,1177),(1178,1178,1178),(1179,1179,1179),(1180,1180,1180),
+(1181,1181,1181),(1182,1182,1182),(1183,1183,1183),(1184,1184,1184),(1185,1185,1185),
+(1186,1186,1186),(1187,1187,1187),(1188,1188,1188),(1189,1189,1189),(1190,1190,1190),
+(1191,1191,1191),(1192,1192,1192),(1193,1193,1193),(1194,1194,1194),(1195,1195,1195),
+(1196,1196,1196),(1197,1197,1197),(1198,1198,1198),(1199,1199,1199),(1200,1200,1200),
+(1201,1201,1201),(1202,1202,1202),(1203,1203,1203),(1204,1204,1204),(1205,1205,1205),
+(1206,1206,1206),(1207,1207,1207),(1208,1208,1208),(1209,1209,1209),(1210,1210,1210),
+(1211,1211,1211),(1212,1212,1212),(1213,1213,1213),(1214,1214,1214),(1215,1215,1215),
+(1216,1216,1216),(1217,1217,1217),(1218,1218,1218),(1219,1219,1219),(1220,1220,1220),
+(1221,1221,1221),(1222,1222,1222),(1223,1223,1223),(1224,1224,1224),(1225,1225,1225),
+(1226,1226,1226),(1227,1227,1227),(1228,1228,1228),(1229,1229,1229),(1230,1230,1230),
+(1231,1231,1231),(1232,1232,1232),(1233,1233,1233),(1234,1234,1234),(1235,1235,1235),
+(1236,1236,1236),(1237,1237,1237),(1238,1238,1238),(1239,1239,1239),(1240,1240,1240),
+(1241,1241,1241),(1242,1242,1242),(1243,1243,1243),(1244,1244,1244),(1245,1245,1245),
+(1246,1246,1246),(1247,1247,1247),(1248,1248,1248),(1249,1249,1249),(1250,1250,1250),
+(1251,1251,1251),(1252,1252,1252),(1253,1253,1253),(1254,1254,1254),(1255,1255,1255),
+(1256,1256,1256),(1257,1257,1257),(1258,1258,1258),(1259,1259,1259),(1260,1260,1260),
+(1261,1261,1261),(1262,1262,1262),(1263,1263,1263),(1264,1264,1264),(1265,1265,1265),
+(1266,1266,1266),(1267,1267,1267),(1268,1268,1268),(1269,1269,1269),(1270,1270,1270),
+(1271,1271,1271),(1272,1272,1272),(1273,1273,1273),(1274,1274,1274),(1275,1275,1275),
+(1276,1276,1276),(1277,1277,1277),(1278,1278,1278),(1279,1279,1279),(1280,1280,1280),
+(1281,1281,1281),(1282,1282,1282),(1283,1283,1283),(1284,1284,1284),(1285,1285,1285),
+(1286,1286,1286),(1287,1287,1287),(1288,1288,1288),(1289,1289,1289),(1290,1290,1290),
+(1291,1291,1291),(1292,1292,1292),(1293,1293,1293),(1294,1294,1294),(1295,1295,1295),
+(1296,1296,1296),(1297,1297,1297),(1298,1298,1298),(1299,1299,1299),(1300,1300,1300),
+(1301,1301,1301),(1302,1302,1302),(1303,1303,1303),(1304,1304,1304),(1305,1305,1305),
+(1306,1306,1306),(1307,1307,1307),(1308,1308,1308),(1309,1309,1309),(1310,1310,1310),
+(1311,1311,1311),(1312,1312,1312),(1313,1313,1313),(1314,1314,1314),(1315,1315,1315),
+(1316,1316,1316),(1317,1317,1317),(1318,1318,1318),(1319,1319,1319),(1320,1320,1320),
+(1321,1321,1321),(1322,1322,1322),(1323,1323,1323),(1324,1324,1324),(1325,1325,1325),
+(1326,1326,1326),(1327,1327,1327),(1328,1328,1328),(1329,1329,1329),(1330,1330,1330),
+(1331,1331,1331),(1332,1332,1332),(1333,1333,1333),(1334,1334,1334),(1335,1335,1335),
+(1336,1336,1336),(1337,1337,1337),(1338,1338,1338),(1339,1339,1339),(1340,1340,1340),
+(1341,1341,1341),(1342,1342,1342),(1343,1343,1343),(1344,1344,1344),(1345,1345,1345),
+(1346,1346,1346),(1347,1347,1347),(1348,1348,1348),(1349,1349,1349),(1350,1350,1350),
+(1351,1351,1351),(1352,1352,1352),(1353,1353,1353),(1354,1354,1354),(1355,1355,1355),
+(1356,1356,1356),(1357,1357,1357),(1358,1358,1358),(1359,1359,1359),(1360,1360,1360),
+(1361,1361,1361),(1362,1362,1362),(1363,1363,1363),(1364,1364,1364),(1365,1365,1365),
+(1366,1366,1366),(1367,1367,1367),(1368,1368,1368),(1369,1369,1369),(1370,1370,1370),
+(1371,1371,1371),(1372,1372,1372),(1373,1373,1373),(1374,1374,1374),(1375,1375,1375),
+(1376,1376,1376),(1377,1377,1377),(1378,1378,1378),(1379,1379,1379),(1380,1380,1380),
+(1381,1381,1381),(1382,1382,1382),(1383,1383,1383),(1384,1384,1384),(1385,1385,1385),
+(1386,1386,1386),(1387,1387,1387),(1388,1388,1388),(1389,1389,1389),(1390,1390,1390),
+(1391,1391,1391),(1392,1392,1392),(1393,1393,1393),(1394,1394,1394),(1395,1395,1395),
+(1396,1396,1396),(1397,1397,1397),(1398,1398,1398),(1399,1399,1399),(1400,1400,1400),
+(1401,1401,1401),(1402,1402,1402),(1403,1403,1403),(1404,1404,1404),(1405,1405,1405),
+(1406,1406,1406),(1407,1407,1407),(1408,1408,1408),(1409,1409,1409),(1410,1410,1410),
+(1411,1411,1411),(1412,1412,1412),(1413,1413,1413),(1414,1414,1414),(1415,1415,1415),
+(1416,1416,1416),(1417,1417,1417),(1418,1418,1418),(1419,1419,1419),(1420,1420,1420),
+(1421,1421,1421),(1422,1422,1422),(1423,1423,1423),(1424,1424,1424),(1425,1425,1425),
+(1426,1426,1426),(1427,1427,1427),(1428,1428,1428),(1429,1429,1429),(1430,1430,1430),
+(1431,1431,1431),(1432,1432,1432),(1433,1433,1433),(1434,1434,1434),(1435,1435,1435),
+(1436,1436,1436),(1437,1437,1437),(1438,1438,1438),(1439,1439,1439),(1440,1440,1440),
+(1441,1441,1441),(1442,1442,1442),(1443,1443,1443),(1444,1444,1444),(1445,1445,1445),
+(1446,1446,1446),(1447,1447,1447),(1448,1448,1448),(1449,1449,1449),(1450,1450,1450),
+(1451,1451,1451),(1452,1452,1452),(1453,1453,1453),(1454,1454,1454),(1455,1455,1455),
+(1456,1456,1456),(1457,1457,1457),(1458,1458,1458),(1459,1459,1459),(1460,1460,1460),
+(1461,1461,1461),(1462,1462,1462),(1463,1463,1463),(1464,1464,1464),(1465,1465,1465),
+(1466,1466,1466),(1467,1467,1467),(1468,1468,1468),(1469,1469,1469),(1470,1470,1470),
+(1471,1471,1471),(1472,1472,1472),(1473,1473,1473),(1474,1474,1474),(1475,1475,1475),
+(1476,1476,1476),(1477,1477,1477),(1478,1478,1478),(1479,1479,1479),(1480,1480,1480),
+(1481,1481,1481),(1482,1482,1482),(1483,1483,1483),(1484,1484,1484),(1485,1485,1485),
+(1486,1486,1486),(1487,1487,1487),(1488,1488,1488),(1489,1489,1489),(1490,1490,1490),
+(1491,1491,1491),(1492,1492,1492),(1493,1493,1493),(1494,1494,1494),(1495,1495,1495),
+(1496,1496,1496),(1497,1497,1497),(1498,1498,1498),(1499,1499,1499),(1500,1500,1500),
+(1501,1501,1501),(1502,1502,1502),(1503,1503,1503),(1504,1504,1504),(1505,1505,1505),
+(1506,1506,1506),(1507,1507,1507),(1508,1508,1508),(1509,1509,1509),(1510,1510,1510),
+(1511,1511,1511),(1512,1512,1512),(1513,1513,1513),(1514,1514,1514),(1515,1515,1515),
+(1516,1516,1516),(1517,1517,1517),(1518,1518,1518),(1519,1519,1519),(1520,1520,1520),
+(1521,1521,1521),(1522,1522,1522),(1523,1523,1523),(1524,1524,1524),(1525,1525,1525),
+(1526,1526,1526),(1527,1527,1527),(1528,1528,1528),(1529,1529,1529),(1530,1530,1530),
+(1531,1531,1531),(1532,1532,1532),(1533,1533,1533),(1534,1534,1534),(1535,1535,1535),
+(1536,1536,1536),(1537,1537,1537),(1538,1538,1538),(1539,1539,1539),(1540,1540,1540),
+(1541,1541,1541),(1542,1542,1542),(1543,1543,1543),(1544,1544,1544),(1545,1545,1545),
+(1546,1546,1546),(1547,1547,1547),(1548,1548,1548),(1549,1549,1549),(1550,1550,1550),
+(1551,1551,1551),(1552,1552,1552),(1553,1553,1553),(1554,1554,1554),(1555,1555,1555),
+(1556,1556,1556),(1557,1557,1557),(1558,1558,1558),(1559,1559,1559),(1560,1560,1560),
+(1561,1561,1561),(1562,1562,1562),(1563,1563,1563),(1564,1564,1564),(1565,1565,1565),
+(1566,1566,1566),(1567,1567,1567),(1568,1568,1568),(1569,1569,1569),(1570,1570,1570),
+(1571,1571,1571),(1572,1572,1572),(1573,1573,1573),(1574,1574,1574),(1575,1575,1575),
+(1576,1576,1576),(1577,1577,1577),(1578,1578,1578),(1579,1579,1579),(1580,1580,1580),
+(1581,1581,1581),(1582,1582,1582),(1583,1583,1583),(1584,1584,1584),(1585,1585,1585),
+(1586,1586,1586),(1587,1587,1587),(1588,1588,1588),(1589,1589,1589),(1590,1590,1590),
+(1591,1591,1591),(1592,1592,1592),(1593,1593,1593),(1594,1594,1594),(1595,1595,1595),
+(1596,1596,1596),(1597,1597,1597),(1598,1598,1598),(1599,1599,1599),(1600,1600,1600),
+(1601,1601,1601),(1602,1602,1602),(1603,1603,1603),(1604,1604,1604),(1605,1605,1605),
+(1606,1606,1606),(1607,1607,1607),(1608,1608,1608),(1609,1609,1609),(1610,1610,1610),
+(1611,1611,1611),(1612,1612,1612),(1613,1613,1613),(1614,1614,1614),(1615,1615,1615),
+(1616,1616,1616),(1617,1617,1617),(1618,1618,1618),(1619,1619,1619),(1620,1620,1620),
+(1621,1621,1621),(1622,1622,1622),(1623,1623,1623),(1624,1624,1624),(1625,1625,1625),
+(1626,1626,1626),(1627,1627,1627),(1628,1628,1628),(1629,1629,1629),(1630,1630,1630),
+(1631,1631,1631),(1632,1632,1632),(1633,1633,1633),(1634,1634,1634),(1635,1635,1635),
+(1636,1636,1636),(1637,1637,1637),(1638,1638,1638),(1639,1639,1639),(1640,1640,1640),
+(1641,1641,1641),(1642,1642,1642),(1643,1643,1643),(1644,1644,1644),(1645,1645,1645),
+(1646,1646,1646),(1647,1647,1647),(1648,1648,1648),(1649,1649,1649),(1650,1650,1650),
+(1651,1651,1651),(1652,1652,1652),(1653,1653,1653),(1654,1654,1654),(1655,1655,1655),
+(1656,1656,1656),(1657,1657,1657),(1658,1658,1658),(1659,1659,1659),(1660,1660,1660),
+(1661,1661,1661),(1662,1662,1662),(1663,1663,1663),(1664,1664,1664),(1665,1665,1665),
+(1666,1666,1666),(1667,1667,1667),(1668,1668,1668),(1669,1669,1669),(1670,1670,1670),
+(1671,1671,1671),(1672,1672,1672),(1673,1673,1673),(1674,1674,1674),(1675,1675,1675),
+(1676,1676,1676),(1677,1677,1677),(1678,1678,1678),(1679,1679,1679),(1680,1680,1680),
+(1681,1681,1681),(1682,1682,1682),(1683,1683,1683),(1684,1684,1684),(1685,1685,1685),
+(1686,1686,1686),(1687,1687,1687),(1688,1688,1688),(1689,1689,1689),(1690,1690,1690),
+(1691,1691,1691),(1692,1692,1692),(1693,1693,1693),(1694,1694,1694),(1695,1695,1695),
+(1696,1696,1696),(1697,1697,1697),(1698,1698,1698),(1699,1699,1699),(1700,1700,1700),
+(1701,1701,1701),(1702,1702,1702),(1703,1703,1703),(1704,1704,1704),(1705,1705,1705),
+(1706,1706,1706),(1707,1707,1707),(1708,1708,1708),(1709,1709,1709),(1710,1710,1710),
+(1711,1711,1711),(1712,1712,1712),(1713,1713,1713),(1714,1714,1714),(1715,1715,1715),
+(1716,1716,1716),(1717,1717,1717),(1718,1718,1718),(1719,1719,1719),(1720,1720,1720),
+(1721,1721,1721),(1722,1722,1722),(1723,1723,1723),(1724,1724,1724),(1725,1725,1725),
+(1726,1726,1726),(1727,1727,1727),(1728,1728,1728),(1729,1729,1729),(1730,1730,1730),
+(1731,1731,1731),(1732,1732,1732),(1733,1733,1733),(1734,1734,1734),(1735,1735,1735),
+(1736,1736,1736),(1737,1737,1737),(1738,1738,1738),(1739,1739,1739),(1740,1740,1740),
+(1741,1741,1741),(1742,1742,1742),(1743,1743,1743),(1744,1744,1744),(1745,1745,1745),
+(1746,1746,1746),(1747,1747,1747),(1748,1748,1748),(1749,1749,1749),(1750,1750,1750),
+(1751,1751,1751),(1752,1752,1752),(1753,1753,1753),(1754,1754,1754),(1755,1755,1755),
+(1756,1756,1756),(1757,1757,1757),(1758,1758,1758),(1759,1759,1759),(1760,1760,1760),
+(1761,1761,1761),(1762,1762,1762),(1763,1763,1763),(1764,1764,1764),(1765,1765,1765),
+(1766,1766,1766),(1767,1767,1767),(1768,1768,1768),(1769,1769,1769),(1770,1770,1770),
+(1771,1771,1771),(1772,1772,1772),(1773,1773,1773),(1774,1774,1774),(1775,1775,1775),
+(1776,1776,1776),(1777,1777,1777),(1778,1778,1778),(1779,1779,1779),(1780,1780,1780),
+(1781,1781,1781),(1782,1782,1782),(1783,1783,1783),(1784,1784,1784),(1785,1785,1785),
+(1786,1786,1786),(1787,1787,1787),(1788,1788,1788),(1789,1789,1789),(1790,1790,1790),
+(1791,1791,1791),(1792,1792,1792),(1793,1793,1793),(1794,1794,1794),(1795,1795,1795),
+(1796,1796,1796),(1797,1797,1797),(1798,1798,1798),(1799,1799,1799),(1800,1800,1800),
+(1801,1801,1801),(1802,1802,1802),(1803,1803,1803),(1804,1804,1804),(1805,1805,1805),
+(1806,1806,1806),(1807,1807,1807),(1808,1808,1808),(1809,1809,1809),(1810,1810,1810),
+(1811,1811,1811),(1812,1812,1812),(1813,1813,1813),(1814,1814,1814),(1815,1815,1815),
+(1816,1816,1816),(1817,1817,1817),(1818,1818,1818),(1819,1819,1819),(1820,1820,1820),
+(1821,1821,1821),(1822,1822,1822),(1823,1823,1823),(1824,1824,1824),(1825,1825,1825),
+(1826,1826,1826),(1827,1827,1827),(1828,1828,1828),(1829,1829,1829),(1830,1830,1830),
+(1831,1831,1831),(1832,1832,1832),(1833,1833,1833),(1834,1834,1834),(1835,1835,1835),
+(1836,1836,1836),(1837,1837,1837),(1838,1838,1838),(1839,1839,1839),(1840,1840,1840),
+(1841,1841,1841),(1842,1842,1842),(1843,1843,1843),(1844,1844,1844),(1845,1845,1845),
+(1846,1846,1846),(1847,1847,1847),(1848,1848,1848),(1849,1849,1849),(1850,1850,1850),
+(1851,1851,1851),(1852,1852,1852),(1853,1853,1853),(1854,1854,1854),(1855,1855,1855),
+(1856,1856,1856),(1857,1857,1857),(1858,1858,1858),(1859,1859,1859),(1860,1860,1860),
+(1861,1861,1861),(1862,1862,1862),(1863,1863,1863),(1864,1864,1864),(1865,1865,1865),
+(1866,1866,1866),(1867,1867,1867),(1868,1868,1868),(1869,1869,1869),(1870,1870,1870),
+(1871,1871,1871),(1872,1872,1872),(1873,1873,1873),(1874,1874,1874),(1875,1875,1875),
+(1876,1876,1876),(1877,1877,1877),(1878,1878,1878),(1879,1879,1879),(1880,1880,1880),
+(1881,1881,1881),(1882,1882,1882),(1883,1883,1883),(1884,1884,1884),(1885,1885,1885),
+(1886,1886,1886),(1887,1887,1887),(1888,1888,1888),(1889,1889,1889),(1890,1890,1890),
+(1891,1891,1891),(1892,1892,1892),(1893,1893,1893),(1894,1894,1894),(1895,1895,1895),
+(1896,1896,1896),(1897,1897,1897),(1898,1898,1898),(1899,1899,1899),(1900,1900,1900),
+(1901,1901,1901),(1902,1902,1902),(1903,1903,1903),(1904,1904,1904),(1905,1905,1905),
+(1906,1906,1906),(1907,1907,1907),(1908,1908,1908),(1909,1909,1909),(1910,1910,1910),
+(1911,1911,1911),(1912,1912,1912),(1913,1913,1913),(1914,1914,1914),(1915,1915,1915),
+(1916,1916,1916),(1917,1917,1917),(1918,1918,1918),(1919,1919,1919),(1920,1920,1920),
+(1921,1921,1921),(1922,1922,1922),(1923,1923,1923),(1924,1924,1924),(1925,1925,1925),
+(1926,1926,1926),(1927,1927,1927),(1928,1928,1928),(1929,1929,1929),(1930,1930,1930),
+(1931,1931,1931),(1932,1932,1932),(1933,1933,1933),(1934,1934,1934),(1935,1935,1935),
+(1936,1936,1936),(1937,1937,1937),(1938,1938,1938),(1939,1939,1939),(1940,1940,1940),
+(1941,1941,1941),(1942,1942,1942),(1943,1943,1943),(1944,1944,1944),(1945,1945,1945),
+(1946,1946,1946),(1947,1947,1947),(1948,1948,1948),(1949,1949,1949),(1950,1950,1950),
+(1951,1951,1951),(1952,1952,1952),(1953,1953,1953),(1954,1954,1954),(1955,1955,1955),
+(1956,1956,1956),(1957,1957,1957),(1958,1958,1958),(1959,1959,1959),(1960,1960,1960),
+(1961,1961,1961),(1962,1962,1962),(1963,1963,1963),(1964,1964,1964),(1965,1965,1965),
+(1966,1966,1966),(1967,1967,1967),(1968,1968,1968),(1969,1969,1969),(1970,1970,1970),
+(1971,1971,1971),(1972,1972,1972),(1973,1973,1973),(1974,1974,1974),(1975,1975,1975),
+(1976,1976,1976),(1977,1977,1977),(1978,1978,1978),(1979,1979,1979),(1980,1980,1980),
+(1981,1981,1981),(1982,1982,1982),(1983,1983,1983),(1984,1984,1984),(1985,1985,1985),
+(1986,1986,1986),(1987,1987,1987),(1988,1988,1988),(1989,1989,1989),(1990,1990,1990),
+(1991,1991,1991),(1992,1992,1992),(1993,1993,1993),(1994,1994,1994),(1995,1995,1995),
+(1996,1996,1996),(1997,1997,1997),(1998,1998,1998),(1999,1999,1999);
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+2000
+INSERT INTO t1 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
+ERROR 23000: Duplicate entry '10' for key 1
+select count(*) from t1;
+count(*)
+2000
+begin;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+2000
+INSERT INTO t1 VALUES
+(2001,2001,2001),(2002,2002,2002),(2003,2003,2003),(2004,2004,2004),(2005,2005,2005);
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+2005
+rollback;
+begin;
+INSERT INTO t1 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
+ERROR 23000: Duplicate entry '10' for key 1
+commit;
+ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
+select * from t1 where pk1=1;
+pk1 b c
+1 1 1
+select * from t1 where pk1=10;
+pk1 b c
+10 10 10
+select count(*) from t1 where pk1 <= 10 order by pk1;
+count(*)
+11
+select count(*) from t1;
+count(*)
+2000
+begin;
+INSERT INTO t1 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
+ERROR 23000: Duplicate entry '10' for key 1
+rollback;
+select * from t1 where pk1=1;
+pk1 b c
+1 1 1
+select * from t1 where pk1=10;
+pk1 b c
+10 10 10
+select count(*) from t1 where pk1 <= 10 order by pk1;
+count(*)
+11
+select count(*) from t1;
+count(*)
+2000
+begin;
+INSERT INTO t1 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
+ERROR 23000: Duplicate entry '10' for key 1
+SELECT * FROM t1 WHERE pk1=10;
+ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
+rollback;
+select * from t1 where pk1=1;
+pk1 b c
+1 1 1
+select * from t1 where pk1=10;
+pk1 b c
+10 10 10
+select count(*) from t1 where pk1 <= 10 order by pk1;
+count(*)
+11
+select count(*) from t1;
+count(*)
+2000
+begin;
+INSERT INTO t1 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
+ERROR 23000: Duplicate entry '10' for key 1
+SELECT * FROM t1 WHERE pk1=10;
+ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
+SELECT * FROM t1 WHERE pk1=10;
+ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
+commit;
+ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
+select * from t1 where pk1=1;
+pk1 b c
+1 1 1
+select * from t1 where pk1=10;
+pk1 b c
+10 10 10
+select count(*) from t1 where pk1 <= 10 order by pk1;
+count(*)
+11
+select count(*) from t1;
+count(*)
+2000
+begin;
+INSERT INTO t1 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
+ERROR 23000: Duplicate entry '10' for key 1
+INSERT INTO t1 values (4000, 40, 44);
+ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
+rollback;
+select * from t1 where pk1=1;
+pk1 b c
+1 1 1
+select * from t1 where pk1=10;
+pk1 b c
+10 10 10
+select count(*) from t1 where pk1 <= 10 order by pk1;
+count(*)
+11
+select count(*) from t1;
+count(*)
+2000
+insert into t1 select * from t1 where b < 10 order by pk1;
+ERROR 23000: Duplicate entry '9' for key 1
+DELETE FROM t1 WHERE pk1=2;
+begin;
+INSERT IGNORE INTO t1 VALUES(1,2,3),(2,3,4);
+select * from t1 where pk1 < 3 order by pk1;
+pk1 b c
+0 0 0
+1 1 1
+2 3 4
+rollback;
+INSERT IGNORE INTO t1 VALUES(1,2,3),(2,3,4);
+select * from t1 where pk1 < 3 order by pk1;
+pk1 b c
+0 0 0
+1 1 1
+2 3 4
+REPLACE INTO t1 values(1, 78, 3);
+select * from t1 where pk1=1;
+pk1 b c
+1 78 3
+INSERT INTO t1 VALUES(1,1,1),(3,4,5) ON DUPLICATE KEY UPDATE b=79;
+select * from t1 where pk1 < 4 order by pk1;
+pk1 b c
+0 0 0
+1 79 3
+2 3 4
+3 79 3
+INSERT INTO t1 VALUES(1,1,1),(3,4,5) ON DUPLICATE KEY UPDATE b=pk1+c;
+select * from t1 where pk1 < 4 order by pk1;
+pk1 b c
+0 0 0
+1 4 3
+2 3 4
+3 6 3
+DELETE FROM t1 WHERE pk1 = 2 OR pk1 = 4 OR pk1 = 6;
+INSERT INTO t1 VALUES(1,1,1),(2,2,17),(3,4,5) ON DUPLICATE KEY UPDATE pk1=b;
+select * from t1 where pk1 = b and b != c order by pk1;
+pk1 b c
+2 2 17
+4 4 3
+6 6 3
+DROP TABLE t1;
+CREATE TABLE t1(a INT) ENGINE=ndb;
+INSERT IGNORE INTO t1 VALUES (1);
+INSERT IGNORE INTO t1 VALUES (1);
+INSERT IGNORE INTO t1 SELECT a FROM t1;
+INSERT IGNORE INTO t1 SELECT a FROM t1;
+INSERT IGNORE INTO t1 SELECT a FROM t1;
+INSERT IGNORE INTO t1 VALUES (1);
+INSERT IGNORE INTO t1 VALUES (1);
+SELECT * FROM t1;
+a
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+DROP TABLE t1;
diff --git a/mysql-test/r/ndb_limit.result b/mysql-test/r/ndb_limit.result
new file mode 100644
index 00000000000..da1ec3b61c3
--- /dev/null
+++ b/mysql-test/r/ndb_limit.result
@@ -0,0 +1,72 @@
+DROP TABLE IF EXISTS t2;
+CREATE TABLE t2 (
+a bigint unsigned NOT NULL PRIMARY KEY,
+b int unsigned not null,
+c int unsigned
+) engine=ndbcluster;
+select count(*) from t2;
+count(*)
+10000
+delete from t2 limit 1;
+select count(*) from t2;
+count(*)
+9999
+delete from t2 limit 100;
+select count(*) from t2;
+count(*)
+9899
+delete from t2 limit 1000;
+select count(*) from t2;
+count(*)
+8899
+update t2 set c=12345678 limit 100;
+select count(*) from t2 where c=12345678;
+count(*)
+100
+select count(*) from t2 where c=12345678 limit 1000;
+count(*)
+100
+select * from t2 limit 0;
+a b c
+drop table t2;
+CREATE TABLE `t2` (
+`views` int(11) NOT NULL default '0',
+`clicks` int(11) NOT NULL default '0',
+`day` date NOT NULL default '0000-00-00',
+`hour` tinyint(4) NOT NULL default '0',
+`bannerid` smallint(6) NOT NULL default '0',
+`zoneid` smallint(6) NOT NULL default '0',
+`source` varchar(50) NOT NULL default '',
+PRIMARY KEY (`day`,`hour`,`bannerid`,`zoneid`,`source`),
+KEY `bannerid_day` (`bannerid`,`day`),
+KEY `zoneid` (`zoneid`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t2` VALUES
+( 1,0,'2004-09-17', 5,100,100,''),
+( 1,0,'2004-09-18', 7,100,100,''),
+( 17,0,'2004-09-27',20,132,100,''),
+( 4,0,'2004-09-16',23,132,100,''),
+( 86,0,'2004-09-18', 7,196,196,''),
+( 11,0,'2004-09-16',16,132,100,''),
+(140,0,'2004-09-18', 0,100,164,''),
+( 2,0,'2004-09-17', 7,132,100,''),
+(846,0,'2004-09-27',11,132,164,''),
+( 1,0,'2004-09-18', 8,132,100,''),
+( 22,0,'2004-09-27', 9,164,132,''),
+(711,0,'2004-09-27', 9,100,164,''),
+( 11,0,'2004-09-18', 0,196,132,''),
+( 41,0,'2004-09-27',15,196,132,''),
+( 57,0,'2004-09-18', 2,164,196,'');
+SELECT DATE_FORMAT(day, '%Y%m%d') as date, DATE_FORMAT(day, '%d-%m-%Y')
+as date_formatted FROM t2 GROUP BY day ORDER BY day DESC;
+date date_formatted
+20040927 27-09-2004
+20040918 18-09-2004
+20040917 17-09-2004
+20040916 16-09-2004
+SELECT DATE_FORMAT(day, '%Y%m%d') as date, DATE_FORMAT(day, '%d-%m-%Y')
+as date_formatted FROM t2 GROUP BY day ORDER BY day DESC LIMIT 2;
+date date_formatted
+20040927 27-09-2004
+20040918 18-09-2004
+drop table t2;
diff --git a/mysql-test/r/ndb_lock.result b/mysql-test/r/ndb_lock.result
new file mode 100644
index 00000000000..b8c2c58aac4
--- /dev/null
+++ b/mysql-test/r/ndb_lock.result
@@ -0,0 +1,65 @@
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
+create table t1 (x integer not null primary key, y varchar(32)) engine = ndb;
+insert into t1 values (1,'one'), (2,'two');
+select * from t1 order by x;
+x y
+1 one
+2 two
+select * from t1 order by x;
+x y
+1 one
+2 two
+start transaction;
+insert into t1 values (3,'three');
+select * from t1 order by x;
+x y
+1 one
+2 two
+3 three
+start transaction;
+select * from t1 order by x;
+x y
+1 one
+2 two
+commit;
+select * from t1 order by x;
+x y
+1 one
+2 two
+3 three
+commit;
+drop table t1;
+create table t1 (pk integer not null primary key, u int not null, o int not null,
+unique(u), key(o)) engine = ndb;
+insert into t1 values (1,1,1), (2,2,2), (3,3,3), (4,4,4), (5,5,5);
+lock tables t1 write;
+delete from t1 where pk = 1;
+unlock tables;
+select * from t1 order by pk;
+pk u o
+2 2 2
+3 3 3
+4 4 4
+5 5 5
+insert into t1 values (1,1,1);
+lock tables t1 write;
+delete from t1 where u = 1;
+unlock tables;
+select * from t1 order by pk;
+pk u o
+2 2 2
+3 3 3
+4 4 4
+5 5 5
+insert into t1 values (1,1,1);
+lock tables t1 write;
+delete from t1 where o = 1;
+unlock tables;
+select * from t1 order by pk;
+pk u o
+2 2 2
+3 3 3
+4 4 4
+5 5 5
+insert into t1 values (1,1,1);
+drop table t1;
diff --git a/mysql-test/r/ndb_minmax.result b/mysql-test/r/ndb_minmax.result
new file mode 100644
index 00000000000..cc0c238ac6e
--- /dev/null
+++ b/mysql-test/r/ndb_minmax.result
@@ -0,0 +1,120 @@
+drop table if exists t1, t2;
+CREATE TABLE t1 (
+a int PRIMARY KEY
+) engine = ndb;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+INSERT INTO t1 VALUES (6);
+select MAX(a) from t1;
+MAX(a)
+6
+select MAX(a) from t1;
+MAX(a)
+6
+select MAX(a) from t1;
+MAX(a)
+6
+select MAX(a) from t1;
+MAX(a)
+6
+select MIN(a) from t1;
+MIN(a)
+1
+select MIN(a) from t1;
+MIN(a)
+1
+select MIN(a) from t1;
+MIN(a)
+1
+select * from t1 order by a;
+a
+1
+2
+3
+4
+5
+6
+select MIN(a) from t1;
+MIN(a)
+1
+select MAX(a) from t1;
+MAX(a)
+6
+select MAX(a) from t1;
+MAX(a)
+6
+select * from t1 order by a;
+a
+1
+2
+3
+4
+5
+6
+drop table t1;
+CREATE TABLE t2 (
+a int PRIMARY KEY,
+b int not null,
+c int not null,
+KEY(b),
+UNIQUE(c)
+) engine = ndb;
+INSERT INTO t2 VALUES (1, 5, 1);
+INSERT INTO t2 VALUES (2, 2, 7);
+INSERT INTO t2 VALUES (3, 3, 3);
+INSERT INTO t2 VALUES (4, 4, 4);
+INSERT INTO t2 VALUES (5, 5, 5);
+INSERT INTO t2 VALUES (6, 6, 6);
+INSERT INTO t2 VALUES (7, 2, 10);
+INSERT INTO t2 VALUES (8, 10, 2);
+select MAX(a) from t2;
+MAX(a)
+8
+select MAX(b) from t2;
+MAX(b)
+10
+select MAX(c) from t2;
+MAX(c)
+10
+select MIN(a) from t2;
+MIN(a)
+1
+select MIN(b) from t2;
+MIN(b)
+2
+select MIN(c) from t2;
+MIN(c)
+1
+select * from t2 order by a;
+a b c
+1 5 1
+2 2 7
+3 3 3
+4 4 4
+5 5 5
+6 6 6
+7 2 10
+8 10 2
+select MIN(b) from t2;
+MIN(b)
+2
+select MAX(a) from t2;
+MAX(a)
+8
+select MAX(c) from t2;
+MAX(c)
+10
+select * from t2 order by a;
+a b c
+1 5 1
+2 2 7
+3 3 3
+4 4 4
+5 5 5
+6 6 6
+7 2 10
+8 10 2
+drop table t2;
diff --git a/mysql-test/r/ndb_replace.result b/mysql-test/r/ndb_replace.result
new file mode 100644
index 00000000000..63fd8b55c8e
--- /dev/null
+++ b/mysql-test/r/ndb_replace.result
@@ -0,0 +1,21 @@
+drop table if exists t1;
+CREATE TABLE t1 (
+gesuchnr int(11) DEFAULT '0' NOT NULL,
+benutzer_id int(11) DEFAULT '0' NOT NULL,
+PRIMARY KEY (gesuchnr,benutzer_id)
+) engine=ndbcluster;
+replace into t1 (gesuchnr,benutzer_id) values (2,1);
+replace into t1 (gesuchnr,benutzer_id) values (1,1);
+replace into t1 (gesuchnr,benutzer_id) values (1,1);
+insert into t1 (gesuchnr, benutzer_id) value (3,2);
+replace into t1 (gesuchnr,benutzer_id) values (1,1);
+replace into t1 (gesuchnr,benutzer_id) values (1,1);
+insert into t1 (gesuchnr,benutzer_id) values (1,1);
+ERROR 23000: Duplicate entry '1-1' for key 1
+replace into t1 (gesuchnr,benutzer_id) values (1,1);
+select * from t1 order by gesuchnr;
+gesuchnr benutzer_id
+1 1
+2 1
+3 2
+drop table t1;
diff --git a/mysql-test/r/ndb_subquery.result b/mysql-test/r/ndb_subquery.result
new file mode 100644
index 00000000000..f65f09b71b3
--- /dev/null
+++ b/mysql-test/r/ndb_subquery.result
@@ -0,0 +1,42 @@
+drop table if exists t1;
+drop table if exists t2;
+create table t1 (p int not null primary key, u int not null, o int not null,
+unique (u), key(o)) engine=ndb;
+create table t2 (p int not null primary key, u int not null, o int not null,
+unique (u), key(o)) engine=ndb;
+insert into t1 values (1,1,1),(2,2,2),(3,3,3);
+insert into t2 values (1,1,1),(2,2,2),(3,3,3), (4,4,4), (5,5,5);
+explain select * from t2 where p NOT IN (select p from t1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using where
+2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 Using index
+select * from t2 where p NOT IN (select p from t1) order by p;
+p u o
+4 4 4
+5 5 5
+explain select * from t2 where p NOT IN (select u from t1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using where
+2 DEPENDENT SUBQUERY t1 unique_subquery u u 4 func 1 Using index
+select * from t2 where p NOT IN (select u from t1) order by p;
+p u o
+4 4 4
+5 5 5
+explain select * from t2 where p NOT IN (select o from t1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using where
+2 DEPENDENT SUBQUERY t1 index_subquery o o 4 func 1 Using index
+select * from t2 where p NOT IN (select o from t1) order by p;
+p u o
+4 4 4
+5 5 5
+explain select * from t2 where p NOT IN (select p+0 from t1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using where
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where
+select * from t2 where p NOT IN (select p+0 from t1) order by p;
+p u o
+4 4 4
+5 5 5
+drop table t1;
+drop table t2;
diff --git a/mysql-test/r/ndb_transaction.result b/mysql-test/r/ndb_transaction.result
new file mode 100644
index 00000000000..691b91b1d36
--- /dev/null
+++ b/mysql-test/r/ndb_transaction.result
@@ -0,0 +1,257 @@
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
+drop database if exists mysqltest;
+CREATE TABLE t1 (
+pk1 INT NOT NULL PRIMARY KEY,
+attr1 INT NOT NULL
+) ENGINE=ndbcluster;
+begin;
+insert into t1 values(1,1);
+insert into t1 values(2,2);
+select count(*) from t1;
+count(*)
+2
+select * from t1 where pk1 = 1;
+pk1 attr1
+1 1
+select t1.attr1 from t1, t1 as t1x where t1.pk1 = t1x.pk1 + 1;
+attr1
+2
+rollback;
+select count(*) from t1;
+count(*)
+0
+select * from t1 where pk1 = 1;
+pk1 attr1
+select t1.attr1 from t1, t1 as t1x where t1.pk1 = t1x.pk1 + 1;
+attr1
+begin;
+insert into t1 values(1,1);
+insert into t1 values(2,2);
+commit;
+select count(*) from t1;
+count(*)
+2
+select * from t1 where pk1 = 1;
+pk1 attr1
+1 1
+select t1.attr1 from t1, t1 as t1x where t1.pk1 = t1x.pk1 + 1;
+attr1
+2
+begin;
+update t1 set attr1 = attr1 * 2;
+select count(*) from t1;
+count(*)
+2
+select * from t1 where pk1 = 1;
+pk1 attr1
+1 2
+select * from t1, t1 as t1x where t1x.attr1 = t1.attr1 - 2;
+pk1 attr1 pk1 attr1
+2 4 1 2
+rollback;
+select count(*) from t1;
+count(*)
+2
+select * from t1 where pk1 = 1;
+pk1 attr1
+1 1
+select * from t1, t1 as t1x where t1x.attr1 = t1.attr1 - 2;
+pk1 attr1 pk1 attr1
+begin;
+update t1 set attr1 = attr1 * 2;
+commit;
+select count(*) from t1;
+count(*)
+2
+select * from t1 where pk1 = 1;
+pk1 attr1
+1 2
+select * from t1, t1 as t1x where t1x.attr1 = t1.attr1 - 2;
+pk1 attr1 pk1 attr1
+2 4 1 2
+begin;
+delete from t1 where attr1 = 2;
+select count(*) from t1;
+count(*)
+1
+select * from t1 where pk1 = 1;
+pk1 attr1
+select * from t1, t1 as t1x where t1x.attr1 = t1.attr1 - 2;
+pk1 attr1 pk1 attr1
+rollback;
+select count(*) from t1;
+count(*)
+2
+select * from t1 where pk1 = 1;
+pk1 attr1
+1 2
+select * from t1, t1 as t1x where t1x.attr1 = t1.attr1 - 2;
+pk1 attr1 pk1 attr1
+2 4 1 2
+begin;
+delete from t1 where attr1 = 2;
+commit;
+select count(*) from t1;
+count(*)
+1
+select * from t1 where pk1 = 1;
+pk1 attr1
+select * from t1, t1 as t1x where t1x.attr1 = t1.attr1 - 2;
+pk1 attr1 pk1 attr1
+DROP TABLE t1;
+CREATE TABLE t1 (id INT, id2 int) engine=ndbcluster;
+begin;
+insert into t1 values(1,1);
+insert into t1 values(2,2);
+select sum(id) from t1;
+sum(id)
+3
+select * from t1 where id = 1;
+id id2
+1 1
+select t1.id from t1, t1 as t1x where t1.id2 = t1x.id2 + 1;
+id
+2
+rollback;
+select sum(id) from t1;
+sum(id)
+NULL
+select * from t1 where id = 1;
+id id2
+select t1.id from t1, t1 as t1x where t1.id2 = t1x.id2 + 1;
+id
+begin;
+insert into t1 values(1,1);
+insert into t1 values(2,2);
+commit;
+select sum(id) from t1;
+sum(id)
+3
+select * from t1 where id = 1;
+id id2
+1 1
+select t1.id from t1, t1 as t1x where t1.id2 = t1x.id2 + 1;
+id
+2
+begin;
+update t1 set id = id * 2;
+select sum(id) from t1;
+sum(id)
+6
+select * from t1 where id = 2;
+id id2
+2 1
+select * from t1, t1 as t1x where t1x.id = t1.id - 2;
+id id2 id id2
+4 2 2 1
+rollback;
+select sum(id) from t1;
+sum(id)
+3
+select * from t1 where id = 2;
+id id2
+2 2
+select * from t1, t1 as t1x where t1x.id = t1.id - 2;
+id id2 id id2
+begin;
+update t1 set id = id * 2;
+commit;
+select sum(id) from t1;
+sum(id)
+6
+select * from t1 where id = 2;
+id id2
+2 1
+select * from t1, t1 as t1x where t1x.id = t1.id - 2;
+id id2 id id2
+4 2 2 1
+DROP TABLE t1;
+CREATE TABLE t2 (
+a bigint unsigned NOT NULL PRIMARY KEY,
+b int unsigned not null,
+c int unsigned
+) engine=ndbcluster;
+CREATE TABLE t3 (
+a bigint unsigned NOT NULL,
+b bigint unsigned not null,
+c bigint unsigned,
+PRIMARY KEY(a)
+) engine=ndbcluster;
+CREATE TABLE t4 (
+a bigint unsigned NOT NULL,
+b bigint unsigned not null,
+c bigint unsigned NOT NULL,
+d int unsigned,
+PRIMARY KEY(a, b, c)
+) engine=ndbcluster;
+select count(*) from t2;
+count(*)
+0
+select count(*) from t3;
+count(*)
+0
+select count(*) from t4;
+count(*)
+0
+select count(*) from t2;
+count(*)
+100
+select count(*) from t3;
+count(*)
+100
+select count(*) from t4;
+count(*)
+100
+begin;
+begin;
+drop table t2;
+drop table t3;
+drop table t4;
+CREATE TABLE t1 (
+pk1 INT NOT NULL PRIMARY KEY,
+attr1 INT NOT NULL
+) ENGINE=ndbcluster;
+create database mysqltest;
+use mysqltest;
+CREATE TABLE t2 (
+a bigint unsigned NOT NULL PRIMARY KEY,
+b int unsigned not null,
+c int unsigned
+) engine=ndbcluster;
+begin;
+insert into test.t1 values(1,1);
+insert into t2 values(1,1,1);
+insert into test.t1 values(2,2);
+insert into t2 values(2,2,2);
+select count(*) from test.t1;
+count(*)
+2
+select count(*) from t2;
+count(*)
+2
+select * from test.t1 where pk1 = 1;
+pk1 attr1
+1 1
+select * from t2 where a = 1;
+a b c
+1 1 1
+select test.t1.attr1
+from test.t1, test.t1 as t1x where test.t1.pk1 = t1x.pk1 + 1;
+attr1
+2
+select t2.a
+from t2, t2 as t2x where t2.a = t2x.a + 1;
+a
+2
+select test.t1.pk1, a from test.t1,t2 where b > test.t1.attr1;
+pk1 a
+1 2
+rollback;
+select count(*) from test.t1;
+count(*)
+0
+select count(*) from t2;
+count(*)
+0
+drop table test.t1, t2;
+drop database mysqltest;
diff --git a/mysql-test/r/ndb_truncate.result b/mysql-test/r/ndb_truncate.result
new file mode 100644
index 00000000000..38f3a78029c
--- /dev/null
+++ b/mysql-test/r/ndb_truncate.result
@@ -0,0 +1,14 @@
+DROP TABLE IF EXISTS t2;
+CREATE TABLE t2 (
+a bigint unsigned NOT NULL PRIMARY KEY,
+b int unsigned not null,
+c int unsigned
+) engine=ndbcluster;
+select count(*) from t2;
+count(*)
+5000
+truncate table t2;
+select count(*) from t2;
+count(*)
+0
+drop table t2;
diff --git a/mysql-test/r/ndb_types.result b/mysql-test/r/ndb_types.result
new file mode 100644
index 00000000000..9a45b77149b
--- /dev/null
+++ b/mysql-test/r/ndb_types.result
@@ -0,0 +1,36 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+auto int(5) unsigned NOT NULL auto_increment,
+string char(10) default "hello",
+tiny tinyint(4) DEFAULT '0' NOT NULL ,
+short smallint(6) DEFAULT '1' NOT NULL ,
+medium mediumint(8) DEFAULT '0' NOT NULL,
+long_int int(11) DEFAULT '0' NOT NULL,
+longlong bigint(13) DEFAULT '0' NOT NULL,
+real_float float(13,1) DEFAULT 0.0 NOT NULL,
+real_double double(16,4),
+utiny tinyint(3) unsigned DEFAULT '0' NOT NULL,
+ushort smallint(5) unsigned zerofill DEFAULT '00000' NOT NULL,
+umedium mediumint(8) unsigned DEFAULT '0' NOT NULL,
+ulong int(11) unsigned DEFAULT '0' NOT NULL,
+ulonglong bigint(13) unsigned DEFAULT '0' NOT NULL,
+time_stamp timestamp,
+date_field date,
+time_field time,
+date_time datetime,
+options enum('one','two','tree') not null,
+flags set('one','two','tree') not null,
+PRIMARY KEY (auto),
+KEY (utiny),
+KEY (tiny),
+KEY (short),
+KEY any_name (medium),
+KEY (longlong),
+KEY (real_float),
+KEY (ushort),
+KEY (umedium),
+KEY (ulong),
+KEY (ulonglong,ulong),
+KEY (options,flags)
+);
+drop table t1;
diff --git a/mysql-test/r/ndb_update.result b/mysql-test/r/ndb_update.result
new file mode 100644
index 00000000000..5df5c861cfb
--- /dev/null
+++ b/mysql-test/r/ndb_update.result
@@ -0,0 +1,13 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+pk1 INT NOT NULL PRIMARY KEY,
+b INT NOT NULL,
+c INT NOT NULL
+) ENGINE=ndbcluster;
+INSERT INTO t1 VALUES (0, 0, 1),(1,1,2),(2,2,3);
+UPDATE t1 set b = c;
+select * from t1 order by pk1;
+pk1 b c
+0 1 1
+1 2 2
+2 3 3
diff --git a/mysql-test/r/negation_elimination.result b/mysql-test/r/negation_elimination.result
new file mode 100644
index 00000000000..9193a125cd1
--- /dev/null
+++ b/mysql-test/r/negation_elimination.result
@@ -0,0 +1,391 @@
+drop table if exists t1;
+create table t1 (a int, key (a));
+insert into t1 values (NULL), (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+(10), (11), (12), (13), (14), (15), (16), (17), (18), (19);
+explain select * from t1 where not(not(a));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL a 5 NULL 21 Using where; Using index
+select * from t1 where not(not(a));
+a
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+explain select * from t1 where not(not(not(a > 10)));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 10 Using where; Using index
+select * from t1 where not(not(not(a > 10)));
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+explain select * from t1 where not(not(not(a < 5) and not(a > 10)));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 5 Using where; Using index
+select * from t1 where not(not(not(a < 5) and not(a > 10)));
+a
+5
+6
+7
+8
+9
+10
+explain select * from t1 where not(a = 10);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 19 Using where; Using index
+select * from t1 where not(a = 10);
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+11
+12
+13
+14
+15
+16
+17
+18
+19
+explain select * from t1 where not(a != 10);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 5 const 1 Using where; Using index
+select * from t1 where not(a != 1);
+a
+1
+explain select * from t1 where not(a < 10);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 11 Using where; Using index
+select * from t1 where not(a < 10);
+a
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+explain select * from t1 where not(a >= 10);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 9 Using where; Using index
+select * from t1 where not(a >= 10);
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+explain select * from t1 where not(a > 10);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 10 Using where; Using index
+select * from t1 where not(a > 10);
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+explain select * from t1 where not(a <= 10);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 10 Using where; Using index
+select * from t1 where not(a <= 10);
+a
+11
+12
+13
+14
+15
+16
+17
+18
+19
+explain select * from t1 where not(a is null);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 20 Using where; Using index
+select * from t1 where not(a is null);
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+explain select * from t1 where not(a is not null);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 5 const 1 Using where; Using index
+select * from t1 where not(a is not null);
+a
+NULL
+explain select * from t1 where not(a < 5 or a > 15);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 10 Using where; Using index
+select * from t1 where not(a < 5 or a > 15);
+a
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+explain select * from t1 where not(a < 15 and a > 5);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 12 Using where; Using index
+select * from t1 where not(a < 15 and a > 5);
+a
+0
+1
+2
+3
+4
+5
+15
+16
+17
+18
+19
+explain select * from t1 where a = 2 or not(a < 10);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 12 Using where; Using index
+select * from t1 where a = 2 or not(a < 10);
+a
+2
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+explain select * from t1 where a > 5 and not(a > 10);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 4 Using where; Using index
+select * from t1 where a > 5 and not(a > 10);
+a
+6
+7
+8
+9
+10
+explain select * from t1 where a > 5 xor a < 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL a 5 NULL 21 Using where; Using index
+select * from t1 where a > 5 xor a < 10;
+a
+0
+1
+2
+3
+4
+5
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+explain select * from t1 where a = 2 or not(a < 5 or a > 15);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 11 Using where; Using index
+select * from t1 where a = 2 or not(a < 5 or a > 15);
+a
+2
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+explain select * from t1 where a = 7 or not(a < 15 and a > 5);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 13 Using where; Using index
+select * from t1 where a = 7 or not(a < 15 and a > 5);
+a
+0
+1
+2
+3
+4
+5
+7
+15
+16
+17
+18
+19
+explain select * from t1 where NULL or not(a < 15 and a > 5);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 12 Using where; Using index
+select * from t1 where NULL or not(a < 15 and a > 5);
+a
+0
+1
+2
+3
+4
+5
+15
+16
+17
+18
+19
+explain select * from t1 where not(NULL and a > 5);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 6 Using where; Using index
+select * from t1 where not(NULL and a > 5);
+a
+0
+1
+2
+3
+4
+5
+explain select * from t1 where not(NULL or a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+select * from t1 where not(NULL or a);
+a
+explain select * from t1 where not(NULL and a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL a 5 NULL 21 Using where; Using index
+select * from t1 where not(NULL and a);
+a
+0
+explain select * from t1 where not((a < 5 or a < 10) and (not(a > 16) or a > 17));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 11 Using where; Using index
+select * from t1 where not((a < 5 or a < 10) and (not(a > 16) or a > 17));
+a
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+explain select * from t1 where not((a < 5 and a < 10) and (not(a > 16) or a > 17));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 15 Using where; Using index
+select * from t1 where not((a < 5 and a < 10) and (not(a > 16) or a > 17));
+a
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+explain select * from t1 where ((a between 5 and 15) and (not(a like 10)));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 10 Using where; Using index
+select * from t1 where ((a between 5 and 15) and (not(a like 10)));
+a
+5
+6
+7
+8
+9
+11
+12
+13
+14
+15
+delete from t1 where a > 3;
+select a, not(not(a)) from t1;
+a not(not(a))
+NULL NULL
+0 0
+1 1
+2 1
+3 1
+explain extended select a, not(not(a)), not(a <= 2 and not(a)), not(a not like "1"), not (a not in (1,2)), not(a != 2) from t1 where not(not(a)) having not(not(a));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL a 5 NULL 5 Using where; Using index
+Warnings:
+Note 1003 select test.t1.a AS `a`,(test.t1.a <> 0) AS `not(not(a))`,((test.t1.a > 2) or test.t1.a) AS `not(a <= 2 and not(a))`,(test.t1.a like _latin1'1') AS `not(a not like "1")`,(test.t1.a in (1,2)) AS `not (a not in (1,2))`,(test.t1.a = 2) AS `not(a != 2)` from test.t1 where test.t1.a having test.t1.a
+drop table t1;
diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result
index 41a1a06aebe..3e233eb512a 100644
--- a/mysql-test/r/null.result
+++ b/mysql-test/r/null.result
@@ -1,12 +1,18 @@
+drop table if exists t1;
select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnull(null,1),ifnull(null,"TRUE"),ifnull("TRUE","ERROR"),1/0 is null,1 is not null;
NULL NULL isnull(null) isnull(1/0) isnull(1/0 = null) ifnull(null,1) ifnull(null,"TRUE") ifnull("TRUE","ERROR") 1/0 is null 1 is not null
NULL NULL 1 1 1 1 TRUE TRUE 1 1
+explain extended select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnull(null,1),ifnull(null,"TRUE"),ifnull("TRUE","ERROR"),1/0 is null,1 is not null;
+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 NULL AS `NULL`,NULL AS `NULL`,isnull(NULL) AS `isnull(null)`,isnull((1 / 0)) AS `isnull(1/0)`,isnull(((1 / 0) = NULL)) AS `isnull(1/0 = null)`,ifnull(NULL,1) AS `ifnull(null,1)`,ifnull(NULL,_latin1'TRUE') AS `ifnull(null,"TRUE")`,ifnull(_latin1'TRUE',_latin1'ERROR') AS `ifnull("TRUE","ERROR")`,isnull((1 / 0)) AS `1/0 is null`,(1 is not null) AS `1 is not null`
select 1 | NULL,1 & NULL,1+NULL,1-NULL;
1 | NULL 1 & NULL 1+NULL 1-NULL
NULL NULL NULL NULL
select NULL=NULL,NULL<>NULL,IFNULL(NULL,1.1)+0,IFNULL(NULL,1) | 0;
NULL=NULL NULL<>NULL IFNULL(NULL,1.1)+0 IFNULL(NULL,1) | 0
-NULL NULL 1 1
+NULL NULL 1.1 1
select strcmp("a",NULL),(1<NULL)+0.0,NULL regexp "a",null like "a%","a%" like null;
strcmp("a",NULL) (1<NULL)+0.0 NULL regexp "a" null like "a%" "a%" like null
NULL NULL NULL NULL NULL
@@ -22,6 +28,11 @@ field(NULL,"a","b","c")
select 2 between null and 1,2 between 3 AND NULL,NULL between 1 and 2,2 between NULL and 3, 2 between 1 AND null;
2 between null and 1 2 between 3 AND NULL NULL between 1 and 2 2 between NULL and 3 2 between 1 AND null
0 0 NULL NULL NULL
+explain extended select 2 between null and 1,2 between 3 AND NULL,NULL between 1 and 2,2 between NULL and 3, 2 between 1 AND null;
+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 (2 between NULL and 1) AS `2 between null and 1`,(2 between 3 and NULL) AS `2 between 3 AND NULL`,(NULL between 1 and 2) AS `NULL between 1 and 2`,(2 between NULL and 3) AS `2 between NULL and 3`,(2 between 1 and NULL) AS `2 between 1 AND null`
SELECT NULL AND NULL, 1 AND NULL, NULL AND 1, NULL OR NULL, 0 OR NULL, NULL OR 0;
NULL AND NULL 1 AND NULL NULL AND 1 NULL OR NULL 0 OR NULL NULL OR 0
NULL NULL NULL NULL NULL NULL
@@ -34,7 +45,11 @@ NULL AND 0 0 and NULL
select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),inet_aton("122.226."),inet_aton("");
inet_ntoa(null) inet_aton(null) inet_aton("122.256") inet_aton("122.226.") inet_aton("")
NULL NULL NULL NULL NULL
-drop table if exists t1;
+explain extended select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),inet_aton("122.226."),inet_aton("");
+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 inet_ntoa(NULL) AS `inet_ntoa(null)`,inet_aton(NULL) AS `inet_aton(null)`,inet_aton(_latin1'122.256') AS `inet_aton("122.256")`,inet_aton(_latin1'122.226.') AS `inet_aton("122.226.")`,inet_aton(_latin1'') AS `inet_aton("")`
create table t1 (x int);
insert into t1 values (null);
select * from t1 where x != 0;
@@ -56,7 +71,7 @@ indexed_field
NULL
NULL
DROP TABLE t1;
-create table t1 (a int, b int) type=myisam;
+create table t1 (a int, b int) engine=myisam;
insert into t1 values(20,null);
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
t2.b=t3.a;
@@ -75,28 +90,46 @@ NULL this is null
drop table t1;
CREATE TABLE t1 (a varchar(16) NOT NULL, b smallint(6) NOT NULL, c datetime NOT NULL, d smallint(6) NOT NULL);
INSERT INTO t1 SET a = "", d= "2003-01-14 03:54:55";
+Warnings:
+Warning 1265 Data truncated for column 'd' at row 1
UPDATE t1 SET d=1/NULL;
+Warnings:
+Warning 1265 Data truncated for column 'd' at row 1
UPDATE t1 SET d=NULL;
+Warnings:
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'd' at row 1
INSERT INTO t1 (a) values (null);
-Column 'a' cannot be null
+ERROR 23000: Column 'a' cannot be null
INSERT INTO t1 (a) values (1/null);
-Column 'a' cannot be null
+ERROR 23000: Column 'a' cannot be null
INSERT INTO t1 (a) values (null),(null);
+Warnings:
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 2
INSERT INTO t1 (b) values (null);
-Column 'b' cannot be null
+ERROR 23000: Column 'b' cannot be null
INSERT INTO t1 (b) values (1/null);
-Column 'b' cannot be null
+ERROR 23000: Column 'b' cannot be null
INSERT INTO t1 (b) values (null),(null);
+Warnings:
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'b' at row 1
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'b' at row 2
INSERT INTO t1 (c) values (null);
-Column 'c' cannot be null
+ERROR 23000: Column 'c' cannot be null
INSERT INTO t1 (c) values (1/null);
-Column 'c' cannot be null
+ERROR 23000: Column 'c' cannot be null
INSERT INTO t1 (c) values (null),(null);
+Warnings:
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'c' at row 1
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'c' at row 2
INSERT INTO t1 (d) values (null);
-Column 'd' cannot be null
+ERROR 23000: Column 'd' cannot be null
INSERT INTO t1 (d) values (1/null);
-Column 'd' cannot be null
+ERROR 23000: Column 'd' cannot be null
INSERT INTO t1 (d) values (null),(null);
+Warnings:
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'd' at row 1
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'd' at row 2
select * from t1;
a b c d
0 0000-00-00 00:00:00 0
@@ -109,22 +142,130 @@ a b c d
0 0000-00-00 00:00:00 0
0 0000-00-00 00:00:00 0
drop table t1;
-CREATE TABLE t1(i int, KEY(i));
-INSERT INTO t1 VALUES(1);
-INSERT INTO t1 SELECT i*2 FROM t1;
-INSERT INTO t1 SELECT i*2 FROM t1;
-INSERT INTO t1 SELECT i*2 FROM t1;
-INSERT INTO t1 SELECT i*2 FROM t1;
-INSERT INTO t1 SELECT i*2 FROM t1;
-INSERT INTO t1 SELECT i*2 FROM t1;
-INSERT INTO t1 SELECT i*2 FROM t1;
-INSERT INTO t1 SELECT i*2 FROM t1;
-INSERT INTO t1 SELECT i*2 FROM t1;
-EXPLAIN SELECT * FROM t1 WHERE i=2 OR i IS NULL;
-table type possible_keys key key_len ref rows Extra
-t1 range i i 5 NULL 10 Using where; Using index
-ALTER TABLE t1 CHANGE i i int NOT NULL;
-EXPLAIN SELECT * FROM t1 WHERE i=2 OR i IS NULL;
-table type possible_keys key key_len ref rows Extra
-t1 range i i 4 NULL 7 Using where; Using index
-DROP TABLE t1;
+create table t1 (a int not null, b int not null, index idx(a));
+insert into t1 values
+(1,1), (2,2), (3,3), (4,4), (5,5), (6,6),
+(7,7), (8,8), (9,9), (10,10), (11,11), (12,12);
+explain select * from t1 where a between 2 and 3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range idx idx 4 NULL 2 Using where
+explain select * from t1 where a between 2 and 3 or b is null;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range idx idx 4 NULL 2 Using where
+drop table t1;
+select cast(NULL as signed);
+cast(NULL as signed)
+NULL
+create table t1(i int, key(i));
+insert into t1 values(1);
+insert into t1 select i*2 from t1;
+insert into t1 select i*2 from t1;
+insert into t1 select i*2 from t1;
+insert into t1 select i*2 from t1;
+insert into t1 select i*2 from t1;
+insert into t1 select i*2 from t1;
+insert into t1 select i*2 from t1;
+insert into t1 select i*2 from t1;
+insert into t1 select i*2 from t1;
+explain select * from t1 where i=2 or i is null;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref_or_null i i 5 const 10 Using where; Using index
+alter table t1 change i i int not null;
+explain select * from t1 where i=2 or i is null;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref i i 4 const 7 Using where; Using index
+drop table t1;
+set names latin2;
+create table t1 select
+null as c00,
+if(1, null, 'string') as c01,
+if(0, null, 'string') as c02,
+ifnull(null, 'string') as c03,
+ifnull('string', null) as c04,
+case when 0 then null else 'string' end as c05,
+case when 1 then null else 'string' end as c06,
+coalesce(null, 'string') as c07,
+coalesce('string', null) as c08,
+least('string',null) as c09,
+least(null, 'string') as c10,
+greatest('string',null) as c11,
+greatest(null, 'string') as c12,
+nullif('string', null) as c13,
+nullif(null, 'string') as c14,
+trim('string' from null) as c15,
+trim(null from 'string') as c16,
+substring_index('string', null, 1) as c17,
+substring_index(null, 'string', 1) as c18,
+elt(1, null, 'string') as c19,
+elt(1, 'string', null) as c20,
+concat('string', null) as c21,
+concat(null, 'string') as c22,
+concat_ws('sep', 'string', null) as c23,
+concat_ws('sep', null, 'string') as c24,
+concat_ws(null, 'string', 'string') as c25,
+make_set(3, 'string', null) as c26,
+make_set(3, null, 'string') as c27,
+export_set(3, null, 'off', 'sep') as c29,
+export_set(3, 'on', null, 'sep') as c30,
+export_set(3, 'on', 'off', null) as c31,
+replace(null, 'from', 'to') as c32,
+replace('str', null, 'to') as c33,
+replace('str', 'from', null) as c34,
+insert('str', 1, 2, null) as c35,
+insert(null, 1, 2, 'str') as c36,
+lpad('str', 10, null) as c37,
+rpad(null, 10, 'str') as c38;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c00` binary(0) default NULL,
+ `c01` varchar(6) character set latin2 default NULL,
+ `c02` varchar(6) character set latin2 default NULL,
+ `c03` varchar(6) character set latin2 NOT NULL default '',
+ `c04` varchar(6) character set latin2 default NULL,
+ `c05` varchar(6) character set latin2 default NULL,
+ `c06` varchar(6) character set latin2 default NULL,
+ `c07` varchar(6) character set latin2 default NULL,
+ `c08` varchar(6) character set latin2 default NULL,
+ `c09` varchar(6) character set latin2 NOT NULL default '',
+ `c10` varchar(6) character set latin2 NOT NULL default '',
+ `c11` varchar(6) character set latin2 NOT NULL default '',
+ `c12` varchar(6) character set latin2 NOT NULL default '',
+ `c13` varchar(6) character set latin2 default NULL,
+ `c14` char(0) character set latin2 default NULL,
+ `c15` char(0) character set latin2 default NULL,
+ `c16` varchar(6) character set latin2 default NULL,
+ `c17` varchar(6) character set latin2 default NULL,
+ `c18` char(0) character set latin2 default NULL,
+ `c19` varchar(6) character set latin2 default NULL,
+ `c20` varchar(6) character set latin2 default NULL,
+ `c21` varchar(6) character set latin2 default NULL,
+ `c22` varchar(6) character set latin2 default NULL,
+ `c23` varchar(9) character set latin2 default NULL,
+ `c24` varchar(9) character set latin2 default NULL,
+ `c25` varchar(12) character set latin2 default NULL,
+ `c26` varchar(7) character set latin2 default NULL,
+ `c27` varchar(7) character set latin2 default NULL,
+ `c29` longtext character set latin2,
+ `c30` longtext character set latin2,
+ `c31` varchar(192) character set latin2 default NULL,
+ `c32` char(0) character set latin2 default NULL,
+ `c33` char(3) character set latin2 default NULL,
+ `c34` char(3) character set latin2 default NULL,
+ `c35` char(3) character set latin2 default NULL,
+ `c36` char(3) character set latin2 default NULL,
+ `c37` varchar(10) character set latin2 default NULL,
+ `c38` varchar(10) character set latin2 default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select
+case 'str' when 'STR' then 'str' when null then 'null' end as c01,
+case 'str' when null then 'null' when 'STR' then 'str' end as c02,
+field(null, 'str1', 'str2') as c03,
+field('str1','STR1', null) as c04,
+field('str1', null, 'STR1') as c05,
+'string' in ('STRING', null) as c08,
+'string' in (null, 'STRING') as c09;
+c01 c02 c03 c04 c05 c08 c09
+str str 0 1 2 1 1
+set names latin1;
diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result
index 41b0ae26617..4b7400e5e60 100644
--- a/mysql-test/r/null_key.result
+++ b/mysql-test/r/null_key.result
@@ -1,39 +1,42 @@
-drop table if exists t1;
-create table t1 (a int, b int not null,unique key (a,b),index(b)) type=myisam;
+drop table if exists t1,t2;
+create table t1 (a int, b int not null,unique key (a,b),index(b)) engine=myisam;
insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6);
explain select * from t1 where a is null;
-table type possible_keys key key_len ref rows Extra
-t1 ref a a 5 const 3 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 5 const 3 Using where; Using index
explain select * from t1 where a is null and b = 2;
-table type possible_keys key key_len ref rows Extra
-t1 ref a,b a 9 const,const 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a,b a 9 const,const 1 Using where; Using index
explain select * from t1 where a is null and b = 7;
-table type possible_keys key key_len ref rows Extra
-t1 ref a,b a 9 const,const 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a,b a 9 const,const 1 Using where; Using index
explain select * from t1 where a=2 and b = 2;
-table type possible_keys key key_len ref rows Extra
-t1 const a,b a 9 const,const 1 Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const a,b a 9 const,const 1 Using index
explain select * from t1 where a<=>b limit 2;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL a 9 NULL 12 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL a 9 NULL 12 Using where; Using index
explain select * from t1 where (a is null or a > 0 and a < 3) and b < 5 limit 3;
-table type possible_keys key key_len ref rows Extra
-t1 range a,b a 9 NULL 3 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a,b a 9 NULL 3 Using where; Using index
explain select * from t1 where (a is null or a = 7) and b=7;
-table type possible_keys key key_len ref rows Extra
-t1 ref a,b b 4 const 2 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref_or_null a,b a 9 const,const 2 Using where; Using index
+explain select * from t1 where (a is null or a = 7) and b=7 order by a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref_or_null a,b a 9 const,const 2 Using where; Using index; Using filesort
explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
-table type possible_keys key key_len ref rows Extra
-t1 ref a,b a 5 const 3 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a,b a 5 const 3 Using where; Using index
explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
-table type possible_keys key key_len ref rows Extra
-t1 range a,b a 9 NULL 2 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a,b a 9 NULL 2 Using where; Using index
explain select * from t1 where a > 1 and a < 3 limit 1;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 5 NULL 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index
explain select * from t1 where a > 8 and a < 9;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 5 NULL 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index
select * from t1 where a is null;
a b
NULL 7
@@ -56,53 +59,55 @@ NULL 9
NULL 9
select * from t1 where (a is null or a = 7) and b=7;
a b
-NULL 7
7 7
+NULL 7
select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
a b
NULL 7
NULL 9
NULL 9
+create table t2 like t1;
+insert into t2 select * from t1;
alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10));
explain select * from t1 where a is null and b = 2;
-table type possible_keys key key_len ref rows Extra
-t1 ref a,b a 5 const 3 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a,b a 5 const 3 Using where
explain select * from t1 where a is null and b = 2 and c=0;
-table type possible_keys key key_len ref rows Extra
-t1 ref a,b a 5 const 3 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a,b a 5 const 3 Using where
explain select * from t1 where a is null and b = 7 and c=0;
-table type possible_keys key key_len ref rows Extra
-t1 ref a,b a 5 const 3 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a,b a 5 const 3 Using where
explain select * from t1 where a=2 and b = 2;
-table type possible_keys key key_len ref rows Extra
-t1 ref a,b a 5 const 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a,b a 5 const 1 Using where
explain select * from t1 where a<=>b limit 2;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 12 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 12 Using where
explain select * from t1 where (a is null or a > 0 and a < 3) and b < 5 and c=0 limit 3;
-table type possible_keys key key_len ref rows Extra
-t1 range a,b a 5 NULL 5 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a,b a 5 NULL 5 Using where
explain select * from t1 where (a is null or a = 7) and b=7 and c=0;
-table type possible_keys key key_len ref rows Extra
-t1 ALL a,b NULL NULL NULL 12 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref_or_null a,b a 5 const 4 Using where
explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
-table type possible_keys key key_len ref rows Extra
-t1 ref a,b a 5 const 3 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a,b a 5 const 3 Using where
explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
-table type possible_keys key key_len ref rows Extra
-t1 ref a,b a 5 const 3 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a,b a 5 const 3 Using where
explain select * from t1 where a > 1 and a < 3 limit 1;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 5 NULL 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 1 Using where
explain select * from t1 where a is null and b=7 or a > 1 and a < 3 limit 1;
-table type possible_keys key key_len ref rows Extra
-t1 range a,b a 5 NULL 4 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a,b a 5 NULL 4 Using where
explain select * from t1 where a > 8 and a < 9;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 5 NULL 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 1 Using where
explain select * from t1 where b like "6%";
-table type possible_keys key key_len ref rows Extra
-t1 range b b 12 NULL 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range b b 12 NULL 1 Using where
select * from t1 where a is null;
a b c
NULL 7 0
@@ -125,8 +130,8 @@ NULL 9 0
NULL 9 0
select * from t1 where (a is null or a = 7) and b=7 and c=0;
a b c
-NULL 7 0
7 7 0
+NULL 7 0
select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
a b c
NULL 7 0
@@ -136,26 +141,122 @@ select * from t1 where b like "6%";
a b c
6 6 0
drop table t1;
-DROP TABLE IF EXISTS t1,t2;
+rename table t2 to t1;
+alter table t1 modify b int null;
+insert into t1 values (7,null), (8,null), (8,7);
+explain select * from t1 where a = 7 and (b=7 or b is null);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref_or_null a,b a 10 const,const 2 Using where; Using index
+select * from t1 where a = 7 and (b=7 or b is null);
+a b
+7 7
+7 NULL
+explain select * from t1 where (a = 7 or a is null) and (b=7 or b is null);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a,b a 10 NULL 3 Using where; Using index
+select * from t1 where (a = 7 or a is null) and (b=7 or b is null);
+a b
+NULL 7
+7 NULL
+7 7
+explain select * from t1 where (a = 7 or a is null) and (a = 7 or a is null);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref_or_null a a 5 const 5 Using where; Using index
+select * from t1 where (a = 7 or a is null) and (a = 7 or a is null);
+a b
+7 NULL
+7 7
+NULL 7
+NULL 9
+NULL 9
+create table t2 (a int);
+insert into t2 values (7),(8);
+explain select * from t2 straight_join t1 where t1.a=t2.a and b is null;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2
+1 SIMPLE t1 ref a,b a 10 test.t2.a,const 2 Using where; Using index
+drop index b on t1;
+explain select * from t2,t1 where t1.a=t2.a and b is null;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2
+1 SIMPLE t1 ref a a 10 test.t2.a,const 2 Using where; Using index
+select * from t2,t1 where t1.a=t2.a and b is null;
+a a b
+7 7 NULL
+8 8 NULL
+explain select * from t2,t1 where t1.a=t2.a and (b= 7 or b is null);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2
+1 SIMPLE t1 ref_or_null a a 10 test.t2.a,const 4 Using where; Using index
+select * from t2,t1 where t1.a=t2.a and (b= 7 or b is null);
+a a b
+7 7 7
+7 7 NULL
+8 8 7
+8 8 NULL
+explain select * from t2,t1 where (t1.a=t2.a or t1.a is null) and b= 7;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2
+1 SIMPLE t1 ref_or_null a a 10 test.t2.a,const 4 Using where; Using index
+select * from t2,t1 where (t1.a=t2.a or t1.a is null) and b= 7;
+a a b
+7 7 7
+7 NULL 7
+8 8 7
+8 NULL 7
+explain select * from t2,t1 where (t1.a=t2.a or t1.a is null) and (b= 7 or b is null);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2
+1 SIMPLE t1 ref_or_null a a 5 test.t2.a 4 Using where; Using index
+select * from t2,t1 where (t1.a=t2.a or t1.a is null) and (b= 7 or b is null);
+a a b
+7 7 NULL
+7 7 7
+7 NULL 7
+8 8 NULL
+8 8 7
+8 NULL 7
+insert into t2 values (null),(6);
+delete from t1 where a=8;
+explain select * from t2,t1 where t1.a=t2.a or t1.a is null;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4
+1 SIMPLE t1 ref_or_null a a 5 test.t2.a 4 Using where; Using index
+explain select * from t2,t1 where t1.a<=>t2.a or (t1.a is null and t1.b <> 9);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4
+1 SIMPLE t1 ref_or_null a a 5 test.t2.a 4 Using where; Using index
+select * from t2,t1 where t1.a<=>t2.a or (t1.a is null and t1.b <> 9);
+a a b
+7 7 NULL
+7 7 7
+7 NULL 7
+8 NULL 7
+NULL NULL 7
+NULL NULL 9
+NULL NULL 9
+6 6 6
+6 NULL 7
+drop table t1,t2;
CREATE TABLE t1 (
id int(10) unsigned NOT NULL auto_increment,
uniq_id int(10) unsigned default NULL,
PRIMARY KEY (id),
UNIQUE KEY idx1 (uniq_id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
CREATE TABLE t2 (
id int(10) unsigned NOT NULL auto_increment,
uniq_id int(10) unsigned default NULL,
PRIMARY KEY (id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL);
INSERT INTO t2 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL);
explain select id from t1 where uniq_id is null;
-table type possible_keys key key_len ref rows Extra
-t1 ref idx1 idx1 5 const 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx1 idx1 5 const 1 Using where
explain select id from t1 where uniq_id =1;
-table type possible_keys key key_len ref rows Extra
-t1 const idx1 idx1 5 const 1
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const idx1 idx1 5 const 1
UPDATE t1 SET id=id+100 where uniq_id is null;
UPDATE t2 SET id=id+100 where uniq_id is null;
select id from t1 where uniq_id is null;
@@ -194,13 +295,13 @@ CREATE TABLE `t1` (
`product_id` char(32) NOT NULL default '',
`product_type` int(11) NOT NULL default '0',
PRIMARY KEY (`order_id`,`product_id`,`product_type`)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
CREATE TABLE `t2` (
`order_id` char(32) NOT NULL default '',
`product_id` char(32) NOT NULL default '',
`product_type` int(11) NOT NULL default '0',
PRIMARY KEY (`order_id`,`product_id`,`product_type`)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 (order_id, product_id, product_type) VALUES
('3d7ce39b5d4b3e3d22aaafe9b633de51',1206029, 3),
('3d7ce39b5d4b3e3d22aaafe9b633de51',5880836, 3),
@@ -235,6 +336,8 @@ index (id),
index (id2)
);
insert into t1 values(null,null),(1,1);
+Warnings:
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'id2' at row 1
select * from t1;
id id2
NULL 0
diff --git a/mysql-test/r/odbc.result b/mysql-test/r/odbc.result
index 5aa163a663e..c0b2ada0053 100644
--- a/mysql-test/r/odbc.result
+++ b/mysql-test/r/odbc.result
@@ -1,7 +1,7 @@
+drop table if exists t1;
select {fn length("hello")}, { date "1997-10-20" };
{fn length("hello")} 1997-10-20
5 1997-10-20
-drop table if exists t1;
create table t1 (a int not null auto_increment,b int not null,primary key (a,b));
insert into t1 SET A=NULL,B=1;
insert into t1 SET a=null,b=2;
@@ -11,6 +11,6 @@ a b
select * from t1 where a is null;
a b
explain select * from t1 where b is null;
-Comment
-Impossible WHERE noticed after reading const tables
+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
drop table t1;
diff --git a/mysql-test/r/olap.result b/mysql-test/r/olap.result
index 52bd83df5ed..bcbe5a8791c 100644
--- a/mysql-test/r/olap.result
+++ b/mysql-test/r/olap.result
@@ -1,27 +1,309 @@
-drop table if exists sales;
-create table sales ( product varchar(32), country varchar(32), year int, profit int);
-insert into sales values ( 'Computer', 'India',2000, 1200),
-( 'TV', 'United States', 1999, 150),
-( 'Calculator', 'United States', 1999,50),
-( 'Computer', 'United States', 1999,1500),
-( 'Computer', 'United States', 2000,1500),
-( 'TV', 'United States', 2000, 150),
-( 'TV', 'India', 2000, 100),
-( 'TV', 'India', 2000, 100),
-( 'Calculator', 'United States', 2000,75),
-( 'Calculator', 'India', 2000,75),
-( 'TV', 'India', 1999, 100),
-( 'Computer', 'India', 1999,1200),
-( 'Computer', 'United States', 2000,1500),
-( 'Calculator', 'United States', 2000,75);
-select product, country , year, sum(profit) from sales group by product, country, year with cube;
-This version of MySQL doesn't yet support 'CUBE'
-explain select product, country , year, sum(profit) from sales group by product, country, year with cube;
-This version of MySQL doesn't yet support 'CUBE'
-select product, country , year, sum(profit) from sales group by product, country, year with rollup;
-This version of MySQL doesn't yet support 'ROLLUP'
-explain select product, country , year, sum(profit) from sales group by product, country, year with rollup;
-This version of MySQL doesn't yet support 'ROLLUP'
-select product, country , year, sum(profit) from sales group by product, country, year with cube union all select product, country , year, sum(profit) from sales group by product, country, year with rollup;
-This version of MySQL doesn't yet support 'CUBE'
-drop table sales;
+drop table if exists t1,t2;
+create table t1 (product varchar(32), country_id int not null, year int, profit int);
+insert into t1 values ( 'Computer', 2,2000, 1200),
+( 'TV', 1, 1999, 150),
+( 'Calculator', 1, 1999,50),
+( 'Computer', 1, 1999,1500),
+( 'Computer', 1, 2000,1500),
+( 'TV', 1, 2000, 150),
+( 'TV', 2, 2000, 100),
+( 'TV', 2, 2000, 100),
+( 'Calculator', 1, 2000,75),
+( 'Calculator', 2, 2000,75),
+( 'TV', 1, 1999, 100),
+( 'Computer', 1, 1999,1200),
+( 'Computer', 2, 2000,1500),
+( 'Calculator', 2, 2000,75),
+( 'Phone', 3, 2003,10)
+;
+create table t2 (country_id int primary key, country char(20) not null);
+insert into t2 values (1, 'USA'),(2,'India'), (3,'Finland');
+select product, sum(profit) from t1 group by product;
+product sum(profit)
+Calculator 275
+Computer 6900
+Phone 10
+TV 600
+select product, sum(profit) from t1 group by product with rollup;
+product sum(profit)
+Calculator 275
+Computer 6900
+Phone 10
+TV 600
+NULL 7785
+select product, sum(profit) from t1 group by 1 with rollup;
+product sum(profit)
+Calculator 275
+Computer 6900
+Phone 10
+TV 600
+NULL 7785
+select product, sum(profit),avg(profit) from t1 group by product with rollup;
+product sum(profit) avg(profit)
+Calculator 275 68.7500
+Computer 6900 1380.0000
+Phone 10 10.0000
+TV 600 120.0000
+NULL 7785 519.0000
+select product, country_id , year, sum(profit) from t1 group by product, country_id, year;
+product country_id year sum(profit)
+Calculator 1 1999 50
+Calculator 1 2000 75
+Calculator 2 2000 150
+Computer 1 1999 2700
+Computer 1 2000 1500
+Computer 2 2000 2700
+Phone 3 2003 10
+TV 1 1999 250
+TV 1 2000 150
+TV 2 2000 200
+select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup;
+product country_id year sum(profit)
+Calculator 1 1999 50
+Calculator 1 2000 75
+Calculator 1 NULL 125
+Calculator 2 2000 150
+Calculator 2 NULL 150
+Calculator NULL NULL 275
+Computer 1 1999 2700
+Computer 1 2000 1500
+Computer 1 NULL 4200
+Computer 2 2000 2700
+Computer 2 NULL 2700
+Computer NULL NULL 6900
+Phone 3 2003 10
+Phone 3 NULL 10
+Phone NULL NULL 10
+TV 1 1999 250
+TV 1 2000 150
+TV 1 NULL 400
+TV 2 2000 200
+TV 2 NULL 200
+TV NULL NULL 600
+NULL NULL NULL 7785
+explain extended select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using temporary; Using filesort
+Warnings:
+Note 1003 select test.t1.product AS `product`,test.t1.country_id AS `country_id`,test.t1.year AS `year`,sum(test.t1.profit) AS `sum(profit)` from test.t1 group by test.t1.product,test.t1.country_id,test.t1.year with rollup
+select product, country_id , sum(profit) from t1 group by product desc, country_id with rollup;
+product country_id sum(profit)
+TV 1 400
+TV 2 200
+TV NULL 600
+Phone 3 10
+Phone NULL 10
+Computer 1 4200
+Computer 2 2700
+Computer NULL 6900
+Calculator 1 125
+Calculator 2 150
+Calculator NULL 275
+NULL NULL 7785
+select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup limit 5;
+product country_id year sum(profit)
+Calculator 1 1999 50
+Calculator 1 2000 75
+Calculator 1 NULL 125
+Calculator 2 2000 150
+Calculator 2 NULL 150
+select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup limit 3,3;
+product country_id year sum(profit)
+Calculator 2 2000 150
+Calculator 2 NULL 150
+Calculator NULL NULL 275
+select product, country_id, count(*), count(distinct year) from t1 group by product, country_id;
+product country_id count(*) count(distinct year)
+Calculator 1 2 2
+Calculator 2 2 1
+Computer 1 3 2
+Computer 2 2 1
+Phone 3 1 1
+TV 1 3 2
+TV 2 2 1
+select product, country_id, count(*), count(distinct year) from t1 group by product, country_id with rollup;
+product country_id count(*) count(distinct year)
+Calculator 1 2 2
+Calculator 2 2 1
+Calculator NULL 4 2
+Computer 1 3 2
+Computer 2 2 1
+Computer NULL 5 2
+Phone 3 1 1
+Phone NULL 1 1
+TV 1 3 2
+TV 2 2 1
+TV NULL 5 2
+NULL NULL 15 3
+select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup having country_id = 1;
+product country_id year sum(profit)
+Calculator 1 1999 50
+Calculator 1 2000 75
+Calculator 1 NULL 125
+Computer 1 1999 2700
+Computer 1 2000 1500
+Computer 1 NULL 4200
+TV 1 1999 250
+TV 1 2000 150
+TV 1 NULL 400
+select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup having sum(profit) > 200;
+product country_id year sum(profit)
+Calculator NULL NULL 275
+Computer 1 1999 2700
+Computer 1 2000 1500
+Computer 1 NULL 4200
+Computer 2 2000 2700
+Computer 2 NULL 2700
+Computer NULL NULL 6900
+TV 1 1999 250
+TV 1 NULL 400
+TV NULL NULL 600
+NULL NULL NULL 7785
+select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup having sum(profit) > 7000;
+product country_id year sum(profit)
+NULL NULL NULL 7785
+select concat(product,':',country_id) as 'prod', concat(":",year,":") as 'year',1+1, sum(profit)/count(*) from t1 group by 1,2 with rollup;
+prod year 1+1 sum(profit)/count(*)
+Calculator:1 :1999: 2 50.00
+Calculator:1 :2000: 2 75.00
+Calculator:1 NULL 2 62.50
+Calculator:2 :2000: 2 75.00
+Calculator:2 NULL 2 75.00
+Computer:1 :1999: 2 1350.00
+Computer:1 :2000: 2 1500.00
+Computer:1 NULL 2 1400.00
+Computer:2 :2000: 2 1350.00
+Computer:2 NULL 2 1350.00
+Phone:3 :2003: 2 10.00
+Phone:3 NULL 2 10.00
+TV:1 :1999: 2 125.00
+TV:1 :2000: 2 150.00
+TV:1 NULL 2 133.33
+TV:2 :2000: 2 100.00
+TV:2 NULL 2 100.00
+NULL NULL 2 519.00
+select product, sum(profit)/count(*) from t1 group by product with rollup;
+product sum(profit)/count(*)
+Calculator 68.75
+Computer 1380.00
+Phone 10.00
+TV 120.00
+NULL 519.00
+select left(product,4) as prod, sum(profit)/count(*) from t1 group by prod with rollup;
+prod sum(profit)/count(*)
+Calc 68.75
+Comp 1380.00
+Phon 10.00
+TV 120.00
+NULL 519.00
+select concat(product,':',country_id), 1+1, sum(profit)/count(*) from t1 group by concat(product,':',country_id) with rollup;
+concat(product,':',country_id) 1+1 sum(profit)/count(*)
+Calculator:1 2 62.50
+Calculator:2 2 75.00
+Computer:1 2 1400.00
+Computer:2 2 1350.00
+Phone:3 2 10.00
+TV:1 2 133.33
+TV:2 2 100.00
+NULL 2 519.00
+select product, country , year, sum(profit) from t1,t2 where t1.country_id=t2.country_id group by product, country, year with rollup;
+product country year sum(profit)
+Calculator India 2000 150
+Calculator India NULL 150
+Calculator USA 1999 50
+Calculator USA 2000 75
+Calculator USA NULL 125
+Calculator NULL NULL 275
+Computer India 2000 2700
+Computer India NULL 2700
+Computer USA 1999 2700
+Computer USA 2000 1500
+Computer USA NULL 4200
+Computer NULL NULL 6900
+Phone Finland 2003 10
+Phone Finland NULL 10
+Phone NULL NULL 10
+TV India 2000 200
+TV India NULL 200
+TV USA 1999 250
+TV USA 2000 150
+TV USA NULL 400
+TV NULL NULL 600
+NULL NULL NULL 7785
+select product, `sum` from (select product, sum(profit) as 'sum' from t1 group by product with rollup) as tmp where product is null;
+product sum
+NULL 7785
+select product from t1 where exists (select product, country_id , sum(profit) from t1 as t2 where t1.product=t2.product group by product, country_id with rollup having sum(profit) > 6000);
+product
+Computer
+Computer
+Computer
+Computer
+Computer
+select product, country_id , year, sum(profit) from t1 group by product, country_id, year having country_id is NULL;
+product country_id year sum(profit)
+select concat(':',product,':'), sum(profit),avg(profit) from t1 group by product with rollup;
+concat(':',product,':') sum(profit) avg(profit)
+:Calculator: 275 68.7500
+:Computer: 6900 1380.0000
+:Phone: 10 10.0000
+:TV: 600 120.0000
+:TV: 7785 519.0000
+select product, country_id , year, sum(profit) from t1 group by product, country_id, year with cube;
+ERROR 42000: This version of MySQL doesn't yet support 'CUBE'
+explain select product, country_id , year, sum(profit) from t1 group by product, country_id, year with cube;
+ERROR 42000: This version of MySQL doesn't yet support 'CUBE'
+select product, country_id , year, sum(profit) from t1 group by product, country_id, year with cube union all select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup;
+ERROR 42000: This version of MySQL doesn't yet support 'CUBE'
+drop table t1,t2;
+CREATE TABLE t1 (i int);
+INSERT INTO t1 VALUES(100);
+CREATE TABLE t2 (i int);
+INSERT INTO t2 VALUES (100),(200);
+SELECT i, COUNT(*) FROM t1 GROUP BY i WITH ROLLUP;
+i COUNT(*)
+100 1
+NULL 1
+SELECT t1.i, t2.i, COUNT(*) FROM t1,t2 GROUP BY t1.i,t2.i WITH ROLLUP;
+i i COUNT(*)
+100 100 1
+100 200 1
+100 NULL 2
+NULL NULL 2
+drop table t1,t2;
+CREATE TABLE user_day(
+user_id INT NOT NULL,
+date DATE NOT NULL,
+UNIQUE INDEX user_date (user_id, date)
+);
+INSERT INTO user_day VALUES
+(1, '2004-06-06' ),
+(1, '2004-06-07' ),
+(2, '2004-06-06' );
+SELECT
+d.date AS day,
+COUNT(d.user_id) as sample,
+COUNT(next_day.user_id) AS not_cancelled
+FROM user_day d
+LEFT JOIN user_day next_day
+ON next_day.user_id=d.user_id AND
+next_day.date= DATE_ADD( d.date, interval 1 day )
+GROUP BY day;
+day sample not_cancelled
+2004-06-06 2 1
+2004-06-07 1 0
+SELECT
+d.date AS day,
+COUNT(d.user_id) as sample,
+COUNT(next_day.user_id) AS not_cancelled
+FROM user_day d
+LEFT JOIN user_day next_day
+ON next_day.user_id=d.user_id AND
+next_day.date= DATE_ADD( d.date, interval 1 day )
+GROUP BY day
+WITH ROLLUP;
+day sample not_cancelled
+2004-06-06 2 1
+2004-06-07 1 0
+NULL 3 1
+DROP TABLE user_day;
diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result
index f6c7bf5bc79..f7cb17a1a74 100644
--- a/mysql-test/r/openssl_1.result
+++ b/mysql-test/r/openssl_1.result
@@ -2,30 +2,30 @@ drop table if exists t1;
create table t1(f1 int);
insert into t1 values (5);
grant select on test.* to ssl_user1@localhost require SSL;
-grant select on test.* to ssl_user2@localhost require cipher "EDH-RSA-DES-CBC3-SHA";
-grant select on test.* to ssl_user3@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com";
-grant select on test.* to ssl_user4@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com";
+grant select on test.* to ssl_user2@localhost require cipher "DHE-RSA-AES256-SHA";
+grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com";
+grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com";
flush privileges;
select * from t1;
f1
5
delete from t1;
-Access denied for user: 'ssl_user1@localhost' to database 'test'
+ERROR 42000: Access denied for user 'ssl_user1'@'localhost' to database 'test'
select * from t1;
f1
5
delete from t1;
-Access denied for user: 'ssl_user2@localhost' to database 'test'
+ERROR 42000: Access denied for user 'ssl_user2'@'localhost' to database 'test'
select * from t1;
f1
5
delete from t1;
-Access denied for user: 'ssl_user3@localhost' to database 'test'
+ERROR 42000: Access denied for user 'ssl_user3'@'localhost' to database 'test'
select * from t1;
f1
5
delete from t1;
-Access denied for user: 'ssl_user4@localhost' to database 'test'
+ERROR 42000: Access denied for user 'ssl_user4'@'localhost' to database 'test'
delete from mysql.user where user='ssl_user%';
delete from mysql.db where user='ssl_user%';
flush privileges;
diff --git a/mysql-test/r/openssl_2.result b/mysql-test/r/openssl_2.result
index b5c67dfbcb0..879c623dd40 100644
--- a/mysql-test/r/openssl_2.result
+++ b/mysql-test/r/openssl_2.result
@@ -1,2 +1,25 @@
-SHOW STATUS LIKE 'SSL%';
+SHOW STATUS LIKE 'Ssl%';
Variable_name Value
+Ssl_accepts 1
+Ssl_finished_accepts 1
+Ssl_finished_connects 0
+Ssl_accept_renegotiates 0
+Ssl_connect_renegotiates 0
+Ssl_callback_cache_hits 0
+Ssl_session_cache_hits 0
+Ssl_session_cache_misses 0
+Ssl_session_cache_timeouts 0
+Ssl_used_session_cache_entries 1
+Ssl_client_connects 0
+Ssl_session_cache_overflows 0
+Ssl_session_cache_size 128
+Ssl_session_cache_mode SERVER
+Ssl_sessions_reused 0
+Ssl_ctx_verify_mode 7
+Ssl_ctx_verify_depth 4294967295
+Ssl_verify_mode 7
+Ssl_verify_depth 4294967295
+Ssl_version TLSv1
+Ssl_cipher EDH-RSA-DES-CBC3-SHA
+Ssl_cipher_list
+Ssl_default_timeout 7200
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index 859d9d4cab0..94d56bbc2fa 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -85,6 +85,15 @@ i
1
3
drop table t1;
+create table t1 ( pk int primary key, name varchar(255) not null, number varchar(255) not null);
+insert into t1 values (1, 'Gamma', '123'), (2, 'Gamma Ext', '123a'), (3, 'Alpha', '001'), (4, 'Beta', '200c');
+select distinct t1.name as 'Building Name',t1.number as 'Building Number' from t1 order by t1.name asc;
+Building Name Building Number
+Alpha 001
+Beta 200c
+Gamma 123
+Gamma Ext 123a
+drop table t1;
create table t1 (id int not null,col1 int not null,col2 int not null,index(col1));
insert into t1 values(1,2,2),(2,2,1),(3,1,2),(4,1,1),(5,1,4),(6,2,3),(7,3,1),(8,2,4);
select * from t1 order by col1,col2;
@@ -107,7 +116,7 @@ col1
2
3
2
-select col1 as id from t1 order by t1.id;
+select col1 as id from t1 order by id;
id
1
1
@@ -117,16 +126,16 @@ id
2
2
3
-select concat(col1) as id from t1 order by t1.id;
+select concat(col1) as id from t1 order by id;
id
-2
-2
1
1
1
2
-3
2
+2
+2
+3
drop table t1;
CREATE TABLE t1 (id int auto_increment primary key,aika varchar(40),aikakentta timestamp);
insert into t1 (aika) values ('Keskiviikko');
@@ -222,7 +231,6 @@ DateOfAction TransactionID
1999-07-27 834
1999-07-27 840
drop table t1,t2,t3;
-drop table if exists t1;
CREATE TABLE t1 (
member_id int(11) NOT NULL auto_increment,
inschrijf_datum varchar(20) NOT NULL default '',
@@ -252,7 +260,7 @@ favo_muziek varchar(30) NOT NULL default '',
info text NOT NULL,
ipnr varchar(30) NOT NULL default '',
PRIMARY KEY (member_id)
-) TYPE=MyISAM PACK_KEYS=1;
+) ENGINE=MyISAM PACK_KEYS=1;
insert into t1 (member_id) values (1),(2),(3);
select member_id, nickname, voornaam FROM t1
ORDER by lastchange_datum DESC LIMIT 2;
@@ -263,14 +271,14 @@ drop table t1;
create table t1 (a int not null, b int, c varchar(10), key (a, b, c));
insert into t1 values (1, NULL, NULL), (1, NULL, 'b'), (1, 1, NULL), (1, 1, 'b'), (1, 1, 'b'), (2, 1, 'a'), (2, 1, 'b'), (2, 2, 'a'), (2, 2, 'b'), (2, 3, 'c'),(1,3,'b');
explain select * from t1 where (a = 1 and b is null and c = 'b') or (a > 2) order by a desc;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 20 NULL 2 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 20 NULL 2 Using where; Using index
select * from t1 where (a = 1 and b is null and c = 'b') or (a > 2) order by a desc;
a b c
1 NULL b
explain select * from t1 where a >= 1 and a < 3 order by a desc;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 4 NULL 10 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 4 NULL 10 Using where; Using index
select * from t1 where a >= 1 and a < 3 order by a desc;
a b c
2 3 c
@@ -285,8 +293,8 @@ a b c
1 NULL b
1 NULL NULL
explain select * from t1 where a = 1 order by a desc, b desc;
-table type possible_keys key key_len ref rows Extra
-t1 ref a a 4 const 5 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 4 const 5 Using where; Using index
select * from t1 where a = 1 order by a desc, b desc;
a b c
1 3 b
@@ -296,34 +304,34 @@ a b c
1 NULL b
1 NULL NULL
explain select * from t1 where a = 1 and b is null order by a desc, b desc;
-table type possible_keys key key_len ref rows Extra
-t1 ref a a 9 const,const 2 Using where; Using index; Using filesort
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 9 const,const 2 Using where; Using index; Using filesort
select * from t1 where a = 1 and b is null order by a desc, b desc;
a b c
1 NULL NULL
1 NULL b
explain select * from t1 where a >= 1 and a < 3 and b >0 order by a desc,b desc;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 9 NULL 8 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 9 NULL 8 Using where; Using index
explain select * from t1 where a = 2 and b >0 order by a desc,b desc;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 9 NULL 4 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 9 NULL 5 Using where; Using index
explain select * from t1 where a = 2 and b is null order by a desc,b desc;
-table type possible_keys key key_len ref rows Extra
-t1 ref a a 9 const,const 1 Using where; Using index; Using filesort
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 9 const,const 1 Using where; Using index; Using filesort
explain select * from t1 where a = 2 and (b is null or b > 0) order by a
desc,b desc;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 9 NULL 5 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 9 NULL 6 Using where; Using index
explain select * from t1 where a = 2 and b > 0 order by a desc,b desc;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 9 NULL 4 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 9 NULL 5 Using where; Using index
explain select * from t1 where a = 2 and b < 2 order by a desc,b desc;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 9 NULL 2 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 9 NULL 2 Using where; Using index
explain select * from t1 where a = 1 order by b desc;
-table type possible_keys key key_len ref rows Extra
-t1 ref a a 4 const 5 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 4 const 5 Using where; Using index
select * from t1 where a = 1 order by b desc;
a b c
1 3 b
@@ -333,9 +341,14 @@ a b c
1 NULL b
1 NULL NULL
alter table t1 modify b int not null, modify c varchar(10) not null;
+Warnings:
+Warning 1265 Data truncated for column 'b' at row 1
+Warning 1265 Data truncated for column 'c' at row 1
+Warning 1265 Data truncated for column 'b' at row 2
+Warning 1265 Data truncated for column 'c' at row 3
explain select * from t1 order by a, b, c;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL a 18 NULL 11 Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL a 18 NULL 11 Using index
select * from t1 order by a, b, c;
a b c
1 0
@@ -350,8 +363,8 @@ a b c
2 2 b
2 3 c
explain select * from t1 order by a desc, b desc, c desc;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL a 18 NULL 11 Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL a 18 NULL 11 Using index
select * from t1 order by a desc, b desc, c desc;
a b c
2 3 c
@@ -366,15 +379,15 @@ a b c
1 0 b
1 0
explain select * from t1 where (a = 1 and b = 1 and c = 'b') or (a > 2) order by a desc;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 18 NULL 3 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 18 NULL 3 Using where; Using index
select * from t1 where (a = 1 and b = 1 and c = 'b') or (a > 2) order by a desc;
a b c
1 1 b
1 1 b
explain select * from t1 where a < 2 and b <= 1 order by a desc, b desc;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 4 NULL 6 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 4 NULL 6 Using where; Using index
select * from t1 where a < 2 and b <= 1 order by a desc, b desc;
a b c
1 1 b
@@ -397,8 +410,8 @@ a b c
1 1 b
1 1
explain select * from t1 where a between 1 and 3 and b <= 1 order by a desc, b desc;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 8 NULL 10 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 8 NULL 10 Using where; Using index
select * from t1 where a between 1 and 3 and b <= 1 order by a desc, b desc;
a b c
2 1 b
@@ -409,8 +422,8 @@ a b c
1 0 b
1 0
explain select * from t1 where a between 0 and 1 order by a desc, b desc;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 4 NULL 5 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 4 NULL 5 Using where; Using index
select * from t1 where a between 0 and 1 order by a desc, b desc;
a b c
1 3 b
@@ -425,7 +438,7 @@ gid int(10) unsigned NOT NULL auto_increment,
cid smallint(5) unsigned NOT NULL default '0',
PRIMARY KEY (gid),
KEY component_id (cid)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (103853,108),(103867,108),(103962,108),(104505,108),(104619,108),(104620,108);
ALTER TABLE t1 add skr int(10) not null;
CREATE TABLE t2 (
@@ -435,12 +448,12 @@ sid tinyint(3) unsigned NOT NULL default '1',
PRIMARY KEY (gid),
KEY uid (uid),
KEY status_id (sid)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t2 VALUES (103853,250,5),(103867,27,5),(103962,27,5),(104505,117,5),(104619,75,5),(104620,15,5);
CREATE TABLE t3 (
uid smallint(6) NOT NULL auto_increment,
PRIMARY KEY (uid)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t3 VALUES (1),(15),(27),(75),(117),(250);
ALTER TABLE t3 add skr int(10) not null;
select t1.gid, t2.sid, t3.uid from t2, t1, t3 where t2.gid = t1.gid and t2.uid = t3.uid order by t3.uid, t1.gid;
@@ -460,27 +473,27 @@ gid sid uid
104505 5 117
103853 5 250
EXPLAIN select t1.gid, t2.sid, t3.uid from t3, t2, t1 where t2.gid = t1.gid and t2.uid = t3.uid order by t1.gid, t3.uid;
-table type possible_keys key key_len ref rows Extra
-t1 index PRIMARY PRIMARY 4 NULL 6 Using index
-t2 eq_ref PRIMARY,uid PRIMARY 4 t1.gid 1
-t3 eq_ref PRIMARY PRIMARY 2 t2.uid 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 6 Using index
+1 SIMPLE t2 eq_ref PRIMARY,uid PRIMARY 4 test.t1.gid 1
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 test.t2.uid 1 Using where; Using index
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t1.gid,t3.skr;
-table type possible_keys key key_len ref rows Extra
-t3 ALL PRIMARY NULL NULL NULL 6 Using temporary; Using filesort
-t1 eq_ref PRIMARY PRIMARY 4 t3.uid 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 ALL PRIMARY NULL NULL NULL 6 Using temporary; Using filesort
+1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.uid 1 Using where; Using index
EXPLAIN SELECT t1.gid, t2.sid, t3.uid from t2, t1, t3 where t2.gid = t1.gid and t2.uid = t3.uid order by t3.uid, t1.gid;
-table type possible_keys key key_len ref rows Extra
-t1 index PRIMARY PRIMARY 4 NULL 6 Using index; Using temporary; Using filesort
-t2 eq_ref PRIMARY,uid PRIMARY 4 t1.gid 1
-t3 eq_ref PRIMARY PRIMARY 2 t2.uid 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 6 Using index; Using temporary; Using filesort
+1 SIMPLE t2 eq_ref PRIMARY,uid PRIMARY 4 test.t1.gid 1
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 test.t2.uid 1 Using where; Using index
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t3.skr,t1.gid;
-table type possible_keys key key_len ref rows Extra
-t3 ALL PRIMARY NULL NULL NULL 6 Using temporary; Using filesort
-t1 eq_ref PRIMARY PRIMARY 4 t3.uid 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 ALL PRIMARY NULL NULL NULL 6 Using temporary; Using filesort
+1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.uid 1 Using where; Using index
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.skr = t3.uid order by t1.gid,t3.skr;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
-t3 eq_ref PRIMARY PRIMARY 2 t1.skr 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 test.t1.skr 1 Using where
drop table t1,t2,t3;
CREATE TABLE t1 (
`titre` char(80) NOT NULL default '',
@@ -542,15 +555,181 @@ a b
1 2
5 NULL
DROP TABLE t1;
+create table t1(id int not null auto_increment primary key, t char(12));
+explain select id,t from t1 order by id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 Using filesort
+explain select id,t from t1 force index (primary) order by id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 1000
+drop table t1;
+CREATE TABLE t1 (
+FieldKey varchar(36) NOT NULL default '',
+LongVal bigint(20) default NULL,
+StringVal mediumtext,
+KEY FieldKey (FieldKey),
+KEY LongField (FieldKey,LongVal),
+KEY StringField (FieldKey,StringVal(32))
+);
+INSERT INTO t1 VALUES ('0',3,'0'),('0',2,'1'),('0',1,'2'),('1',2,'1'),('1',1,'3'), ('1',0,'2'),('2',3,'0'),('2',2,'1'),('2',1,'2'),('2',3,'0'),('2',2,'1'),('2',1,'2'),('3',2,'1'),('3',1,'2'),('3','3','3');
+EXPLAIN SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref FieldKey,LongField,StringField LongField 36 const 3 Using where
+SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal;
+FieldKey LongVal StringVal
+1 0 2
+1 1 3
+1 2 1
+EXPLAIN SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range FieldKey,LongField,StringField FieldKey 36 NULL 4 Using where; Using filesort
+SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal;
+FieldKey LongVal StringVal
+3 1 2
+3 2 1
+3 3 3
+EXPLAIN SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY FieldKey, LongVal;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range FieldKey,LongField,StringField LongField 36 NULL 4 Using where
+SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY FieldKey, LongVal;
+FieldKey LongVal StringVal
+3 1 2
+3 2 1
+3 3 3
+DROP TABLE t1;
CREATE TABLE t1 (a INT, b INT);
SET @id=0;
UPDATE t1 SET a=0 ORDER BY (a=@id), b;
DROP TABLE t1;
-create table t1(id int not null auto_increment primary key, t char(12));
-explain select id,t from t1 order by id;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 1000 Using filesort
-explain select id,t from t1 force index (primary) order by id;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL PRIMARY 4 NULL 1000
+CREATE TABLE t1 ( id smallint(6) unsigned NOT NULL default '0', menu tinyint(4) NOT NULL default '0', KEY id (id), KEY menu (menu)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (11384, 2),(11392, 2);
+SELECT id FROM t1 WHERE id <11984 AND menu =2 ORDER BY id DESC LIMIT 1 ;
+id
+11392
+drop table t1;
+create table t1(a int, b int, index(b));
+insert into t1 values (2, 1), (1, 1), (4, NULL), (3, NULL), (6, 2), (5, 2);
+explain select * from t1 where b=1 or b is null order by a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref_or_null b b 5 const 3 Using where; Using filesort
+select * from t1 where b=1 or b is null order by a;
+a b
+1 1
+2 1
+3 NULL
+4 NULL
+explain select * from t1 where b=2 or b is null order by a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref_or_null b b 5 const 4 Using where; Using filesort
+select * from t1 where b=2 or b is null order by a;
+a b
+3 NULL
+4 NULL
+5 2
+6 2
+drop table t1;
+create table t1 (a int not null auto_increment, b int not null, c int not null, d int not null,
+key(a,b,d), key(c,b,a));
+create table t2 like t1;
+insert into t1 values (NULL, 1, 2, 0), (NULL, 2, 1, 1), (NULL, 3, 4, 2), (NULL, 4, 3, 3);
+insert into t2 select null, b, c, d from t1;
+insert into t1 select null, b, c, d from t2;
+insert into t2 select null, b, c, d from t1;
+insert into t1 select null, b, c, d from t2;
+insert into t2 select null, b, c, d from t1;
+insert into t1 select null, b, c, d from t2;
+insert into t2 select null, b, c, d from t1;
+insert into t1 select null, b, c, d from t2;
+insert into t2 select null, b, c, d from t1;
+insert into t1 select null, b, c, d from t2;
+optimize table t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+set @row=10;
+insert into t1 select 1, b, c + (@row:=@row - 1) * 10, d - @row from t2 limit 10;
+select * from t1 where a=1 and b in (1) order by c, b, a;
+a b c d
+1 1 2 0
+1 1 12 -1
+1 1 52 -5
+1 1 92 -9
+select * from t1 where a=1 and b in (1);
+a b c d
+1 1 92 -9
+1 1 52 -5
+1 1 12 -1
+1 1 2 0
+drop table t1, t2;
+create table t1 (col1 int, col int);
+create table t2 (col2 int, col int);
+insert into t1 values (1,1),(2,2),(3,3);
+insert into t2 values (1,3),(2,2),(3,1);
+select t1.* , t2.col as t2_col from t1 left join t2 on (t1.col1=t2.col2)
+order by col;
+col1 col t2_col
+1 1 3
+2 2 2
+3 3 1
+select col1 as col, col from t1 order by col;
+ERROR 23000: Column 'col' in order clause is ambiguous
+select t1.col as c1, t2.col as c2 from t1, t2 where t1.col1=t2.col2
+order by col;
+ERROR 23000: Column 'col' in order clause is ambiguous
+select t1.col as c1, t2.col as c2 from t1, t2 where t1.col1=t2.col2
+order by col;
+ERROR 23000: Column 'col' in order clause is ambiguous
+select col1 from t1, t2 where t1.col1=t2.col2 order by col;
+ERROR 23000: Column 'col' in order clause is ambiguous
+select t1.col as t1_col, t2.col2 from t1, t2 where t1.col1=t2.col2
+order by col;
+ERROR 23000: Column 'col' in order clause is ambiguous
+select t1.col as t1_col, t2.col from t1, t2 where t1.col1=t2.col2
+order by col;
+t1_col col
+3 1
+2 2
+1 3
+select col2 as c, col as c from t2 order by col;
+c c
+3 1
+2 2
+1 3
+select col2 as col, col as col2 from t2 order by col;
+col col2
+1 3
+2 2
+3 1
+select t2.col2, t2.col, t2.col from t2 order by col;
+col2 col col
+3 1 1
+2 2 2
+1 3 3
+select t2.col2 as col from t2 order by t2.col;
+col
+3
+2
+1
+select t2.col2 as col, t2.col from t2 order by t2.col;
+col col
+3 1
+2 2
+1 3
+select t2.col2, t2.col, t2.col from t2 order by t2.col;
+col2 col col
+3 1 1
+2 2 2
+1 3 3
+drop table t1, t2;
+create table t1 (a char(25));
+insert into t1 set a = repeat('x', 20);
+insert into t1 set a = concat(repeat('x', 19), 'z');
+insert into t1 set a = concat(repeat('x', 19), 'ab');
+insert into t1 set a = concat(repeat('x', 19), 'aa');
+set max_sort_length=20;
+select a from t1 order by a;
+a
+xxxxxxxxxxxxxxxxxxxab
+xxxxxxxxxxxxxxxxxxxaa
+xxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxz
drop table t1;
diff --git a/mysql-test/r/outfile.result b/mysql-test/r/outfile.result
new file mode 100644
index 00000000000..4dc09f65b7c
--- /dev/null
+++ b/mysql-test/r/outfile.result
@@ -0,0 +1,10 @@
+drop table if exists t1;
+CREATE TABLE t1 (a INT);
+EXPLAIN
+SELECT *
+INTO OUTFILE '/tmp/t1.txt'
+ FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
+ FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
+DROP TABLE t1;
diff --git a/mysql-test/r/packet.result b/mysql-test/r/packet.result
index 6733f2b142e..dfb5595e02d 100644
--- a/mysql-test/r/packet.result
+++ b/mysql-test/r/packet.result
@@ -8,11 +8,13 @@ len
select repeat('a',2000);
repeat('a',2000)
NULL
+Warnings:
+Warning 1301 Result of repeat() was larger than max_allowed_packet (1024) - truncated
select @@net_buffer_length, @@max_allowed_packet;
@@net_buffer_length @@max_allowed_packet
1024 1024
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
-Got a packet bigger than 'max_allowed_packet'
+ERROR 08S01: Got a packet bigger than 'max_allowed_packet' bytes
set global max_allowed_packet=default;
set max_allowed_packet=default;
set global net_buffer_length=default;
diff --git a/mysql-test/r/packet.result.es b/mysql-test/r/packet.result.es
new file mode 100644
index 00000000000..0ff587b3957
--- /dev/null
+++ b/mysql-test/r/packet.result.es
@@ -0,0 +1,26 @@
+set global max_allowed_packet=100;
+set max_allowed_packet=100;
+set global net_buffer_length=100;
+set net_buffer_length=100;
+SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
+len
+1024
+select repeat('a',2000);
+repeat('a',2000)
+NULL
+Warnings:
+Warning 1301 Result of repeat() was larger than max_allowed_packet (1024) - truncated
+select @@net_buffer_length, @@max_allowed_packet;
+@@net_buffer_length @@max_allowed_packet
+1024 1024
+SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
+set global max_allowed_packet=default;
+set max_allowed_packet=default;
+set global net_buffer_length=default;
+set net_buffer_length=default;
+SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
+len
+100
+select length(repeat('a',2000));
+length(repeat('a',2000))
+2000
diff --git a/mysql-test/r/preload.result b/mysql-test/r/preload.result
new file mode 100644
index 00000000000..f0b99a8d6f1
--- /dev/null
+++ b/mysql-test/r/preload.result
@@ -0,0 +1,167 @@
+drop table if exists t1, t2;
+create table t1 (
+a int not null auto_increment,
+b char(16) not null,
+primary key (a),
+key (b)
+);
+create table t2(
+a int not null auto_increment,
+b char(16) not null,
+primary key (a),
+key (b)
+);
+insert into t1(b) values
+('test0'),
+('test1'),
+('test2'),
+('test3'),
+('test4'),
+('test5'),
+('test6'),
+('test7');
+insert into t2(b) select b from t1;
+insert into t1(b) select b from t2;
+insert into t2(b) select b from t1;
+insert into t1(b) select b from t2;
+insert into t2(b) select b from t1;
+insert into t1(b) select b from t2;
+insert into t2(b) select b from t1;
+insert into t1(b) select b from t2;
+insert into t2(b) select b from t1;
+insert into t1(b) select b from t2;
+insert into t2(b) select b from t1;
+insert into t1(b) select b from t2;
+insert into t2(b) select b from t1;
+insert into t1(b) select b from t2;
+insert into t2(b) select b from t1;
+insert into t1(b) select b from t2;
+insert into t2(b) select b from t1;
+insert into t1(b) select b from t2;
+select count(*) from t1;
+count(*)
+33448
+select count(*) from t2;
+count(*)
+20672
+flush tables;
+flush status;
+show status like "key_read%";
+Variable_name Value
+Key_read_requests 0
+Key_reads 0
+select count(*) from t1 where b = 'test1';
+count(*)
+4181
+show status like "key_read%";
+Variable_name Value
+Key_read_requests 217
+Key_reads 45
+select count(*) from t1 where b = 'test1';
+count(*)
+4181
+show status like "key_read%";
+Variable_name Value
+Key_read_requests 434
+Key_reads 45
+flush tables;
+flush status;
+select @@preload_buffer_size;
+@@preload_buffer_size
+32768
+load index into cache t1;
+Table Op Msg_type Msg_text
+test.t1 preload_keys status OK
+show status like "key_read%";
+Variable_name Value
+Key_read_requests 0
+Key_reads 0
+select count(*) from t1 where b = 'test1';
+count(*)
+4181
+show status like "key_read%";
+Variable_name Value
+Key_read_requests 217
+Key_reads 45
+flush tables;
+flush status;
+show status like "key_read%";
+Variable_name Value
+Key_read_requests 0
+Key_reads 0
+set session preload_buffer_size=256*1024;
+select @@preload_buffer_size;
+@@preload_buffer_size
+262144
+load index into cache t1 ignore leaves;
+Table Op Msg_type Msg_text
+test.t1 preload_keys status OK
+show status like "key_read%";
+Variable_name Value
+Key_read_requests 0
+Key_reads 0
+select count(*) from t1 where b = 'test1';
+count(*)
+4181
+show status like "key_read%";
+Variable_name Value
+Key_read_requests 217
+Key_reads 45
+flush tables;
+flush status;
+show status like "key_read%";
+Variable_name Value
+Key_read_requests 0
+Key_reads 0
+set session preload_buffer_size=1*1024;
+select @@preload_buffer_size;
+@@preload_buffer_size
+1024
+load index into cache t1, t2 key (primary,b) ignore leaves;
+Table Op Msg_type Msg_text
+test.t1 preload_keys status OK
+test.t2 preload_keys status OK
+show status like "key_read%";
+Variable_name Value
+Key_read_requests 0
+Key_reads 0
+select count(*) from t1 where b = 'test1';
+count(*)
+4181
+select count(*) from t2 where b = 'test1';
+count(*)
+2584
+show status like "key_read%";
+Variable_name Value
+Key_read_requests 351
+Key_reads 73
+flush tables;
+flush status;
+show status like "key_read%";
+Variable_name Value
+Key_read_requests 0
+Key_reads 0
+load index into cache t3, t2 key (primary,b) ;
+Table Op Msg_type Msg_text
+test.t3 preload_keys error Table 'test.t3' doesn't exist
+test.t2 preload_keys status OK
+show status like "key_read%";
+Variable_name Value
+Key_read_requests 0
+Key_reads 0
+flush tables;
+flush status;
+show status like "key_read%";
+Variable_name Value
+Key_read_requests 0
+Key_reads 0
+load index into cache t3 key (b), t2 key (c) ;
+Table Op Msg_type Msg_text
+test.t3 preload_keys error Table 'test.t3' doesn't exist
+test.t2 preload_keys error Key column 'c' doesn't exist in table
+test.t2 preload_keys status Operation failed
+show status like "key_read%";
+Variable_name Value
+Key_read_requests 0
+Key_reads 0
+drop table t1, t2;
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
new file mode 100644
index 00000000000..4cb32fa4644
--- /dev/null
+++ b/mysql-test/r/ps.result
@@ -0,0 +1,484 @@
+drop table if exists t1,t2;
+create table t1
+(
+a int primary key,
+b char(10)
+);
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+set @a=2;
+prepare stmt1 from 'select * from t1 where a <= ?';
+execute stmt1 using @a;
+a b
+1 one
+2 two
+set @a=3;
+execute stmt1 using @a;
+a b
+1 one
+2 two
+3 three
+deallocate prepare no_such_statement;
+ERROR HY000: Unknown prepared statement handler (no_such_statement) given to DEALLOCATE PREPARE
+execute stmt1;
+ERROR HY000: Incorrect arguments to EXECUTE
+prepare stmt2 from 'prepare nested_stmt from "select 1"';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"select 1"' at line 1
+prepare stmt2 from 'execute stmt1';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'stmt1' at line 1
+prepare stmt2 from 'deallocate prepare z';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'z' at line 1
+prepare stmt3 from 'insert into t1 values (?,?)';
+set @arg1=5, @arg2='five';
+execute stmt3 using @arg1, @arg2;
+select * from t1 where a>3;
+a b
+4 four
+5 five
+prepare stmt4 from 'update t1 set a=? where b=?';
+set @arg1=55, @arg2='five';
+execute stmt4 using @arg1, @arg2;
+select * from t1 where a>3;
+a b
+4 four
+55 five
+prepare stmt4 from 'create table t2 (a int)';
+execute stmt4;
+prepare stmt4 from 'drop table t2';
+execute stmt4;
+execute stmt4;
+ERROR 42S02: Unknown table 't2'
+prepare stmt5 from 'select ? + a from t1';
+set @a=1;
+execute stmt5 using @a;
+? + a
+2
+3
+4
+5
+56
+execute stmt5 using @no_such_var;
+? + a
+NULL
+NULL
+NULL
+NULL
+NULL
+set @nullvar=1;
+set @nullvar=NULL;
+execute stmt5 using @nullvar;
+? + a
+NULL
+NULL
+NULL
+NULL
+NULL
+set @nullvar2=NULL;
+execute stmt5 using @nullvar2;
+? + a
+NULL
+NULL
+NULL
+NULL
+NULL
+prepare stmt6 from 'select 1; select2';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '; select2' at line 1
+prepare stmt6 from 'insert into t1 values (5,"five"); select2';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '; select2' at line 1
+explain prepare stmt6 from 'insert into t1 values (5,"five"); select2';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from 'insert into t1 values (5,"five"); select2'' at line 1
+create table t2
+(
+a int
+);
+insert into t2 values (0);
+set @arg00=NULL ;
+prepare stmt1 from 'select 1 FROM t2 where a=?' ;
+execute stmt1 using @arg00 ;
+1
+prepare stmt1 from @nosuchvar;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1
+set @ivar= 1234;
+prepare stmt1 from @ivar;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1234' at line 1
+set @fvar= 123.4567;
+prepare stmt1 from @fvar;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '123.4567' at line 1
+drop table t1,t2;
+PREPARE stmt1 FROM "select _utf8 'A' collate utf8_bin = ?";
+set @var='A';
+EXECUTE stmt1 USING @var;
+_utf8 'A' collate utf8_bin = ?
+1
+DEALLOCATE PREPARE stmt1;
+create table t1 (id int);
+prepare stmt1 from "select FOUND_ROWS()";
+select SQL_CALC_FOUND_ROWS * from t1;
+id
+execute stmt1;
+FOUND_ROWS()
+0
+insert into t1 values (1);
+select SQL_CALC_FOUND_ROWS * from t1;
+id
+1
+execute stmt1;
+FOUND_ROWS()
+1
+execute stmt1;
+FOUND_ROWS()
+0
+deallocate prepare stmt1;
+drop table t1;
+create table t1
+(
+c1 tinyint, c2 smallint, c3 mediumint, c4 int,
+c5 integer, c6 bigint, c7 float, c8 double,
+c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
+c13 date, c14 datetime, c15 timestamp(14), c16 time,
+c17 year, c18 bit, c19 bool, c20 char,
+c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
+c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
+c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
+c32 set('monday', 'tuesday', 'wednesday')
+) engine = MYISAM ;
+create table t2 like t1;
+set @stmt= ' explain SELECT (SELECT SUM(c1 + c12 + 0.0) FROM t2 where (t1.c2 - 0e-3) = t2.c2 GROUP BY t1.c15 LIMIT 1) as scalar_s, exists (select 1.0e+0 from t2 where t2.c3 * 9.0000000000 = t1.c4) as exists_s, c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s FROM t1, (select c25 x, c32 y from t2) tt WHERE x * 1 = c25 ' ;
+prepare stmt1 from @stmt ;
+execute stmt1 ;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+5 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+4 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+3 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+execute stmt1 ;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+5 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+4 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+3 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+explain SELECT (SELECT SUM(c1 + c12 + 0.0) FROM t2 where (t1.c2 - 0e-3) = t2.c2 GROUP BY t1.c15 LIMIT 1) as scalar_s, exists (select 1.0e+0 from t2 where t2.c3 * 9.0000000000 = t1.c4) as exists_s, c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s FROM t1, (select c25 x, c32 y from t2) tt WHERE x * 1 = c25;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+5 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+4 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+3 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+deallocate prepare stmt1;
+drop tables t1,t2;
+set @arg00=1;
+prepare stmt1 from ' create table t1 (m int) as select 1 as m ' ;
+execute stmt1 ;
+select m from t1;
+m
+1
+drop table t1;
+prepare stmt1 from ' create table t1 (m int) as select ? as m ' ;
+execute stmt1 using @arg00;
+select m from t1;
+m
+1
+deallocate prepare stmt1;
+drop table t1;
+create table t1 (id int(10) unsigned NOT NULL default '0',
+name varchar(64) NOT NULL default '',
+PRIMARY KEY (id), UNIQUE KEY `name` (`name`));
+insert into t1 values (1,'1'),(2,'2'),(3,'3'),(4,'4'),(5,'5'),(6,'6'),(7,'7');
+prepare stmt1 from 'select name from t1 where id=? or id=?';
+set @id1=1,@id2=6;
+execute stmt1 using @id1, @id2;
+name
+1
+6
+select name from t1 where id=1 or id=6;
+name
+1
+6
+deallocate prepare stmt1;
+drop table t1;
+create table t1 ( a int primary key, b varchar(30)) engine = MYISAM ;
+prepare stmt1 from ' show table status from test like ''t1%'' ';
+execute stmt1;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t1 MyISAM 9 Dynamic 0 0 0 4294967295 1024 0 NULL # # # latin1_swedish_ci NULL
+show table status from test like 't1%' ;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t1 MyISAM 9 Dynamic 0 0 0 4294967295 1024 0 NULL # # # latin1_swedish_ci NULL
+deallocate prepare stmt1 ;
+drop table t1;
+create table t1(a varchar(2), b varchar(3));
+prepare stmt1 from "select a, b from t1 where (not (a='aa' and b < 'zzz'))";
+execute stmt1;
+a b
+execute stmt1;
+a b
+deallocate prepare stmt1;
+drop table t1;
+prepare stmt1 from "select 1 into @var";
+execute stmt1;
+execute stmt1;
+prepare stmt1 from "create table t1 select 1 as i";
+execute stmt1;
+drop table t1;
+execute stmt1;
+prepare stmt1 from "insert into t1 select i from t1";
+execute stmt1;
+execute stmt1;
+prepare stmt1 from "select * from t1 into outfile 'f1.txt'";
+execute stmt1;
+deallocate prepare stmt1;
+drop table t1;
+prepare stmt1 from 'select 1';
+prepare STMT1 from 'select 2';
+execute sTmT1;
+2
+2
+deallocate prepare StMt1;
+deallocate prepare Stmt1;
+ERROR HY000: Unknown prepared statement handler (Stmt1) given to DEALLOCATE PREPARE
+set names utf8;
+prepare `Ì` from 'select 1234';
+execute `Ì` ;
+1234
+1234
+set names latin1;
+execute `ü`;
+1234
+1234
+set names default;
+create table t1 (a varchar(10)) charset=utf8;
+insert into t1 (a) values ('yahoo');
+set character_set_connection=latin1;
+prepare stmt from 'select a from t1 where a like ?';
+set @var='google';
+execute stmt using @var;
+a
+execute stmt using @var;
+a
+deallocate prepare stmt;
+drop table t1;
+create table t1 (a bigint(20) not null primary key auto_increment);
+insert into t1 (a) values (null);
+select * from t1;
+a
+1
+prepare stmt from "insert into t1 (a) values (?)";
+set @var=null;
+execute stmt using @var;
+select * from t1;
+a
+1
+2
+drop table t1;
+create table t1 (a timestamp not null);
+prepare stmt from "insert into t1 (a) values (?)";
+execute stmt using @var;
+select * from t1;
+deallocate prepare stmt;
+drop table t1;
+prepare stmt from "select 'abc' like convert('abc' using utf8)";
+execute stmt;
+'abc' like convert('abc' using utf8)
+1
+execute stmt;
+'abc' like convert('abc' using utf8)
+1
+deallocate prepare stmt;
+create table t1 ( a bigint );
+prepare stmt from 'select a from t1 where a between ? and ?';
+set @a=1;
+execute stmt using @a, @a;
+a
+execute stmt using @a, @a;
+a
+execute stmt using @a, @a;
+a
+drop table t1;
+deallocate prepare stmt;
+create table t1 (a int);
+prepare stmt from "select * from t1 where 1 > (1 in (SELECT * FROM t1))";
+execute stmt;
+a
+execute stmt;
+a
+execute stmt;
+a
+drop table t1;
+deallocate prepare stmt;
+create table t1 (a int, b int);
+insert into t1 (a, b) values (1,1), (1,2), (2,1), (2,2);
+prepare stmt from
+"explain select * from t1 where t1.a=2 and t1.a=t1.b and t1.b > 1 + ?";
+set @v=5;
+execute stmt using @v;
+id select_type table type possible_keys key key_len ref rows Extra
+- - - - - - - - NULL Impossible WHERE
+set @v=0;
+execute stmt using @v;
+id select_type table type possible_keys key key_len ref rows Extra
+- - - - - - - - 4 Using where
+set @v=5;
+execute stmt using @v;
+id select_type table type possible_keys key key_len ref rows Extra
+- - - - - - - - NULL Impossible WHERE
+drop table t1;
+deallocate prepare stmt;
+create table t1 (a int);
+insert into t1 (a) values (1), (2), (3), (4);
+set @precision=10000000000;
+select rand(),
+cast(rand(10)*@precision as unsigned integer),
+cast(rand(a)*@precision as unsigned integer) from t1;
+rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer)
+- 6570515219 -
+- 1282061302 -
+- 6698761160 -
+- 9647622201 -
+prepare stmt from
+"select rand(),
+ cast(rand(10)*@precision as unsigned integer),
+ cast(rand(a)*@precision as unsigned integer),
+ cast(rand(?)*@precision as unsigned integer) from t1";
+set @var=1;
+execute stmt using @var;
+rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer)
+- 6570515219 - 4054035371
+- 1282061302 - 8716141803
+- 6698761160 - 1418603212
+- 9647622201 - 944590960
+set @var=2;
+execute stmt using @var;
+rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer)
+- 6570515219 1559528654 6555866465
+- 1282061302 6238114970 1223466192
+- 6698761160 6511989195 6449731873
+- 9647622201 3845601374 8578261098
+set @var=3;
+execute stmt using @var;
+rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer)
+- 6570515219 1559528654 9057697559
+- 1282061302 6238114970 3730790581
+- 6698761160 6511989195 1480860534
+- 9647622201 3845601374 6211931236
+drop table t1;
+deallocate prepare stmt;
+create database mysqltest1;
+create table t1 (a int);
+create table mysqltest1.t1 (a int);
+select * from t1, mysqltest1.t1;
+a a
+prepare stmt from "select * from t1, mysqltest1.t1";
+execute stmt;
+a a
+execute stmt;
+a a
+execute stmt;
+a a
+drop table t1;
+drop table mysqltest1.t1;
+drop database mysqltest1;
+deallocate prepare stmt;
+select '1.1' as a, '1.2' as a UNION SELECT '2.1', '2.2';
+a a
+1.1 1.2
+2.1 2.2
+prepare stmt from
+"select '1.1' as a, '1.2' as a UNION SELECT '2.1', '2.2'";
+execute stmt;
+a a
+1.1 1.2
+2.1 2.2
+execute stmt;
+a a
+1.1 1.2
+2.1 2.2
+execute stmt;
+a a
+1.1 1.2
+2.1 2.2
+deallocate prepare stmt;
+create table t1 (a int);
+insert into t1 values (1),(2),(3);
+create table t2 select * from t1;
+prepare stmt FROM 'create table t2 select * from t1';
+drop table t2;
+execute stmt;
+drop table t2;
+execute stmt;
+execute stmt;
+ERROR 42S01: Table 't2' already exists
+drop table t2;
+execute stmt;
+drop table t1,t2;
+deallocate prepare stmt;
+create table t1 (a int);
+insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+prepare stmt from "select sql_calc_found_rows * from t1 limit 2";
+execute stmt;
+a
+1
+2
+select found_rows();
+found_rows()
+10
+execute stmt;
+a
+1
+2
+select found_rows();
+found_rows()
+10
+execute stmt;
+a
+1
+2
+select found_rows();
+found_rows()
+10
+deallocate prepare stmt;
+drop table t1;
+CREATE TABLE t1 (N int, M tinyint);
+INSERT INTO t1 VALUES (1,0),(1,0),(2,0),(2,0),(3,0);
+PREPARE stmt FROM 'UPDATE t1 AS P1 INNER JOIN (SELECT N FROM t1 GROUP BY N HAVING COUNT(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2';
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+prepare stmt from "select ? is null, ? is not null, ?";
+select @no_such_var is null, @no_such_var is not null, @no_such_var;
+@no_such_var is null @no_such_var is not null @no_such_var
+1 0 NULL
+execute stmt using @no_such_var, @no_such_var, @no_such_var;
+? is null ? is not null ?
+1 0 NULL
+set @var='abc';
+select @var is null, @var is not null, @var;
+@var is null @var is not null @var
+0 1 abc
+execute stmt using @var, @var, @var;
+? is null ? is not null ?
+0 1 abc
+set @var=null;
+select @var is null, @var is not null, @var;
+@var is null @var is not null @var
+1 0 NULL
+execute stmt using @var, @var, @var;
+? is null ? is not null ?
+1 0 NULL
+create table t1 (pnum char(3));
+create table t2 (pnum char(3));
+prepare stmt from "select pnum from t2 having pnum in (select 'p1' from t1)";
+execute stmt;
+pnum
+execute stmt;
+pnum
+execute stmt;
+pnum
+deallocate prepare stmt;
+drop table t1, t2;
diff --git a/mysql-test/r/ps_10nestset.result b/mysql-test/r/ps_10nestset.result
new file mode 100644
index 00000000000..ff63485a5f9
--- /dev/null
+++ b/mysql-test/r/ps_10nestset.result
@@ -0,0 +1,76 @@
+drop table if exists t1;
+create table t1 (
+id INTEGER AUTO_INCREMENT PRIMARY KEY,
+emp CHAR(10) NOT NULL,
+salary DECIMAL(6,2) NOT NULL,
+l INTEGER NOT NULL,
+r INTEGER NOT NULL);
+prepare st_ins from 'insert into t1 set emp = ?, salary = ?, l = ?, r = ?';
+set @arg_nam= 'Jerry';
+set @arg_sal= 1000;
+set @arg_l= 1;
+set @arg_r= 12;
+execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
+set @arg_nam= 'Bert';
+set @arg_sal= 900;
+set @arg_l= 2;
+set @arg_r= 3;
+execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
+set @arg_nam= 'Chuck';
+set @arg_sal= 900;
+set @arg_l= 4;
+set @arg_r= 11;
+execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
+set @arg_nam= 'Donna';
+set @arg_sal= 800;
+set @arg_l= 5;
+set @arg_r= 6;
+execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
+set @arg_nam= 'Eddie';
+set @arg_sal= 700;
+set @arg_l= 7;
+set @arg_r= 8;
+execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
+set @arg_nam= 'Fred';
+set @arg_sal= 600;
+set @arg_l= 9;
+set @arg_r= 10;
+execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
+select * from t1;
+id emp salary l r
+1 Jerry 1000.00 1 12
+2 Bert 900.00 2 3
+3 Chuck 900.00 4 11
+4 Donna 800.00 5 6
+5 Eddie 700.00 7 8
+6 Fred 600.00 9 10
+prepare st_raise_base from 'update t1 set salary = salary * ( 1 + ? ) where r - l = 1';
+prepare st_raise_mgr from 'update t1 set salary = salary + ? where r - l > 1';
+set @arg_percent= .10;
+set @arg_amount= 100;
+execute st_raise_base using @arg_percent;
+execute st_raise_mgr using @arg_amount;
+execute st_raise_base using @arg_percent;
+execute st_raise_mgr using @arg_amount;
+execute st_raise_base using @arg_percent;
+execute st_raise_mgr using @arg_amount;
+select * from t1;
+id emp salary l r
+1 Jerry 1300.00 1 12
+2 Bert 1197.90 2 3
+3 Chuck 1200.00 4 11
+4 Donna 1064.80 5 6
+5 Eddie 931.70 7 8
+6 Fred 798.60 9 10
+prepare st_round from 'update t1 set salary = salary + ? - ( salary MOD ? )';
+set @arg_round= 50;
+execute st_round using @arg_round, @arg_round;
+select * from t1;
+id emp salary l r
+1 Jerry 1350.00 1 12
+2 Bert 1200.00 2 3
+3 Chuck 1250.00 4 11
+4 Donna 1100.00 5 6
+5 Eddie 950.00 7 8
+6 Fred 800.00 9 10
+drop table t1;
diff --git a/mysql-test/r/ps_11bugs.result b/mysql-test/r/ps_11bugs.result
new file mode 100644
index 00000000000..c0d7fe502af
--- /dev/null
+++ b/mysql-test/r/ps_11bugs.result
@@ -0,0 +1,118 @@
+drop table if exists t1, t2;
+CREATE TABLE t1(session_id char(9) NOT NULL);
+INSERT INTO t1 VALUES ("abc");
+SELECT * FROM t1;
+session_id
+abc
+prepare st_1180 from 'SELECT * FROM t1 WHERE ?="1111" and session_id = "abc"';
+set @arg1= 'abc';
+execute st_1180 using @arg1;
+session_id
+set @arg1= '1111';
+execute st_1180 using @arg1;
+session_id
+abc
+set @arg1= 'abc';
+execute st_1180 using @arg1;
+session_id
+drop table t1;
+create table t1 (
+c_01 char(6), c_02 integer, c_03 real, c_04 int(3), c_05 varchar(20),
+c_06 date, c_07 char(1), c_08 real, c_09 int(11), c_10 time,
+c_11 char(6), c_12 integer, c_13 real, c_14 int(3), c_15 varchar(20),
+c_16 date, c_17 char(1), c_18 real, c_19 int(11), c_20 text);
+prepare st_1644 from 'insert into t1 values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
+set @arg01= 'row_1';
+set @arg02= 1;
+set @arg03= 1.1;
+set @arg04= 111;
+set @arg05= 'row_one';
+set @arg06= '2004-10-12';
+set @arg07= '1';
+set @arg08= 1.1;
+set @arg09= '100100100';
+set @arg10= '12:34:56';
+set @arg11= 'row_1';
+set @arg12= 1;
+set @arg13= 1.1;
+set @arg14= 111;
+set @arg15= 'row_one';
+set @arg16= '2004-10-12';
+set @arg17= '1';
+set @arg18= 1.1;
+set @arg19= '100100100';
+set @arg20= '12:34:56';
+execute st_1644 using @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg09, @arg10,
+@arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17, @arg18, @arg19, @arg20;
+set @arg01= NULL;
+set @arg02= NULL;
+set @arg03= NULL;
+set @arg04= NULL;
+set @arg05= NULL;
+set @arg06= NULL;
+set @arg07= NULL;
+set @arg08= NULL;
+set @arg09= NULL;
+set @arg10= NULL;
+set @arg11= NULL;
+set @arg12= NULL;
+set @arg13= NULL;
+set @arg14= NULL;
+set @arg15= NULL;
+set @arg16= NULL;
+set @arg17= NULL;
+set @arg18= NULL;
+set @arg19= NULL;
+set @arg20= NULL;
+execute st_1644 using @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg09, @arg10,
+@arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17, @arg18, @arg19, @arg20;
+set @arg01= 'row_3';
+set @arg02= 3;
+set @arg03= 3.3;
+set @arg04= 333;
+set @arg05= 'row_three';
+set @arg06= '2004-10-12';
+set @arg07= '3';
+set @arg08= 3.3;
+set @arg09= '300300300';
+set @arg10= '12:34:56';
+set @arg11= 'row_3';
+set @arg12= 3;
+set @arg13= 3.3;
+set @arg14= 333;
+set @arg15= 'row_three';
+set @arg16= '2004-10-12';
+set @arg17= '3';
+set @arg18= 3.3;
+set @arg19= '300300300';
+set @arg20= '12:34:56';
+execute st_1644 using @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg09, @arg10,
+@arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17, @arg18, @arg19, @arg20;
+select * from t1;
+c_01 c_02 c_03 c_04 c_05 c_06 c_07 c_08 c_09 c_10 c_11 c_12 c_13 c_14 c_15 c_16 c_17 c_18 c_19 c_20
+row_1 1 1.1 111 row_one 2004-10-12 1 1.1 100100100 12:34:56 row_1 1 1.1 111 row_one 2004-10-12 1 1.1 100100100 12:34:56
+NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+row_3 3 3.3 333 row_three 2004-10-12 3 3.3 300300300 12:34:56 row_3 3 3.3 333 row_three 2004-10-12 3 3.3 300300300 12:34:56
+drop table t1;
+create table t1(
+cola varchar(50) not null,
+colb varchar(8) not null,
+colc varchar(12) not null,
+cold varchar(2) not null,
+primary key (cola, colb, cold));
+create table t2(
+cola varchar(50) not null,
+colb varchar(8) not null,
+colc varchar(2) not null,
+cold float,
+primary key (cold));
+insert into t1 values ('aaaa', 'yyyy', 'yyyy-dd-mm', 'R');
+insert into t2 values ('aaaa', 'yyyy', 'R', 203), ('bbbb', 'zzzz', 'C', 201);
+prepare st_1676 from 'select a.cola, a.colb, a.cold from t1 a, t2 b where a.cola = ? and a.colb = ? and a.cold = ? and b.cola = a.cola and b.colb = a.colb and b.colc = a.cold';
+set @arg0= "aaaa";
+set @arg1= "yyyy";
+set @arg2= "R";
+execute st_1676 using @arg0, @arg1, @arg2;
+cola colb cold
+aaaa yyyy R
+drop table t1, t2;
diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result
new file mode 100644
index 00000000000..5f8cb2597c6
--- /dev/null
+++ b/mysql-test/r/ps_1general.result
@@ -0,0 +1,886 @@
+drop table if exists t5, t6, t7, t8;
+drop database if exists mysqltest ;
+test_sequence
+------ basic tests ------
+drop table if exists t1, t9 ;
+create table t1
+(
+a int, b varchar(30),
+primary key(a)
+) engine = 'MYISAM' ;
+create table t9
+(
+c1 tinyint, c2 smallint, c3 mediumint, c4 int,
+c5 integer, c6 bigint, c7 float, c8 double,
+c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
+c13 date, c14 datetime, c15 timestamp(14), c16 time,
+c17 year, c18 bit, c19 bool, c20 char,
+c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
+c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
+c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
+c32 set('monday', 'tuesday', 'wednesday'),
+primary key(c1)
+) engine = 'MYISAM' ;
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+PREPARE stmt FROM ' select * from t1 where a = ? ' ;
+SET @var= 2 ;
+EXECUTE stmt USING @var ;
+a b
+2 two
+select * from t1 where a = @var ;
+a b
+2 two
+DEALLOCATE PREPARE stmt ;
+prepare stmt1 from ' select 1 as my_col ' ;
+prepare stmt1 from ' select ? as my_col ' ;
+prepare ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
+prepare stmt1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
+prepare stmt1 from ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
+prepare_garbage stmt1 from ' select 1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'prepare_garbage stmt1 from ' select 1 '' at line 1
+prepare stmt1 from_garbage ' select 1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from_garbage ' select 1 '' at line 1
+prepare stmt1 from ' select_garbage 1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select_garbage 1' at line 1
+prepare from ' select 1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from ' select 1 '' at line 1
+prepare stmt1 ' select 1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' select 1 '' at line 1
+prepare ? from ' select ? as my_col ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? from ' select ? as my_col '' at line 1
+set @arg00='select 1 as my_col';
+prepare stmt1 from @arg00;
+set @arg00='';
+prepare stmt1 from @arg00;
+ERROR 42000: Query was empty
+set @arg00=NULL;
+prepare stmt1 from @arg01;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1
+prepare stmt1 from ' select * from t1 where a <= 2 ' ;
+prepare stmt1 from ' select * from t1 where x <= 2 ' ;
+ERROR 42S22: Unknown column 'x' in 'where clause'
+prepare stmt1 from ' insert into t1(a,x) values(?,?) ' ;
+ERROR 42S22: Unknown column 'x' in 'field list'
+prepare stmt1 from ' insert into t1(x,a) values(?,?) ' ;
+ERROR 42S22: Unknown column 'x' in 'field list'
+drop table if exists not_exist ;
+prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
+ERROR 42S02: Table 'test.not_exist' doesn't exist
+prepare stmt1 from ' insert into t1 values(? ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
+prepare stmt1 from ' select a, b from t1
+ where a=? and where ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where' at line 2
+execute never_prepared ;
+ERROR HY000: Unknown prepared statement handler (never_prepared) given to EXECUTE
+prepare stmt1 from ' select * from t1 where a <= 2 ' ;
+prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
+ERROR 42S02: Table 'test.not_exist' doesn't exist
+execute stmt1 ;
+ERROR HY000: Unknown prepared statement handler (stmt1) given to EXECUTE
+create table t5
+(
+a int primary key,
+b char(30),
+c int
+);
+insert into t5( a, b, c) values( 1, 'original table', 1);
+prepare stmt2 from ' select * from t5 ' ;
+execute stmt2 ;
+a b c
+1 original table 1
+drop table t5 ;
+execute stmt2 ;
+ERROR 42S02: Table 'test.t5' doesn't exist
+create table t5
+(
+a int primary key,
+b char(30),
+c int
+);
+insert into t5( a, b, c) values( 9, 'recreated table', 9);
+execute stmt2 ;
+a b c
+9 recreated table 9
+drop table t5 ;
+create table t5
+(
+a int primary key,
+c int,
+b char(30)
+);
+insert into t5( a, b, c) values( 9, 'recreated table', 9);
+execute stmt2 ;
+a b c
+9 recreated table 9
+drop table t5 ;
+create table t5
+(
+a int primary key,
+b char(30),
+c int,
+d timestamp default current_timestamp
+);
+insert into t5( a, b, c) values( 9, 'recreated table', 9);
+execute stmt2 ;
+a b c
+9 recreated table 9
+drop table t5 ;
+create table t5
+(
+a int primary key,
+d timestamp default current_timestamp,
+b char(30),
+c int
+);
+insert into t5( a, b, c) values( 9, 'recreated table', 9);
+execute stmt2 ;
+a b c
+9 recreated table 9
+drop table t5 ;
+create table t5
+(
+a timestamp default '2004-02-29 18:01:59',
+b char(30),
+c int
+);
+insert into t5( b, c) values( 'recreated table', 9);
+execute stmt2 ;
+a b c
+2004-02-29 18:01:59 recreated table 9
+drop table t5 ;
+create table t5
+(
+f1 int primary key,
+f2 char(30),
+f3 int
+);
+insert into t5( f1, f2, f3) values( 9, 'recreated table', 9);
+execute stmt2 ;
+ERROR 42S22: Unknown column 'test.t5.a' in 'field list'
+drop table t5 ;
+prepare stmt1 from ' select * from t1 where a <= 2 ' ;
+execute stmt1 ;
+a b
+1 one
+2 two
+set @arg00=1 ;
+set @arg01='two' ;
+prepare stmt1 from ' select * from t1 where a <= ? ' ;
+execute stmt1 using @arg00;
+a b
+1 one
+execute stmt1 ;
+ERROR HY000: Incorrect arguments to EXECUTE
+execute stmt1 using @arg00, @arg01;
+ERROR HY000: Incorrect arguments to EXECUTE
+execute stmt1 using @not_set;
+a b
+deallocate prepare never_prepared ;
+ERROR HY000: Unknown prepared statement handler (never_prepared) given to DEALLOCATE PREPARE
+prepare stmt1 from ' select * from t1 where a <= 2 ' ;
+prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
+ERROR 42S02: Table 'test.not_exist' doesn't exist
+deallocate prepare stmt1;
+ERROR HY000: Unknown prepared statement handler (stmt1) given to DEALLOCATE PREPARE
+create table t5
+(
+a int primary key,
+b char(10)
+);
+prepare stmt2 from ' select a,b from t5 where a <= 2 ' ;
+drop table t5 ;
+deallocate prepare stmt2;
+prepare stmt1 from ' select a from t1 where a <= 2 ' ;
+prepare stmt2 from ' select b from t1 where a <= 2 ' ;
+execute stmt2 ;
+b
+one
+two
+execute stmt1 ;
+a
+1
+2
+prepare stmt1 from ' select a from t1 where a <= 2 ' ;
+prepare stmt2 from ' select a from t1 where a <= 2 ' ;
+execute stmt2 ;
+a
+1
+2
+execute stmt1 ;
+a
+1
+2
+deallocate prepare stmt1 ;
+execute stmt2 ;
+a
+1
+2
+test_sequence
+------ show and misc tests ------
+drop table if exists t2;
+create table t2
+(
+a int primary key, b char(10)
+);
+prepare stmt4 from ' show databases ';
+execute stmt4;
+Database
+mysql
+test
+prepare stmt4 from ' show tables from test like ''t2%'' ';
+execute stmt4;
+Tables_in_test (t2%)
+t2
+prepare stmt4 from ' show columns from t2 from test like ''a%'' ';
+execute stmt4;
+Field Type Null Key Default Extra
+a int(11) PRI 0
+create index t2_idx on t2(b);
+prepare stmt4 from ' show index from t2 from test ';
+execute stmt4;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t2 0 PRIMARY 1 a A 0 NULL NULL BTREE
+t2 1 t2_idx 1 b A NULL NULL NULL YES BTREE
+prepare stmt4 from ' show table status from test like ''t2%'' ';
+execute stmt4;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t2 MyISAM 9 Fixed 0 0 0 64424509439 1024 0 NULL # # # latin1_swedish_ci NULL
+prepare stmt4 from ' show table status from test like ''t9%'' ';
+execute stmt4;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t9 MyISAM 9 Dynamic 2 220 440 4294967295 2048 0 NULL # # # latin1_swedish_ci NULL
+prepare stmt4 from ' show status like ''Threads_running'' ';
+execute stmt4;
+Variable_name Value
+Threads_running 1
+prepare stmt4 from ' show variables like ''sql_mode'' ';
+execute stmt4;
+Variable_name Value
+sql_mode
+prepare stmt4 from ' show engine bdb logs ';
+execute stmt4;
+prepare stmt4 from ' show full processlist ';
+execute stmt4;
+Id User Host db Command Time State Info
+number root localhost test Query 0 NULL show full processlist
+prepare stmt4 from ' show grants for user ';
+prepare stmt4 from ' show create table t2 ';
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+prepare stmt4 from ' show master status ';
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+prepare stmt4 from ' show master logs ';
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+prepare stmt4 from ' show slave status ';
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+prepare stmt4 from ' show warnings limit 20 ';
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+prepare stmt4 from ' show errors limit 20 ';
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+prepare stmt4 from ' show storage engines ';
+execute stmt4;
+Engine Support Comment
+MyISAM YES/NO Default engine as of MySQL 3.23 with great performance
+HEAP YES/NO Alias for MEMORY
+MEMORY YES/NO Hash based, stored in memory, useful for temporary tables
+MERGE YES/NO Collection of identical MyISAM tables
+MRG_MYISAM YES/NO Alias for MERGE
+ISAM YES/NO Obsolete storage engine, now replaced by MyISAM
+MRG_ISAM YES/NO Obsolete storage engine, now replaced by MERGE
+InnoDB YES/NO Supports transactions, row-level locking, and foreign keys
+INNOBASE YES/NO Alias for INNODB
+BDB YES/NO Supports transactions and page-level locking
+BERKELEYDB YES/NO Alias for BDB
+NDBCLUSTER YES/NO Clustered, fault-tolerant, memory-based tables
+NDB YES/NO Alias for NDBCLUSTER
+EXAMPLE YES/NO Example storage engine
+ARCHIVE YES/NO Archive storage engine
+CSV YES/NO CSV storage engine
+drop table if exists t5;
+prepare stmt1 from ' drop table if exists t5 ' ;
+execute stmt1 ;
+Warnings:
+Note 1051 Unknown table 't5'
+prepare stmt1 from ' drop table t5 ' ;
+execute stmt1 ;
+ERROR 42S02: Unknown table 't5'
+prepare stmt1 from ' SELECT @@version ' ;
+execute stmt1 ;
+@@VERSION
+<version>
+prepare stmt_do from ' do @var:= (1 in (select a from t1)) ' ;
+prepare stmt_set from ' set @var= (1 in (select a from t1)) ' ;
+execute stmt_do ;
+content of @var is:
+1
+execute stmt_set ;
+content of @var is:
+1
+execute stmt_do ;
+content of @var is:
+1
+execute stmt_set ;
+content of @var is:
+1
+execute stmt_do ;
+content of @var is:
+1
+execute stmt_set ;
+content of @var is:
+1
+drop table if exists t5 ;
+create table t5 (a int) ;
+prepare stmt_do from ' do @var:= (1 in (select a from t5)) ' ;
+prepare stmt_set from ' set @var= (1 in (select a from t5)) ' ;
+execute stmt_do ;
+content of @var is:
+0
+execute stmt_set ;
+content of @var is:
+0
+execute stmt_do ;
+content of @var is:
+0
+execute stmt_set ;
+content of @var is:
+0
+execute stmt_do ;
+content of @var is:
+0
+execute stmt_set ;
+content of @var is:
+0
+drop table t5 ;
+deallocate prepare stmt_do ;
+deallocate prepare stmt_set ;
+prepare stmt1 from ' prepare stmt2 from '' select 1 '' ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' select 1 '' at line 1
+prepare stmt1 from ' execute stmt2 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'stmt2' at line 1
+prepare stmt1 from ' deallocate prepare never_prepared ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'never_prepared' at line 1
+prepare stmt4 from ' use test ' ;
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+prepare stmt3 from ' create database mysqltest ';
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+create database mysqltest ;
+prepare stmt3 from ' drop database mysqltest ';
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+drop database mysqltest ;
+prepare stmt3 from ' grant all on test.t1 to drop_user@localhost
+identified by ''looser'' ';
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+grant all on test.t1 to drop_user@localhost
+identified by 'looser' ;
+prepare stmt3 from ' revoke all privileges on test.t1 from
+drop_user@localhost ';
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+revoke all privileges on test.t1 from drop_user@localhost ;
+prepare stmt3 from ' drop user drop_user@localhost ';
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+drop user drop_user@localhost;
+prepare stmt3 from ' describe t2 ';
+execute stmt3;
+Field Type Null Key Default Extra
+a int(11) PRI 0
+b char(10) YES MUL NULL
+drop table t2 ;
+execute stmt3;
+ERROR 42S02: Table 'test.t2' doesn't exist
+prepare stmt3 from ' lock tables t1 read ' ;
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+prepare stmt3 from ' unlock tables ' ;
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+prepare stmt1 from ' load data infile ''data.txt''
+into table t1 fields terminated by ''\t'' ';
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+prepare stmt1 from ' select * into outfile ''data.txt'' from t1 ';
+execute stmt1 ;
+prepare stmt1 from ' optimize table t1 ' ;
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+prepare stmt1 from ' analyze table t1 ' ;
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+prepare stmt1 from ' checksum table t1 ' ;
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+prepare stmt1 from ' repair table t1 ' ;
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+prepare stmt1 from ' restore table t1 from ''data.txt'' ' ;
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+prepare stmt1 from ' handler t1 open ';
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+prepare stmt3 from ' commit ' ;
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+prepare stmt3 from ' rollback ' ;
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+prepare stmt4 from ' SET sql_mode=ansi ';
+execute stmt4;
+select 'a' || 'b' ;
+'a' || 'b'
+ab
+prepare stmt4 from ' SET sql_mode="" ';
+execute stmt4;
+select 'a' || 'b' ;
+'a' || 'b'
+0
+prepare stmt5 from ' select ''a'' || ''b'' ' ;
+execute stmt5;
+'a' || 'b'
+0
+SET sql_mode=ansi;
+execute stmt5;
+'a' || 'b'
+0
+SET sql_mode="";
+prepare stmt1 from ' flush local privileges ' ;
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+prepare stmt1 from ' reset query cache ' ;
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+prepare stmt1 from ' KILL 0 ';
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+prepare stmt1 from ' explain select a from t1 order by b ';
+execute stmt1;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def id 8 3 1 N 32801 0 8
+def select_type 253 19 6 N 1 31 8
+def table 253 64 2 N 1 31 8
+def type 253 10 3 N 1 31 8
+def possible_keys 253 4096 0 Y 0 31 8
+def key 253 64 0 Y 0 31 8
+def key_len 8 3 0 Y 32800 0 8
+def ref 253 1024 0 Y 0 31 8
+def rows 8 10 1 N 32801 0 8
+def Extra 253 255 14 N 1 31 8
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort
+SET @arg00=1 ;
+prepare stmt1 from ' explain select a from t1 where a > ? order by b ';
+execute stmt1 using @arg00;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def id 8 3 1 N 32801 0 8
+def select_type 253 19 6 N 1 31 8
+def table 253 64 2 N 1 31 8
+def type 253 10 5 N 1 31 8
+def possible_keys 253 4096 7 Y 0 31 8
+def key 253 64 7 Y 0 31 8
+def key_len 8 3 1 Y 32800 0 8
+def ref 253 1024 0 Y 0 31 8
+def rows 8 10 1 N 32801 0 8
+def Extra 253 255 27 N 1 31 8
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using filesort
+drop table if exists t2;
+create table t2 (id smallint, name varchar(20)) ;
+prepare stmt1 from ' insert into t2 values(?, ?) ' ;
+set @id= 9876 ;
+set @arg00= 'MySQL - Open Source Database' ;
+set @arg01= "'" ;
+set @arg02= '"' ;
+set @arg03= "my'sql'" ;
+set @arg04= 'my"sql"' ;
+insert into t2 values ( @id , @arg00 );
+Warnings:
+Warning 1265 Data truncated for column 'name' at row 1
+insert into t2 values ( @id , @arg01 );
+insert into t2 values ( @id , @arg02 );
+insert into t2 values ( @id , @arg03 );
+insert into t2 values ( @id , @arg04 );
+prepare stmt1 from ' select * from t2 where id= ? and name= ? ';
+execute stmt1 using @id, @arg00 ;
+id name
+execute stmt1 using @id, @arg01 ;
+id name
+9876 '
+execute stmt1 using @id, @arg02 ;
+id name
+9876 "
+execute stmt1 using @id, @arg03 ;
+id name
+9876 my'sql'
+execute stmt1 using @id, @arg04 ;
+id name
+9876 my"sql"
+drop table t2;
+test_sequence
+------ create/drop/alter/rename tests ------
+drop table if exists t2, t3;
+prepare stmt_drop from ' drop table if exists t2 ' ;
+execute stmt_drop;
+prepare stmt_create from ' create table t2 (
+ a int primary key, b char(10)) ';
+execute stmt_create;
+prepare stmt3 from ' create table t3 like t2 ';
+execute stmt3;
+drop table t3;
+set @arg00=1;
+prepare stmt3 from ' create table t3 (m int) select ? as m ' ;
+execute stmt3 using @arg00;
+select m from t3;
+m
+1
+drop table t3;
+prepare stmt3 from ' create index t2_idx on t2(b) ';
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+prepare stmt3 from ' drop index t2_idx on t2 ' ;
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+prepare stmt3 from ' alter table t2 drop primary key ';
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+drop table if exists new_t2;
+prepare stmt3 from ' rename table t2 to new_t2 ';
+execute stmt3;
+execute stmt3;
+ERROR 42S01: Table 'new_t2' already exists
+rename table new_t2 to t2;
+drop table t2;
+prepare stmt1 from ' rename table t5 to t6, t7 to t8 ' ;
+create table t5 (a int) ;
+execute stmt1 ;
+ERROR HY000: Can't find file: './test/t7.frm' (errno: 2)
+create table t7 (a int) ;
+execute stmt1 ;
+execute stmt1 ;
+ERROR 42S01: Table 't6' already exists
+rename table t6 to t5, t8 to t7 ;
+execute stmt1 ;
+drop table t6, t8 ;
+test_sequence
+------ big statement tests ------
+(select 'ABC' as my_const_col from t1 where
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 ) ;
+my_const_col
+ABC
+ABC
+ABC
+ABC
+prepare stmt1 from "select 'ABC' as my_const_col from t1 where
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 " ;
+execute stmt1 ;
+my_const_col
+ABC
+ABC
+ABC
+ABC
+execute stmt1 ;
+my_const_col
+ABC
+ABC
+ABC
+ABC
+(select 'ABC' as my_const_col FROM t1 WHERE
+'1234567890123456789012345678901234567890123456789012345678901234567890'
+= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
+'1234567890123456789012345678901234567890123456789012345678901234567890'
+= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
+'1234567890123456789012345678901234567890123456789012345678901234567890'
+= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
+'1234567890123456789012345678901234567890123456789012345678901234567890'
+= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
+'1234567890123456789012345678901234567890123456789012345678901234567890'
+= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
+'1234567890123456789012345678901234567890123456789012345678901234567890'
+= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
+'1234567890123456789012345678901234567890123456789012345678901234567890'
+= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
+'1234567890123456789012345678901234567890123456789012345678901234567890'
+= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
+'1234567890123456789012345678901234567890123456789012345678901234567890'
+= '1234567890123456789012345678901234567890123456789012345678901234567890' ) ;
+my_const_col
+ABC
+ABC
+ABC
+ABC
+prepare stmt1 from "select 'ABC' as my_const_col FROM t1 WHERE
+'1234567890123456789012345678901234567890123456789012345678901234567890'
+= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
+'1234567890123456789012345678901234567890123456789012345678901234567890'
+= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
+'1234567890123456789012345678901234567890123456789012345678901234567890'
+= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
+'1234567890123456789012345678901234567890123456789012345678901234567890'
+= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
+'1234567890123456789012345678901234567890123456789012345678901234567890'
+= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
+'1234567890123456789012345678901234567890123456789012345678901234567890'
+= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
+'1234567890123456789012345678901234567890123456789012345678901234567890'
+= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
+'1234567890123456789012345678901234567890123456789012345678901234567890'
+= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
+'1234567890123456789012345678901234567890123456789012345678901234567890'
+= '1234567890123456789012345678901234567890123456789012345678901234567890' " ;
+execute stmt1 ;
+my_const_col
+ABC
+ABC
+ABC
+ABC
+execute stmt1 ;
+my_const_col
+ABC
+ABC
+ABC
+ABC
+select 'ABC' as my_const_col FROM t1 WHERE
+@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
+@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
+@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
+@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
+@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
+@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
+@arg00=@arg00 ;
+my_const_col
+ABC
+ABC
+ABC
+ABC
+prepare stmt1 from ' select ''ABC'' as my_const_col FROM t1 WHERE
+ ? = ? and ? = ? and ? = ? and ? = ? and
+ ? = ? and ? = ? and ? = ? and ? = ? and
+ ? = ? and ? = ? and ? = ? and ? = ? and
+ ? = ? and ? = ? and ? = ? and ? = ? and
+ ? = ? and ? = ? and ? = ? and ? = ? and
+ ? = ? and ? = ? and ? = ? and ? = ? and
+ ? = ? ' ;
+execute stmt1 using
+@arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00;
+my_const_col
+ABC
+ABC
+ABC
+ABC
+execute stmt1 using
+@arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07,
+@arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17,
+@arg20, @arg21, @arg22, @arg23, @arg24, @arg25, @arg26, @arg27,
+@arg30, @arg31, @arg32, @arg33, @arg34, @arg35, @arg36, @arg37,
+@arg40, @arg41, @arg42, @arg43, @arg44, @arg45, @arg46, @arg47,
+@arg50, @arg51, @arg52, @arg53, @arg54, @arg55, @arg56, @arg57,
+@arg60, @arg61 ;
+my_const_col
+ABC
+ABC
+ABC
+ABC
+drop table if exists t5 ;
+set @col_num= 1000 ;
+select @string as "" ;
+
+create table t5( c999 int,c998 int,c997 int,c996 int,c995 int,c994 int,c993 int,c992 int,c991 int,c990 int,c989 int,c988 int,c987 int,c986 int,c985 int,c984 int,c983 int,c982 int,c981 int,c980 int,c979 int,c978 int,c977 int,c976 int,c975 int,c974 int,c973 int,c972 int,c971 int,c970 int,c969 int,c968 int,c967 int,c966 int,c965 int,c964 int,c963 int,c962 int,c961 int,c960 int,c959 int,c958 int,c957 int,c956 int,c955 int,c954 int,c953 int,c952 int,c951 int,c950 int,c949 int,c948 int,c947 int,c946 int,c945 int,c944 int,c943 int,c942 int,c941 int,c940 int,c939 int,c938 int,c937 int,c936 int,c935 int,c934 int,c933 int,c932 int,c931 int,c930 int,c929 int,c928 int,c927 int,c926 int,c925 int,c924 int,c923 int,c922 int,c921 int,c920 int,c919 int,c918 int,c917 int,c916 int,c915 int,c914 int,c913 int,c912 int,c911 int,c910 int,c909 int,c908 int,c907 int,c906 int,c905 int,c904 int,c903 int,c902 int,c901 int,c900 int,c899 int,c898 int,c897 int,c896 int,c895 int,c894 int,c893 int,c892 int,c891 int,c890 int,c889 int,c888 int,c887 int,c886 int,c885 int,c884 int,c883 int,c882 int,c881 int,c880 int,c879 int,c878 int,c877 int,c876 int,c875 int,c874 int,c873 int,c872 int,c871 int,c870 int,c869 int,c868 int,c867 int,c866 int,c865 int,c864 int,c863 int,c862 int,c861 int,c860 int,c859 int,c858 int,c857 int,c856 int,c855 int,c854 int,c853 int,c852 int,c851 int,c850 int,c849 int,c848 int,c847 int,c846 int,c845 int,c844 int,c843 int,c842 int,c841 int,c840 int,c839 int,c838 int,c837 int,c836 int,c835 int,c834 int,c833 int,c832 int,c831 int,c830 int,c829 int,c828 int,c827 int,c826 int,c825 int,c824 int,c823 int,c822 int,c821 int,c820 int,c819 int,c818 int,c817 int,c816 int,c815 int,c814 int,c813 int,c812 int,c811 int,c810 int,c809 int,c808 int,c807 int,c806 int,c805 int,c804 int,c803 int,c802 int,c801 int,c800 int,c799 int,c798 int,c797 int,c796 int,c795 int,c794 int,c793 int,c792 int,c791 int,c790 int,c789 int,c788 int,c787 int,c786 int,c785 int,c784 int,c783 int,c782 int,c781 int,c780 int,c779 int,c778 int,c777 int,c776 int,c775 int,c774 int,c773 int,c772 int,c771 int,c770 int,c769 int,c768 int,c767 int,c766 int,c765 int,c764 int,c763 int,c762 int,c761 int,c760 int,c759 int,c758 int,c757 int,c756 int,c755 int,c754 int,c753 int,c752 int,c751 int,c750 int,c749 int,c748 int,c747 int,c746 int,c745 int,c744 int,c743 int,c742 int,c741 int,c740 int,c739 int,c738 int,c737 int,c736 int,c735 int,c734 int,c733 int,c732 int,c731 int,c730 int,c729 int,c728 int,c727 int,c726 int,c725 int,c724 int,c723 int,c722 int,c721 int,c720 int,c719 int,c718 int,c717 int,c716 int,c715 int,c714 int,c713 int,c712 int,c711 int,c710 int,c709 int,c708 int,c707 int,c706 int,c705 int,c704 int,c703 int,c702 int,c701 int,c700 int,c699 int,c698 int,c697 int,c696 int,c695 int,c694 int,c693 int,c692 int,c691 int,c690 int,c689 int,c688 int,c687 int,c686 int,c685 int,c684 int,c683 int,c682 int,c681 int,c680 int,c679 int,c678 int,c677 int,c676 int,c675 int,c674 int,c673 int,c672 int,c671 int,c670 int,c669 int,c668 int,c667 int,c666 int,c665 int,c664 int,c663 int,c662 int,c661 int,c660 int,c659 int,c658 int,c657 int,c656 int,c655 int,c654 int,c653 int,c652 int,c651 int,c650 int,c649 int,c648 int,c647 int,c646 int,c645 int,c644 int,c643 int,c642 int,c641 int,c640 int,c639 int,c638 int,c637 int,c636 int,c635 int,c634 int,c633 int,c632 int,c631 int,c630 int,c629 int,c628 int,c627 int,c626 int,c625 int,c624 int,c623 int,c622 int,c621 int,c620 int,c619 int,c618 int,c617 int,c616 int,c615 int,c614 int,c613 int,c612 int,c611 int,c610 int,c609 int,c608 int,c607 int,c606 int,c605 int,c604 int,c603 int,c602 int,c601 int,c600 int,c599 int,c598 int,c597 int,c596 int,c595 int,c594 int,c593 int,c592 int,c591 int,c590 int,c589 int,c588 int,c587 int,c586 int,c585 int,c584 int,c583 int,c582 int,c581 int,c580 int,c579 int,c578 int,c577 int,c576 int,c575 int,c574 int,c573 int,c572 int,c571 int,c570 int,c569 int,c568 int,c567 int,c566 int,c565 int,c564 int,c563 int,c562 int,c561 int,c560 int,c559 int,c558 int,c557 int,c556 int,c555 int,c554 int,c553 int,c552 int,c551 int,c550 int,c549 int,c548 int,c547 int,c546 int,c545 int,c544 int,c543 int,c542 int,c541 int,c540 int,c539 int,c538 int,c537 int,c536 int,c535 int,c534 int,c533 int,c532 int,c531 int,c530 int,c529 int,c528 int,c527 int,c526 int,c525 int,c524 int,c523 int,c522 int,c521 int,c520 int,c519 int,c518 int,c517 int,c516 int,c515 int,c514 int,c513 int,c512 int,c511 int,c510 int,c509 int,c508 int,c507 int,c506 int,c505 int,c504 int,c503 int,c502 int,c501 int,c500 int,c499 int,c498 int,c497 int,c496 int,c495 int,c494 int,c493 int,c492 int,c491 int,c490 int,c489 int,c488 int,c487 int,c486 int,c485 int,c484 int,c483 int,c482 int,c481 int,c480 int,c479 int,c478 int,c477 int,c476 int,c475 int,c474 int,c473 int,c472 int,c471 int,c470 int,c469 int,c468 int,c467 int,c466 int,c465 int,c464 int,c463 int,c462 int,c461 int,c460 int,c459 int,c458 int,c457 int,c456 int,c455 int,c454 int,c453 int,c452 int,c451 int,c450 int,c449 int,c448 int,c447 int,c446 int,c445 int,c444 int,c443 int,c442 int,c441 int,c440 int,c439 int,c438 int,c437 int,c436 int,c435 int,c434 int,c433 int,c432 int,c431 int,c430 int,c429 int,c428 int,c427 int,c426 int,c425 int,c424 int,c423 int,c422 int,c421 int,c420 int,c419 int,c418 int,c417 int,c416 int,c415 int,c414 int,c413 int,c412 int,c411 int,c410 int,c409 int,c408 int,c407 int,c406 int,c405 int,c404 int,c403 int,c402 int,c401 int,c400 int,c399 int,c398 int,c397 int,c396 int,c395 int,c394 int,c393 int,c392 int,c391 int,c390 int,c389 int,c388 int,c387 int,c386 int,c385 int,c384 int,c383 int,c382 int,c381 int,c380 int,c379 int,c378 int,c377 int,c376 int,c375 int,c374 int,c373 int,c372 int,c371 int,c370 int,c369 int,c368 int,c367 int,c366 int,c365 int,c364 int,c363 int,c362 int,c361 int,c360 int,c359 int,c358 int,c357 int,c356 int,c355 int,c354 int,c353 int,c352 int,c351 int,c350 int,c349 int,c348 int,c347 int,c346 int,c345 int,c344 int,c343 int,c342 int,c341 int,c340 int,c339 int,c338 int,c337 int,c336 int,c335 int,c334 int,c333 int,c332 int,c331 int,c330 int,c329 int,c328 int,c327 int,c326 int,c325 int,c324 int,c323 int,c322 int,c321 int,c320 int,c319 int,c318 int,c317 int,c316 int,c315 int,c314 int,c313 int,c312 int,c311 int,c310 int,c309 int,c308 int,c307 int,c306 int,c305 int,c304 int,c303 int,c302 int,c301 int,c300 int,c299 int,c298 int,c297 int,c296 int,c295 int,c294 int,c293 int,c292 int,c291 int,c290 int,c289 int,c288 int,c287 int,c286 int,c285 int,c284 int,c283 int,c282 int,c281 int,c280 int,c279 int,c278 int,c277 int,c276 int,c275 int,c274 int,c273 int,c272 int,c271 int,c270 int,c269 int,c268 int,c267 int,c266 int,c265 int,c264 int,c263 int,c262 int,c261 int,c260 int,c259 int,c258 int,c257 int,c256 int,c255 int,c254 int,c253 int,c252 int,c251 int,c250 int,c249 int,c248 int,c247 int,c246 int,c245 int,c244 int,c243 int,c242 int,c241 int,c240 int,c239 int,c238 int,c237 int,c236 int,c235 int,c234 int,c233 int,c232 int,c231 int,c230 int,c229 int,c228 int,c227 int,c226 int,c225 int,c224 int,c223 int,c222 int,c221 int,c220 int,c219 int,c218 int,c217 int,c216 int,c215 int,c214 int,c213 int,c212 int,c211 int,c210 int,c209 int,c208 int,c207 int,c206 int,c205 int,c204 int,c203 int,c202 int,c201 int,c200 int,c199 int,c198 int,c197 int,c196 int,c195 int,c194 int,c193 int,c192 int,c191 int,c190 int,c189 int,c188 int,c187 int,c186 int,c185 int,c184 int,c183 int,c182 int,c181 int,c180 int,c179 int,c178 int,c177 int,c176 int,c175 int,c174 int,c173 int,c172 int,c171 int,c170 int,c169 int,c168 int,c167 int,c166 int,c165 int,c164 int,c163 int,c162 int,c161 int,c160 int,c159 int,c158 int,c157 int,c156 int,c155 int,c154 int,c153 int,c152 int,c151 int,c150 int,c149 int,c148 int,c147 int,c146 int,c145 int,c144 int,c143 int,c142 int,c141 int,c140 int,c139 int,c138 int,c137 int,c136 int,c135 int,c134 int,c133 int,c132 int,c131 int,c130 int,c129 int,c128 int,c127 int,c126 int,c125 int,c124 int,c123 int,c122 int,c121 int,c120 int,c119 int,c118 int,c117 int,c116 int,c115 int,c114 int,c113 int,c112 int,c111 int,c110 int,c109 int,c108 int,c107 int,c106 int,c105 int,c104 int,c103 int,c102 int,c101 int,c100 int,c99 int,c98 int,c97 int,c96 int,c95 int,c94 int,c93 int,c92 int,c91 int,c90 int,c89 int,c88 int,c87 int,c86 int,c85 int,c84 int,c83 int,c82 int,c81 int,c80 int,c79 int,c78 int,c77 int,c76 int,c75 int,c74 int,c73 int,c72 int,c71 int,c70 int,c69 int,c68 int,c67 int,c66 int,c65 int,c64 int,c63 int,c62 int,c61 int,c60 int,c59 int,c58 int,c57 int,c56 int,c55 int,c54 int,c53 int,c52 int,c51 int,c50 int,c49 int,c48 int,c47 int,c46 int,c45 int,c44 int,c43 int,c42 int,c41 int,c40 int,c39 int,c38 int,c37 int,c36 int,c35 int,c34 int,c33 int,c32 int,c31 int,c30 int,c29 int,c28 int,c27 int,c26 int,c25 int,c24 int,c23 int,c22 int,c21 int,c20 int,c19 int,c18 int,c17 int,c16 int,c15 int,c14 int,c13 int,c12 int,c11 int,c10 int,c9 int,c8 int,c7 int,c6 int,c5 int,c4 int,c3 int,c2 int,c1 int,c0 int)
+prepare stmt1 from @string ;
+execute stmt1 ;
+select @string as "" ;
+
+insert into t5 values(1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 )
+prepare stmt1 from @string ;
+execute stmt1 ;
+prepare stmt1 from ' select * from t5 ' ;
+execute stmt1 ;
+drop table t5 ;
+test_sequence
+------ grant/revoke/drop affects a parallel session test ------
+show grants for second_user@localhost ;
+ERROR 42000: There is no such grant defined for user 'second_user' on host 'localhost'
+create database mysqltest;
+use mysqltest;
+use test;
+grant usage on mysqltest.* to second_user@localhost
+identified by 'looser' ;
+grant select on mysqltest.t9 to second_user@localhost
+identified by 'looser' ;
+show grants for second_user@localhost ;
+Grants for second_user@localhost
+GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
+GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
+select current_user();
+current_user()
+second_user@localhost
+show grants for current_user();
+Grants for second_user@localhost
+GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
+GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
+prepare s_t9 from 'select c1 as my_col
+ from t9 where c1= 1' ;
+execute s_t9 ;
+my_col
+1
+select a as my_col from t1;
+ERROR 42000: select command denied to user 'second_user'@'localhost' for table 't1'
+grant select on mysqltest.t1 to second_user@localhost
+identified by 'looser' ;
+show grants for second_user@localhost ;
+Grants for second_user@localhost
+GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
+GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
+GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
+drop table mysqltest.t9 ;
+show grants for second_user@localhost ;
+Grants for second_user@localhost
+GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
+GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
+GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
+show grants for second_user@localhost ;
+Grants for second_user@localhost
+GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
+GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
+GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
+prepare s_t1 from 'select a as my_col from t1' ;
+execute s_t1 ;
+my_col
+1
+2
+3
+4
+execute s_t9 ;
+ERROR 42S02: Table 'mysqltest.t9' doesn't exist
+revoke all privileges on mysqltest.t1 from second_user@localhost
+identified by 'looser' ;
+show grants for second_user@localhost ;
+Grants for second_user@localhost
+GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
+GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
+show grants for second_user@localhost ;
+Grants for second_user@localhost
+GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
+GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
+execute s_t1 ;
+ERROR 42000: select command denied to user 'second_user'@'localhost' for table 't1'
+revoke all privileges, grant option from second_user@localhost ;
+show grants for second_user@localhost ;
+Grants for second_user@localhost
+GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
+drop user second_user@localhost ;
+commit ;
+show grants for second_user@localhost ;
+ERROR 42000: There is no such grant defined for user 'second_user' on host 'localhost'
+drop table t1,t9 ;
+drop database mysqltest;
diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result
new file mode 100644
index 00000000000..c2799c6faed
--- /dev/null
+++ b/mysql-test/r/ps_2myisam.result
@@ -0,0 +1,3133 @@
+use test;
+drop table if exists t1, t9 ;
+create table t1
+(
+a int, b varchar(30),
+primary key(a)
+) engine = 'MYISAM' ;
+create table t9
+(
+c1 tinyint, c2 smallint, c3 mediumint, c4 int,
+c5 integer, c6 bigint, c7 float, c8 double,
+c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
+c13 date, c14 datetime, c15 timestamp(14), c16 time,
+c17 year, c18 bit, c19 bool, c20 char,
+c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
+c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
+c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
+c32 set('monday', 'tuesday', 'wednesday'),
+primary key(c1)
+) engine = 'MYISAM' ;
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+test_sequence
+------ simple select tests ------
+prepare stmt1 from ' select * from t9 order by c1 ' ;
+execute stmt1;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t9 t9 c1 c1 1 4 1 N 49155 0 63
+def test t9 t9 c2 c2 2 6 1 Y 32768 0 63
+def test t9 t9 c3 c3 9 9 1 Y 32768 0 63
+def test t9 t9 c4 c4 3 11 1 Y 32768 0 63
+def test t9 t9 c5 c5 3 11 1 Y 32768 0 63
+def test t9 t9 c6 c6 8 20 1 Y 32768 0 63
+def test t9 t9 c7 c7 4 12 1 Y 32768 31 63
+def test t9 t9 c8 c8 5 22 1 Y 32768 31 63
+def test t9 t9 c9 c9 5 22 1 Y 32768 31 63
+def test t9 t9 c10 c10 5 22 1 Y 32768 31 63
+def test t9 t9 c11 c11 0 9 6 Y 32768 4 63
+def test t9 t9 c12 c12 0 10 6 Y 32768 4 63
+def test t9 t9 c13 c13 10 10 10 Y 128 0 63
+def test t9 t9 c14 c14 12 19 19 Y 128 0 63
+def test t9 t9 c15 c15 7 19 19 N 1249 0 63
+def test t9 t9 c16 c16 11 8 8 Y 128 0 63
+def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
+def test t9 t9 c18 c18 1 1 1 Y 32768 0 63
+def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
+def test t9 t9 c20 c20 254 1 1 Y 0 0 8
+def test t9 t9 c21 c21 253 10 10 Y 0 0 8
+def test t9 t9 c22 c22 253 30 30 Y 0 0 8
+def test t9 t9 c23 c23 252 255 8 Y 144 0 63
+def test t9 t9 c24 c24 252 255 8 Y 16 0 8
+def test t9 t9 c25 c25 252 65535 4 Y 144 0 63
+def test t9 t9 c26 c26 252 65535 4 Y 16 0 8
+def test t9 t9 c27 c27 252 16777215 10 Y 144 0 63
+def test t9 t9 c28 c28 252 16777215 10 Y 16 0 8
+def test t9 t9 c29 c29 252 16777215 8 Y 144 0 63
+def test t9 t9 c30 c30 252 16777215 8 Y 16 0 8
+def test t9 t9 c31 c31 254 5 3 Y 256 0 8
+def test t9 t9 c32 c32 254 24 7 Y 2048 0 8
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+set @arg00='SELECT' ;
+prepare stmt1 from ' ? a from t1 where a=1 ';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1
+set @arg00=1 ;
+select @arg00, b from t1 where a=1 ;
+@arg00 b
+1 one
+prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+? b
+1 one
+set @arg00='lion' ;
+select @arg00, b from t1 where a=1 ;
+@arg00 b
+lion one
+prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+? b
+lion one
+set @arg00=NULL ;
+select @arg00, b from t1 where a=1 ;
+@arg00 b
+NULL one
+prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+? b
+NULL one
+set @arg00=1 ;
+select b, a - @arg00 from t1 where a=1 ;
+b a - @arg00
+one 0
+prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+b a - ?
+one 0
+set @arg00=null ;
+select @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select @arg00 + 1 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? + 1 as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select 1 + @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select 1 + ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+set @arg00='MySQL' ;
+select substr(@arg00,1,2) from t1 where a=1 ;
+substr(@arg00,1,2)
+My
+prepare stmt1 from ' select substr(?,1,2) from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+substr(?,1,2)
+My
+set @arg00=3 ;
+select substr('MySQL',@arg00,5) from t1 where a=1 ;
+substr('MySQL',@arg00,5)
+SQL
+prepare stmt1 from ' select substr(''MySQL'',?,5) from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+substr('MySQL',?,5)
+SQL
+select substr('MySQL',1,@arg00) from t1 where a=1 ;
+substr('MySQL',1,@arg00)
+MyS
+prepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+substr('MySQL',1,?)
+MyS
+set @arg00='MySQL' ;
+select a , concat(@arg00,b) from t1 order by a;
+a concat(@arg00,b)
+1 MySQLone
+2 MySQLtwo
+3 MySQLthree
+4 MySQLfour
+prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ;
+execute stmt1 using @arg00;
+a concat(?,b)
+1 MySQLone
+2 MySQLtwo
+3 MySQLthree
+4 MySQLfour
+select a , concat(b,@arg00) from t1 order by a ;
+a concat(b,@arg00)
+1 oneMySQL
+2 twoMySQL
+3 threeMySQL
+4 fourMySQL
+prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ;
+execute stmt1 using @arg00;
+a concat(b,?)
+1 oneMySQL
+2 twoMySQL
+3 threeMySQL
+4 fourMySQL
+set @arg00='MySQL' ;
+select group_concat(@arg00,b order by a) from t1
+group by 'a' ;
+group_concat(@arg00,b order by a)
+MySQLone,MySQLtwo,MySQLthree,MySQLfour
+prepare stmt1 from ' select group_concat(?,b order by a) from t1
+group by ''a'' ' ;
+execute stmt1 using @arg00;
+group_concat(?,b order by a)
+MySQLone,MySQLtwo,MySQLthree,MySQLfour
+select group_concat(b,@arg00 order by a) from t1
+group by 'a' ;
+group_concat(b,@arg00 order by a)
+oneMySQL,twoMySQL,threeMySQL,fourMySQL
+prepare stmt1 from ' select group_concat(b,? order by a) from t1
+group by ''a'' ' ;
+execute stmt1 using @arg00;
+group_concat(b,? order by a)
+oneMySQL,twoMySQL,threeMySQL,fourMySQL
+set @arg00='first' ;
+set @arg01='second' ;
+set @arg02=NULL;
+select @arg00, @arg01 from t1 where a=1 ;
+@arg00 @arg01
+first second
+prepare stmt1 from ' select ?, ? from t1 where a=1 ' ;
+execute stmt1 using @arg00, @arg01 ;
+? ?
+first second
+execute stmt1 using @arg02, @arg01 ;
+? ?
+NULL second
+execute stmt1 using @arg00, @arg02 ;
+? ?
+first NULL
+execute stmt1 using @arg02, @arg02 ;
+? ?
+NULL NULL
+drop table if exists t5 ;
+create table t5 (id1 int(11) not null default '0',
+value2 varchar(100), value1 varchar(100)) ;
+insert into t5 values (1,'hh','hh'),(2,'hh','hh'),
+(1,'ii','ii'),(2,'ii','ii') ;
+prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ;
+set @arg00=1 ;
+set @arg01='hh' ;
+execute stmt1 using @arg00, @arg01 ;
+id1 value1
+1 hh
+1 ii
+2 hh
+drop table t5 ;
+drop table if exists t5 ;
+create table t5(session_id char(9) not null) ;
+insert into t5 values ('abc') ;
+prepare stmt1 from ' select * from t5
+where ?=''1111'' and session_id = ''abc'' ' ;
+set @arg00='abc' ;
+execute stmt1 using @arg00 ;
+session_id
+set @arg00='1111' ;
+execute stmt1 using @arg00 ;
+session_id
+abc
+set @arg00='abc' ;
+execute stmt1 using @arg00 ;
+session_id
+drop table t5 ;
+set @arg00='FROM' ;
+select a @arg00 t1 where a=1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 t1 where a=1' at line 1
+prepare stmt1 from ' select a ? t1 where a=1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? t1 where a=1' at line 1
+set @arg00='t1' ;
+select a from @arg00 where a=1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 where a=1' at line 1
+prepare stmt1 from ' select a from ? where a=1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? where a=1' at line 1
+set @arg00='WHERE' ;
+select a from t1 @arg00 a=1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a=1' at line 1
+prepare stmt1 from ' select a from t1 ? a=1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a=1' at line 1
+set @arg00=1 ;
+select a FROM t1 where a=@arg00 ;
+a
+1
+prepare stmt1 from ' select a FROM t1 where a=? ' ;
+execute stmt1 using @arg00 ;
+a
+1
+set @arg00=1000 ;
+execute stmt1 using @arg00 ;
+a
+set @arg00=NULL ;
+select a FROM t1 where a=@arg00 ;
+a
+prepare stmt1 from ' select a FROM t1 where a=? ' ;
+execute stmt1 using @arg00 ;
+a
+set @arg00=4 ;
+select a FROM t1 where a=sqrt(@arg00) ;
+a
+2
+prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
+execute stmt1 using @arg00 ;
+a
+2
+set @arg00=NULL ;
+select a FROM t1 where a=sqrt(@arg00) ;
+a
+prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
+execute stmt1 using @arg00 ;
+a
+set @arg00=2 ;
+set @arg01=3 ;
+select a FROM t1 where a in (@arg00,@arg01) order by a;
+a
+2
+3
+prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a ';
+execute stmt1 using @arg00, @arg01;
+a
+2
+3
+set @arg00= 'one' ;
+set @arg01= 'two' ;
+set @arg02= 'five' ;
+prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ;
+execute stmt1 using @arg00, @arg01, @arg02 ;
+b
+one
+two
+prepare stmt1 from ' select b FROM t1 where b like ? ';
+set @arg00='two' ;
+execute stmt1 using @arg00 ;
+b
+two
+set @arg00='tw%' ;
+execute stmt1 using @arg00 ;
+b
+two
+set @arg00='%wo' ;
+execute stmt1 using @arg00 ;
+b
+two
+set @arg00=null ;
+insert into t9 set c1= 0, c5 = NULL ;
+select c5 from t9 where c5 > NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 > ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 < NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 < ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 = NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 = ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 <=> NULL ;
+c5
+NULL
+prepare stmt1 from ' select c5 from t9 where c5 <=> ? ';
+execute stmt1 using @arg00 ;
+c5
+NULL
+delete from t9 where c1= 0 ;
+set @arg00='>' ;
+select a FROM t1 where a @arg00 1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 1' at line 1
+prepare stmt1 from ' select a FROM t1 where a ? 1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? 1' at line 1
+set @arg00=1 ;
+select a,b FROM t1 where a is not NULL
+AND b is not NULL group by a - @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+prepare stmt1 from ' select a,b FROM t1 where a is not NULL
+AND b is not NULL group by a - ? ' ;
+execute stmt1 using @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00='two' ;
+select a,b FROM t1 where a is not NULL
+AND b is not NULL having b <> @arg00 order by a ;
+a b
+1 one
+3 three
+4 four
+prepare stmt1 from ' select a,b FROM t1 where a is not NULL
+AND b is not NULL having b <> ? order by a ' ;
+execute stmt1 using @arg00 ;
+a b
+1 one
+3 three
+4 four
+set @arg00=1 ;
+select a,b FROM t1 where a is not NULL
+AND b is not NULL order by a - @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+prepare stmt1 from ' select a,b FROM t1 where a is not NULL
+AND b is not NULL order by a - ? ' ;
+execute stmt1 using @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00=2 ;
+select a,b from t1 order by 2 ;
+a b
+4 four
+1 one
+3 three
+2 two
+prepare stmt1 from ' select a,b from t1
+order by ? ';
+execute stmt1 using @arg00;
+a b
+4 four
+1 one
+3 three
+2 two
+set @arg00=1 ;
+execute stmt1 using @arg00;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00=0 ;
+execute stmt1 using @arg00;
+ERROR 42S22: Unknown column '?' in 'order clause'
+set @arg00=1;
+prepare stmt1 from ' select a,b from t1 order by a
+limit 1 ';
+execute stmt1 ;
+a b
+1 one
+prepare stmt1 from ' select a,b from t1
+limit ? ';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 2
+set @arg00='b' ;
+set @arg01=0 ;
+set @arg02=2 ;
+set @arg03=2 ;
+select sum(a), @arg00 from t1 where a > @arg01
+and b is not null group by substr(b,@arg02)
+having sum(a) <> @arg03 ;
+sum(a) @arg00
+3 b
+1 b
+4 b
+prepare stmt1 from ' select sum(a), ? from t1 where a > ?
+and b is not null group by substr(b,?)
+having sum(a) <> ? ';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03;
+sum(a) ?
+3 b
+1 b
+4 b
+test_sequence
+------ join tests ------
+select first.a as a1, second.a as a2
+from t1 first, t1 second
+where first.a = second.a order by a1 ;
+a1 a2
+1 1
+2 2
+3 3
+4 4
+prepare stmt1 from ' select first.a as a1, second.a as a2
+ from t1 first, t1 second
+ where first.a = second.a order by a1 ';
+execute stmt1 ;
+a1 a2
+1 1
+2 2
+3 3
+4 4
+set @arg00='ABC';
+set @arg01='two';
+set @arg02='one';
+select first.a, @arg00, second.a FROM t1 first, t1 second
+where @arg01 = first.b or first.a = second.a or second.b = @arg02
+order by second.a, first.a;
+a @arg00 a
+1 ABC 1
+2 ABC 1
+3 ABC 1
+4 ABC 1
+2 ABC 2
+2 ABC 3
+3 ABC 3
+2 ABC 4
+4 ABC 4
+prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
+ where ? = first.b or first.a = second.a or second.b = ?
+ order by second.a, first.a';
+execute stmt1 using @arg00, @arg01, @arg02;
+a ? a
+1 ABC 1
+2 ABC 1
+3 ABC 1
+4 ABC 1
+2 ABC 2
+2 ABC 3
+3 ABC 3
+2 ABC 4
+4 ABC 4
+drop table if exists t2 ;
+create table t2 as select * from t1 ;
+set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
+set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
+set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
+set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
+set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
+set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
+set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
+the join statement is:
+SELECT * FROM t2 right join t1 using(a) order by t2.a
+prepare stmt1 from @query9 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural right join t1 order by t2.a
+prepare stmt1 from @query8 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query7 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 using(a) order by t2.a
+prepare stmt1 from @query6 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural left join t1 order by t2.a
+prepare stmt1 from @query5 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query4 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 join t1 using(a) order by t2.a
+prepare stmt1 from @query3 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural join t1 order by t2.a
+prepare stmt1 from @query2 ;
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+the join statement is:
+SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a
+prepare stmt1 from @query1 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+drop table t2 ;
+test_sequence
+------ subquery tests ------
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = ''two'') ';
+execute stmt1 ;
+a b
+2 two
+set @arg00='two' ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where b = 'two' ) and b=@arg00 ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = ''two'') and b=? ';
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00='two' ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where b = @arg00 ) and b='two' ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = ? ) and b=''two'' ' ;
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=3 ;
+set @arg01='three' ;
+select a,b FROM t1 where (a,b) in (select 3, 'three');
+a b
+3 three
+select a FROM t1 where (a,b) in (select @arg00,@arg01);
+a
+3
+prepare stmt1 from ' select a FROM t1 where (a,b) in (select ?, ?) ';
+execute stmt1 using @arg00, @arg01;
+a
+3
+set @arg00=1 ;
+set @arg01='two' ;
+set @arg02=2 ;
+set @arg03='two' ;
+select a, @arg00, b FROM t1 outer_table where
+b=@arg01 and a = (select @arg02 from t1 where b = @arg03 ) ;
+a @arg00 b
+2 1 two
+prepare stmt1 from ' select a, ?, b FROM t1 outer_table where
+ b=? and a = (select ? from t1 where b = ? ) ' ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
+a ? b
+2 1 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = outer_table.b ) order by a ';
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+set @arg00='two' ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where b = outer_table.b ) and b=@arg00 ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = outer_table.b) and b=? ';
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=2 ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where a = @arg00 and b = outer_table.b) and b='two' ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where a = ? and b = outer_table.b) and b=''two'' ' ;
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=2 ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where outer_table.a = @arg00 and a=2) and b='two' ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where outer_table.a = ? and a=2) and b=''two'' ' ;
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=1 ;
+set @arg01='two' ;
+set @arg02=2 ;
+set @arg03='two' ;
+select a, @arg00, b FROM t1 outer_table where
+b=@arg01 and a = (select @arg02 from t1 where outer_table.b = @arg03
+and outer_table.a=a ) ;
+a @arg00 b
+2 1 two
+prepare stmt1 from ' select a, ?, b FROM t1 outer_table where
+ b=? and a = (select ? from t1 where outer_table.b = ?
+ and outer_table.a=a ) ' ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
+a ? b
+2 1 two
+set @arg00=1 ;
+set @arg01=0 ;
+select a, @arg00
+from ( select a - @arg00 as a from t1 where a=@arg00 ) as t2
+where a=@arg01;
+a @arg00
+0 1
+prepare stmt1 from ' select a, ?
+ from ( select a - ? as a from t1 where a=? ) as t2
+ where a=? ';
+execute stmt1 using @arg00, @arg00, @arg00, @arg01 ;
+a ?
+0 1
+drop table if exists t2 ;
+create table t2 as select * from t1;
+prepare stmt1 from ' select a in (select a from t2) from t1 ' ;
+execute stmt1 ;
+a in (select a from t2)
+1
+1
+1
+1
+drop table if exists t5, t6, t7 ;
+create table t5 (a int , b int) ;
+create table t6 like t5 ;
+create table t7 like t5 ;
+insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
+(2, -1), (3, 10) ;
+insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ;
+insert into t7 values (3, 3), (2, 2), (1, 1) ;
+prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1) from t7 ' ;
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+drop table t5, t6, t7 ;
+drop table if exists t2 ;
+create table t2 as select * from t9;
+set @stmt= ' SELECT
+ (SELECT SUM(c1 + c12 + 0.0) FROM t2
+ where (t9.c2 - 0e-3) = t2.c2
+ GROUP BY t9.c15 LIMIT 1) as scalar_s,
+ exists (select 1.0e+0 from t2
+ where t2.c3 * 9.0000000000 = t9.c4) as exists_s,
+ c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s,
+ (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s
+FROM t9,
+(select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
+prepare stmt1 from @stmt ;
+execute stmt1 ;
+execute stmt1 ;
+set @stmt= concat('explain ',@stmt);
+prepare stmt1 from @stmt ;
+execute stmt1 ;
+execute stmt1 ;
+set @stmt= ' SELECT
+ (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
+ GROUP BY t9.c15 LIMIT 1) as scalar_s,
+ exists (select ? from t2
+ where t2.c3*?=t9.c4) as exists_s,
+ c5*? in (select c6+? from t2) as in_s,
+ (c7-?, c8-?) in (select c9+?, c10+? from t2) as in_row_s
+FROM t9,
+(select c25 x, c32 y from t2) tt WHERE x =c25 ' ;
+set @arg00= 0.0 ;
+set @arg01= 0e-3 ;
+set @arg02= 1.0e+0 ;
+set @arg03= 9.0000000000 ;
+set @arg04= 4 ;
+set @arg05= 0.3e+1 ;
+set @arg06= 4 ;
+set @arg07= 4 ;
+set @arg08= 4.0 ;
+set @arg09= 40e-1 ;
+prepare stmt1 from @stmt ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+set @stmt= concat('explain ',@stmt);
+prepare stmt1 from @stmt ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+drop table t2 ;
+select 1 < (select a from t1) ;
+ERROR 21000: Subquery returns more than 1 row
+prepare stmt1 from ' select 1 < (select a from t1) ' ;
+execute stmt1 ;
+ERROR 21000: Subquery returns more than 1 row
+select 1 as my_col ;
+my_col
+1
+test_sequence
+------ union tests ------
+prepare stmt1 from ' select a FROM t1 where a=1
+ union distinct
+ select a FROM t1 where a=1 ';
+execute stmt1 ;
+a
+1
+execute stmt1 ;
+a
+1
+prepare stmt1 from ' select a FROM t1 where a=1
+ union all
+ select a FROM t1 where a=1 ';
+execute stmt1 ;
+a
+1
+1
+prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+set @arg00=1 ;
+select @arg00 FROM t1 where a=1
+union distinct
+select 1 FROM t1 where a=1;
+@arg00
+1
+prepare stmt1 from ' select ? FROM t1 where a=1
+ union distinct
+ select 1 FROM t1 where a=1 ' ;
+execute stmt1 using @arg00;
+?
+1
+set @arg00=1 ;
+select 1 FROM t1 where a=1
+union distinct
+select @arg00 FROM t1 where a=1;
+1
+1
+prepare stmt1 from ' select 1 FROM t1 where a=1
+ union distinct
+ select ? FROM t1 where a=1 ' ;
+execute stmt1 using @arg00;
+1
+1
+set @arg00='a' ;
+select @arg00 FROM t1 where a=1
+union distinct
+select @arg00 FROM t1 where a=1;
+@arg00
+a
+prepare stmt1 from ' select ? FROM t1 where a=1
+ union distinct
+ select ? FROM t1 where a=1 ';
+execute stmt1 using @arg00, @arg00;
+?
+a
+prepare stmt1 from ' select ?
+ union distinct
+ select ? ';
+execute stmt1 using @arg00, @arg00;
+?
+a
+set @arg00='a' ;
+set @arg01=1 ;
+set @arg02='a' ;
+set @arg03=2 ;
+select @arg00 FROM t1 where a=@arg01
+union distinct
+select @arg02 FROM t1 where a=@arg03;
+@arg00
+a
+prepare stmt1 from ' select ? FROM t1 where a=?
+ union distinct
+ select ? FROM t1 where a=? ' ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03;
+?
+a
+set @arg00=1 ;
+prepare stmt1 from ' select sum(a) + 200, ? from t1
+union distinct
+select sum(a) + 200, 1 from t1
+group by b ' ;
+execute stmt1 using @arg00;
+sum(a) + 200 ?
+210 1
+204 1
+201 1
+203 1
+202 1
+set @Oporto='Oporto' ;
+set @Lisboa='Lisboa' ;
+set @0=0 ;
+set @1=1 ;
+set @2=2 ;
+set @3=3 ;
+set @4=4 ;
+select @Oporto,@Lisboa,@0,@1,@2,@3,@4 ;
+@Oporto @Lisboa @0 @1 @2 @3 @4
+Oporto Lisboa 0 1 2 3 4
+select sum(a) + 200 as the_sum, @Oporto as the_town from t1
+group by b
+union distinct
+select sum(a) + 200, @Lisboa from t1
+group by b ;
+the_sum the_town
+204 Oporto
+201 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+201 Lisboa
+203 Lisboa
+202 Lisboa
+prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
+ group by b
+ union distinct
+ select sum(a) + 200, ? from t1
+ group by b ' ;
+execute stmt1 using @Oporto, @Lisboa;
+the_sum the_town
+204 Oporto
+201 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+201 Lisboa
+203 Lisboa
+202 Lisboa
+select sum(a) + 200 as the_sum, @Oporto as the_town from t1
+where a > @1
+group by b
+union distinct
+select sum(a) + 200, @Lisboa from t1
+where a > @2
+group by b ;
+the_sum the_town
+204 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+203 Lisboa
+prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
+ where a > ?
+ group by b
+ union distinct
+ select sum(a) + 200, ? from t1
+ where a > ?
+ group by b ' ;
+execute stmt1 using @Oporto, @1, @Lisboa, @2;
+the_sum the_town
+204 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+203 Lisboa
+select sum(a) + 200 as the_sum, @Oporto as the_town from t1
+where a > @1
+group by b
+having avg(a) > @2
+union distinct
+select sum(a) + 200, @Lisboa from t1
+where a > @2
+group by b
+having avg(a) > @3;
+the_sum the_town
+204 Oporto
+203 Oporto
+204 Lisboa
+prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
+ where a > ?
+ group by b
+ having avg(a) > ?
+ union distinct
+ select sum(a) + 200, ? from t1
+ where a > ?
+ group by b
+ having avg(a) > ? ';
+execute stmt1 using @Oporto, @1, @2, @Lisboa, @2, @3;
+the_sum the_town
+204 Oporto
+203 Oporto
+204 Lisboa
+test_sequence
+------ explain select tests ------
+prepare stmt1 from ' explain select * from t9 ' ;
+execute stmt1;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def id 8 3 1 N 32801 0 8
+def select_type 253 19 6 N 1 31 8
+def table 253 64 2 N 1 31 8
+def type 253 10 3 N 1 31 8
+def possible_keys 253 4096 0 Y 0 31 8
+def key 253 64 0 Y 0 31 8
+def key_len 8 3 0 Y 32800 0 8
+def ref 253 1024 0 Y 0 31 8
+def rows 8 10 1 N 32801 0 8
+def Extra 253 255 0 N 1 31 8
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t9 ALL NULL NULL NULL NULL 2
+drop table if exists t2 ;
+create table t2 (s varchar(25), fulltext(s))
+ENGINE = 'MYISAM' ;
+insert into t2 values ('Gravedigger'), ('Greed'),('Hollow Dogs') ;
+commit ;
+prepare stmt1 from ' select s from t2 where match (s) against (?) ' ;
+set @arg00='Dogs' ;
+execute stmt1 using @arg00 ;
+s
+Hollow Dogs
+prepare stmt1 from ' SELECT s FROM t2
+where match (s) against (concat(?,''digger'')) ';
+set @arg00='Grave' ;
+execute stmt1 using @arg00 ;
+s
+Gravedigger
+drop table t2 ;
+test_sequence
+------ delete tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+prepare stmt1 from 'delete from t1 where a=2' ;
+execute stmt1;
+select a,b from t1 where a=2;
+a b
+execute stmt1;
+insert into t1 values(0,NULL);
+set @arg00=NULL;
+prepare stmt1 from 'delete from t1 where b=?' ;
+execute stmt1 using @arg00;
+select a,b from t1 where b is NULL ;
+a b
+0 NULL
+set @arg00='one';
+execute stmt1 using @arg00;
+select a,b from t1 where b=@arg00;
+a b
+prepare stmt1 from 'truncate table t1' ;
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+test_sequence
+------ update tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ;
+execute stmt1;
+select a,b from t1 where a=2;
+a b
+2 a=two
+execute stmt1;
+select a,b from t1 where a=2;
+a b
+2 a=two
+set @arg00=NULL;
+prepare stmt1 from 'update t1 set b=? where a=2' ;
+execute stmt1 using @arg00;
+select a,b from t1 where a=2;
+a b
+2 NULL
+set @arg00='two';
+execute stmt1 using @arg00;
+select a,b from t1 where a=2;
+a b
+2 two
+set @arg00=2;
+prepare stmt1 from 'update t1 set b=NULL where a=?' ;
+execute stmt1 using @arg00;
+select a,b from t1 where a=@arg00;
+a b
+2 NULL
+update t1 set b='two' where a=@arg00;
+set @arg00=2000;
+execute stmt1 using @arg00;
+select a,b from t1 where a=@arg00;
+a b
+set @arg00=2;
+set @arg01=22;
+prepare stmt1 from 'update t1 set a=? where a=?' ;
+execute stmt1 using @arg00, @arg00;
+select a,b from t1 where a=@arg00;
+a b
+2 two
+execute stmt1 using @arg01, @arg00;
+select a,b from t1 where a=@arg01;
+a b
+22 two
+execute stmt1 using @arg00, @arg01;
+select a,b from t1 where a=@arg00;
+a b
+2 two
+set @arg00=NULL;
+set @arg01=2;
+execute stmt1 using @arg00, @arg01;
+Warnings:
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1
+select a,b from t1 order by a;
+a b
+0 two
+1 one
+3 three
+4 four
+set @arg00=0;
+execute stmt1 using @arg01, @arg00;
+select a,b from t1 order by a;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00=23;
+set @arg01='two';
+set @arg02=2;
+set @arg03='two';
+set @arg04=2;
+drop table if exists t2;
+create table t2 as select a,b from t1 ;
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 where a = @arg00 ;
+a b
+23 two
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a not in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 order by a ;
+a b
+1 one
+2 two
+3 three
+4 four
+drop table t2 ;
+create table t2
+(
+a int, b varchar(30),
+primary key(a)
+) engine = 'MYISAM' ;
+insert into t2(a,b) select a, b from t1 ;
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 where a = @arg00 ;
+a b
+23 two
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a not in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 order by a ;
+a b
+1 one
+2 two
+3 three
+4 four
+drop table t2 ;
+set @arg00=1;
+prepare stmt1 from 'update t1 set b=''bla''
+where a=2
+limit 1';
+execute stmt1 ;
+select a,b from t1 where b = 'bla' ;
+a b
+2 bla
+prepare stmt1 from 'update t1 set b=''bla''
+where a=2
+limit ?';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 3
+test_sequence
+------ insert tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+prepare stmt1 from 'insert into t1 values(5, ''five'' )';
+execute stmt1;
+select a,b from t1 where a = 5;
+a b
+5 five
+set @arg00='six' ;
+prepare stmt1 from 'insert into t1 values(6, ? )';
+execute stmt1 using @arg00;
+select a,b from t1 where b = @arg00;
+a b
+6 six
+execute stmt1 using @arg00;
+ERROR 23000: Duplicate entry '6' for key 1
+set @arg00=NULL ;
+prepare stmt1 from 'insert into t1 values(0, ? )';
+execute stmt1 using @arg00;
+select a,b from t1 where b is NULL;
+a b
+0 NULL
+set @arg00=8 ;
+set @arg01='eight' ;
+prepare stmt1 from 'insert into t1 values(?, ? )';
+execute stmt1 using @arg00, @arg01 ;
+select a,b from t1 where b = @arg01;
+a b
+8 eight
+set @NULL= null ;
+set @arg00= 'abc' ;
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg00 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg00 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 abc
+10002 abc
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @NULL ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @NULL ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 NULL
+10002 NULL
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 10 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 9 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 8 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 7 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 6 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 5 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 4 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 3 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg01 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 10001
+10002 10002
+10003 10003
+10004 10004
+10005 10005
+10006 10006
+10007 10007
+10008 10008
+10009 10009
+10010 10010
+delete from t1 where a > 10000 ;
+set @arg00=81 ;
+set @arg01='8-1' ;
+set @arg02=82 ;
+set @arg03='8-2' ;
+prepare stmt1 from 'insert into t1 values(?,?),(?,?)';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
+select a,b from t1 where a in (@arg00,@arg02) ;
+a b
+81 8-1
+82 8-2
+set @arg00=9 ;
+set @arg01='nine' ;
+prepare stmt1 from 'insert into t1 set a=?, b=? ';
+execute stmt1 using @arg00, @arg01 ;
+select a,b from t1 where a = @arg00 ;
+a b
+9 nine
+set @arg00=6 ;
+set @arg01=1 ;
+prepare stmt1 from 'insert into t1 set a=?, b=''sechs''
+ on duplicate key update a=a + ?, b=concat(b,''modified'') ';
+execute stmt1 using @arg00, @arg01;
+select * from t1 order by a;
+a b
+0 NULL
+1 one
+2 two
+3 three
+4 four
+5 five
+7 sixmodified
+8 eight
+9 nine
+81 8-1
+82 8-2
+set @arg00=81 ;
+set @arg01=1 ;
+execute stmt1 using @arg00, @arg01;
+ERROR 23000: Duplicate entry '82' for key 1
+drop table if exists t2 ;
+create table t2 (id int auto_increment primary key)
+ENGINE= 'MYISAM' ;
+prepare stmt1 from ' select last_insert_id() ' ;
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+1
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+2
+drop table t2 ;
+set @1000=1000 ;
+set @x1000_2="x1000_2" ;
+set @x1000_3="x1000_3" ;
+set @x1000="x1000" ;
+set @1100=1100 ;
+set @x1100="x1100" ;
+set @100=100 ;
+set @updated="updated" ;
+insert into t1 values(1000,'x1000_1') ;
+insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3)
+on duplicate key update a = a + @100, b = concat(b,@updated) ;
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 x1000_3
+1100 x1000_1updated
+delete from t1 where a >= 1000 ;
+insert into t1 values(1000,'x1000_1') ;
+prepare stmt1 from ' insert into t1 values(?,?),(?,?)
+ on duplicate key update a = a + ?, b = concat(b,?) ';
+execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ;
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 x1000_3
+1100 x1000_1updated
+delete from t1 where a >= 1000 ;
+insert into t1 values(1000,'x1000_1') ;
+execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ;
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1200 x1000_1updatedupdated
+delete from t1 where a >= 1000 ;
+prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
+execute stmt1;
+execute stmt1;
+execute stmt1;
+test_sequence
+------ multi table tests ------
+delete from t1 ;
+delete from t9 ;
+insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
+insert into t9 (c1,c21)
+values (1, 'one'), (2, 'two'), (3, 'three') ;
+prepare stmt_delete from " delete t1, t9
+ from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
+prepare stmt_update from " update t1, t9
+ set t1.b='updated', t9.c21='updated'
+ where t1.a=t9.c1 and t1.a=? ";
+prepare stmt_select1 from " select a, b from t1 order by a" ;
+prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
+set @arg00= 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+2 two
+3 three
+execute stmt_select2 ;
+c1 c21
+2 two
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+3 three
+execute stmt_select2 ;
+c1 c21
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+execute stmt_select2 ;
+c1 c21
+set @arg00= @arg00 + 1 ;
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+insert into t1 values(0,NULL) ;
+set @duplicate='duplicate ' ;
+set @1000=1000 ;
+set @5=5 ;
+select a,b from t1 where a < 5 order by a ;
+a b
+0 NULL
+1 one
+2 two
+3 three
+4 four
+insert into t1 select a + @1000, concat(@duplicate,b) from t1
+where a < @5 ;
+affected rows: 5
+info: Records: 5 Duplicates: 0 Warnings: 0
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 NULL
+1001 duplicate one
+1002 duplicate two
+1003 duplicate three
+1004 duplicate four
+delete from t1 where a >= 1000 ;
+prepare stmt1 from ' insert into t1 select a + ?, concat(?,b) from t1
+where a < ? ' ;
+execute stmt1 using @1000, @duplicate, @5;
+affected rows: 5
+info: Records: 5 Duplicates: 0 Warnings: 0
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 NULL
+1001 duplicate one
+1002 duplicate two
+1003 duplicate three
+1004 duplicate four
+delete from t1 where a >= 1000 ;
+set @1=1 ;
+set @2=2 ;
+set @100=100 ;
+set @float=1.00;
+set @five='five' ;
+drop table if exists t2;
+create table t2 like t1 ;
+insert into t2 (b,a)
+select @duplicate, sum(first.a) from t1 first, t1 second
+where first.a <> @5 and second.b = first.b
+and second.b <> @five
+group by second.b
+having sum(second.a) > @2
+union
+select b, a + @100 from t1
+where (a,b) in ( select sqrt(a+@1)+CAST(@float AS signed),b
+from t1);
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
+select a,b from t2 order by a ;
+a b
+3 duplicate
+4 duplicate
+103 three
+delete from t2 ;
+prepare stmt1 from ' insert into t2 (b,a)
+select ?, sum(first.a)
+ from t1 first, t1 second
+ where first.a <> ? and second.b = first.b and second.b <> ?
+ group by second.b
+ having sum(second.a) > ?
+union
+select b, a + ? from t1
+ where (a,b) in ( select sqrt(a+?)+CAST(? AS signed),b
+ from t1 ) ' ;
+execute stmt1 using @duplicate, @5, @five, @2, @100, @1, @float ;
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
+select a,b from t2 order by a ;
+a b
+3 duplicate
+4 duplicate
+103 three
+drop table t2;
+drop table if exists t5 ;
+set @arg01= 8;
+set @arg02= 8.0;
+set @arg03= 80.00000000000e-1;
+set @arg04= 'abc' ;
+set @arg05= CAST('abc' as binary) ;
+set @arg06= '1991-08-05' ;
+set @arg07= CAST('1991-08-05' as date);
+set @arg08= '1991-08-05 01:01:01' ;
+set @arg09= CAST('1991-08-05 01:01:01' as datetime) ;
+set @arg10= unix_timestamp('1991-01-01 01:01:01');
+set @arg11= YEAR('1991-01-01 01:01:01');
+set @arg12= 8 ;
+set @arg12= NULL ;
+set @arg13= 8.0 ;
+set @arg13= NULL ;
+set @arg14= 'abc';
+set @arg14= NULL ;
+set @arg15= CAST('abc' as binary) ;
+set @arg15= NULL ;
+create table t5 as select
+8 as const01, @arg01 as param01,
+8.0 as const02, @arg02 as param02,
+80.00000000000e-1 as const03, @arg03 as param03,
+'abc' as const04, @arg04 as param04,
+CAST('abc' as binary) as const05, @arg05 as param05,
+'1991-08-05' as const06, @arg06 as param06,
+CAST('1991-08-05' as date) as const07, @arg07 as param07,
+'1991-08-05 01:01:01' as const08, @arg08 as param08,
+CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09,
+unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10,
+YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11,
+NULL as const12, @arg12 as param12,
+@arg13 as param13,
+@arg14 as param14,
+@arg15 as param15;
+show create table t5 ;
+Table Create Table
+t5 CREATE TABLE `t5` (
+ `const01` bigint(1) NOT NULL default '0',
+ `param01` bigint(20) default NULL,
+ `const02` double(3,1) NOT NULL default '0.0',
+ `param02` double default NULL,
+ `const03` double NOT NULL default '0',
+ `param03` double default NULL,
+ `const04` char(3) NOT NULL default '',
+ `param04` longtext,
+ `const05` binary(3) NOT NULL default '',
+ `param05` longblob,
+ `const06` varchar(10) NOT NULL default '',
+ `param06` longtext,
+ `const07` date default NULL,
+ `param07` longblob,
+ `const08` varchar(19) NOT NULL default '',
+ `param08` longtext,
+ `const09` datetime default NULL,
+ `param09` longblob,
+ `const10` int(10) NOT NULL default '0',
+ `param10` bigint(20) default NULL,
+ `const11` int(4) default NULL,
+ `param11` bigint(20) default NULL,
+ `const12` binary(0) default NULL,
+ `param12` bigint(20) default NULL,
+ `param13` double default NULL,
+ `param14` longtext,
+ `param15` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t5 ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t5 t5 const01 const01 8 1 1 N 32769 0 63
+def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
+def test t5 t5 const02 const02 5 3 3 N 32769 1 63
+def test t5 t5 param02 param02 5 20 1 Y 32768 31 63
+def test t5 t5 const03 const03 5 23 1 N 32769 31 63
+def test t5 t5 param03 param03 5 20 1 Y 32768 31 63
+def test t5 t5 const04 const04 254 3 3 N 1 0 8
+def test t5 t5 param04 param04 252 16777215 3 Y 16 0 8
+def test t5 t5 const05 const05 254 3 3 N 129 0 63
+def test t5 t5 param05 param05 252 16777215 3 Y 144 0 63
+def test t5 t5 const06 const06 253 10 10 N 1 0 8
+def test t5 t5 param06 param06 252 16777215 10 Y 16 0 8
+def test t5 t5 const07 const07 10 10 10 Y 128 0 63
+def test t5 t5 param07 param07 252 16777215 10 Y 144 0 63
+def test t5 t5 const08 const08 253 19 19 N 1 0 8
+def test t5 t5 param08 param08 252 16777215 19 Y 16 0 8
+def test t5 t5 const09 const09 12 19 19 Y 128 0 63
+def test t5 t5 param09 param09 252 16777215 19 Y 144 0 63
+def test t5 t5 const10 const10 3 10 9 N 32769 0 63
+def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
+def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
+def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
+def test t5 t5 const12 const12 254 0 0 Y 128 0 63
+def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
+def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
+def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
+const01 8
+param01 8
+const02 8.0
+param02 8
+const03 8
+param03 8
+const04 abc
+param04 abc
+const05 abc
+param05 abc
+const06 1991-08-05
+param06 1991-08-05
+const07 1991-08-05
+param07 1991-08-05
+const08 1991-08-05 01:01:01
+param08 1991-08-05 01:01:01
+const09 1991-08-05 01:01:01
+param09 1991-08-05 01:01:01
+const10 662680861
+param10 662680861
+const11 1991
+param11 1991
+const12 NULL
+param12 NULL
+param13 NULL
+param14 NULL
+param15 NULL
+drop table t5 ;
+test_sequence
+------ data type conversion tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ;
+select * from t9 order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+test_sequence
+------ select @parameter:= column ------
+prepare full_info from "select @arg01, @arg02, @arg03, @arg04,
+ @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12,
+ @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20,
+ @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28,
+ @arg29, @arg30, @arg31, @arg32" ;
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 1 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 0 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select
+ @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+ @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+ @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+ @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+ @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+ @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+ @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+ @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':= c1 from t9 where c1= 1' at line 1
+test_sequence
+------ select column, .. into @parm,.. ------
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 1 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 0 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+ c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+ c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? from t9 where c1= 1' at line 1
+test_sequence
+-- insert into numeric columns --
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ;
+set @arg00= 21 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ;
+execute stmt1 ;
+set @arg00= 23;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
+30.0, 30.0, 30.0 ) ;
+set @arg00= 31.0 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0,
+ 32.0, 32.0, 32.0 )" ;
+execute stmt1 ;
+set @arg00= 33.0;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( '40', '40', '40', '40', '40', '40', '40', '40',
+'40', '40', '40' ) ;
+set @arg00= '41' ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( '42', '42', '42', '42', '42', '42', '42', '42',
+ '42', '42', '42' )" ;
+execute stmt1 ;
+set @arg00= '43';
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ;
+set @arg00= CAST('51' as binary) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ;
+execute stmt1 ;
+set @arg00= CAST('53' as binary) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 2 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+NULL, NULL, NULL ) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 61, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL )" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 8.0 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 71, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 'abc' ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 81, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c1 >= 20
+order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12
+20 20 20 20 20 20 20 20 20 20 20.0000
+21 21 21 21 21 21 21 21 21 21 21.0000
+22 22 22 22 22 22 22 22 22 22 22.0000
+23 23 23 23 23 23 23 23 23 23 23.0000
+30 30 30 30 30 30 30 30 30 30 30.0000
+31 31 31 31 31 31 31 31 31 31 31.0000
+32 32 32 32 32 32 32 32 32 32 32.0000
+33 33 33 33 33 33 33 33 33 33 33.0000
+40 40 40 40 40 40 40 40 40 40 40.0000
+41 41 41 41 41 41 41 41 41 41 41.0000
+42 42 42 42 42 42 42 42 42 42 42.0000
+43 43 43 43 43 43 43 43 43 43 43.0000
+50 50 50 50 50 50 50 50 50 50 50.0000
+51 51 51 51 51 51 51 51 51 51 51.0000
+52 52 52 52 52 52 52 52 52 52 52.0000
+53 53 53 53 53 53 53 53 53 53 53.0000
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where numeric column = .. --
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+and c8= 20 and c9= 20 and c10= 20 and c12= 20;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+ and c8= 20 and c9= 20 and c10= 20 and c12= 20 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+ and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20';
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' ";
+execute stmt1 ;
+found
+true
+set @arg00= '20';
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+c12= CAST('20' as binary);
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+ c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+ c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+ c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+ c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+ c12= CAST('20' as binary) ";
+execute stmt1 ;
+found
+true
+set @arg00= CAST('20' as binary) ;
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- some numeric overflow experiments --
+prepare my_insert from "insert into t9
+ ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c21 = 'O' ";
+prepare my_delete from "delete from t9 where c21 = 'O' ";
+set @arg00= 9223372036854775807 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= '9223372036854775807' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= -9223372036854775808 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-9223372036854775808' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= 1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= '1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 1
+c2 1
+c3 1
+c4 1
+c5 1
+c6 1
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= -1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -1
+c2 -1
+c3 -1
+c4 -1
+c5 -1
+c6 -1
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+test_sequence
+-- insert into string columns --
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30
+from t9 where c1 >= 20
+order by c1 ;
+c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
+20 2 20 20 20 20 20 20 20 20 20 20
+21 2 21 21 21 21 21 21 21 21 21 21
+22 2 22 22 22 22 22 22 22 22 22 22
+23 2 23 23 23 23 23 23 23 23 23 23
+30 3 30 30 30 30 30 30 30 30 30 30
+31 3 31 31 31 31 31 31 31 31 31 31
+32 3 32 32 32 32 32 32 32 32 32 32
+33 3 33 33 33 33 33 33 33 33 33 33
+40 4 40 40 40 40 40 40 40 40 40 40
+41 4 41 41 41 41 41 41 41 41 41 41
+42 4 42 42 42 42 42 42 42 42 42 42
+43 4 43 43 43 43 43 43 43 43 43 43
+50 5 50 50 50.00 50.00 50.00 50.00 50.00 50.00 50.00 50.00
+51 5 51 51 51 51 51 51 51 51 51 51
+52 5 52 52 52.00 52.00 52.00 52.00 52.00 52.00 52.00 52.00
+53 5 53 53 53.00 53.00 53.00 53.00 53.00 53.00 53.00 53.00
+54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00
+55 5 55 55 55 55 55 55 55 55 55 55
+56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00
+57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where string column = .. --
+set @arg00= '20';
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+c27= '20' and c28= '20' and c29= '20' and c30= '20' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+ c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+ c27= '20' and c28= '20' and c29= '20' and c30= '20'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('20' as binary);
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+= CAST('20' as binary) and c21= CAST('20' as binary)
+and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+c30= CAST('20' as binary) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and
+c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+ = CAST('20' as binary) and c21= CAST('20' as binary)
+ and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+ c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+ c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+ c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+ c30= CAST('20' as binary)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and
+ c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and
+ c29= ? and c30= ?";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+c27= 20 and c28= 20 and c29= 20 and c30= 20 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+ c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+ c27= 20 and c28= 20 and c29= 20 and c30= 20" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+ c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+ c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- insert into date/time columns --
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
+c1 c13 c14 c15 c16 c17
+20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+21 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+22 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+23 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+30 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+60 NULL NULL 1991-01-01 01:01:01 NULL NULL
+61 NULL NULL 1991-01-01 01:01:01 NULL NULL
+62 NULL NULL 1991-01-01 01:01:01 NULL NULL
+63 NULL NULL 1991-01-01 01:01:01 NULL NULL
+71 NULL NULL 1991-01-01 01:01:01 NULL NULL
+73 NULL NULL 1991-01-01 01:01:01 NULL NULL
+81 NULL NULL 1991-01-01 01:01:01 NULL NULL
+83 NULL NULL 1991-01-01 01:01:01 NULL NULL
+test_sequence
+-- select .. where date/time column = .. --
+set @arg00= '1991-01-01 01:01:01' ;
+select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+c17= '1991-01-01 01:01:01' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+ c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+ c17= '1991-01-01 01:01:01'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
+select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+c14= CAST('1991-01-01 01:01:01' as datetime) and
+c15= CAST('1991-01-01 01:01:01' as datetime) and
+c16= CAST('1991-01-01 01:01:01' as datetime) and
+c17= CAST('1991-01-01 01:01:01' as datetime) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+ c14= CAST('1991-01-01 01:01:01' as datetime) and
+ c15= CAST('1991-01-01 01:01:01' as datetime) and
+ c16= CAST('1991-01-01 01:01:01' as datetime) and
+ c17= CAST('1991-01-01 01:01:01' as datetime)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 1991 ;
+select 'true' as found from t9
+where c1= 20 and c17= 1991 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= 1991" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= ?" ;
+execute stmt1 using @arg00 ;
+found
+true
+set @arg00= 1.991e+3 ;
+select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and abs(c17 - @arg00) < 0.01 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - ?) < 0.01" ;
+execute stmt1 using @arg00 ;
+found
+true
+drop table t1, t9;
diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result
new file mode 100644
index 00000000000..034cd75ea4b
--- /dev/null
+++ b/mysql-test/r/ps_3innodb.result
@@ -0,0 +1,3116 @@
+use test;
+drop table if exists t1, t9 ;
+create table t1
+(
+a int, b varchar(30),
+primary key(a)
+) engine = 'InnoDB' ;
+create table t9
+(
+c1 tinyint, c2 smallint, c3 mediumint, c4 int,
+c5 integer, c6 bigint, c7 float, c8 double,
+c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
+c13 date, c14 datetime, c15 timestamp(14), c16 time,
+c17 year, c18 bit, c19 bool, c20 char,
+c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
+c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
+c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
+c32 set('monday', 'tuesday', 'wednesday'),
+primary key(c1)
+) engine = 'InnoDB' ;
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+test_sequence
+------ simple select tests ------
+prepare stmt1 from ' select * from t9 order by c1 ' ;
+execute stmt1;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t9 t9 c1 c1 1 4 1 N 49155 0 63
+def test t9 t9 c2 c2 2 6 1 Y 32768 0 63
+def test t9 t9 c3 c3 9 9 1 Y 32768 0 63
+def test t9 t9 c4 c4 3 11 1 Y 32768 0 63
+def test t9 t9 c5 c5 3 11 1 Y 32768 0 63
+def test t9 t9 c6 c6 8 20 1 Y 32768 0 63
+def test t9 t9 c7 c7 4 12 1 Y 32768 31 63
+def test t9 t9 c8 c8 5 22 1 Y 32768 31 63
+def test t9 t9 c9 c9 5 22 1 Y 32768 31 63
+def test t9 t9 c10 c10 5 22 1 Y 32768 31 63
+def test t9 t9 c11 c11 0 9 6 Y 32768 4 63
+def test t9 t9 c12 c12 0 10 6 Y 32768 4 63
+def test t9 t9 c13 c13 10 10 10 Y 128 0 63
+def test t9 t9 c14 c14 12 19 19 Y 128 0 63
+def test t9 t9 c15 c15 7 19 19 N 1249 0 63
+def test t9 t9 c16 c16 11 8 8 Y 128 0 63
+def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
+def test t9 t9 c18 c18 1 1 1 Y 32768 0 63
+def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
+def test t9 t9 c20 c20 254 1 1 Y 0 0 8
+def test t9 t9 c21 c21 253 10 10 Y 0 0 8
+def test t9 t9 c22 c22 253 30 30 Y 0 0 8
+def test t9 t9 c23 c23 252 255 8 Y 144 0 63
+def test t9 t9 c24 c24 252 255 8 Y 16 0 8
+def test t9 t9 c25 c25 252 65535 4 Y 144 0 63
+def test t9 t9 c26 c26 252 65535 4 Y 16 0 8
+def test t9 t9 c27 c27 252 16777215 10 Y 144 0 63
+def test t9 t9 c28 c28 252 16777215 10 Y 16 0 8
+def test t9 t9 c29 c29 252 16777215 8 Y 144 0 63
+def test t9 t9 c30 c30 252 16777215 8 Y 16 0 8
+def test t9 t9 c31 c31 254 5 3 Y 256 0 8
+def test t9 t9 c32 c32 254 24 7 Y 2048 0 8
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+set @arg00='SELECT' ;
+prepare stmt1 from ' ? a from t1 where a=1 ';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1
+set @arg00=1 ;
+select @arg00, b from t1 where a=1 ;
+@arg00 b
+1 one
+prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+? b
+1 one
+set @arg00='lion' ;
+select @arg00, b from t1 where a=1 ;
+@arg00 b
+lion one
+prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+? b
+lion one
+set @arg00=NULL ;
+select @arg00, b from t1 where a=1 ;
+@arg00 b
+NULL one
+prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+? b
+NULL one
+set @arg00=1 ;
+select b, a - @arg00 from t1 where a=1 ;
+b a - @arg00
+one 0
+prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+b a - ?
+one 0
+set @arg00=null ;
+select @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select @arg00 + 1 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? + 1 as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select 1 + @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select 1 + ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+set @arg00='MySQL' ;
+select substr(@arg00,1,2) from t1 where a=1 ;
+substr(@arg00,1,2)
+My
+prepare stmt1 from ' select substr(?,1,2) from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+substr(?,1,2)
+My
+set @arg00=3 ;
+select substr('MySQL',@arg00,5) from t1 where a=1 ;
+substr('MySQL',@arg00,5)
+SQL
+prepare stmt1 from ' select substr(''MySQL'',?,5) from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+substr('MySQL',?,5)
+SQL
+select substr('MySQL',1,@arg00) from t1 where a=1 ;
+substr('MySQL',1,@arg00)
+MyS
+prepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+substr('MySQL',1,?)
+MyS
+set @arg00='MySQL' ;
+select a , concat(@arg00,b) from t1 order by a;
+a concat(@arg00,b)
+1 MySQLone
+2 MySQLtwo
+3 MySQLthree
+4 MySQLfour
+prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ;
+execute stmt1 using @arg00;
+a concat(?,b)
+1 MySQLone
+2 MySQLtwo
+3 MySQLthree
+4 MySQLfour
+select a , concat(b,@arg00) from t1 order by a ;
+a concat(b,@arg00)
+1 oneMySQL
+2 twoMySQL
+3 threeMySQL
+4 fourMySQL
+prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ;
+execute stmt1 using @arg00;
+a concat(b,?)
+1 oneMySQL
+2 twoMySQL
+3 threeMySQL
+4 fourMySQL
+set @arg00='MySQL' ;
+select group_concat(@arg00,b order by a) from t1
+group by 'a' ;
+group_concat(@arg00,b order by a)
+MySQLone,MySQLtwo,MySQLthree,MySQLfour
+prepare stmt1 from ' select group_concat(?,b order by a) from t1
+group by ''a'' ' ;
+execute stmt1 using @arg00;
+group_concat(?,b order by a)
+MySQLone,MySQLtwo,MySQLthree,MySQLfour
+select group_concat(b,@arg00 order by a) from t1
+group by 'a' ;
+group_concat(b,@arg00 order by a)
+oneMySQL,twoMySQL,threeMySQL,fourMySQL
+prepare stmt1 from ' select group_concat(b,? order by a) from t1
+group by ''a'' ' ;
+execute stmt1 using @arg00;
+group_concat(b,? order by a)
+oneMySQL,twoMySQL,threeMySQL,fourMySQL
+set @arg00='first' ;
+set @arg01='second' ;
+set @arg02=NULL;
+select @arg00, @arg01 from t1 where a=1 ;
+@arg00 @arg01
+first second
+prepare stmt1 from ' select ?, ? from t1 where a=1 ' ;
+execute stmt1 using @arg00, @arg01 ;
+? ?
+first second
+execute stmt1 using @arg02, @arg01 ;
+? ?
+NULL second
+execute stmt1 using @arg00, @arg02 ;
+? ?
+first NULL
+execute stmt1 using @arg02, @arg02 ;
+? ?
+NULL NULL
+drop table if exists t5 ;
+create table t5 (id1 int(11) not null default '0',
+value2 varchar(100), value1 varchar(100)) ;
+insert into t5 values (1,'hh','hh'),(2,'hh','hh'),
+(1,'ii','ii'),(2,'ii','ii') ;
+prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ;
+set @arg00=1 ;
+set @arg01='hh' ;
+execute stmt1 using @arg00, @arg01 ;
+id1 value1
+1 hh
+1 ii
+2 hh
+drop table t5 ;
+drop table if exists t5 ;
+create table t5(session_id char(9) not null) ;
+insert into t5 values ('abc') ;
+prepare stmt1 from ' select * from t5
+where ?=''1111'' and session_id = ''abc'' ' ;
+set @arg00='abc' ;
+execute stmt1 using @arg00 ;
+session_id
+set @arg00='1111' ;
+execute stmt1 using @arg00 ;
+session_id
+abc
+set @arg00='abc' ;
+execute stmt1 using @arg00 ;
+session_id
+drop table t5 ;
+set @arg00='FROM' ;
+select a @arg00 t1 where a=1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 t1 where a=1' at line 1
+prepare stmt1 from ' select a ? t1 where a=1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? t1 where a=1' at line 1
+set @arg00='t1' ;
+select a from @arg00 where a=1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 where a=1' at line 1
+prepare stmt1 from ' select a from ? where a=1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? where a=1' at line 1
+set @arg00='WHERE' ;
+select a from t1 @arg00 a=1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a=1' at line 1
+prepare stmt1 from ' select a from t1 ? a=1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a=1' at line 1
+set @arg00=1 ;
+select a FROM t1 where a=@arg00 ;
+a
+1
+prepare stmt1 from ' select a FROM t1 where a=? ' ;
+execute stmt1 using @arg00 ;
+a
+1
+set @arg00=1000 ;
+execute stmt1 using @arg00 ;
+a
+set @arg00=NULL ;
+select a FROM t1 where a=@arg00 ;
+a
+prepare stmt1 from ' select a FROM t1 where a=? ' ;
+execute stmt1 using @arg00 ;
+a
+set @arg00=4 ;
+select a FROM t1 where a=sqrt(@arg00) ;
+a
+2
+prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
+execute stmt1 using @arg00 ;
+a
+2
+set @arg00=NULL ;
+select a FROM t1 where a=sqrt(@arg00) ;
+a
+prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
+execute stmt1 using @arg00 ;
+a
+set @arg00=2 ;
+set @arg01=3 ;
+select a FROM t1 where a in (@arg00,@arg01) order by a;
+a
+2
+3
+prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a ';
+execute stmt1 using @arg00, @arg01;
+a
+2
+3
+set @arg00= 'one' ;
+set @arg01= 'two' ;
+set @arg02= 'five' ;
+prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ;
+execute stmt1 using @arg00, @arg01, @arg02 ;
+b
+one
+two
+prepare stmt1 from ' select b FROM t1 where b like ? ';
+set @arg00='two' ;
+execute stmt1 using @arg00 ;
+b
+two
+set @arg00='tw%' ;
+execute stmt1 using @arg00 ;
+b
+two
+set @arg00='%wo' ;
+execute stmt1 using @arg00 ;
+b
+two
+set @arg00=null ;
+insert into t9 set c1= 0, c5 = NULL ;
+select c5 from t9 where c5 > NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 > ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 < NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 < ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 = NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 = ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 <=> NULL ;
+c5
+NULL
+prepare stmt1 from ' select c5 from t9 where c5 <=> ? ';
+execute stmt1 using @arg00 ;
+c5
+NULL
+delete from t9 where c1= 0 ;
+set @arg00='>' ;
+select a FROM t1 where a @arg00 1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 1' at line 1
+prepare stmt1 from ' select a FROM t1 where a ? 1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? 1' at line 1
+set @arg00=1 ;
+select a,b FROM t1 where a is not NULL
+AND b is not NULL group by a - @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+prepare stmt1 from ' select a,b FROM t1 where a is not NULL
+AND b is not NULL group by a - ? ' ;
+execute stmt1 using @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00='two' ;
+select a,b FROM t1 where a is not NULL
+AND b is not NULL having b <> @arg00 order by a ;
+a b
+1 one
+3 three
+4 four
+prepare stmt1 from ' select a,b FROM t1 where a is not NULL
+AND b is not NULL having b <> ? order by a ' ;
+execute stmt1 using @arg00 ;
+a b
+1 one
+3 three
+4 four
+set @arg00=1 ;
+select a,b FROM t1 where a is not NULL
+AND b is not NULL order by a - @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+prepare stmt1 from ' select a,b FROM t1 where a is not NULL
+AND b is not NULL order by a - ? ' ;
+execute stmt1 using @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00=2 ;
+select a,b from t1 order by 2 ;
+a b
+4 four
+1 one
+3 three
+2 two
+prepare stmt1 from ' select a,b from t1
+order by ? ';
+execute stmt1 using @arg00;
+a b
+4 four
+1 one
+3 three
+2 two
+set @arg00=1 ;
+execute stmt1 using @arg00;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00=0 ;
+execute stmt1 using @arg00;
+ERROR 42S22: Unknown column '?' in 'order clause'
+set @arg00=1;
+prepare stmt1 from ' select a,b from t1 order by a
+limit 1 ';
+execute stmt1 ;
+a b
+1 one
+prepare stmt1 from ' select a,b from t1
+limit ? ';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 2
+set @arg00='b' ;
+set @arg01=0 ;
+set @arg02=2 ;
+set @arg03=2 ;
+select sum(a), @arg00 from t1 where a > @arg01
+and b is not null group by substr(b,@arg02)
+having sum(a) <> @arg03 ;
+sum(a) @arg00
+3 b
+1 b
+4 b
+prepare stmt1 from ' select sum(a), ? from t1 where a > ?
+and b is not null group by substr(b,?)
+having sum(a) <> ? ';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03;
+sum(a) ?
+3 b
+1 b
+4 b
+test_sequence
+------ join tests ------
+select first.a as a1, second.a as a2
+from t1 first, t1 second
+where first.a = second.a order by a1 ;
+a1 a2
+1 1
+2 2
+3 3
+4 4
+prepare stmt1 from ' select first.a as a1, second.a as a2
+ from t1 first, t1 second
+ where first.a = second.a order by a1 ';
+execute stmt1 ;
+a1 a2
+1 1
+2 2
+3 3
+4 4
+set @arg00='ABC';
+set @arg01='two';
+set @arg02='one';
+select first.a, @arg00, second.a FROM t1 first, t1 second
+where @arg01 = first.b or first.a = second.a or second.b = @arg02
+order by second.a, first.a;
+a @arg00 a
+1 ABC 1
+2 ABC 1
+3 ABC 1
+4 ABC 1
+2 ABC 2
+2 ABC 3
+3 ABC 3
+2 ABC 4
+4 ABC 4
+prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
+ where ? = first.b or first.a = second.a or second.b = ?
+ order by second.a, first.a';
+execute stmt1 using @arg00, @arg01, @arg02;
+a ? a
+1 ABC 1
+2 ABC 1
+3 ABC 1
+4 ABC 1
+2 ABC 2
+2 ABC 3
+3 ABC 3
+2 ABC 4
+4 ABC 4
+drop table if exists t2 ;
+create table t2 as select * from t1 ;
+set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
+set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
+set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
+set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
+set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
+set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
+set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
+the join statement is:
+SELECT * FROM t2 right join t1 using(a) order by t2.a
+prepare stmt1 from @query9 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural right join t1 order by t2.a
+prepare stmt1 from @query8 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query7 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 using(a) order by t2.a
+prepare stmt1 from @query6 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural left join t1 order by t2.a
+prepare stmt1 from @query5 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query4 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 join t1 using(a) order by t2.a
+prepare stmt1 from @query3 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural join t1 order by t2.a
+prepare stmt1 from @query2 ;
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+the join statement is:
+SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a
+prepare stmt1 from @query1 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+drop table t2 ;
+test_sequence
+------ subquery tests ------
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = ''two'') ';
+execute stmt1 ;
+a b
+2 two
+set @arg00='two' ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where b = 'two' ) and b=@arg00 ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = ''two'') and b=? ';
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00='two' ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where b = @arg00 ) and b='two' ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = ? ) and b=''two'' ' ;
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=3 ;
+set @arg01='three' ;
+select a,b FROM t1 where (a,b) in (select 3, 'three');
+a b
+3 three
+select a FROM t1 where (a,b) in (select @arg00,@arg01);
+a
+3
+prepare stmt1 from ' select a FROM t1 where (a,b) in (select ?, ?) ';
+execute stmt1 using @arg00, @arg01;
+a
+3
+set @arg00=1 ;
+set @arg01='two' ;
+set @arg02=2 ;
+set @arg03='two' ;
+select a, @arg00, b FROM t1 outer_table where
+b=@arg01 and a = (select @arg02 from t1 where b = @arg03 ) ;
+a @arg00 b
+2 1 two
+prepare stmt1 from ' select a, ?, b FROM t1 outer_table where
+ b=? and a = (select ? from t1 where b = ? ) ' ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
+a ? b
+2 1 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = outer_table.b ) order by a ';
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+set @arg00='two' ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where b = outer_table.b ) and b=@arg00 ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = outer_table.b) and b=? ';
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=2 ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where a = @arg00 and b = outer_table.b) and b='two' ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where a = ? and b = outer_table.b) and b=''two'' ' ;
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=2 ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where outer_table.a = @arg00 and a=2) and b='two' ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where outer_table.a = ? and a=2) and b=''two'' ' ;
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=1 ;
+set @arg01='two' ;
+set @arg02=2 ;
+set @arg03='two' ;
+select a, @arg00, b FROM t1 outer_table where
+b=@arg01 and a = (select @arg02 from t1 where outer_table.b = @arg03
+and outer_table.a=a ) ;
+a @arg00 b
+2 1 two
+prepare stmt1 from ' select a, ?, b FROM t1 outer_table where
+ b=? and a = (select ? from t1 where outer_table.b = ?
+ and outer_table.a=a ) ' ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
+a ? b
+2 1 two
+set @arg00=1 ;
+set @arg01=0 ;
+select a, @arg00
+from ( select a - @arg00 as a from t1 where a=@arg00 ) as t2
+where a=@arg01;
+a @arg00
+0 1
+prepare stmt1 from ' select a, ?
+ from ( select a - ? as a from t1 where a=? ) as t2
+ where a=? ';
+execute stmt1 using @arg00, @arg00, @arg00, @arg01 ;
+a ?
+0 1
+drop table if exists t2 ;
+create table t2 as select * from t1;
+prepare stmt1 from ' select a in (select a from t2) from t1 ' ;
+execute stmt1 ;
+a in (select a from t2)
+1
+1
+1
+1
+drop table if exists t5, t6, t7 ;
+create table t5 (a int , b int) ;
+create table t6 like t5 ;
+create table t7 like t5 ;
+insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
+(2, -1), (3, 10) ;
+insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ;
+insert into t7 values (3, 3), (2, 2), (1, 1) ;
+prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1) from t7 ' ;
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+drop table t5, t6, t7 ;
+drop table if exists t2 ;
+create table t2 as select * from t9;
+set @stmt= ' SELECT
+ (SELECT SUM(c1 + c12 + 0.0) FROM t2
+ where (t9.c2 - 0e-3) = t2.c2
+ GROUP BY t9.c15 LIMIT 1) as scalar_s,
+ exists (select 1.0e+0 from t2
+ where t2.c3 * 9.0000000000 = t9.c4) as exists_s,
+ c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s,
+ (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s
+FROM t9,
+(select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
+prepare stmt1 from @stmt ;
+execute stmt1 ;
+execute stmt1 ;
+set @stmt= concat('explain ',@stmt);
+prepare stmt1 from @stmt ;
+execute stmt1 ;
+execute stmt1 ;
+set @stmt= ' SELECT
+ (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
+ GROUP BY t9.c15 LIMIT 1) as scalar_s,
+ exists (select ? from t2
+ where t2.c3*?=t9.c4) as exists_s,
+ c5*? in (select c6+? from t2) as in_s,
+ (c7-?, c8-?) in (select c9+?, c10+? from t2) as in_row_s
+FROM t9,
+(select c25 x, c32 y from t2) tt WHERE x =c25 ' ;
+set @arg00= 0.0 ;
+set @arg01= 0e-3 ;
+set @arg02= 1.0e+0 ;
+set @arg03= 9.0000000000 ;
+set @arg04= 4 ;
+set @arg05= 0.3e+1 ;
+set @arg06= 4 ;
+set @arg07= 4 ;
+set @arg08= 4.0 ;
+set @arg09= 40e-1 ;
+prepare stmt1 from @stmt ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+set @stmt= concat('explain ',@stmt);
+prepare stmt1 from @stmt ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+drop table t2 ;
+select 1 < (select a from t1) ;
+ERROR 21000: Subquery returns more than 1 row
+prepare stmt1 from ' select 1 < (select a from t1) ' ;
+execute stmt1 ;
+ERROR 21000: Subquery returns more than 1 row
+select 1 as my_col ;
+my_col
+1
+test_sequence
+------ union tests ------
+prepare stmt1 from ' select a FROM t1 where a=1
+ union distinct
+ select a FROM t1 where a=1 ';
+execute stmt1 ;
+a
+1
+execute stmt1 ;
+a
+1
+prepare stmt1 from ' select a FROM t1 where a=1
+ union all
+ select a FROM t1 where a=1 ';
+execute stmt1 ;
+a
+1
+1
+prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+set @arg00=1 ;
+select @arg00 FROM t1 where a=1
+union distinct
+select 1 FROM t1 where a=1;
+@arg00
+1
+prepare stmt1 from ' select ? FROM t1 where a=1
+ union distinct
+ select 1 FROM t1 where a=1 ' ;
+execute stmt1 using @arg00;
+?
+1
+set @arg00=1 ;
+select 1 FROM t1 where a=1
+union distinct
+select @arg00 FROM t1 where a=1;
+1
+1
+prepare stmt1 from ' select 1 FROM t1 where a=1
+ union distinct
+ select ? FROM t1 where a=1 ' ;
+execute stmt1 using @arg00;
+1
+1
+set @arg00='a' ;
+select @arg00 FROM t1 where a=1
+union distinct
+select @arg00 FROM t1 where a=1;
+@arg00
+a
+prepare stmt1 from ' select ? FROM t1 where a=1
+ union distinct
+ select ? FROM t1 where a=1 ';
+execute stmt1 using @arg00, @arg00;
+?
+a
+prepare stmt1 from ' select ?
+ union distinct
+ select ? ';
+execute stmt1 using @arg00, @arg00;
+?
+a
+set @arg00='a' ;
+set @arg01=1 ;
+set @arg02='a' ;
+set @arg03=2 ;
+select @arg00 FROM t1 where a=@arg01
+union distinct
+select @arg02 FROM t1 where a=@arg03;
+@arg00
+a
+prepare stmt1 from ' select ? FROM t1 where a=?
+ union distinct
+ select ? FROM t1 where a=? ' ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03;
+?
+a
+set @arg00=1 ;
+prepare stmt1 from ' select sum(a) + 200, ? from t1
+union distinct
+select sum(a) + 200, 1 from t1
+group by b ' ;
+execute stmt1 using @arg00;
+sum(a) + 200 ?
+210 1
+204 1
+201 1
+203 1
+202 1
+set @Oporto='Oporto' ;
+set @Lisboa='Lisboa' ;
+set @0=0 ;
+set @1=1 ;
+set @2=2 ;
+set @3=3 ;
+set @4=4 ;
+select @Oporto,@Lisboa,@0,@1,@2,@3,@4 ;
+@Oporto @Lisboa @0 @1 @2 @3 @4
+Oporto Lisboa 0 1 2 3 4
+select sum(a) + 200 as the_sum, @Oporto as the_town from t1
+group by b
+union distinct
+select sum(a) + 200, @Lisboa from t1
+group by b ;
+the_sum the_town
+204 Oporto
+201 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+201 Lisboa
+203 Lisboa
+202 Lisboa
+prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
+ group by b
+ union distinct
+ select sum(a) + 200, ? from t1
+ group by b ' ;
+execute stmt1 using @Oporto, @Lisboa;
+the_sum the_town
+204 Oporto
+201 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+201 Lisboa
+203 Lisboa
+202 Lisboa
+select sum(a) + 200 as the_sum, @Oporto as the_town from t1
+where a > @1
+group by b
+union distinct
+select sum(a) + 200, @Lisboa from t1
+where a > @2
+group by b ;
+the_sum the_town
+204 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+203 Lisboa
+prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
+ where a > ?
+ group by b
+ union distinct
+ select sum(a) + 200, ? from t1
+ where a > ?
+ group by b ' ;
+execute stmt1 using @Oporto, @1, @Lisboa, @2;
+the_sum the_town
+204 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+203 Lisboa
+select sum(a) + 200 as the_sum, @Oporto as the_town from t1
+where a > @1
+group by b
+having avg(a) > @2
+union distinct
+select sum(a) + 200, @Lisboa from t1
+where a > @2
+group by b
+having avg(a) > @3;
+the_sum the_town
+204 Oporto
+203 Oporto
+204 Lisboa
+prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
+ where a > ?
+ group by b
+ having avg(a) > ?
+ union distinct
+ select sum(a) + 200, ? from t1
+ where a > ?
+ group by b
+ having avg(a) > ? ';
+execute stmt1 using @Oporto, @1, @2, @Lisboa, @2, @3;
+the_sum the_town
+204 Oporto
+203 Oporto
+204 Lisboa
+test_sequence
+------ explain select tests ------
+prepare stmt1 from ' explain select * from t9 ' ;
+execute stmt1;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def id 8 3 1 N 32801 0 8
+def select_type 253 19 6 N 1 31 8
+def table 253 64 2 N 1 31 8
+def type 253 10 3 N 1 31 8
+def possible_keys 253 4096 0 Y 0 31 8
+def key 253 64 0 Y 0 31 8
+def key_len 8 3 0 Y 32800 0 8
+def ref 253 1024 0 Y 0 31 8
+def rows 8 10 1 N 32801 0 8
+def Extra 253 255 0 N 1 31 8
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t9 ALL NULL NULL NULL NULL 2
+test_sequence
+------ delete tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+prepare stmt1 from 'delete from t1 where a=2' ;
+execute stmt1;
+select a,b from t1 where a=2;
+a b
+execute stmt1;
+insert into t1 values(0,NULL);
+set @arg00=NULL;
+prepare stmt1 from 'delete from t1 where b=?' ;
+execute stmt1 using @arg00;
+select a,b from t1 where b is NULL ;
+a b
+0 NULL
+set @arg00='one';
+execute stmt1 using @arg00;
+select a,b from t1 where b=@arg00;
+a b
+prepare stmt1 from 'truncate table t1' ;
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+test_sequence
+------ update tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ;
+execute stmt1;
+select a,b from t1 where a=2;
+a b
+2 a=two
+execute stmt1;
+select a,b from t1 where a=2;
+a b
+2 a=two
+set @arg00=NULL;
+prepare stmt1 from 'update t1 set b=? where a=2' ;
+execute stmt1 using @arg00;
+select a,b from t1 where a=2;
+a b
+2 NULL
+set @arg00='two';
+execute stmt1 using @arg00;
+select a,b from t1 where a=2;
+a b
+2 two
+set @arg00=2;
+prepare stmt1 from 'update t1 set b=NULL where a=?' ;
+execute stmt1 using @arg00;
+select a,b from t1 where a=@arg00;
+a b
+2 NULL
+update t1 set b='two' where a=@arg00;
+set @arg00=2000;
+execute stmt1 using @arg00;
+select a,b from t1 where a=@arg00;
+a b
+set @arg00=2;
+set @arg01=22;
+prepare stmt1 from 'update t1 set a=? where a=?' ;
+execute stmt1 using @arg00, @arg00;
+select a,b from t1 where a=@arg00;
+a b
+2 two
+execute stmt1 using @arg01, @arg00;
+select a,b from t1 where a=@arg01;
+a b
+22 two
+execute stmt1 using @arg00, @arg01;
+select a,b from t1 where a=@arg00;
+a b
+2 two
+set @arg00=NULL;
+set @arg01=2;
+execute stmt1 using @arg00, @arg01;
+Warnings:
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1
+select a,b from t1 order by a;
+a b
+0 two
+1 one
+3 three
+4 four
+set @arg00=0;
+execute stmt1 using @arg01, @arg00;
+select a,b from t1 order by a;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00=23;
+set @arg01='two';
+set @arg02=2;
+set @arg03='two';
+set @arg04=2;
+drop table if exists t2;
+create table t2 as select a,b from t1 ;
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 where a = @arg00 ;
+a b
+23 two
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a not in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 order by a ;
+a b
+1 one
+2 two
+3 three
+4 four
+drop table t2 ;
+create table t2
+(
+a int, b varchar(30),
+primary key(a)
+) engine = 'InnoDB' ;
+insert into t2(a,b) select a, b from t1 ;
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 where a = @arg00 ;
+a b
+23 two
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a not in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 order by a ;
+a b
+1 one
+2 two
+3 three
+4 four
+drop table t2 ;
+set @arg00=1;
+prepare stmt1 from 'update t1 set b=''bla''
+where a=2
+limit 1';
+execute stmt1 ;
+select a,b from t1 where b = 'bla' ;
+a b
+2 bla
+prepare stmt1 from 'update t1 set b=''bla''
+where a=2
+limit ?';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 3
+test_sequence
+------ insert tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+prepare stmt1 from 'insert into t1 values(5, ''five'' )';
+execute stmt1;
+select a,b from t1 where a = 5;
+a b
+5 five
+set @arg00='six' ;
+prepare stmt1 from 'insert into t1 values(6, ? )';
+execute stmt1 using @arg00;
+select a,b from t1 where b = @arg00;
+a b
+6 six
+execute stmt1 using @arg00;
+ERROR 23000: Duplicate entry '6' for key 1
+set @arg00=NULL ;
+prepare stmt1 from 'insert into t1 values(0, ? )';
+execute stmt1 using @arg00;
+select a,b from t1 where b is NULL;
+a b
+0 NULL
+set @arg00=8 ;
+set @arg01='eight' ;
+prepare stmt1 from 'insert into t1 values(?, ? )';
+execute stmt1 using @arg00, @arg01 ;
+select a,b from t1 where b = @arg01;
+a b
+8 eight
+set @NULL= null ;
+set @arg00= 'abc' ;
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg00 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg00 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 abc
+10002 abc
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @NULL ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @NULL ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 NULL
+10002 NULL
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 10 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 9 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 8 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 7 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 6 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 5 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 4 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 3 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg01 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 10001
+10002 10002
+10003 10003
+10004 10004
+10005 10005
+10006 10006
+10007 10007
+10008 10008
+10009 10009
+10010 10010
+delete from t1 where a > 10000 ;
+set @arg00=81 ;
+set @arg01='8-1' ;
+set @arg02=82 ;
+set @arg03='8-2' ;
+prepare stmt1 from 'insert into t1 values(?,?),(?,?)';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
+select a,b from t1 where a in (@arg00,@arg02) ;
+a b
+81 8-1
+82 8-2
+set @arg00=9 ;
+set @arg01='nine' ;
+prepare stmt1 from 'insert into t1 set a=?, b=? ';
+execute stmt1 using @arg00, @arg01 ;
+select a,b from t1 where a = @arg00 ;
+a b
+9 nine
+set @arg00=6 ;
+set @arg01=1 ;
+prepare stmt1 from 'insert into t1 set a=?, b=''sechs''
+ on duplicate key update a=a + ?, b=concat(b,''modified'') ';
+execute stmt1 using @arg00, @arg01;
+select * from t1 order by a;
+a b
+0 NULL
+1 one
+2 two
+3 three
+4 four
+5 five
+7 sixmodified
+8 eight
+9 nine
+81 8-1
+82 8-2
+set @arg00=81 ;
+set @arg01=1 ;
+execute stmt1 using @arg00, @arg01;
+ERROR 23000: Duplicate entry '82' for key 1
+drop table if exists t2 ;
+create table t2 (id int auto_increment primary key)
+ENGINE= 'InnoDB' ;
+prepare stmt1 from ' select last_insert_id() ' ;
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+1
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+2
+drop table t2 ;
+set @1000=1000 ;
+set @x1000_2="x1000_2" ;
+set @x1000_3="x1000_3" ;
+set @x1000="x1000" ;
+set @1100=1100 ;
+set @x1100="x1100" ;
+set @100=100 ;
+set @updated="updated" ;
+insert into t1 values(1000,'x1000_1') ;
+insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3)
+on duplicate key update a = a + @100, b = concat(b,@updated) ;
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 x1000_3
+1100 x1000_1updated
+delete from t1 where a >= 1000 ;
+insert into t1 values(1000,'x1000_1') ;
+prepare stmt1 from ' insert into t1 values(?,?),(?,?)
+ on duplicate key update a = a + ?, b = concat(b,?) ';
+execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ;
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 x1000_3
+1100 x1000_1updated
+delete from t1 where a >= 1000 ;
+insert into t1 values(1000,'x1000_1') ;
+execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ;
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1200 x1000_1updatedupdated
+delete from t1 where a >= 1000 ;
+prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
+execute stmt1;
+execute stmt1;
+execute stmt1;
+test_sequence
+------ multi table tests ------
+delete from t1 ;
+delete from t9 ;
+insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
+insert into t9 (c1,c21)
+values (1, 'one'), (2, 'two'), (3, 'three') ;
+prepare stmt_delete from " delete t1, t9
+ from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
+prepare stmt_update from " update t1, t9
+ set t1.b='updated', t9.c21='updated'
+ where t1.a=t9.c1 and t1.a=? ";
+prepare stmt_select1 from " select a, b from t1 order by a" ;
+prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
+set @arg00= 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+2 two
+3 three
+execute stmt_select2 ;
+c1 c21
+2 two
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+3 three
+execute stmt_select2 ;
+c1 c21
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+execute stmt_select2 ;
+c1 c21
+set @arg00= @arg00 + 1 ;
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+insert into t1 values(0,NULL) ;
+set @duplicate='duplicate ' ;
+set @1000=1000 ;
+set @5=5 ;
+select a,b from t1 where a < 5 order by a ;
+a b
+0 NULL
+1 one
+2 two
+3 three
+4 four
+insert into t1 select a + @1000, concat(@duplicate,b) from t1
+where a < @5 ;
+affected rows: 5
+info: Records: 5 Duplicates: 0 Warnings: 0
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 NULL
+1001 duplicate one
+1002 duplicate two
+1003 duplicate three
+1004 duplicate four
+delete from t1 where a >= 1000 ;
+prepare stmt1 from ' insert into t1 select a + ?, concat(?,b) from t1
+where a < ? ' ;
+execute stmt1 using @1000, @duplicate, @5;
+affected rows: 5
+info: Records: 5 Duplicates: 0 Warnings: 0
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 NULL
+1001 duplicate one
+1002 duplicate two
+1003 duplicate three
+1004 duplicate four
+delete from t1 where a >= 1000 ;
+set @1=1 ;
+set @2=2 ;
+set @100=100 ;
+set @float=1.00;
+set @five='five' ;
+drop table if exists t2;
+create table t2 like t1 ;
+insert into t2 (b,a)
+select @duplicate, sum(first.a) from t1 first, t1 second
+where first.a <> @5 and second.b = first.b
+and second.b <> @five
+group by second.b
+having sum(second.a) > @2
+union
+select b, a + @100 from t1
+where (a,b) in ( select sqrt(a+@1)+CAST(@float AS signed),b
+from t1);
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
+select a,b from t2 order by a ;
+a b
+3 duplicate
+4 duplicate
+103 three
+delete from t2 ;
+prepare stmt1 from ' insert into t2 (b,a)
+select ?, sum(first.a)
+ from t1 first, t1 second
+ where first.a <> ? and second.b = first.b and second.b <> ?
+ group by second.b
+ having sum(second.a) > ?
+union
+select b, a + ? from t1
+ where (a,b) in ( select sqrt(a+?)+CAST(? AS signed),b
+ from t1 ) ' ;
+execute stmt1 using @duplicate, @5, @five, @2, @100, @1, @float ;
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
+select a,b from t2 order by a ;
+a b
+3 duplicate
+4 duplicate
+103 three
+drop table t2;
+drop table if exists t5 ;
+set @arg01= 8;
+set @arg02= 8.0;
+set @arg03= 80.00000000000e-1;
+set @arg04= 'abc' ;
+set @arg05= CAST('abc' as binary) ;
+set @arg06= '1991-08-05' ;
+set @arg07= CAST('1991-08-05' as date);
+set @arg08= '1991-08-05 01:01:01' ;
+set @arg09= CAST('1991-08-05 01:01:01' as datetime) ;
+set @arg10= unix_timestamp('1991-01-01 01:01:01');
+set @arg11= YEAR('1991-01-01 01:01:01');
+set @arg12= 8 ;
+set @arg12= NULL ;
+set @arg13= 8.0 ;
+set @arg13= NULL ;
+set @arg14= 'abc';
+set @arg14= NULL ;
+set @arg15= CAST('abc' as binary) ;
+set @arg15= NULL ;
+create table t5 as select
+8 as const01, @arg01 as param01,
+8.0 as const02, @arg02 as param02,
+80.00000000000e-1 as const03, @arg03 as param03,
+'abc' as const04, @arg04 as param04,
+CAST('abc' as binary) as const05, @arg05 as param05,
+'1991-08-05' as const06, @arg06 as param06,
+CAST('1991-08-05' as date) as const07, @arg07 as param07,
+'1991-08-05 01:01:01' as const08, @arg08 as param08,
+CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09,
+unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10,
+YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11,
+NULL as const12, @arg12 as param12,
+@arg13 as param13,
+@arg14 as param14,
+@arg15 as param15;
+show create table t5 ;
+Table Create Table
+t5 CREATE TABLE `t5` (
+ `const01` bigint(1) NOT NULL default '0',
+ `param01` bigint(20) default NULL,
+ `const02` double(3,1) NOT NULL default '0.0',
+ `param02` double default NULL,
+ `const03` double NOT NULL default '0',
+ `param03` double default NULL,
+ `const04` char(3) NOT NULL default '',
+ `param04` longtext,
+ `const05` binary(3) NOT NULL default '',
+ `param05` longblob,
+ `const06` varchar(10) NOT NULL default '',
+ `param06` longtext,
+ `const07` date default NULL,
+ `param07` longblob,
+ `const08` varchar(19) NOT NULL default '',
+ `param08` longtext,
+ `const09` datetime default NULL,
+ `param09` longblob,
+ `const10` int(10) NOT NULL default '0',
+ `param10` bigint(20) default NULL,
+ `const11` int(4) default NULL,
+ `param11` bigint(20) default NULL,
+ `const12` binary(0) default NULL,
+ `param12` bigint(20) default NULL,
+ `param13` double default NULL,
+ `param14` longtext,
+ `param15` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t5 ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t5 t5 const01 const01 8 1 1 N 32769 0 63
+def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
+def test t5 t5 const02 const02 5 3 3 N 32769 1 63
+def test t5 t5 param02 param02 5 20 1 Y 32768 31 63
+def test t5 t5 const03 const03 5 23 1 N 32769 31 63
+def test t5 t5 param03 param03 5 20 1 Y 32768 31 63
+def test t5 t5 const04 const04 254 3 3 N 1 0 8
+def test t5 t5 param04 param04 252 16777215 3 Y 16 0 8
+def test t5 t5 const05 const05 254 3 3 N 129 0 63
+def test t5 t5 param05 param05 252 16777215 3 Y 144 0 63
+def test t5 t5 const06 const06 253 10 10 N 1 0 8
+def test t5 t5 param06 param06 252 16777215 10 Y 16 0 8
+def test t5 t5 const07 const07 10 10 10 Y 128 0 63
+def test t5 t5 param07 param07 252 16777215 10 Y 144 0 63
+def test t5 t5 const08 const08 253 19 19 N 1 0 8
+def test t5 t5 param08 param08 252 16777215 19 Y 16 0 8
+def test t5 t5 const09 const09 12 19 19 Y 128 0 63
+def test t5 t5 param09 param09 252 16777215 19 Y 144 0 63
+def test t5 t5 const10 const10 3 10 9 N 32769 0 63
+def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
+def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
+def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
+def test t5 t5 const12 const12 254 0 0 Y 128 0 63
+def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
+def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
+def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
+const01 8
+param01 8
+const02 8.0
+param02 8
+const03 8
+param03 8
+const04 abc
+param04 abc
+const05 abc
+param05 abc
+const06 1991-08-05
+param06 1991-08-05
+const07 1991-08-05
+param07 1991-08-05
+const08 1991-08-05 01:01:01
+param08 1991-08-05 01:01:01
+const09 1991-08-05 01:01:01
+param09 1991-08-05 01:01:01
+const10 662680861
+param10 662680861
+const11 1991
+param11 1991
+const12 NULL
+param12 NULL
+param13 NULL
+param14 NULL
+param15 NULL
+drop table t5 ;
+test_sequence
+------ data type conversion tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ;
+select * from t9 order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+test_sequence
+------ select @parameter:= column ------
+prepare full_info from "select @arg01, @arg02, @arg03, @arg04,
+ @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12,
+ @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20,
+ @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28,
+ @arg29, @arg30, @arg31, @arg32" ;
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 1 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 0 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select
+ @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+ @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+ @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+ @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+ @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+ @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+ @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+ @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':= c1 from t9 where c1= 1' at line 1
+test_sequence
+------ select column, .. into @parm,.. ------
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 1 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 0 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+ c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+ c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? from t9 where c1= 1' at line 1
+test_sequence
+-- insert into numeric columns --
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ;
+set @arg00= 21 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ;
+execute stmt1 ;
+set @arg00= 23;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
+30.0, 30.0, 30.0 ) ;
+set @arg00= 31.0 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0,
+ 32.0, 32.0, 32.0 )" ;
+execute stmt1 ;
+set @arg00= 33.0;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( '40', '40', '40', '40', '40', '40', '40', '40',
+'40', '40', '40' ) ;
+set @arg00= '41' ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( '42', '42', '42', '42', '42', '42', '42', '42',
+ '42', '42', '42' )" ;
+execute stmt1 ;
+set @arg00= '43';
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ;
+set @arg00= CAST('51' as binary) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ;
+execute stmt1 ;
+set @arg00= CAST('53' as binary) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 2 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+NULL, NULL, NULL ) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 61, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL )" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 8.0 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 71, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 'abc' ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 81, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c1 >= 20
+order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12
+20 20 20 20 20 20 20 20 20 20 20.0000
+21 21 21 21 21 21 21 21 21 21 21.0000
+22 22 22 22 22 22 22 22 22 22 22.0000
+23 23 23 23 23 23 23 23 23 23 23.0000
+30 30 30 30 30 30 30 30 30 30 30.0000
+31 31 31 31 31 31 31 31 31 31 31.0000
+32 32 32 32 32 32 32 32 32 32 32.0000
+33 33 33 33 33 33 33 33 33 33 33.0000
+40 40 40 40 40 40 40 40 40 40 40.0000
+41 41 41 41 41 41 41 41 41 41 41.0000
+42 42 42 42 42 42 42 42 42 42 42.0000
+43 43 43 43 43 43 43 43 43 43 43.0000
+50 50 50 50 50 50 50 50 50 50 50.0000
+51 51 51 51 51 51 51 51 51 51 51.0000
+52 52 52 52 52 52 52 52 52 52 52.0000
+53 53 53 53 53 53 53 53 53 53 53.0000
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where numeric column = .. --
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+and c8= 20 and c9= 20 and c10= 20 and c12= 20;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+ and c8= 20 and c9= 20 and c10= 20 and c12= 20 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+ and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20';
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' ";
+execute stmt1 ;
+found
+true
+set @arg00= '20';
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+c12= CAST('20' as binary);
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+ c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+ c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+ c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+ c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+ c12= CAST('20' as binary) ";
+execute stmt1 ;
+found
+true
+set @arg00= CAST('20' as binary) ;
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- some numeric overflow experiments --
+prepare my_insert from "insert into t9
+ ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c21 = 'O' ";
+prepare my_delete from "delete from t9 where c21 = 'O' ";
+set @arg00= 9223372036854775807 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= '9223372036854775807' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= -9223372036854775808 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-9223372036854775808' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= 1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= '1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 1
+c2 1
+c3 1
+c4 1
+c5 1
+c6 1
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= -1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -1
+c2 -1
+c3 -1
+c4 -1
+c5 -1
+c6 -1
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+test_sequence
+-- insert into string columns --
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30
+from t9 where c1 >= 20
+order by c1 ;
+c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
+20 2 20 20 20 20 20 20 20 20 20 20
+21 2 21 21 21 21 21 21 21 21 21 21
+22 2 22 22 22 22 22 22 22 22 22 22
+23 2 23 23 23 23 23 23 23 23 23 23
+30 3 30 30 30 30 30 30 30 30 30 30
+31 3 31 31 31 31 31 31 31 31 31 31
+32 3 32 32 32 32 32 32 32 32 32 32
+33 3 33 33 33 33 33 33 33 33 33 33
+40 4 40 40 40 40 40 40 40 40 40 40
+41 4 41 41 41 41 41 41 41 41 41 41
+42 4 42 42 42 42 42 42 42 42 42 42
+43 4 43 43 43 43 43 43 43 43 43 43
+50 5 50 50 50.00 50.00 50.00 50.00 50.00 50.00 50.00 50.00
+51 5 51 51 51 51 51 51 51 51 51 51
+52 5 52 52 52.00 52.00 52.00 52.00 52.00 52.00 52.00 52.00
+53 5 53 53 53.00 53.00 53.00 53.00 53.00 53.00 53.00 53.00
+54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00
+55 5 55 55 55 55 55 55 55 55 55 55
+56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00
+57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where string column = .. --
+set @arg00= '20';
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+c27= '20' and c28= '20' and c29= '20' and c30= '20' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+ c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+ c27= '20' and c28= '20' and c29= '20' and c30= '20'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('20' as binary);
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+= CAST('20' as binary) and c21= CAST('20' as binary)
+and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+c30= CAST('20' as binary) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and
+c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+ = CAST('20' as binary) and c21= CAST('20' as binary)
+ and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+ c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+ c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+ c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+ c30= CAST('20' as binary)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and
+ c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and
+ c29= ? and c30= ?";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+c27= 20 and c28= 20 and c29= 20 and c30= 20 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+ c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+ c27= 20 and c28= 20 and c29= 20 and c30= 20" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+ c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+ c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- insert into date/time columns --
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
+c1 c13 c14 c15 c16 c17
+20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+21 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+22 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+23 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+30 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+60 NULL NULL 1991-01-01 01:01:01 NULL NULL
+61 NULL NULL 1991-01-01 01:01:01 NULL NULL
+62 NULL NULL 1991-01-01 01:01:01 NULL NULL
+63 NULL NULL 1991-01-01 01:01:01 NULL NULL
+71 NULL NULL 1991-01-01 01:01:01 NULL NULL
+73 NULL NULL 1991-01-01 01:01:01 NULL NULL
+81 NULL NULL 1991-01-01 01:01:01 NULL NULL
+83 NULL NULL 1991-01-01 01:01:01 NULL NULL
+test_sequence
+-- select .. where date/time column = .. --
+set @arg00= '1991-01-01 01:01:01' ;
+select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+c17= '1991-01-01 01:01:01' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+ c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+ c17= '1991-01-01 01:01:01'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
+select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+c14= CAST('1991-01-01 01:01:01' as datetime) and
+c15= CAST('1991-01-01 01:01:01' as datetime) and
+c16= CAST('1991-01-01 01:01:01' as datetime) and
+c17= CAST('1991-01-01 01:01:01' as datetime) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+ c14= CAST('1991-01-01 01:01:01' as datetime) and
+ c15= CAST('1991-01-01 01:01:01' as datetime) and
+ c16= CAST('1991-01-01 01:01:01' as datetime) and
+ c17= CAST('1991-01-01 01:01:01' as datetime)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 1991 ;
+select 'true' as found from t9
+where c1= 20 and c17= 1991 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= 1991" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= ?" ;
+execute stmt1 using @arg00 ;
+found
+true
+set @arg00= 1.991e+3 ;
+select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and abs(c17 - @arg00) < 0.01 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - ?) < 0.01" ;
+execute stmt1 using @arg00 ;
+found
+true
+drop table t1, t9;
diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result
new file mode 100644
index 00000000000..60a9ddd2bf2
--- /dev/null
+++ b/mysql-test/r/ps_4heap.result
@@ -0,0 +1,3117 @@
+use test;
+drop table if exists t1, t9 ;
+create table t1
+(
+a int, b varchar(30),
+primary key(a)
+) engine = 'HEAP' ;
+drop table if exists t9;
+create table t9
+(
+c1 tinyint, c2 smallint, c3 mediumint, c4 int,
+c5 integer, c6 bigint, c7 float, c8 double,
+c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
+c13 date, c14 datetime, c15 timestamp(14), c16 time,
+c17 year, c18 bit, c19 bool, c20 char,
+c21 char(10), c22 varchar(30), c23 char(100), c24 char(100),
+c25 char(100), c26 char(100), c27 char(100), c28 char(100),
+c29 char(100), c30 char(100), c31 enum('one', 'two', 'three'),
+c32 set('monday', 'tuesday', 'wednesday'),
+primary key(c1)
+) engine = 'HEAP' ;
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+test_sequence
+------ simple select tests ------
+prepare stmt1 from ' select * from t9 order by c1 ' ;
+execute stmt1;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t9 t9 c1 c1 1 4 1 N 49155 0 63
+def test t9 t9 c2 c2 2 6 1 Y 32768 0 63
+def test t9 t9 c3 c3 9 9 1 Y 32768 0 63
+def test t9 t9 c4 c4 3 11 1 Y 32768 0 63
+def test t9 t9 c5 c5 3 11 1 Y 32768 0 63
+def test t9 t9 c6 c6 8 20 1 Y 32768 0 63
+def test t9 t9 c7 c7 4 12 1 Y 32768 31 63
+def test t9 t9 c8 c8 5 22 1 Y 32768 31 63
+def test t9 t9 c9 c9 5 22 1 Y 32768 31 63
+def test t9 t9 c10 c10 5 22 1 Y 32768 31 63
+def test t9 t9 c11 c11 0 9 6 Y 32768 4 63
+def test t9 t9 c12 c12 0 10 6 Y 32768 4 63
+def test t9 t9 c13 c13 10 10 10 Y 128 0 63
+def test t9 t9 c14 c14 12 19 19 Y 128 0 63
+def test t9 t9 c15 c15 7 19 19 N 1249 0 63
+def test t9 t9 c16 c16 11 8 8 Y 128 0 63
+def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
+def test t9 t9 c18 c18 1 1 1 Y 32768 0 63
+def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
+def test t9 t9 c20 c20 254 1 1 Y 0 0 8
+def test t9 t9 c21 c21 253 10 10 Y 0 0 8
+def test t9 t9 c22 c22 253 30 30 Y 0 0 8
+def test t9 t9 c23 c23 253 100 8 Y 0 0 8
+def test t9 t9 c24 c24 253 100 8 Y 0 0 8
+def test t9 t9 c25 c25 253 100 4 Y 0 0 8
+def test t9 t9 c26 c26 253 100 4 Y 0 0 8
+def test t9 t9 c27 c27 253 100 10 Y 0 0 8
+def test t9 t9 c28 c28 253 100 10 Y 0 0 8
+def test t9 t9 c29 c29 253 100 8 Y 0 0 8
+def test t9 t9 c30 c30 253 100 8 Y 0 0 8
+def test t9 t9 c31 c31 254 5 3 Y 256 0 8
+def test t9 t9 c32 c32 254 24 7 Y 2048 0 8
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+set @arg00='SELECT' ;
+prepare stmt1 from ' ? a from t1 where a=1 ';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1
+set @arg00=1 ;
+select @arg00, b from t1 where a=1 ;
+@arg00 b
+1 one
+prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+? b
+1 one
+set @arg00='lion' ;
+select @arg00, b from t1 where a=1 ;
+@arg00 b
+lion one
+prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+? b
+lion one
+set @arg00=NULL ;
+select @arg00, b from t1 where a=1 ;
+@arg00 b
+NULL one
+prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+? b
+NULL one
+set @arg00=1 ;
+select b, a - @arg00 from t1 where a=1 ;
+b a - @arg00
+one 0
+prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+b a - ?
+one 0
+set @arg00=null ;
+select @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select @arg00 + 1 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? + 1 as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select 1 + @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select 1 + ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+set @arg00='MySQL' ;
+select substr(@arg00,1,2) from t1 where a=1 ;
+substr(@arg00,1,2)
+My
+prepare stmt1 from ' select substr(?,1,2) from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+substr(?,1,2)
+My
+set @arg00=3 ;
+select substr('MySQL',@arg00,5) from t1 where a=1 ;
+substr('MySQL',@arg00,5)
+SQL
+prepare stmt1 from ' select substr(''MySQL'',?,5) from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+substr('MySQL',?,5)
+SQL
+select substr('MySQL',1,@arg00) from t1 where a=1 ;
+substr('MySQL',1,@arg00)
+MyS
+prepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+substr('MySQL',1,?)
+MyS
+set @arg00='MySQL' ;
+select a , concat(@arg00,b) from t1 order by a;
+a concat(@arg00,b)
+1 MySQLone
+2 MySQLtwo
+3 MySQLthree
+4 MySQLfour
+prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ;
+execute stmt1 using @arg00;
+a concat(?,b)
+1 MySQLone
+2 MySQLtwo
+3 MySQLthree
+4 MySQLfour
+select a , concat(b,@arg00) from t1 order by a ;
+a concat(b,@arg00)
+1 oneMySQL
+2 twoMySQL
+3 threeMySQL
+4 fourMySQL
+prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ;
+execute stmt1 using @arg00;
+a concat(b,?)
+1 oneMySQL
+2 twoMySQL
+3 threeMySQL
+4 fourMySQL
+set @arg00='MySQL' ;
+select group_concat(@arg00,b order by a) from t1
+group by 'a' ;
+group_concat(@arg00,b order by a)
+MySQLone,MySQLtwo,MySQLthree,MySQLfour
+prepare stmt1 from ' select group_concat(?,b order by a) from t1
+group by ''a'' ' ;
+execute stmt1 using @arg00;
+group_concat(?,b order by a)
+MySQLone,MySQLtwo,MySQLthree,MySQLfour
+select group_concat(b,@arg00 order by a) from t1
+group by 'a' ;
+group_concat(b,@arg00 order by a)
+oneMySQL,twoMySQL,threeMySQL,fourMySQL
+prepare stmt1 from ' select group_concat(b,? order by a) from t1
+group by ''a'' ' ;
+execute stmt1 using @arg00;
+group_concat(b,? order by a)
+oneMySQL,twoMySQL,threeMySQL,fourMySQL
+set @arg00='first' ;
+set @arg01='second' ;
+set @arg02=NULL;
+select @arg00, @arg01 from t1 where a=1 ;
+@arg00 @arg01
+first second
+prepare stmt1 from ' select ?, ? from t1 where a=1 ' ;
+execute stmt1 using @arg00, @arg01 ;
+? ?
+first second
+execute stmt1 using @arg02, @arg01 ;
+? ?
+NULL second
+execute stmt1 using @arg00, @arg02 ;
+? ?
+first NULL
+execute stmt1 using @arg02, @arg02 ;
+? ?
+NULL NULL
+drop table if exists t5 ;
+create table t5 (id1 int(11) not null default '0',
+value2 varchar(100), value1 varchar(100)) ;
+insert into t5 values (1,'hh','hh'),(2,'hh','hh'),
+(1,'ii','ii'),(2,'ii','ii') ;
+prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ;
+set @arg00=1 ;
+set @arg01='hh' ;
+execute stmt1 using @arg00, @arg01 ;
+id1 value1
+1 hh
+1 ii
+2 hh
+drop table t5 ;
+drop table if exists t5 ;
+create table t5(session_id char(9) not null) ;
+insert into t5 values ('abc') ;
+prepare stmt1 from ' select * from t5
+where ?=''1111'' and session_id = ''abc'' ' ;
+set @arg00='abc' ;
+execute stmt1 using @arg00 ;
+session_id
+set @arg00='1111' ;
+execute stmt1 using @arg00 ;
+session_id
+abc
+set @arg00='abc' ;
+execute stmt1 using @arg00 ;
+session_id
+drop table t5 ;
+set @arg00='FROM' ;
+select a @arg00 t1 where a=1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 t1 where a=1' at line 1
+prepare stmt1 from ' select a ? t1 where a=1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? t1 where a=1' at line 1
+set @arg00='t1' ;
+select a from @arg00 where a=1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 where a=1' at line 1
+prepare stmt1 from ' select a from ? where a=1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? where a=1' at line 1
+set @arg00='WHERE' ;
+select a from t1 @arg00 a=1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a=1' at line 1
+prepare stmt1 from ' select a from t1 ? a=1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a=1' at line 1
+set @arg00=1 ;
+select a FROM t1 where a=@arg00 ;
+a
+1
+prepare stmt1 from ' select a FROM t1 where a=? ' ;
+execute stmt1 using @arg00 ;
+a
+1
+set @arg00=1000 ;
+execute stmt1 using @arg00 ;
+a
+set @arg00=NULL ;
+select a FROM t1 where a=@arg00 ;
+a
+prepare stmt1 from ' select a FROM t1 where a=? ' ;
+execute stmt1 using @arg00 ;
+a
+set @arg00=4 ;
+select a FROM t1 where a=sqrt(@arg00) ;
+a
+2
+prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
+execute stmt1 using @arg00 ;
+a
+2
+set @arg00=NULL ;
+select a FROM t1 where a=sqrt(@arg00) ;
+a
+prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
+execute stmt1 using @arg00 ;
+a
+set @arg00=2 ;
+set @arg01=3 ;
+select a FROM t1 where a in (@arg00,@arg01) order by a;
+a
+2
+3
+prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a ';
+execute stmt1 using @arg00, @arg01;
+a
+2
+3
+set @arg00= 'one' ;
+set @arg01= 'two' ;
+set @arg02= 'five' ;
+prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ;
+execute stmt1 using @arg00, @arg01, @arg02 ;
+b
+one
+two
+prepare stmt1 from ' select b FROM t1 where b like ? ';
+set @arg00='two' ;
+execute stmt1 using @arg00 ;
+b
+two
+set @arg00='tw%' ;
+execute stmt1 using @arg00 ;
+b
+two
+set @arg00='%wo' ;
+execute stmt1 using @arg00 ;
+b
+two
+set @arg00=null ;
+insert into t9 set c1= 0, c5 = NULL ;
+select c5 from t9 where c5 > NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 > ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 < NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 < ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 = NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 = ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 <=> NULL ;
+c5
+NULL
+prepare stmt1 from ' select c5 from t9 where c5 <=> ? ';
+execute stmt1 using @arg00 ;
+c5
+NULL
+delete from t9 where c1= 0 ;
+set @arg00='>' ;
+select a FROM t1 where a @arg00 1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 1' at line 1
+prepare stmt1 from ' select a FROM t1 where a ? 1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? 1' at line 1
+set @arg00=1 ;
+select a,b FROM t1 where a is not NULL
+AND b is not NULL group by a - @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+prepare stmt1 from ' select a,b FROM t1 where a is not NULL
+AND b is not NULL group by a - ? ' ;
+execute stmt1 using @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00='two' ;
+select a,b FROM t1 where a is not NULL
+AND b is not NULL having b <> @arg00 order by a ;
+a b
+1 one
+3 three
+4 four
+prepare stmt1 from ' select a,b FROM t1 where a is not NULL
+AND b is not NULL having b <> ? order by a ' ;
+execute stmt1 using @arg00 ;
+a b
+1 one
+3 three
+4 four
+set @arg00=1 ;
+select a,b FROM t1 where a is not NULL
+AND b is not NULL order by a - @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+prepare stmt1 from ' select a,b FROM t1 where a is not NULL
+AND b is not NULL order by a - ? ' ;
+execute stmt1 using @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00=2 ;
+select a,b from t1 order by 2 ;
+a b
+4 four
+1 one
+3 three
+2 two
+prepare stmt1 from ' select a,b from t1
+order by ? ';
+execute stmt1 using @arg00;
+a b
+4 four
+1 one
+3 three
+2 two
+set @arg00=1 ;
+execute stmt1 using @arg00;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00=0 ;
+execute stmt1 using @arg00;
+ERROR 42S22: Unknown column '?' in 'order clause'
+set @arg00=1;
+prepare stmt1 from ' select a,b from t1 order by a
+limit 1 ';
+execute stmt1 ;
+a b
+1 one
+prepare stmt1 from ' select a,b from t1
+limit ? ';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 2
+set @arg00='b' ;
+set @arg01=0 ;
+set @arg02=2 ;
+set @arg03=2 ;
+select sum(a), @arg00 from t1 where a > @arg01
+and b is not null group by substr(b,@arg02)
+having sum(a) <> @arg03 ;
+sum(a) @arg00
+3 b
+1 b
+4 b
+prepare stmt1 from ' select sum(a), ? from t1 where a > ?
+and b is not null group by substr(b,?)
+having sum(a) <> ? ';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03;
+sum(a) ?
+3 b
+1 b
+4 b
+test_sequence
+------ join tests ------
+select first.a as a1, second.a as a2
+from t1 first, t1 second
+where first.a = second.a order by a1 ;
+a1 a2
+1 1
+2 2
+3 3
+4 4
+prepare stmt1 from ' select first.a as a1, second.a as a2
+ from t1 first, t1 second
+ where first.a = second.a order by a1 ';
+execute stmt1 ;
+a1 a2
+1 1
+2 2
+3 3
+4 4
+set @arg00='ABC';
+set @arg01='two';
+set @arg02='one';
+select first.a, @arg00, second.a FROM t1 first, t1 second
+where @arg01 = first.b or first.a = second.a or second.b = @arg02
+order by second.a, first.a;
+a @arg00 a
+1 ABC 1
+2 ABC 1
+3 ABC 1
+4 ABC 1
+2 ABC 2
+2 ABC 3
+3 ABC 3
+2 ABC 4
+4 ABC 4
+prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
+ where ? = first.b or first.a = second.a or second.b = ?
+ order by second.a, first.a';
+execute stmt1 using @arg00, @arg01, @arg02;
+a ? a
+1 ABC 1
+2 ABC 1
+3 ABC 1
+4 ABC 1
+2 ABC 2
+2 ABC 3
+3 ABC 3
+2 ABC 4
+4 ABC 4
+drop table if exists t2 ;
+create table t2 as select * from t1 ;
+set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
+set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
+set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
+set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
+set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
+set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
+set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
+the join statement is:
+SELECT * FROM t2 right join t1 using(a) order by t2.a
+prepare stmt1 from @query9 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural right join t1 order by t2.a
+prepare stmt1 from @query8 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query7 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 using(a) order by t2.a
+prepare stmt1 from @query6 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural left join t1 order by t2.a
+prepare stmt1 from @query5 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query4 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 join t1 using(a) order by t2.a
+prepare stmt1 from @query3 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural join t1 order by t2.a
+prepare stmt1 from @query2 ;
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+the join statement is:
+SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a
+prepare stmt1 from @query1 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+drop table t2 ;
+test_sequence
+------ subquery tests ------
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = ''two'') ';
+execute stmt1 ;
+a b
+2 two
+set @arg00='two' ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where b = 'two' ) and b=@arg00 ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = ''two'') and b=? ';
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00='two' ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where b = @arg00 ) and b='two' ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = ? ) and b=''two'' ' ;
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=3 ;
+set @arg01='three' ;
+select a,b FROM t1 where (a,b) in (select 3, 'three');
+a b
+3 three
+select a FROM t1 where (a,b) in (select @arg00,@arg01);
+a
+3
+prepare stmt1 from ' select a FROM t1 where (a,b) in (select ?, ?) ';
+execute stmt1 using @arg00, @arg01;
+a
+3
+set @arg00=1 ;
+set @arg01='two' ;
+set @arg02=2 ;
+set @arg03='two' ;
+select a, @arg00, b FROM t1 outer_table where
+b=@arg01 and a = (select @arg02 from t1 where b = @arg03 ) ;
+a @arg00 b
+2 1 two
+prepare stmt1 from ' select a, ?, b FROM t1 outer_table where
+ b=? and a = (select ? from t1 where b = ? ) ' ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
+a ? b
+2 1 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = outer_table.b ) order by a ';
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+set @arg00='two' ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where b = outer_table.b ) and b=@arg00 ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = outer_table.b) and b=? ';
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=2 ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where a = @arg00 and b = outer_table.b) and b='two' ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where a = ? and b = outer_table.b) and b=''two'' ' ;
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=2 ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where outer_table.a = @arg00 and a=2) and b='two' ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where outer_table.a = ? and a=2) and b=''two'' ' ;
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=1 ;
+set @arg01='two' ;
+set @arg02=2 ;
+set @arg03='two' ;
+select a, @arg00, b FROM t1 outer_table where
+b=@arg01 and a = (select @arg02 from t1 where outer_table.b = @arg03
+and outer_table.a=a ) ;
+a @arg00 b
+2 1 two
+prepare stmt1 from ' select a, ?, b FROM t1 outer_table where
+ b=? and a = (select ? from t1 where outer_table.b = ?
+ and outer_table.a=a ) ' ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
+a ? b
+2 1 two
+set @arg00=1 ;
+set @arg01=0 ;
+select a, @arg00
+from ( select a - @arg00 as a from t1 where a=@arg00 ) as t2
+where a=@arg01;
+a @arg00
+0 1
+prepare stmt1 from ' select a, ?
+ from ( select a - ? as a from t1 where a=? ) as t2
+ where a=? ';
+execute stmt1 using @arg00, @arg00, @arg00, @arg01 ;
+a ?
+0 1
+drop table if exists t2 ;
+create table t2 as select * from t1;
+prepare stmt1 from ' select a in (select a from t2) from t1 ' ;
+execute stmt1 ;
+a in (select a from t2)
+1
+1
+1
+1
+drop table if exists t5, t6, t7 ;
+create table t5 (a int , b int) ;
+create table t6 like t5 ;
+create table t7 like t5 ;
+insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
+(2, -1), (3, 10) ;
+insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ;
+insert into t7 values (3, 3), (2, 2), (1, 1) ;
+prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1) from t7 ' ;
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+drop table t5, t6, t7 ;
+drop table if exists t2 ;
+create table t2 as select * from t9;
+set @stmt= ' SELECT
+ (SELECT SUM(c1 + c12 + 0.0) FROM t2
+ where (t9.c2 - 0e-3) = t2.c2
+ GROUP BY t9.c15 LIMIT 1) as scalar_s,
+ exists (select 1.0e+0 from t2
+ where t2.c3 * 9.0000000000 = t9.c4) as exists_s,
+ c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s,
+ (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s
+FROM t9,
+(select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
+prepare stmt1 from @stmt ;
+execute stmt1 ;
+execute stmt1 ;
+set @stmt= concat('explain ',@stmt);
+prepare stmt1 from @stmt ;
+execute stmt1 ;
+execute stmt1 ;
+set @stmt= ' SELECT
+ (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
+ GROUP BY t9.c15 LIMIT 1) as scalar_s,
+ exists (select ? from t2
+ where t2.c3*?=t9.c4) as exists_s,
+ c5*? in (select c6+? from t2) as in_s,
+ (c7-?, c8-?) in (select c9+?, c10+? from t2) as in_row_s
+FROM t9,
+(select c25 x, c32 y from t2) tt WHERE x =c25 ' ;
+set @arg00= 0.0 ;
+set @arg01= 0e-3 ;
+set @arg02= 1.0e+0 ;
+set @arg03= 9.0000000000 ;
+set @arg04= 4 ;
+set @arg05= 0.3e+1 ;
+set @arg06= 4 ;
+set @arg07= 4 ;
+set @arg08= 4.0 ;
+set @arg09= 40e-1 ;
+prepare stmt1 from @stmt ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+set @stmt= concat('explain ',@stmt);
+prepare stmt1 from @stmt ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+drop table t2 ;
+select 1 < (select a from t1) ;
+ERROR 21000: Subquery returns more than 1 row
+prepare stmt1 from ' select 1 < (select a from t1) ' ;
+execute stmt1 ;
+ERROR 21000: Subquery returns more than 1 row
+select 1 as my_col ;
+my_col
+1
+test_sequence
+------ union tests ------
+prepare stmt1 from ' select a FROM t1 where a=1
+ union distinct
+ select a FROM t1 where a=1 ';
+execute stmt1 ;
+a
+1
+execute stmt1 ;
+a
+1
+prepare stmt1 from ' select a FROM t1 where a=1
+ union all
+ select a FROM t1 where a=1 ';
+execute stmt1 ;
+a
+1
+1
+prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+set @arg00=1 ;
+select @arg00 FROM t1 where a=1
+union distinct
+select 1 FROM t1 where a=1;
+@arg00
+1
+prepare stmt1 from ' select ? FROM t1 where a=1
+ union distinct
+ select 1 FROM t1 where a=1 ' ;
+execute stmt1 using @arg00;
+?
+1
+set @arg00=1 ;
+select 1 FROM t1 where a=1
+union distinct
+select @arg00 FROM t1 where a=1;
+1
+1
+prepare stmt1 from ' select 1 FROM t1 where a=1
+ union distinct
+ select ? FROM t1 where a=1 ' ;
+execute stmt1 using @arg00;
+1
+1
+set @arg00='a' ;
+select @arg00 FROM t1 where a=1
+union distinct
+select @arg00 FROM t1 where a=1;
+@arg00
+a
+prepare stmt1 from ' select ? FROM t1 where a=1
+ union distinct
+ select ? FROM t1 where a=1 ';
+execute stmt1 using @arg00, @arg00;
+?
+a
+prepare stmt1 from ' select ?
+ union distinct
+ select ? ';
+execute stmt1 using @arg00, @arg00;
+?
+a
+set @arg00='a' ;
+set @arg01=1 ;
+set @arg02='a' ;
+set @arg03=2 ;
+select @arg00 FROM t1 where a=@arg01
+union distinct
+select @arg02 FROM t1 where a=@arg03;
+@arg00
+a
+prepare stmt1 from ' select ? FROM t1 where a=?
+ union distinct
+ select ? FROM t1 where a=? ' ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03;
+?
+a
+set @arg00=1 ;
+prepare stmt1 from ' select sum(a) + 200, ? from t1
+union distinct
+select sum(a) + 200, 1 from t1
+group by b ' ;
+execute stmt1 using @arg00;
+sum(a) + 200 ?
+210 1
+204 1
+201 1
+203 1
+202 1
+set @Oporto='Oporto' ;
+set @Lisboa='Lisboa' ;
+set @0=0 ;
+set @1=1 ;
+set @2=2 ;
+set @3=3 ;
+set @4=4 ;
+select @Oporto,@Lisboa,@0,@1,@2,@3,@4 ;
+@Oporto @Lisboa @0 @1 @2 @3 @4
+Oporto Lisboa 0 1 2 3 4
+select sum(a) + 200 as the_sum, @Oporto as the_town from t1
+group by b
+union distinct
+select sum(a) + 200, @Lisboa from t1
+group by b ;
+the_sum the_town
+204 Oporto
+201 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+201 Lisboa
+203 Lisboa
+202 Lisboa
+prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
+ group by b
+ union distinct
+ select sum(a) + 200, ? from t1
+ group by b ' ;
+execute stmt1 using @Oporto, @Lisboa;
+the_sum the_town
+204 Oporto
+201 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+201 Lisboa
+203 Lisboa
+202 Lisboa
+select sum(a) + 200 as the_sum, @Oporto as the_town from t1
+where a > @1
+group by b
+union distinct
+select sum(a) + 200, @Lisboa from t1
+where a > @2
+group by b ;
+the_sum the_town
+204 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+203 Lisboa
+prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
+ where a > ?
+ group by b
+ union distinct
+ select sum(a) + 200, ? from t1
+ where a > ?
+ group by b ' ;
+execute stmt1 using @Oporto, @1, @Lisboa, @2;
+the_sum the_town
+204 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+203 Lisboa
+select sum(a) + 200 as the_sum, @Oporto as the_town from t1
+where a > @1
+group by b
+having avg(a) > @2
+union distinct
+select sum(a) + 200, @Lisboa from t1
+where a > @2
+group by b
+having avg(a) > @3;
+the_sum the_town
+204 Oporto
+203 Oporto
+204 Lisboa
+prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
+ where a > ?
+ group by b
+ having avg(a) > ?
+ union distinct
+ select sum(a) + 200, ? from t1
+ where a > ?
+ group by b
+ having avg(a) > ? ';
+execute stmt1 using @Oporto, @1, @2, @Lisboa, @2, @3;
+the_sum the_town
+204 Oporto
+203 Oporto
+204 Lisboa
+test_sequence
+------ explain select tests ------
+prepare stmt1 from ' explain select * from t9 ' ;
+execute stmt1;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def id 8 3 1 N 32801 0 8
+def select_type 253 19 6 N 1 31 8
+def table 253 64 2 N 1 31 8
+def type 253 10 3 N 1 31 8
+def possible_keys 253 4096 0 Y 0 31 8
+def key 253 64 0 Y 0 31 8
+def key_len 8 3 0 Y 32800 0 8
+def ref 253 1024 0 Y 0 31 8
+def rows 8 10 1 N 32801 0 8
+def Extra 253 255 0 N 1 31 8
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t9 ALL NULL NULL NULL NULL 2
+test_sequence
+------ delete tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+prepare stmt1 from 'delete from t1 where a=2' ;
+execute stmt1;
+select a,b from t1 where a=2;
+a b
+execute stmt1;
+insert into t1 values(0,NULL);
+set @arg00=NULL;
+prepare stmt1 from 'delete from t1 where b=?' ;
+execute stmt1 using @arg00;
+select a,b from t1 where b is NULL ;
+a b
+0 NULL
+set @arg00='one';
+execute stmt1 using @arg00;
+select a,b from t1 where b=@arg00;
+a b
+prepare stmt1 from 'truncate table t1' ;
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+test_sequence
+------ update tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ;
+execute stmt1;
+select a,b from t1 where a=2;
+a b
+2 a=two
+execute stmt1;
+select a,b from t1 where a=2;
+a b
+2 a=two
+set @arg00=NULL;
+prepare stmt1 from 'update t1 set b=? where a=2' ;
+execute stmt1 using @arg00;
+select a,b from t1 where a=2;
+a b
+2 NULL
+set @arg00='two';
+execute stmt1 using @arg00;
+select a,b from t1 where a=2;
+a b
+2 two
+set @arg00=2;
+prepare stmt1 from 'update t1 set b=NULL where a=?' ;
+execute stmt1 using @arg00;
+select a,b from t1 where a=@arg00;
+a b
+2 NULL
+update t1 set b='two' where a=@arg00;
+set @arg00=2000;
+execute stmt1 using @arg00;
+select a,b from t1 where a=@arg00;
+a b
+set @arg00=2;
+set @arg01=22;
+prepare stmt1 from 'update t1 set a=? where a=?' ;
+execute stmt1 using @arg00, @arg00;
+select a,b from t1 where a=@arg00;
+a b
+2 two
+execute stmt1 using @arg01, @arg00;
+select a,b from t1 where a=@arg01;
+a b
+22 two
+execute stmt1 using @arg00, @arg01;
+select a,b from t1 where a=@arg00;
+a b
+2 two
+set @arg00=NULL;
+set @arg01=2;
+execute stmt1 using @arg00, @arg01;
+Warnings:
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1
+select a,b from t1 order by a;
+a b
+0 two
+1 one
+3 three
+4 four
+set @arg00=0;
+execute stmt1 using @arg01, @arg00;
+select a,b from t1 order by a;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00=23;
+set @arg01='two';
+set @arg02=2;
+set @arg03='two';
+set @arg04=2;
+drop table if exists t2;
+create table t2 as select a,b from t1 ;
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 where a = @arg00 ;
+a b
+23 two
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a not in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 order by a ;
+a b
+1 one
+2 two
+3 three
+4 four
+drop table t2 ;
+create table t2
+(
+a int, b varchar(30),
+primary key(a)
+) engine = 'HEAP' ;
+insert into t2(a,b) select a, b from t1 ;
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 where a = @arg00 ;
+a b
+23 two
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a not in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 order by a ;
+a b
+1 one
+2 two
+3 three
+4 four
+drop table t2 ;
+set @arg00=1;
+prepare stmt1 from 'update t1 set b=''bla''
+where a=2
+limit 1';
+execute stmt1 ;
+select a,b from t1 where b = 'bla' ;
+a b
+2 bla
+prepare stmt1 from 'update t1 set b=''bla''
+where a=2
+limit ?';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 3
+test_sequence
+------ insert tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+prepare stmt1 from 'insert into t1 values(5, ''five'' )';
+execute stmt1;
+select a,b from t1 where a = 5;
+a b
+5 five
+set @arg00='six' ;
+prepare stmt1 from 'insert into t1 values(6, ? )';
+execute stmt1 using @arg00;
+select a,b from t1 where b = @arg00;
+a b
+6 six
+execute stmt1 using @arg00;
+ERROR 23000: Duplicate entry '6' for key 1
+set @arg00=NULL ;
+prepare stmt1 from 'insert into t1 values(0, ? )';
+execute stmt1 using @arg00;
+select a,b from t1 where b is NULL;
+a b
+0 NULL
+set @arg00=8 ;
+set @arg01='eight' ;
+prepare stmt1 from 'insert into t1 values(?, ? )';
+execute stmt1 using @arg00, @arg01 ;
+select a,b from t1 where b = @arg01;
+a b
+8 eight
+set @NULL= null ;
+set @arg00= 'abc' ;
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg00 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg00 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 abc
+10002 abc
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @NULL ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @NULL ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 NULL
+10002 NULL
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 10 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 9 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 8 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 7 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 6 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 5 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 4 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 3 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg01 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 10001
+10002 10002
+10003 10003
+10004 10004
+10005 10005
+10006 10006
+10007 10007
+10008 10008
+10009 10009
+10010 10010
+delete from t1 where a > 10000 ;
+set @arg00=81 ;
+set @arg01='8-1' ;
+set @arg02=82 ;
+set @arg03='8-2' ;
+prepare stmt1 from 'insert into t1 values(?,?),(?,?)';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
+select a,b from t1 where a in (@arg00,@arg02) ;
+a b
+81 8-1
+82 8-2
+set @arg00=9 ;
+set @arg01='nine' ;
+prepare stmt1 from 'insert into t1 set a=?, b=? ';
+execute stmt1 using @arg00, @arg01 ;
+select a,b from t1 where a = @arg00 ;
+a b
+9 nine
+set @arg00=6 ;
+set @arg01=1 ;
+prepare stmt1 from 'insert into t1 set a=?, b=''sechs''
+ on duplicate key update a=a + ?, b=concat(b,''modified'') ';
+execute stmt1 using @arg00, @arg01;
+select * from t1 order by a;
+a b
+0 NULL
+1 one
+2 two
+3 three
+4 four
+5 five
+7 sixmodified
+8 eight
+9 nine
+81 8-1
+82 8-2
+set @arg00=81 ;
+set @arg01=1 ;
+execute stmt1 using @arg00, @arg01;
+ERROR 23000: Duplicate entry '82' for key 1
+drop table if exists t2 ;
+create table t2 (id int auto_increment primary key)
+ENGINE= 'HEAP' ;
+prepare stmt1 from ' select last_insert_id() ' ;
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+1
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+2
+drop table t2 ;
+set @1000=1000 ;
+set @x1000_2="x1000_2" ;
+set @x1000_3="x1000_3" ;
+set @x1000="x1000" ;
+set @1100=1100 ;
+set @x1100="x1100" ;
+set @100=100 ;
+set @updated="updated" ;
+insert into t1 values(1000,'x1000_1') ;
+insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3)
+on duplicate key update a = a + @100, b = concat(b,@updated) ;
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 x1000_3
+1100 x1000_1updated
+delete from t1 where a >= 1000 ;
+insert into t1 values(1000,'x1000_1') ;
+prepare stmt1 from ' insert into t1 values(?,?),(?,?)
+ on duplicate key update a = a + ?, b = concat(b,?) ';
+execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ;
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 x1000_3
+1100 x1000_1updated
+delete from t1 where a >= 1000 ;
+insert into t1 values(1000,'x1000_1') ;
+execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ;
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1200 x1000_1updatedupdated
+delete from t1 where a >= 1000 ;
+prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
+execute stmt1;
+execute stmt1;
+execute stmt1;
+test_sequence
+------ multi table tests ------
+delete from t1 ;
+delete from t9 ;
+insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
+insert into t9 (c1,c21)
+values (1, 'one'), (2, 'two'), (3, 'three') ;
+prepare stmt_delete from " delete t1, t9
+ from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
+prepare stmt_update from " update t1, t9
+ set t1.b='updated', t9.c21='updated'
+ where t1.a=t9.c1 and t1.a=? ";
+prepare stmt_select1 from " select a, b from t1 order by a" ;
+prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
+set @arg00= 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+2 two
+3 three
+execute stmt_select2 ;
+c1 c21
+2 two
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+3 three
+execute stmt_select2 ;
+c1 c21
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+execute stmt_select2 ;
+c1 c21
+set @arg00= @arg00 + 1 ;
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+insert into t1 values(0,NULL) ;
+set @duplicate='duplicate ' ;
+set @1000=1000 ;
+set @5=5 ;
+select a,b from t1 where a < 5 order by a ;
+a b
+0 NULL
+1 one
+2 two
+3 three
+4 four
+insert into t1 select a + @1000, concat(@duplicate,b) from t1
+where a < @5 ;
+affected rows: 5
+info: Records: 5 Duplicates: 0 Warnings: 0
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 NULL
+1001 duplicate one
+1002 duplicate two
+1003 duplicate three
+1004 duplicate four
+delete from t1 where a >= 1000 ;
+prepare stmt1 from ' insert into t1 select a + ?, concat(?,b) from t1
+where a < ? ' ;
+execute stmt1 using @1000, @duplicate, @5;
+affected rows: 5
+info: Records: 5 Duplicates: 0 Warnings: 0
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 NULL
+1001 duplicate one
+1002 duplicate two
+1003 duplicate three
+1004 duplicate four
+delete from t1 where a >= 1000 ;
+set @1=1 ;
+set @2=2 ;
+set @100=100 ;
+set @float=1.00;
+set @five='five' ;
+drop table if exists t2;
+create table t2 like t1 ;
+insert into t2 (b,a)
+select @duplicate, sum(first.a) from t1 first, t1 second
+where first.a <> @5 and second.b = first.b
+and second.b <> @five
+group by second.b
+having sum(second.a) > @2
+union
+select b, a + @100 from t1
+where (a,b) in ( select sqrt(a+@1)+CAST(@float AS signed),b
+from t1);
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
+select a,b from t2 order by a ;
+a b
+3 duplicate
+4 duplicate
+103 three
+delete from t2 ;
+prepare stmt1 from ' insert into t2 (b,a)
+select ?, sum(first.a)
+ from t1 first, t1 second
+ where first.a <> ? and second.b = first.b and second.b <> ?
+ group by second.b
+ having sum(second.a) > ?
+union
+select b, a + ? from t1
+ where (a,b) in ( select sqrt(a+?)+CAST(? AS signed),b
+ from t1 ) ' ;
+execute stmt1 using @duplicate, @5, @five, @2, @100, @1, @float ;
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
+select a,b from t2 order by a ;
+a b
+3 duplicate
+4 duplicate
+103 three
+drop table t2;
+drop table if exists t5 ;
+set @arg01= 8;
+set @arg02= 8.0;
+set @arg03= 80.00000000000e-1;
+set @arg04= 'abc' ;
+set @arg05= CAST('abc' as binary) ;
+set @arg06= '1991-08-05' ;
+set @arg07= CAST('1991-08-05' as date);
+set @arg08= '1991-08-05 01:01:01' ;
+set @arg09= CAST('1991-08-05 01:01:01' as datetime) ;
+set @arg10= unix_timestamp('1991-01-01 01:01:01');
+set @arg11= YEAR('1991-01-01 01:01:01');
+set @arg12= 8 ;
+set @arg12= NULL ;
+set @arg13= 8.0 ;
+set @arg13= NULL ;
+set @arg14= 'abc';
+set @arg14= NULL ;
+set @arg15= CAST('abc' as binary) ;
+set @arg15= NULL ;
+create table t5 as select
+8 as const01, @arg01 as param01,
+8.0 as const02, @arg02 as param02,
+80.00000000000e-1 as const03, @arg03 as param03,
+'abc' as const04, @arg04 as param04,
+CAST('abc' as binary) as const05, @arg05 as param05,
+'1991-08-05' as const06, @arg06 as param06,
+CAST('1991-08-05' as date) as const07, @arg07 as param07,
+'1991-08-05 01:01:01' as const08, @arg08 as param08,
+CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09,
+unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10,
+YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11,
+NULL as const12, @arg12 as param12,
+@arg13 as param13,
+@arg14 as param14,
+@arg15 as param15;
+show create table t5 ;
+Table Create Table
+t5 CREATE TABLE `t5` (
+ `const01` bigint(1) NOT NULL default '0',
+ `param01` bigint(20) default NULL,
+ `const02` double(3,1) NOT NULL default '0.0',
+ `param02` double default NULL,
+ `const03` double NOT NULL default '0',
+ `param03` double default NULL,
+ `const04` char(3) NOT NULL default '',
+ `param04` longtext,
+ `const05` binary(3) NOT NULL default '',
+ `param05` longblob,
+ `const06` varchar(10) NOT NULL default '',
+ `param06` longtext,
+ `const07` date default NULL,
+ `param07` longblob,
+ `const08` varchar(19) NOT NULL default '',
+ `param08` longtext,
+ `const09` datetime default NULL,
+ `param09` longblob,
+ `const10` int(10) NOT NULL default '0',
+ `param10` bigint(20) default NULL,
+ `const11` int(4) default NULL,
+ `param11` bigint(20) default NULL,
+ `const12` binary(0) default NULL,
+ `param12` bigint(20) default NULL,
+ `param13` double default NULL,
+ `param14` longtext,
+ `param15` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t5 ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t5 t5 const01 const01 8 1 1 N 32769 0 63
+def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
+def test t5 t5 const02 const02 5 3 3 N 32769 1 63
+def test t5 t5 param02 param02 5 20 1 Y 32768 31 63
+def test t5 t5 const03 const03 5 23 1 N 32769 31 63
+def test t5 t5 param03 param03 5 20 1 Y 32768 31 63
+def test t5 t5 const04 const04 254 3 3 N 1 0 8
+def test t5 t5 param04 param04 252 16777215 3 Y 16 0 8
+def test t5 t5 const05 const05 254 3 3 N 129 0 63
+def test t5 t5 param05 param05 252 16777215 3 Y 144 0 63
+def test t5 t5 const06 const06 253 10 10 N 1 0 8
+def test t5 t5 param06 param06 252 16777215 10 Y 16 0 8
+def test t5 t5 const07 const07 10 10 10 Y 128 0 63
+def test t5 t5 param07 param07 252 16777215 10 Y 144 0 63
+def test t5 t5 const08 const08 253 19 19 N 1 0 8
+def test t5 t5 param08 param08 252 16777215 19 Y 16 0 8
+def test t5 t5 const09 const09 12 19 19 Y 128 0 63
+def test t5 t5 param09 param09 252 16777215 19 Y 144 0 63
+def test t5 t5 const10 const10 3 10 9 N 32769 0 63
+def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
+def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
+def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
+def test t5 t5 const12 const12 254 0 0 Y 128 0 63
+def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
+def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
+def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
+const01 8
+param01 8
+const02 8.0
+param02 8
+const03 8
+param03 8
+const04 abc
+param04 abc
+const05 abc
+param05 abc
+const06 1991-08-05
+param06 1991-08-05
+const07 1991-08-05
+param07 1991-08-05
+const08 1991-08-05 01:01:01
+param08 1991-08-05 01:01:01
+const09 1991-08-05 01:01:01
+param09 1991-08-05 01:01:01
+const10 662680861
+param10 662680861
+const11 1991
+param11 1991
+const12 NULL
+param12 NULL
+param13 NULL
+param14 NULL
+param15 NULL
+drop table t5 ;
+test_sequence
+------ data type conversion tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ;
+select * from t9 order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+test_sequence
+------ select @parameter:= column ------
+prepare full_info from "select @arg01, @arg02, @arg03, @arg04,
+ @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12,
+ @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20,
+ @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28,
+ @arg29, @arg30, @arg31, @arg32" ;
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 1 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 0 31 8
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 0 31 8
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 0 31 8
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 0 31 8
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 0 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 0 31 8
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 0 31 8
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 0 31 8
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 0 31 8
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select
+ @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+ @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+ @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+ @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+ @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+ @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+ @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+ @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 0 31 8
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 0 31 8
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 0 31 8
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 0 31 8
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 0 31 8
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 0 31 8
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 0 31 8
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 0 31 8
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':= c1 from t9 where c1= 1' at line 1
+test_sequence
+------ select column, .. into @parm,.. ------
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 1 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 0 31 8
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 0 31 8
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 0 31 8
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 0 31 8
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 0 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 0 31 8
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 0 31 8
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 0 31 8
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 0 31 8
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+ c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+ c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 0 31 8
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 0 31 8
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 0 31 8
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 0 31 8
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 0 31 8
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 0 31 8
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 0 31 8
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 0 31 8
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? from t9 where c1= 1' at line 1
+test_sequence
+-- insert into numeric columns --
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ;
+set @arg00= 21 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ;
+execute stmt1 ;
+set @arg00= 23;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
+30.0, 30.0, 30.0 ) ;
+set @arg00= 31.0 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0,
+ 32.0, 32.0, 32.0 )" ;
+execute stmt1 ;
+set @arg00= 33.0;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( '40', '40', '40', '40', '40', '40', '40', '40',
+'40', '40', '40' ) ;
+set @arg00= '41' ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( '42', '42', '42', '42', '42', '42', '42', '42',
+ '42', '42', '42' )" ;
+execute stmt1 ;
+set @arg00= '43';
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ;
+set @arg00= CAST('51' as binary) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ;
+execute stmt1 ;
+set @arg00= CAST('53' as binary) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 2 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+NULL, NULL, NULL ) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 61, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL )" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 8.0 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 71, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 'abc' ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 81, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c1 >= 20
+order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12
+20 20 20 20 20 20 20 20 20 20 20.0000
+21 21 21 21 21 21 21 21 21 21 21.0000
+22 22 22 22 22 22 22 22 22 22 22.0000
+23 23 23 23 23 23 23 23 23 23 23.0000
+30 30 30 30 30 30 30 30 30 30 30.0000
+31 31 31 31 31 31 31 31 31 31 31.0000
+32 32 32 32 32 32 32 32 32 32 32.0000
+33 33 33 33 33 33 33 33 33 33 33.0000
+40 40 40 40 40 40 40 40 40 40 40.0000
+41 41 41 41 41 41 41 41 41 41 41.0000
+42 42 42 42 42 42 42 42 42 42 42.0000
+43 43 43 43 43 43 43 43 43 43 43.0000
+50 50 50 50 50 50 50 50 50 50 50.0000
+51 51 51 51 51 51 51 51 51 51 51.0000
+52 52 52 52 52 52 52 52 52 52 52.0000
+53 53 53 53 53 53 53 53 53 53 53.0000
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where numeric column = .. --
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+and c8= 20 and c9= 20 and c10= 20 and c12= 20;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+ and c8= 20 and c9= 20 and c10= 20 and c12= 20 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+ and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20';
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' ";
+execute stmt1 ;
+found
+true
+set @arg00= '20';
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+c12= CAST('20' as binary);
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+ c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+ c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+ c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+ c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+ c12= CAST('20' as binary) ";
+execute stmt1 ;
+found
+true
+set @arg00= CAST('20' as binary) ;
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- some numeric overflow experiments --
+prepare my_insert from "insert into t9
+ ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c21 = 'O' ";
+prepare my_delete from "delete from t9 where c21 = 'O' ";
+set @arg00= 9223372036854775807 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= '9223372036854775807' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= -9223372036854775808 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-9223372036854775808' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= 1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= '1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 1
+c2 1
+c3 1
+c4 1
+c5 1
+c6 1
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= -1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -1
+c2 -1
+c3 -1
+c4 -1
+c5 -1
+c6 -1
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+test_sequence
+-- insert into string columns --
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30
+from t9 where c1 >= 20
+order by c1 ;
+c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
+20 2 20 20 20 20 20 20 20 20 20 20
+21 2 21 21 21 21 21 21 21 21 21 21
+22 2 22 22 22 22 22 22 22 22 22 22
+23 2 23 23 23 23 23 23 23 23 23 23
+30 3 30 30 30 30 30 30 30 30 30 30
+31 3 31 31 31 31 31 31 31 31 31 31
+32 3 32 32 32 32 32 32 32 32 32 32
+33 3 33 33 33 33 33 33 33 33 33 33
+40 4 40 40 40 40 40 40 40 40 40 40
+41 4 41 41 41 41 41 41 41 41 41 41
+42 4 42 42 42 42 42 42 42 42 42 42
+43 4 43 43 43 43 43 43 43 43 43 43
+50 5 50 50 50 50 50 50 50 50 50 50
+51 5 51 51 51 51 51 51 51 51 51 51
+52 5 52 52 52 52 52 52 52 52 52 52
+53 5 53 53 53 53 53 53 53 53 53 53
+54 5 54 54 54 54 54 54 54 54 54 54
+55 5 55 55 55 55 55 55 55 55 55 55
+56 6 56 56 56 56 56 56 56 56 56 56
+57 6 57 57 57 57 57 57 57 57 57 57
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where string column = .. --
+set @arg00= '20';
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+c27= '20' and c28= '20' and c29= '20' and c30= '20' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+ c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+ c27= '20' and c28= '20' and c29= '20' and c30= '20'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('20' as binary);
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+= CAST('20' as binary) and c21= CAST('20' as binary)
+and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+c30= CAST('20' as binary) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and
+c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+ = CAST('20' as binary) and c21= CAST('20' as binary)
+ and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+ c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+ c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+ c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+ c30= CAST('20' as binary)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and
+ c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and
+ c29= ? and c30= ?";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+c27= 20 and c28= 20 and c29= 20 and c30= 20 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+ c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+ c27= 20 and c28= 20 and c29= 20 and c30= 20" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+ c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+ c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- insert into date/time columns --
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
+c1 c13 c14 c15 c16 c17
+20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+21 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+22 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+23 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+30 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+60 NULL NULL 1991-01-01 01:01:01 NULL NULL
+61 NULL NULL 1991-01-01 01:01:01 NULL NULL
+62 NULL NULL 1991-01-01 01:01:01 NULL NULL
+63 NULL NULL 1991-01-01 01:01:01 NULL NULL
+71 NULL NULL 1991-01-01 01:01:01 NULL NULL
+73 NULL NULL 1991-01-01 01:01:01 NULL NULL
+81 NULL NULL 1991-01-01 01:01:01 NULL NULL
+83 NULL NULL 1991-01-01 01:01:01 NULL NULL
+test_sequence
+-- select .. where date/time column = .. --
+set @arg00= '1991-01-01 01:01:01' ;
+select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+c17= '1991-01-01 01:01:01' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+ c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+ c17= '1991-01-01 01:01:01'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
+select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+c14= CAST('1991-01-01 01:01:01' as datetime) and
+c15= CAST('1991-01-01 01:01:01' as datetime) and
+c16= CAST('1991-01-01 01:01:01' as datetime) and
+c17= CAST('1991-01-01 01:01:01' as datetime) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+ c14= CAST('1991-01-01 01:01:01' as datetime) and
+ c15= CAST('1991-01-01 01:01:01' as datetime) and
+ c16= CAST('1991-01-01 01:01:01' as datetime) and
+ c17= CAST('1991-01-01 01:01:01' as datetime)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 1991 ;
+select 'true' as found from t9
+where c1= 20 and c17= 1991 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= 1991" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= ?" ;
+execute stmt1 using @arg00 ;
+found
+true
+set @arg00= 1.991e+3 ;
+select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and abs(c17 - @arg00) < 0.01 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - ?) < 0.01" ;
+execute stmt1 using @arg00 ;
+found
+true
+drop table t1, t9;
diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result
new file mode 100644
index 00000000000..e07cb7d7c49
--- /dev/null
+++ b/mysql-test/r/ps_5merge.result
@@ -0,0 +1,6064 @@
+use test;
+drop table if exists t1, t1_1, t1_2,
+t9, t9_1, t9_2;
+drop table if exists t1, t9 ;
+create table t1
+(
+a int, b varchar(30),
+primary key(a)
+) engine = 'MYISAM' ;
+create table t9
+(
+c1 tinyint, c2 smallint, c3 mediumint, c4 int,
+c5 integer, c6 bigint, c7 float, c8 double,
+c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
+c13 date, c14 datetime, c15 timestamp(14), c16 time,
+c17 year, c18 bit, c19 bool, c20 char,
+c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
+c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
+c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
+c32 set('monday', 'tuesday', 'wednesday'),
+primary key(c1)
+) engine = 'MYISAM' ;
+rename table t1 to t1_1, t9 to t9_1 ;
+drop table if exists t1, t9 ;
+create table t1
+(
+a int, b varchar(30),
+primary key(a)
+) engine = 'MYISAM' ;
+create table t9
+(
+c1 tinyint, c2 smallint, c3 mediumint, c4 int,
+c5 integer, c6 bigint, c7 float, c8 double,
+c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
+c13 date, c14 datetime, c15 timestamp(14), c16 time,
+c17 year, c18 bit, c19 bool, c20 char,
+c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
+c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
+c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
+c32 set('monday', 'tuesday', 'wednesday'),
+primary key(c1)
+) engine = 'MYISAM' ;
+rename table t1 to t1_2, t9 to t9_2 ;
+create table t1
+(
+a int, b varchar(30),
+primary key(a)
+) ENGINE = MERGE UNION=(t1_1,t1_2)
+INSERT_METHOD=FIRST;
+create table t9
+(
+c1 tinyint, c2 smallint, c3 mediumint, c4 int,
+c5 integer, c6 bigint, c7 float, c8 double,
+c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
+c13 date, c14 datetime, c15 timestamp(14), c16 time,
+c17 year, c18 bit, c19 bool, c20 char,
+c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
+c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
+c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
+c32 set('monday', 'tuesday', 'wednesday'),
+primary key(c1)
+) ENGINE = MERGE UNION=(t9_1,t9_2)
+INSERT_METHOD=FIRST;
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+test_sequence
+------ simple select tests ------
+prepare stmt1 from ' select * from t9 order by c1 ' ;
+execute stmt1;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t9 t9 c1 c1 1 4 1 N 49155 0 63
+def test t9 t9 c2 c2 2 6 1 Y 32768 0 63
+def test t9 t9 c3 c3 9 9 1 Y 32768 0 63
+def test t9 t9 c4 c4 3 11 1 Y 32768 0 63
+def test t9 t9 c5 c5 3 11 1 Y 32768 0 63
+def test t9 t9 c6 c6 8 20 1 Y 32768 0 63
+def test t9 t9 c7 c7 4 12 1 Y 32768 31 63
+def test t9 t9 c8 c8 5 22 1 Y 32768 31 63
+def test t9 t9 c9 c9 5 22 1 Y 32768 31 63
+def test t9 t9 c10 c10 5 22 1 Y 32768 31 63
+def test t9 t9 c11 c11 0 9 6 Y 32768 4 63
+def test t9 t9 c12 c12 0 10 6 Y 32768 4 63
+def test t9 t9 c13 c13 10 10 10 Y 128 0 63
+def test t9 t9 c14 c14 12 19 19 Y 128 0 63
+def test t9 t9 c15 c15 7 19 19 N 1249 0 63
+def test t9 t9 c16 c16 11 8 8 Y 128 0 63
+def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
+def test t9 t9 c18 c18 1 1 1 Y 32768 0 63
+def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
+def test t9 t9 c20 c20 254 1 1 Y 0 0 8
+def test t9 t9 c21 c21 253 10 10 Y 0 0 8
+def test t9 t9 c22 c22 253 30 30 Y 0 0 8
+def test t9 t9 c23 c23 252 255 8 Y 144 0 63
+def test t9 t9 c24 c24 252 255 8 Y 16 0 8
+def test t9 t9 c25 c25 252 65535 4 Y 144 0 63
+def test t9 t9 c26 c26 252 65535 4 Y 16 0 8
+def test t9 t9 c27 c27 252 16777215 10 Y 144 0 63
+def test t9 t9 c28 c28 252 16777215 10 Y 16 0 8
+def test t9 t9 c29 c29 252 16777215 8 Y 144 0 63
+def test t9 t9 c30 c30 252 16777215 8 Y 16 0 8
+def test t9 t9 c31 c31 254 5 3 Y 256 0 8
+def test t9 t9 c32 c32 254 24 7 Y 2048 0 8
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+set @arg00='SELECT' ;
+prepare stmt1 from ' ? a from t1 where a=1 ';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1
+set @arg00=1 ;
+select @arg00, b from t1 where a=1 ;
+@arg00 b
+1 one
+prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+? b
+1 one
+set @arg00='lion' ;
+select @arg00, b from t1 where a=1 ;
+@arg00 b
+lion one
+prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+? b
+lion one
+set @arg00=NULL ;
+select @arg00, b from t1 where a=1 ;
+@arg00 b
+NULL one
+prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+? b
+NULL one
+set @arg00=1 ;
+select b, a - @arg00 from t1 where a=1 ;
+b a - @arg00
+one 0
+prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+b a - ?
+one 0
+set @arg00=null ;
+select @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select @arg00 + 1 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? + 1 as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select 1 + @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select 1 + ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+set @arg00='MySQL' ;
+select substr(@arg00,1,2) from t1 where a=1 ;
+substr(@arg00,1,2)
+My
+prepare stmt1 from ' select substr(?,1,2) from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+substr(?,1,2)
+My
+set @arg00=3 ;
+select substr('MySQL',@arg00,5) from t1 where a=1 ;
+substr('MySQL',@arg00,5)
+SQL
+prepare stmt1 from ' select substr(''MySQL'',?,5) from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+substr('MySQL',?,5)
+SQL
+select substr('MySQL',1,@arg00) from t1 where a=1 ;
+substr('MySQL',1,@arg00)
+MyS
+prepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+substr('MySQL',1,?)
+MyS
+set @arg00='MySQL' ;
+select a , concat(@arg00,b) from t1 order by a;
+a concat(@arg00,b)
+1 MySQLone
+2 MySQLtwo
+3 MySQLthree
+4 MySQLfour
+prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ;
+execute stmt1 using @arg00;
+a concat(?,b)
+1 MySQLone
+2 MySQLtwo
+3 MySQLthree
+4 MySQLfour
+select a , concat(b,@arg00) from t1 order by a ;
+a concat(b,@arg00)
+1 oneMySQL
+2 twoMySQL
+3 threeMySQL
+4 fourMySQL
+prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ;
+execute stmt1 using @arg00;
+a concat(b,?)
+1 oneMySQL
+2 twoMySQL
+3 threeMySQL
+4 fourMySQL
+set @arg00='MySQL' ;
+select group_concat(@arg00,b order by a) from t1
+group by 'a' ;
+group_concat(@arg00,b order by a)
+MySQLone,MySQLtwo,MySQLthree,MySQLfour
+prepare stmt1 from ' select group_concat(?,b order by a) from t1
+group by ''a'' ' ;
+execute stmt1 using @arg00;
+group_concat(?,b order by a)
+MySQLone,MySQLtwo,MySQLthree,MySQLfour
+select group_concat(b,@arg00 order by a) from t1
+group by 'a' ;
+group_concat(b,@arg00 order by a)
+oneMySQL,twoMySQL,threeMySQL,fourMySQL
+prepare stmt1 from ' select group_concat(b,? order by a) from t1
+group by ''a'' ' ;
+execute stmt1 using @arg00;
+group_concat(b,? order by a)
+oneMySQL,twoMySQL,threeMySQL,fourMySQL
+set @arg00='first' ;
+set @arg01='second' ;
+set @arg02=NULL;
+select @arg00, @arg01 from t1 where a=1 ;
+@arg00 @arg01
+first second
+prepare stmt1 from ' select ?, ? from t1 where a=1 ' ;
+execute stmt1 using @arg00, @arg01 ;
+? ?
+first second
+execute stmt1 using @arg02, @arg01 ;
+? ?
+NULL second
+execute stmt1 using @arg00, @arg02 ;
+? ?
+first NULL
+execute stmt1 using @arg02, @arg02 ;
+? ?
+NULL NULL
+drop table if exists t5 ;
+create table t5 (id1 int(11) not null default '0',
+value2 varchar(100), value1 varchar(100)) ;
+insert into t5 values (1,'hh','hh'),(2,'hh','hh'),
+(1,'ii','ii'),(2,'ii','ii') ;
+prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ;
+set @arg00=1 ;
+set @arg01='hh' ;
+execute stmt1 using @arg00, @arg01 ;
+id1 value1
+1 hh
+1 ii
+2 hh
+drop table t5 ;
+drop table if exists t5 ;
+create table t5(session_id char(9) not null) ;
+insert into t5 values ('abc') ;
+prepare stmt1 from ' select * from t5
+where ?=''1111'' and session_id = ''abc'' ' ;
+set @arg00='abc' ;
+execute stmt1 using @arg00 ;
+session_id
+set @arg00='1111' ;
+execute stmt1 using @arg00 ;
+session_id
+abc
+set @arg00='abc' ;
+execute stmt1 using @arg00 ;
+session_id
+drop table t5 ;
+set @arg00='FROM' ;
+select a @arg00 t1 where a=1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 t1 where a=1' at line 1
+prepare stmt1 from ' select a ? t1 where a=1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? t1 where a=1' at line 1
+set @arg00='t1' ;
+select a from @arg00 where a=1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 where a=1' at line 1
+prepare stmt1 from ' select a from ? where a=1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? where a=1' at line 1
+set @arg00='WHERE' ;
+select a from t1 @arg00 a=1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a=1' at line 1
+prepare stmt1 from ' select a from t1 ? a=1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a=1' at line 1
+set @arg00=1 ;
+select a FROM t1 where a=@arg00 ;
+a
+1
+prepare stmt1 from ' select a FROM t1 where a=? ' ;
+execute stmt1 using @arg00 ;
+a
+1
+set @arg00=1000 ;
+execute stmt1 using @arg00 ;
+a
+set @arg00=NULL ;
+select a FROM t1 where a=@arg00 ;
+a
+prepare stmt1 from ' select a FROM t1 where a=? ' ;
+execute stmt1 using @arg00 ;
+a
+set @arg00=4 ;
+select a FROM t1 where a=sqrt(@arg00) ;
+a
+2
+prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
+execute stmt1 using @arg00 ;
+a
+2
+set @arg00=NULL ;
+select a FROM t1 where a=sqrt(@arg00) ;
+a
+prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
+execute stmt1 using @arg00 ;
+a
+set @arg00=2 ;
+set @arg01=3 ;
+select a FROM t1 where a in (@arg00,@arg01) order by a;
+a
+2
+3
+prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a ';
+execute stmt1 using @arg00, @arg01;
+a
+2
+3
+set @arg00= 'one' ;
+set @arg01= 'two' ;
+set @arg02= 'five' ;
+prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ;
+execute stmt1 using @arg00, @arg01, @arg02 ;
+b
+one
+two
+prepare stmt1 from ' select b FROM t1 where b like ? ';
+set @arg00='two' ;
+execute stmt1 using @arg00 ;
+b
+two
+set @arg00='tw%' ;
+execute stmt1 using @arg00 ;
+b
+two
+set @arg00='%wo' ;
+execute stmt1 using @arg00 ;
+b
+two
+set @arg00=null ;
+insert into t9 set c1= 0, c5 = NULL ;
+select c5 from t9 where c5 > NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 > ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 < NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 < ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 = NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 = ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 <=> NULL ;
+c5
+NULL
+prepare stmt1 from ' select c5 from t9 where c5 <=> ? ';
+execute stmt1 using @arg00 ;
+c5
+NULL
+delete from t9 where c1= 0 ;
+set @arg00='>' ;
+select a FROM t1 where a @arg00 1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 1' at line 1
+prepare stmt1 from ' select a FROM t1 where a ? 1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? 1' at line 1
+set @arg00=1 ;
+select a,b FROM t1 where a is not NULL
+AND b is not NULL group by a - @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+prepare stmt1 from ' select a,b FROM t1 where a is not NULL
+AND b is not NULL group by a - ? ' ;
+execute stmt1 using @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00='two' ;
+select a,b FROM t1 where a is not NULL
+AND b is not NULL having b <> @arg00 order by a ;
+a b
+1 one
+3 three
+4 four
+prepare stmt1 from ' select a,b FROM t1 where a is not NULL
+AND b is not NULL having b <> ? order by a ' ;
+execute stmt1 using @arg00 ;
+a b
+1 one
+3 three
+4 four
+set @arg00=1 ;
+select a,b FROM t1 where a is not NULL
+AND b is not NULL order by a - @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+prepare stmt1 from ' select a,b FROM t1 where a is not NULL
+AND b is not NULL order by a - ? ' ;
+execute stmt1 using @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00=2 ;
+select a,b from t1 order by 2 ;
+a b
+4 four
+1 one
+3 three
+2 two
+prepare stmt1 from ' select a,b from t1
+order by ? ';
+execute stmt1 using @arg00;
+a b
+4 four
+1 one
+3 three
+2 two
+set @arg00=1 ;
+execute stmt1 using @arg00;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00=0 ;
+execute stmt1 using @arg00;
+ERROR 42S22: Unknown column '?' in 'order clause'
+set @arg00=1;
+prepare stmt1 from ' select a,b from t1 order by a
+limit 1 ';
+execute stmt1 ;
+a b
+1 one
+prepare stmt1 from ' select a,b from t1
+limit ? ';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 2
+set @arg00='b' ;
+set @arg01=0 ;
+set @arg02=2 ;
+set @arg03=2 ;
+select sum(a), @arg00 from t1 where a > @arg01
+and b is not null group by substr(b,@arg02)
+having sum(a) <> @arg03 ;
+sum(a) @arg00
+3 b
+1 b
+4 b
+prepare stmt1 from ' select sum(a), ? from t1 where a > ?
+and b is not null group by substr(b,?)
+having sum(a) <> ? ';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03;
+sum(a) ?
+3 b
+1 b
+4 b
+test_sequence
+------ join tests ------
+select first.a as a1, second.a as a2
+from t1 first, t1 second
+where first.a = second.a order by a1 ;
+a1 a2
+1 1
+2 2
+3 3
+4 4
+prepare stmt1 from ' select first.a as a1, second.a as a2
+ from t1 first, t1 second
+ where first.a = second.a order by a1 ';
+execute stmt1 ;
+a1 a2
+1 1
+2 2
+3 3
+4 4
+set @arg00='ABC';
+set @arg01='two';
+set @arg02='one';
+select first.a, @arg00, second.a FROM t1 first, t1 second
+where @arg01 = first.b or first.a = second.a or second.b = @arg02
+order by second.a, first.a;
+a @arg00 a
+1 ABC 1
+2 ABC 1
+3 ABC 1
+4 ABC 1
+2 ABC 2
+2 ABC 3
+3 ABC 3
+2 ABC 4
+4 ABC 4
+prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
+ where ? = first.b or first.a = second.a or second.b = ?
+ order by second.a, first.a';
+execute stmt1 using @arg00, @arg01, @arg02;
+a ? a
+1 ABC 1
+2 ABC 1
+3 ABC 1
+4 ABC 1
+2 ABC 2
+2 ABC 3
+3 ABC 3
+2 ABC 4
+4 ABC 4
+drop table if exists t2 ;
+create table t2 as select * from t1 ;
+set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
+set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
+set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
+set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
+set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
+set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
+set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
+the join statement is:
+SELECT * FROM t2 right join t1 using(a) order by t2.a
+prepare stmt1 from @query9 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural right join t1 order by t2.a
+prepare stmt1 from @query8 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query7 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 using(a) order by t2.a
+prepare stmt1 from @query6 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural left join t1 order by t2.a
+prepare stmt1 from @query5 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query4 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 join t1 using(a) order by t2.a
+prepare stmt1 from @query3 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural join t1 order by t2.a
+prepare stmt1 from @query2 ;
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+the join statement is:
+SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a
+prepare stmt1 from @query1 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+drop table t2 ;
+test_sequence
+------ subquery tests ------
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = ''two'') ';
+execute stmt1 ;
+a b
+2 two
+set @arg00='two' ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where b = 'two' ) and b=@arg00 ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = ''two'') and b=? ';
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00='two' ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where b = @arg00 ) and b='two' ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = ? ) and b=''two'' ' ;
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=3 ;
+set @arg01='three' ;
+select a,b FROM t1 where (a,b) in (select 3, 'three');
+a b
+3 three
+select a FROM t1 where (a,b) in (select @arg00,@arg01);
+a
+3
+prepare stmt1 from ' select a FROM t1 where (a,b) in (select ?, ?) ';
+execute stmt1 using @arg00, @arg01;
+a
+3
+set @arg00=1 ;
+set @arg01='two' ;
+set @arg02=2 ;
+set @arg03='two' ;
+select a, @arg00, b FROM t1 outer_table where
+b=@arg01 and a = (select @arg02 from t1 where b = @arg03 ) ;
+a @arg00 b
+2 1 two
+prepare stmt1 from ' select a, ?, b FROM t1 outer_table where
+ b=? and a = (select ? from t1 where b = ? ) ' ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
+a ? b
+2 1 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = outer_table.b ) order by a ';
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+set @arg00='two' ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where b = outer_table.b ) and b=@arg00 ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = outer_table.b) and b=? ';
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=2 ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where a = @arg00 and b = outer_table.b) and b='two' ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where a = ? and b = outer_table.b) and b=''two'' ' ;
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=2 ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where outer_table.a = @arg00 and a=2) and b='two' ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where outer_table.a = ? and a=2) and b=''two'' ' ;
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=1 ;
+set @arg01='two' ;
+set @arg02=2 ;
+set @arg03='two' ;
+select a, @arg00, b FROM t1 outer_table where
+b=@arg01 and a = (select @arg02 from t1 where outer_table.b = @arg03
+and outer_table.a=a ) ;
+a @arg00 b
+2 1 two
+prepare stmt1 from ' select a, ?, b FROM t1 outer_table where
+ b=? and a = (select ? from t1 where outer_table.b = ?
+ and outer_table.a=a ) ' ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
+a ? b
+2 1 two
+set @arg00=1 ;
+set @arg01=0 ;
+select a, @arg00
+from ( select a - @arg00 as a from t1 where a=@arg00 ) as t2
+where a=@arg01;
+a @arg00
+0 1
+prepare stmt1 from ' select a, ?
+ from ( select a - ? as a from t1 where a=? ) as t2
+ where a=? ';
+execute stmt1 using @arg00, @arg00, @arg00, @arg01 ;
+a ?
+0 1
+drop table if exists t2 ;
+create table t2 as select * from t1;
+prepare stmt1 from ' select a in (select a from t2) from t1 ' ;
+execute stmt1 ;
+a in (select a from t2)
+1
+1
+1
+1
+drop table if exists t5, t6, t7 ;
+create table t5 (a int , b int) ;
+create table t6 like t5 ;
+create table t7 like t5 ;
+insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
+(2, -1), (3, 10) ;
+insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ;
+insert into t7 values (3, 3), (2, 2), (1, 1) ;
+prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1) from t7 ' ;
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+drop table t5, t6, t7 ;
+drop table if exists t2 ;
+create table t2 as select * from t9;
+set @stmt= ' SELECT
+ (SELECT SUM(c1 + c12 + 0.0) FROM t2
+ where (t9.c2 - 0e-3) = t2.c2
+ GROUP BY t9.c15 LIMIT 1) as scalar_s,
+ exists (select 1.0e+0 from t2
+ where t2.c3 * 9.0000000000 = t9.c4) as exists_s,
+ c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s,
+ (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s
+FROM t9,
+(select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
+prepare stmt1 from @stmt ;
+execute stmt1 ;
+execute stmt1 ;
+set @stmt= concat('explain ',@stmt);
+prepare stmt1 from @stmt ;
+execute stmt1 ;
+execute stmt1 ;
+set @stmt= ' SELECT
+ (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
+ GROUP BY t9.c15 LIMIT 1) as scalar_s,
+ exists (select ? from t2
+ where t2.c3*?=t9.c4) as exists_s,
+ c5*? in (select c6+? from t2) as in_s,
+ (c7-?, c8-?) in (select c9+?, c10+? from t2) as in_row_s
+FROM t9,
+(select c25 x, c32 y from t2) tt WHERE x =c25 ' ;
+set @arg00= 0.0 ;
+set @arg01= 0e-3 ;
+set @arg02= 1.0e+0 ;
+set @arg03= 9.0000000000 ;
+set @arg04= 4 ;
+set @arg05= 0.3e+1 ;
+set @arg06= 4 ;
+set @arg07= 4 ;
+set @arg08= 4.0 ;
+set @arg09= 40e-1 ;
+prepare stmt1 from @stmt ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+set @stmt= concat('explain ',@stmt);
+prepare stmt1 from @stmt ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+drop table t2 ;
+select 1 < (select a from t1) ;
+ERROR 21000: Subquery returns more than 1 row
+prepare stmt1 from ' select 1 < (select a from t1) ' ;
+execute stmt1 ;
+ERROR 21000: Subquery returns more than 1 row
+select 1 as my_col ;
+my_col
+1
+test_sequence
+------ union tests ------
+prepare stmt1 from ' select a FROM t1 where a=1
+ union distinct
+ select a FROM t1 where a=1 ';
+execute stmt1 ;
+a
+1
+execute stmt1 ;
+a
+1
+prepare stmt1 from ' select a FROM t1 where a=1
+ union all
+ select a FROM t1 where a=1 ';
+execute stmt1 ;
+a
+1
+1
+prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+set @arg00=1 ;
+select @arg00 FROM t1 where a=1
+union distinct
+select 1 FROM t1 where a=1;
+@arg00
+1
+prepare stmt1 from ' select ? FROM t1 where a=1
+ union distinct
+ select 1 FROM t1 where a=1 ' ;
+execute stmt1 using @arg00;
+?
+1
+set @arg00=1 ;
+select 1 FROM t1 where a=1
+union distinct
+select @arg00 FROM t1 where a=1;
+1
+1
+prepare stmt1 from ' select 1 FROM t1 where a=1
+ union distinct
+ select ? FROM t1 where a=1 ' ;
+execute stmt1 using @arg00;
+1
+1
+set @arg00='a' ;
+select @arg00 FROM t1 where a=1
+union distinct
+select @arg00 FROM t1 where a=1;
+@arg00
+a
+prepare stmt1 from ' select ? FROM t1 where a=1
+ union distinct
+ select ? FROM t1 where a=1 ';
+execute stmt1 using @arg00, @arg00;
+?
+a
+prepare stmt1 from ' select ?
+ union distinct
+ select ? ';
+execute stmt1 using @arg00, @arg00;
+?
+a
+set @arg00='a' ;
+set @arg01=1 ;
+set @arg02='a' ;
+set @arg03=2 ;
+select @arg00 FROM t1 where a=@arg01
+union distinct
+select @arg02 FROM t1 where a=@arg03;
+@arg00
+a
+prepare stmt1 from ' select ? FROM t1 where a=?
+ union distinct
+ select ? FROM t1 where a=? ' ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03;
+?
+a
+set @arg00=1 ;
+prepare stmt1 from ' select sum(a) + 200, ? from t1
+union distinct
+select sum(a) + 200, 1 from t1
+group by b ' ;
+execute stmt1 using @arg00;
+sum(a) + 200 ?
+210 1
+204 1
+201 1
+203 1
+202 1
+set @Oporto='Oporto' ;
+set @Lisboa='Lisboa' ;
+set @0=0 ;
+set @1=1 ;
+set @2=2 ;
+set @3=3 ;
+set @4=4 ;
+select @Oporto,@Lisboa,@0,@1,@2,@3,@4 ;
+@Oporto @Lisboa @0 @1 @2 @3 @4
+Oporto Lisboa 0 1 2 3 4
+select sum(a) + 200 as the_sum, @Oporto as the_town from t1
+group by b
+union distinct
+select sum(a) + 200, @Lisboa from t1
+group by b ;
+the_sum the_town
+204 Oporto
+201 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+201 Lisboa
+203 Lisboa
+202 Lisboa
+prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
+ group by b
+ union distinct
+ select sum(a) + 200, ? from t1
+ group by b ' ;
+execute stmt1 using @Oporto, @Lisboa;
+the_sum the_town
+204 Oporto
+201 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+201 Lisboa
+203 Lisboa
+202 Lisboa
+select sum(a) + 200 as the_sum, @Oporto as the_town from t1
+where a > @1
+group by b
+union distinct
+select sum(a) + 200, @Lisboa from t1
+where a > @2
+group by b ;
+the_sum the_town
+204 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+203 Lisboa
+prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
+ where a > ?
+ group by b
+ union distinct
+ select sum(a) + 200, ? from t1
+ where a > ?
+ group by b ' ;
+execute stmt1 using @Oporto, @1, @Lisboa, @2;
+the_sum the_town
+204 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+203 Lisboa
+select sum(a) + 200 as the_sum, @Oporto as the_town from t1
+where a > @1
+group by b
+having avg(a) > @2
+union distinct
+select sum(a) + 200, @Lisboa from t1
+where a > @2
+group by b
+having avg(a) > @3;
+the_sum the_town
+204 Oporto
+203 Oporto
+204 Lisboa
+prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
+ where a > ?
+ group by b
+ having avg(a) > ?
+ union distinct
+ select sum(a) + 200, ? from t1
+ where a > ?
+ group by b
+ having avg(a) > ? ';
+execute stmt1 using @Oporto, @1, @2, @Lisboa, @2, @3;
+the_sum the_town
+204 Oporto
+203 Oporto
+204 Lisboa
+test_sequence
+------ explain select tests ------
+prepare stmt1 from ' explain select * from t9 ' ;
+execute stmt1;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def id 8 3 1 N 32801 0 8
+def select_type 253 19 6 N 1 31 8
+def table 253 64 2 N 1 31 8
+def type 253 10 3 N 1 31 8
+def possible_keys 253 4096 0 Y 0 31 8
+def key 253 64 0 Y 0 31 8
+def key_len 8 3 0 Y 32800 0 8
+def ref 253 1024 0 Y 0 31 8
+def rows 8 10 1 N 32801 0 8
+def Extra 253 255 0 N 1 31 8
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t9 ALL NULL NULL NULL NULL 2
+test_sequence
+------ delete tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+prepare stmt1 from 'delete from t1 where a=2' ;
+execute stmt1;
+select a,b from t1 where a=2;
+a b
+execute stmt1;
+insert into t1 values(0,NULL);
+set @arg00=NULL;
+prepare stmt1 from 'delete from t1 where b=?' ;
+execute stmt1 using @arg00;
+select a,b from t1 where b is NULL ;
+a b
+0 NULL
+set @arg00='one';
+execute stmt1 using @arg00;
+select a,b from t1 where b=@arg00;
+a b
+prepare stmt1 from 'truncate table t1' ;
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+test_sequence
+------ update tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ;
+execute stmt1;
+select a,b from t1 where a=2;
+a b
+2 a=two
+execute stmt1;
+select a,b from t1 where a=2;
+a b
+2 a=two
+set @arg00=NULL;
+prepare stmt1 from 'update t1 set b=? where a=2' ;
+execute stmt1 using @arg00;
+select a,b from t1 where a=2;
+a b
+2 NULL
+set @arg00='two';
+execute stmt1 using @arg00;
+select a,b from t1 where a=2;
+a b
+2 two
+set @arg00=2;
+prepare stmt1 from 'update t1 set b=NULL where a=?' ;
+execute stmt1 using @arg00;
+select a,b from t1 where a=@arg00;
+a b
+2 NULL
+update t1 set b='two' where a=@arg00;
+set @arg00=2000;
+execute stmt1 using @arg00;
+select a,b from t1 where a=@arg00;
+a b
+set @arg00=2;
+set @arg01=22;
+prepare stmt1 from 'update t1 set a=? where a=?' ;
+execute stmt1 using @arg00, @arg00;
+select a,b from t1 where a=@arg00;
+a b
+2 two
+execute stmt1 using @arg01, @arg00;
+select a,b from t1 where a=@arg01;
+a b
+22 two
+execute stmt1 using @arg00, @arg01;
+select a,b from t1 where a=@arg00;
+a b
+2 two
+set @arg00=NULL;
+set @arg01=2;
+execute stmt1 using @arg00, @arg01;
+Warnings:
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1
+select a,b from t1 order by a;
+a b
+0 two
+1 one
+3 three
+4 four
+set @arg00=0;
+execute stmt1 using @arg01, @arg00;
+select a,b from t1 order by a;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00=23;
+set @arg01='two';
+set @arg02=2;
+set @arg03='two';
+set @arg04=2;
+drop table if exists t2;
+create table t2 as select a,b from t1 ;
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 where a = @arg00 ;
+a b
+23 two
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a not in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 order by a ;
+a b
+1 one
+2 two
+3 three
+4 four
+drop table t2 ;
+create table t2
+(
+a int, b varchar(30),
+primary key(a)
+) engine = 'MYISAM' ;
+insert into t2(a,b) select a, b from t1 ;
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 where a = @arg00 ;
+a b
+23 two
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a not in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 order by a ;
+a b
+1 one
+2 two
+3 three
+4 four
+drop table t2 ;
+set @arg00=1;
+prepare stmt1 from 'update t1 set b=''bla''
+where a=2
+limit 1';
+execute stmt1 ;
+select a,b from t1 where b = 'bla' ;
+a b
+2 bla
+prepare stmt1 from 'update t1 set b=''bla''
+where a=2
+limit ?';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 3
+test_sequence
+------ insert tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+prepare stmt1 from 'insert into t1 values(5, ''five'' )';
+execute stmt1;
+select a,b from t1 where a = 5;
+a b
+5 five
+set @arg00='six' ;
+prepare stmt1 from 'insert into t1 values(6, ? )';
+execute stmt1 using @arg00;
+select a,b from t1 where b = @arg00;
+a b
+6 six
+execute stmt1 using @arg00;
+ERROR 23000: Duplicate entry '6' for key 1
+set @arg00=NULL ;
+prepare stmt1 from 'insert into t1 values(0, ? )';
+execute stmt1 using @arg00;
+select a,b from t1 where b is NULL;
+a b
+0 NULL
+set @arg00=8 ;
+set @arg01='eight' ;
+prepare stmt1 from 'insert into t1 values(?, ? )';
+execute stmt1 using @arg00, @arg01 ;
+select a,b from t1 where b = @arg01;
+a b
+8 eight
+set @NULL= null ;
+set @arg00= 'abc' ;
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg00 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg00 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 abc
+10002 abc
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @NULL ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @NULL ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 NULL
+10002 NULL
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 10 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 9 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 8 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 7 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 6 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 5 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 4 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 3 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg01 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 10001
+10002 10002
+10003 10003
+10004 10004
+10005 10005
+10006 10006
+10007 10007
+10008 10008
+10009 10009
+10010 10010
+delete from t1 where a > 10000 ;
+set @arg00=81 ;
+set @arg01='8-1' ;
+set @arg02=82 ;
+set @arg03='8-2' ;
+prepare stmt1 from 'insert into t1 values(?,?),(?,?)';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
+select a,b from t1 where a in (@arg00,@arg02) ;
+a b
+81 8-1
+82 8-2
+set @arg00=9 ;
+set @arg01='nine' ;
+prepare stmt1 from 'insert into t1 set a=?, b=? ';
+execute stmt1 using @arg00, @arg01 ;
+select a,b from t1 where a = @arg00 ;
+a b
+9 nine
+set @arg00=6 ;
+set @arg01=1 ;
+prepare stmt1 from 'insert into t1 set a=?, b=''sechs''
+ on duplicate key update a=a + ?, b=concat(b,''modified'') ';
+execute stmt1 using @arg00, @arg01;
+select * from t1 order by a;
+a b
+0 NULL
+1 one
+2 two
+3 three
+4 four
+5 five
+7 sixmodified
+8 eight
+9 nine
+81 8-1
+82 8-2
+set @arg00=81 ;
+set @arg01=1 ;
+execute stmt1 using @arg00, @arg01;
+ERROR 23000: Duplicate entry '82' for key 1
+drop table if exists t2 ;
+create table t2 (id int auto_increment primary key)
+ENGINE= 'MYISAM' ;
+prepare stmt1 from ' select last_insert_id() ' ;
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+1
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+2
+drop table t2 ;
+set @1000=1000 ;
+set @x1000_2="x1000_2" ;
+set @x1000_3="x1000_3" ;
+set @x1000="x1000" ;
+set @1100=1100 ;
+set @x1100="x1100" ;
+set @100=100 ;
+set @updated="updated" ;
+insert into t1 values(1000,'x1000_1') ;
+insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3)
+on duplicate key update a = a + @100, b = concat(b,@updated) ;
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 x1000_3
+1100 x1000_1updated
+delete from t1 where a >= 1000 ;
+insert into t1 values(1000,'x1000_1') ;
+prepare stmt1 from ' insert into t1 values(?,?),(?,?)
+ on duplicate key update a = a + ?, b = concat(b,?) ';
+execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ;
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 x1000_3
+1100 x1000_1updated
+delete from t1 where a >= 1000 ;
+insert into t1 values(1000,'x1000_1') ;
+execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ;
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1200 x1000_1updatedupdated
+delete from t1 where a >= 1000 ;
+prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
+execute stmt1;
+execute stmt1;
+execute stmt1;
+test_sequence
+------ multi table tests ------
+delete from t1 ;
+delete from t9 ;
+insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
+insert into t9 (c1,c21)
+values (1, 'one'), (2, 'two'), (3, 'three') ;
+prepare stmt_delete from " delete t1, t9
+ from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
+prepare stmt_update from " update t1, t9
+ set t1.b='updated', t9.c21='updated'
+ where t1.a=t9.c1 and t1.a=? ";
+prepare stmt_select1 from " select a, b from t1 order by a" ;
+prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
+set @arg00= 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+2 two
+3 three
+execute stmt_select2 ;
+c1 c21
+2 two
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+3 three
+execute stmt_select2 ;
+c1 c21
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+execute stmt_select2 ;
+c1 c21
+set @arg00= @arg00 + 1 ;
+drop table if exists t5 ;
+set @arg01= 8;
+set @arg02= 8.0;
+set @arg03= 80.00000000000e-1;
+set @arg04= 'abc' ;
+set @arg05= CAST('abc' as binary) ;
+set @arg06= '1991-08-05' ;
+set @arg07= CAST('1991-08-05' as date);
+set @arg08= '1991-08-05 01:01:01' ;
+set @arg09= CAST('1991-08-05 01:01:01' as datetime) ;
+set @arg10= unix_timestamp('1991-01-01 01:01:01');
+set @arg11= YEAR('1991-01-01 01:01:01');
+set @arg12= 8 ;
+set @arg12= NULL ;
+set @arg13= 8.0 ;
+set @arg13= NULL ;
+set @arg14= 'abc';
+set @arg14= NULL ;
+set @arg15= CAST('abc' as binary) ;
+set @arg15= NULL ;
+create table t5 as select
+8 as const01, @arg01 as param01,
+8.0 as const02, @arg02 as param02,
+80.00000000000e-1 as const03, @arg03 as param03,
+'abc' as const04, @arg04 as param04,
+CAST('abc' as binary) as const05, @arg05 as param05,
+'1991-08-05' as const06, @arg06 as param06,
+CAST('1991-08-05' as date) as const07, @arg07 as param07,
+'1991-08-05 01:01:01' as const08, @arg08 as param08,
+CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09,
+unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10,
+YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11,
+NULL as const12, @arg12 as param12,
+@arg13 as param13,
+@arg14 as param14,
+@arg15 as param15;
+show create table t5 ;
+Table Create Table
+t5 CREATE TABLE `t5` (
+ `const01` bigint(1) NOT NULL default '0',
+ `param01` bigint(20) default NULL,
+ `const02` double(3,1) NOT NULL default '0.0',
+ `param02` double default NULL,
+ `const03` double NOT NULL default '0',
+ `param03` double default NULL,
+ `const04` char(3) NOT NULL default '',
+ `param04` longtext,
+ `const05` binary(3) NOT NULL default '',
+ `param05` longblob,
+ `const06` varchar(10) NOT NULL default '',
+ `param06` longtext,
+ `const07` date default NULL,
+ `param07` longblob,
+ `const08` varchar(19) NOT NULL default '',
+ `param08` longtext,
+ `const09` datetime default NULL,
+ `param09` longblob,
+ `const10` int(10) NOT NULL default '0',
+ `param10` bigint(20) default NULL,
+ `const11` int(4) default NULL,
+ `param11` bigint(20) default NULL,
+ `const12` binary(0) default NULL,
+ `param12` bigint(20) default NULL,
+ `param13` double default NULL,
+ `param14` longtext,
+ `param15` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t5 ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t5 t5 const01 const01 8 1 1 N 32769 0 63
+def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
+def test t5 t5 const02 const02 5 3 3 N 32769 1 63
+def test t5 t5 param02 param02 5 20 1 Y 32768 31 63
+def test t5 t5 const03 const03 5 23 1 N 32769 31 63
+def test t5 t5 param03 param03 5 20 1 Y 32768 31 63
+def test t5 t5 const04 const04 254 3 3 N 1 0 8
+def test t5 t5 param04 param04 252 16777215 3 Y 16 0 8
+def test t5 t5 const05 const05 254 3 3 N 129 0 63
+def test t5 t5 param05 param05 252 16777215 3 Y 144 0 63
+def test t5 t5 const06 const06 253 10 10 N 1 0 8
+def test t5 t5 param06 param06 252 16777215 10 Y 16 0 8
+def test t5 t5 const07 const07 10 10 10 Y 128 0 63
+def test t5 t5 param07 param07 252 16777215 10 Y 144 0 63
+def test t5 t5 const08 const08 253 19 19 N 1 0 8
+def test t5 t5 param08 param08 252 16777215 19 Y 16 0 8
+def test t5 t5 const09 const09 12 19 19 Y 128 0 63
+def test t5 t5 param09 param09 252 16777215 19 Y 144 0 63
+def test t5 t5 const10 const10 3 10 9 N 32769 0 63
+def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
+def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
+def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
+def test t5 t5 const12 const12 254 0 0 Y 128 0 63
+def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
+def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
+def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
+const01 8
+param01 8
+const02 8.0
+param02 8
+const03 8
+param03 8
+const04 abc
+param04 abc
+const05 abc
+param05 abc
+const06 1991-08-05
+param06 1991-08-05
+const07 1991-08-05
+param07 1991-08-05
+const08 1991-08-05 01:01:01
+param08 1991-08-05 01:01:01
+const09 1991-08-05 01:01:01
+param09 1991-08-05 01:01:01
+const10 662680861
+param10 662680861
+const11 1991
+param11 1991
+const12 NULL
+param12 NULL
+param13 NULL
+param14 NULL
+param15 NULL
+drop table t5 ;
+test_sequence
+------ data type conversion tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ;
+select * from t9 order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+test_sequence
+------ select @parameter:= column ------
+prepare full_info from "select @arg01, @arg02, @arg03, @arg04,
+ @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12,
+ @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20,
+ @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28,
+ @arg29, @arg30, @arg31, @arg32" ;
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 1 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 0 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select
+ @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+ @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+ @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+ @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+ @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+ @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+ @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+ @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':= c1 from t9 where c1= 1' at line 1
+test_sequence
+------ select column, .. into @parm,.. ------
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 1 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 0 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+ c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+ c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? from t9 where c1= 1' at line 1
+test_sequence
+-- insert into numeric columns --
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ;
+set @arg00= 21 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ;
+execute stmt1 ;
+set @arg00= 23;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
+30.0, 30.0, 30.0 ) ;
+set @arg00= 31.0 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0,
+ 32.0, 32.0, 32.0 )" ;
+execute stmt1 ;
+set @arg00= 33.0;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( '40', '40', '40', '40', '40', '40', '40', '40',
+'40', '40', '40' ) ;
+set @arg00= '41' ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( '42', '42', '42', '42', '42', '42', '42', '42',
+ '42', '42', '42' )" ;
+execute stmt1 ;
+set @arg00= '43';
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ;
+set @arg00= CAST('51' as binary) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ;
+execute stmt1 ;
+set @arg00= CAST('53' as binary) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 2 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+NULL, NULL, NULL ) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 61, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL )" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 8.0 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 71, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 'abc' ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 81, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c1 >= 20
+order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12
+20 20 20 20 20 20 20 20 20 20 20.0000
+21 21 21 21 21 21 21 21 21 21 21.0000
+22 22 22 22 22 22 22 22 22 22 22.0000
+23 23 23 23 23 23 23 23 23 23 23.0000
+30 30 30 30 30 30 30 30 30 30 30.0000
+31 31 31 31 31 31 31 31 31 31 31.0000
+32 32 32 32 32 32 32 32 32 32 32.0000
+33 33 33 33 33 33 33 33 33 33 33.0000
+40 40 40 40 40 40 40 40 40 40 40.0000
+41 41 41 41 41 41 41 41 41 41 41.0000
+42 42 42 42 42 42 42 42 42 42 42.0000
+43 43 43 43 43 43 43 43 43 43 43.0000
+50 50 50 50 50 50 50 50 50 50 50.0000
+51 51 51 51 51 51 51 51 51 51 51.0000
+52 52 52 52 52 52 52 52 52 52 52.0000
+53 53 53 53 53 53 53 53 53 53 53.0000
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where numeric column = .. --
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+and c8= 20 and c9= 20 and c10= 20 and c12= 20;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+ and c8= 20 and c9= 20 and c10= 20 and c12= 20 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+ and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20';
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' ";
+execute stmt1 ;
+found
+true
+set @arg00= '20';
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+c12= CAST('20' as binary);
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+ c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+ c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+ c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+ c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+ c12= CAST('20' as binary) ";
+execute stmt1 ;
+found
+true
+set @arg00= CAST('20' as binary) ;
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- some numeric overflow experiments --
+prepare my_insert from "insert into t9
+ ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c21 = 'O' ";
+prepare my_delete from "delete from t9 where c21 = 'O' ";
+set @arg00= 9223372036854775807 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= '9223372036854775807' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= -9223372036854775808 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-9223372036854775808' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= 1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= '1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 1
+c2 1
+c3 1
+c4 1
+c5 1
+c6 1
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= -1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -1
+c2 -1
+c3 -1
+c4 -1
+c5 -1
+c6 -1
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+test_sequence
+-- insert into string columns --
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30
+from t9 where c1 >= 20
+order by c1 ;
+c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
+20 2 20 20 20 20 20 20 20 20 20 20
+21 2 21 21 21 21 21 21 21 21 21 21
+22 2 22 22 22 22 22 22 22 22 22 22
+23 2 23 23 23 23 23 23 23 23 23 23
+30 3 30 30 30 30 30 30 30 30 30 30
+31 3 31 31 31 31 31 31 31 31 31 31
+32 3 32 32 32 32 32 32 32 32 32 32
+33 3 33 33 33 33 33 33 33 33 33 33
+40 4 40 40 40 40 40 40 40 40 40 40
+41 4 41 41 41 41 41 41 41 41 41 41
+42 4 42 42 42 42 42 42 42 42 42 42
+43 4 43 43 43 43 43 43 43 43 43 43
+50 5 50 50 50.00 50.00 50.00 50.00 50.00 50.00 50.00 50.00
+51 5 51 51 51 51 51 51 51 51 51 51
+52 5 52 52 52.00 52.00 52.00 52.00 52.00 52.00 52.00 52.00
+53 5 53 53 53.00 53.00 53.00 53.00 53.00 53.00 53.00 53.00
+54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00
+55 5 55 55 55 55 55 55 55 55 55 55
+56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00
+57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where string column = .. --
+set @arg00= '20';
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+c27= '20' and c28= '20' and c29= '20' and c30= '20' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+ c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+ c27= '20' and c28= '20' and c29= '20' and c30= '20'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('20' as binary);
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+= CAST('20' as binary) and c21= CAST('20' as binary)
+and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+c30= CAST('20' as binary) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and
+c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+ = CAST('20' as binary) and c21= CAST('20' as binary)
+ and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+ c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+ c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+ c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+ c30= CAST('20' as binary)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and
+ c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and
+ c29= ? and c30= ?";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+c27= 20 and c28= 20 and c29= 20 and c30= 20 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+ c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+ c27= 20 and c28= 20 and c29= 20 and c30= 20" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+ c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+ c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- insert into date/time columns --
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
+c1 c13 c14 c15 c16 c17
+20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+21 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+22 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+23 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+30 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+60 NULL NULL 1991-01-01 01:01:01 NULL NULL
+61 NULL NULL 1991-01-01 01:01:01 NULL NULL
+62 NULL NULL 1991-01-01 01:01:01 NULL NULL
+63 NULL NULL 1991-01-01 01:01:01 NULL NULL
+71 NULL NULL 1991-01-01 01:01:01 NULL NULL
+73 NULL NULL 1991-01-01 01:01:01 NULL NULL
+81 NULL NULL 1991-01-01 01:01:01 NULL NULL
+83 NULL NULL 1991-01-01 01:01:01 NULL NULL
+test_sequence
+-- select .. where date/time column = .. --
+set @arg00= '1991-01-01 01:01:01' ;
+select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+c17= '1991-01-01 01:01:01' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+ c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+ c17= '1991-01-01 01:01:01'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
+select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+c14= CAST('1991-01-01 01:01:01' as datetime) and
+c15= CAST('1991-01-01 01:01:01' as datetime) and
+c16= CAST('1991-01-01 01:01:01' as datetime) and
+c17= CAST('1991-01-01 01:01:01' as datetime) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+ c14= CAST('1991-01-01 01:01:01' as datetime) and
+ c15= CAST('1991-01-01 01:01:01' as datetime) and
+ c16= CAST('1991-01-01 01:01:01' as datetime) and
+ c17= CAST('1991-01-01 01:01:01' as datetime)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 1991 ;
+select 'true' as found from t9
+where c1= 20 and c17= 1991 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= 1991" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= ?" ;
+execute stmt1 using @arg00 ;
+found
+true
+set @arg00= 1.991e+3 ;
+select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and abs(c17 - @arg00) < 0.01 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - ?) < 0.01" ;
+execute stmt1 using @arg00 ;
+found
+true
+drop table t1, t9 ;
+create table t1
+(
+a int, b varchar(30),
+primary key(a)
+) ENGINE = MERGE UNION=(t1_1,t1_2)
+INSERT_METHOD=LAST;
+create table t9
+(
+c1 tinyint, c2 smallint, c3 mediumint, c4 int,
+c5 integer, c6 bigint, c7 float, c8 double,
+c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
+c13 date, c14 datetime, c15 timestamp(14), c16 time,
+c17 year, c18 bit, c19 bool, c20 char,
+c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
+c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
+c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
+c32 set('monday', 'tuesday', 'wednesday'),
+primary key(c1)
+) ENGINE = MERGE UNION=(t9_1,t9_2)
+INSERT_METHOD=LAST;
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+test_sequence
+------ simple select tests ------
+prepare stmt1 from ' select * from t9 order by c1 ' ;
+execute stmt1;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t9 t9 c1 c1 1 4 1 N 49155 0 63
+def test t9 t9 c2 c2 2 6 1 Y 32768 0 63
+def test t9 t9 c3 c3 9 9 1 Y 32768 0 63
+def test t9 t9 c4 c4 3 11 1 Y 32768 0 63
+def test t9 t9 c5 c5 3 11 1 Y 32768 0 63
+def test t9 t9 c6 c6 8 20 1 Y 32768 0 63
+def test t9 t9 c7 c7 4 12 1 Y 32768 31 63
+def test t9 t9 c8 c8 5 22 1 Y 32768 31 63
+def test t9 t9 c9 c9 5 22 1 Y 32768 31 63
+def test t9 t9 c10 c10 5 22 1 Y 32768 31 63
+def test t9 t9 c11 c11 0 9 6 Y 32768 4 63
+def test t9 t9 c12 c12 0 10 6 Y 32768 4 63
+def test t9 t9 c13 c13 10 10 10 Y 128 0 63
+def test t9 t9 c14 c14 12 19 19 Y 128 0 63
+def test t9 t9 c15 c15 7 19 19 N 1249 0 63
+def test t9 t9 c16 c16 11 8 8 Y 128 0 63
+def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
+def test t9 t9 c18 c18 1 1 1 Y 32768 0 63
+def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
+def test t9 t9 c20 c20 254 1 1 Y 0 0 8
+def test t9 t9 c21 c21 253 10 10 Y 0 0 8
+def test t9 t9 c22 c22 253 30 30 Y 0 0 8
+def test t9 t9 c23 c23 252 255 8 Y 144 0 63
+def test t9 t9 c24 c24 252 255 8 Y 16 0 8
+def test t9 t9 c25 c25 252 65535 4 Y 144 0 63
+def test t9 t9 c26 c26 252 65535 4 Y 16 0 8
+def test t9 t9 c27 c27 252 16777215 10 Y 144 0 63
+def test t9 t9 c28 c28 252 16777215 10 Y 16 0 8
+def test t9 t9 c29 c29 252 16777215 8 Y 144 0 63
+def test t9 t9 c30 c30 252 16777215 8 Y 16 0 8
+def test t9 t9 c31 c31 254 5 3 Y 256 0 8
+def test t9 t9 c32 c32 254 24 7 Y 2048 0 8
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+set @arg00='SELECT' ;
+prepare stmt1 from ' ? a from t1 where a=1 ';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1
+set @arg00=1 ;
+select @arg00, b from t1 where a=1 ;
+@arg00 b
+1 one
+prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+? b
+1 one
+set @arg00='lion' ;
+select @arg00, b from t1 where a=1 ;
+@arg00 b
+lion one
+prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+? b
+lion one
+set @arg00=NULL ;
+select @arg00, b from t1 where a=1 ;
+@arg00 b
+NULL one
+prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+? b
+NULL one
+set @arg00=1 ;
+select b, a - @arg00 from t1 where a=1 ;
+b a - @arg00
+one 0
+prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+b a - ?
+one 0
+set @arg00=null ;
+select @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select @arg00 + 1 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? + 1 as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select 1 + @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select 1 + ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+set @arg00='MySQL' ;
+select substr(@arg00,1,2) from t1 where a=1 ;
+substr(@arg00,1,2)
+My
+prepare stmt1 from ' select substr(?,1,2) from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+substr(?,1,2)
+My
+set @arg00=3 ;
+select substr('MySQL',@arg00,5) from t1 where a=1 ;
+substr('MySQL',@arg00,5)
+SQL
+prepare stmt1 from ' select substr(''MySQL'',?,5) from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+substr('MySQL',?,5)
+SQL
+select substr('MySQL',1,@arg00) from t1 where a=1 ;
+substr('MySQL',1,@arg00)
+MyS
+prepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+substr('MySQL',1,?)
+MyS
+set @arg00='MySQL' ;
+select a , concat(@arg00,b) from t1 order by a;
+a concat(@arg00,b)
+1 MySQLone
+2 MySQLtwo
+3 MySQLthree
+4 MySQLfour
+prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ;
+execute stmt1 using @arg00;
+a concat(?,b)
+1 MySQLone
+2 MySQLtwo
+3 MySQLthree
+4 MySQLfour
+select a , concat(b,@arg00) from t1 order by a ;
+a concat(b,@arg00)
+1 oneMySQL
+2 twoMySQL
+3 threeMySQL
+4 fourMySQL
+prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ;
+execute stmt1 using @arg00;
+a concat(b,?)
+1 oneMySQL
+2 twoMySQL
+3 threeMySQL
+4 fourMySQL
+set @arg00='MySQL' ;
+select group_concat(@arg00,b order by a) from t1
+group by 'a' ;
+group_concat(@arg00,b order by a)
+MySQLone,MySQLtwo,MySQLthree,MySQLfour
+prepare stmt1 from ' select group_concat(?,b order by a) from t1
+group by ''a'' ' ;
+execute stmt1 using @arg00;
+group_concat(?,b order by a)
+MySQLone,MySQLtwo,MySQLthree,MySQLfour
+select group_concat(b,@arg00 order by a) from t1
+group by 'a' ;
+group_concat(b,@arg00 order by a)
+oneMySQL,twoMySQL,threeMySQL,fourMySQL
+prepare stmt1 from ' select group_concat(b,? order by a) from t1
+group by ''a'' ' ;
+execute stmt1 using @arg00;
+group_concat(b,? order by a)
+oneMySQL,twoMySQL,threeMySQL,fourMySQL
+set @arg00='first' ;
+set @arg01='second' ;
+set @arg02=NULL;
+select @arg00, @arg01 from t1 where a=1 ;
+@arg00 @arg01
+first second
+prepare stmt1 from ' select ?, ? from t1 where a=1 ' ;
+execute stmt1 using @arg00, @arg01 ;
+? ?
+first second
+execute stmt1 using @arg02, @arg01 ;
+? ?
+NULL second
+execute stmt1 using @arg00, @arg02 ;
+? ?
+first NULL
+execute stmt1 using @arg02, @arg02 ;
+? ?
+NULL NULL
+drop table if exists t5 ;
+create table t5 (id1 int(11) not null default '0',
+value2 varchar(100), value1 varchar(100)) ;
+insert into t5 values (1,'hh','hh'),(2,'hh','hh'),
+(1,'ii','ii'),(2,'ii','ii') ;
+prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ;
+set @arg00=1 ;
+set @arg01='hh' ;
+execute stmt1 using @arg00, @arg01 ;
+id1 value1
+1 hh
+1 ii
+2 hh
+drop table t5 ;
+drop table if exists t5 ;
+create table t5(session_id char(9) not null) ;
+insert into t5 values ('abc') ;
+prepare stmt1 from ' select * from t5
+where ?=''1111'' and session_id = ''abc'' ' ;
+set @arg00='abc' ;
+execute stmt1 using @arg00 ;
+session_id
+set @arg00='1111' ;
+execute stmt1 using @arg00 ;
+session_id
+abc
+set @arg00='abc' ;
+execute stmt1 using @arg00 ;
+session_id
+drop table t5 ;
+set @arg00='FROM' ;
+select a @arg00 t1 where a=1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 t1 where a=1' at line 1
+prepare stmt1 from ' select a ? t1 where a=1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? t1 where a=1' at line 1
+set @arg00='t1' ;
+select a from @arg00 where a=1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 where a=1' at line 1
+prepare stmt1 from ' select a from ? where a=1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? where a=1' at line 1
+set @arg00='WHERE' ;
+select a from t1 @arg00 a=1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a=1' at line 1
+prepare stmt1 from ' select a from t1 ? a=1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a=1' at line 1
+set @arg00=1 ;
+select a FROM t1 where a=@arg00 ;
+a
+1
+prepare stmt1 from ' select a FROM t1 where a=? ' ;
+execute stmt1 using @arg00 ;
+a
+1
+set @arg00=1000 ;
+execute stmt1 using @arg00 ;
+a
+set @arg00=NULL ;
+select a FROM t1 where a=@arg00 ;
+a
+prepare stmt1 from ' select a FROM t1 where a=? ' ;
+execute stmt1 using @arg00 ;
+a
+set @arg00=4 ;
+select a FROM t1 where a=sqrt(@arg00) ;
+a
+2
+prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
+execute stmt1 using @arg00 ;
+a
+2
+set @arg00=NULL ;
+select a FROM t1 where a=sqrt(@arg00) ;
+a
+prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
+execute stmt1 using @arg00 ;
+a
+set @arg00=2 ;
+set @arg01=3 ;
+select a FROM t1 where a in (@arg00,@arg01) order by a;
+a
+2
+3
+prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a ';
+execute stmt1 using @arg00, @arg01;
+a
+2
+3
+set @arg00= 'one' ;
+set @arg01= 'two' ;
+set @arg02= 'five' ;
+prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ;
+execute stmt1 using @arg00, @arg01, @arg02 ;
+b
+one
+two
+prepare stmt1 from ' select b FROM t1 where b like ? ';
+set @arg00='two' ;
+execute stmt1 using @arg00 ;
+b
+two
+set @arg00='tw%' ;
+execute stmt1 using @arg00 ;
+b
+two
+set @arg00='%wo' ;
+execute stmt1 using @arg00 ;
+b
+two
+set @arg00=null ;
+insert into t9 set c1= 0, c5 = NULL ;
+select c5 from t9 where c5 > NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 > ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 < NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 < ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 = NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 = ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 <=> NULL ;
+c5
+NULL
+prepare stmt1 from ' select c5 from t9 where c5 <=> ? ';
+execute stmt1 using @arg00 ;
+c5
+NULL
+delete from t9 where c1= 0 ;
+set @arg00='>' ;
+select a FROM t1 where a @arg00 1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 1' at line 1
+prepare stmt1 from ' select a FROM t1 where a ? 1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? 1' at line 1
+set @arg00=1 ;
+select a,b FROM t1 where a is not NULL
+AND b is not NULL group by a - @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+prepare stmt1 from ' select a,b FROM t1 where a is not NULL
+AND b is not NULL group by a - ? ' ;
+execute stmt1 using @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00='two' ;
+select a,b FROM t1 where a is not NULL
+AND b is not NULL having b <> @arg00 order by a ;
+a b
+1 one
+3 three
+4 four
+prepare stmt1 from ' select a,b FROM t1 where a is not NULL
+AND b is not NULL having b <> ? order by a ' ;
+execute stmt1 using @arg00 ;
+a b
+1 one
+3 three
+4 four
+set @arg00=1 ;
+select a,b FROM t1 where a is not NULL
+AND b is not NULL order by a - @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+prepare stmt1 from ' select a,b FROM t1 where a is not NULL
+AND b is not NULL order by a - ? ' ;
+execute stmt1 using @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00=2 ;
+select a,b from t1 order by 2 ;
+a b
+4 four
+1 one
+3 three
+2 two
+prepare stmt1 from ' select a,b from t1
+order by ? ';
+execute stmt1 using @arg00;
+a b
+4 four
+1 one
+3 three
+2 two
+set @arg00=1 ;
+execute stmt1 using @arg00;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00=0 ;
+execute stmt1 using @arg00;
+ERROR 42S22: Unknown column '?' in 'order clause'
+set @arg00=1;
+prepare stmt1 from ' select a,b from t1 order by a
+limit 1 ';
+execute stmt1 ;
+a b
+1 one
+prepare stmt1 from ' select a,b from t1
+limit ? ';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 2
+set @arg00='b' ;
+set @arg01=0 ;
+set @arg02=2 ;
+set @arg03=2 ;
+select sum(a), @arg00 from t1 where a > @arg01
+and b is not null group by substr(b,@arg02)
+having sum(a) <> @arg03 ;
+sum(a) @arg00
+3 b
+1 b
+4 b
+prepare stmt1 from ' select sum(a), ? from t1 where a > ?
+and b is not null group by substr(b,?)
+having sum(a) <> ? ';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03;
+sum(a) ?
+3 b
+1 b
+4 b
+test_sequence
+------ join tests ------
+select first.a as a1, second.a as a2
+from t1 first, t1 second
+where first.a = second.a order by a1 ;
+a1 a2
+1 1
+2 2
+3 3
+4 4
+prepare stmt1 from ' select first.a as a1, second.a as a2
+ from t1 first, t1 second
+ where first.a = second.a order by a1 ';
+execute stmt1 ;
+a1 a2
+1 1
+2 2
+3 3
+4 4
+set @arg00='ABC';
+set @arg01='two';
+set @arg02='one';
+select first.a, @arg00, second.a FROM t1 first, t1 second
+where @arg01 = first.b or first.a = second.a or second.b = @arg02
+order by second.a, first.a;
+a @arg00 a
+1 ABC 1
+2 ABC 1
+3 ABC 1
+4 ABC 1
+2 ABC 2
+2 ABC 3
+3 ABC 3
+2 ABC 4
+4 ABC 4
+prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
+ where ? = first.b or first.a = second.a or second.b = ?
+ order by second.a, first.a';
+execute stmt1 using @arg00, @arg01, @arg02;
+a ? a
+1 ABC 1
+2 ABC 1
+3 ABC 1
+4 ABC 1
+2 ABC 2
+2 ABC 3
+3 ABC 3
+2 ABC 4
+4 ABC 4
+drop table if exists t2 ;
+create table t2 as select * from t1 ;
+set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
+set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
+set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
+set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
+set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
+set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
+set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
+the join statement is:
+SELECT * FROM t2 right join t1 using(a) order by t2.a
+prepare stmt1 from @query9 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural right join t1 order by t2.a
+prepare stmt1 from @query8 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query7 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 using(a) order by t2.a
+prepare stmt1 from @query6 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural left join t1 order by t2.a
+prepare stmt1 from @query5 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query4 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 join t1 using(a) order by t2.a
+prepare stmt1 from @query3 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural join t1 order by t2.a
+prepare stmt1 from @query2 ;
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+the join statement is:
+SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a
+prepare stmt1 from @query1 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+drop table t2 ;
+test_sequence
+------ subquery tests ------
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = ''two'') ';
+execute stmt1 ;
+a b
+2 two
+set @arg00='two' ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where b = 'two' ) and b=@arg00 ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = ''two'') and b=? ';
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00='two' ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where b = @arg00 ) and b='two' ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = ? ) and b=''two'' ' ;
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=3 ;
+set @arg01='three' ;
+select a,b FROM t1 where (a,b) in (select 3, 'three');
+a b
+3 three
+select a FROM t1 where (a,b) in (select @arg00,@arg01);
+a
+3
+prepare stmt1 from ' select a FROM t1 where (a,b) in (select ?, ?) ';
+execute stmt1 using @arg00, @arg01;
+a
+3
+set @arg00=1 ;
+set @arg01='two' ;
+set @arg02=2 ;
+set @arg03='two' ;
+select a, @arg00, b FROM t1 outer_table where
+b=@arg01 and a = (select @arg02 from t1 where b = @arg03 ) ;
+a @arg00 b
+2 1 two
+prepare stmt1 from ' select a, ?, b FROM t1 outer_table where
+ b=? and a = (select ? from t1 where b = ? ) ' ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
+a ? b
+2 1 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = outer_table.b ) order by a ';
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+set @arg00='two' ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where b = outer_table.b ) and b=@arg00 ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = outer_table.b) and b=? ';
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=2 ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where a = @arg00 and b = outer_table.b) and b='two' ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where a = ? and b = outer_table.b) and b=''two'' ' ;
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=2 ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where outer_table.a = @arg00 and a=2) and b='two' ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where outer_table.a = ? and a=2) and b=''two'' ' ;
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=1 ;
+set @arg01='two' ;
+set @arg02=2 ;
+set @arg03='two' ;
+select a, @arg00, b FROM t1 outer_table where
+b=@arg01 and a = (select @arg02 from t1 where outer_table.b = @arg03
+and outer_table.a=a ) ;
+a @arg00 b
+2 1 two
+prepare stmt1 from ' select a, ?, b FROM t1 outer_table where
+ b=? and a = (select ? from t1 where outer_table.b = ?
+ and outer_table.a=a ) ' ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
+a ? b
+2 1 two
+set @arg00=1 ;
+set @arg01=0 ;
+select a, @arg00
+from ( select a - @arg00 as a from t1 where a=@arg00 ) as t2
+where a=@arg01;
+a @arg00
+0 1
+prepare stmt1 from ' select a, ?
+ from ( select a - ? as a from t1 where a=? ) as t2
+ where a=? ';
+execute stmt1 using @arg00, @arg00, @arg00, @arg01 ;
+a ?
+0 1
+drop table if exists t2 ;
+create table t2 as select * from t1;
+prepare stmt1 from ' select a in (select a from t2) from t1 ' ;
+execute stmt1 ;
+a in (select a from t2)
+1
+1
+1
+1
+drop table if exists t5, t6, t7 ;
+create table t5 (a int , b int) ;
+create table t6 like t5 ;
+create table t7 like t5 ;
+insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
+(2, -1), (3, 10) ;
+insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ;
+insert into t7 values (3, 3), (2, 2), (1, 1) ;
+prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1) from t7 ' ;
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+drop table t5, t6, t7 ;
+drop table if exists t2 ;
+create table t2 as select * from t9;
+set @stmt= ' SELECT
+ (SELECT SUM(c1 + c12 + 0.0) FROM t2
+ where (t9.c2 - 0e-3) = t2.c2
+ GROUP BY t9.c15 LIMIT 1) as scalar_s,
+ exists (select 1.0e+0 from t2
+ where t2.c3 * 9.0000000000 = t9.c4) as exists_s,
+ c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s,
+ (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s
+FROM t9,
+(select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
+prepare stmt1 from @stmt ;
+execute stmt1 ;
+execute stmt1 ;
+set @stmt= concat('explain ',@stmt);
+prepare stmt1 from @stmt ;
+execute stmt1 ;
+execute stmt1 ;
+set @stmt= ' SELECT
+ (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
+ GROUP BY t9.c15 LIMIT 1) as scalar_s,
+ exists (select ? from t2
+ where t2.c3*?=t9.c4) as exists_s,
+ c5*? in (select c6+? from t2) as in_s,
+ (c7-?, c8-?) in (select c9+?, c10+? from t2) as in_row_s
+FROM t9,
+(select c25 x, c32 y from t2) tt WHERE x =c25 ' ;
+set @arg00= 0.0 ;
+set @arg01= 0e-3 ;
+set @arg02= 1.0e+0 ;
+set @arg03= 9.0000000000 ;
+set @arg04= 4 ;
+set @arg05= 0.3e+1 ;
+set @arg06= 4 ;
+set @arg07= 4 ;
+set @arg08= 4.0 ;
+set @arg09= 40e-1 ;
+prepare stmt1 from @stmt ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+set @stmt= concat('explain ',@stmt);
+prepare stmt1 from @stmt ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+drop table t2 ;
+select 1 < (select a from t1) ;
+ERROR 21000: Subquery returns more than 1 row
+prepare stmt1 from ' select 1 < (select a from t1) ' ;
+execute stmt1 ;
+ERROR 21000: Subquery returns more than 1 row
+select 1 as my_col ;
+my_col
+1
+test_sequence
+------ union tests ------
+prepare stmt1 from ' select a FROM t1 where a=1
+ union distinct
+ select a FROM t1 where a=1 ';
+execute stmt1 ;
+a
+1
+execute stmt1 ;
+a
+1
+prepare stmt1 from ' select a FROM t1 where a=1
+ union all
+ select a FROM t1 where a=1 ';
+execute stmt1 ;
+a
+1
+1
+prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+set @arg00=1 ;
+select @arg00 FROM t1 where a=1
+union distinct
+select 1 FROM t1 where a=1;
+@arg00
+1
+prepare stmt1 from ' select ? FROM t1 where a=1
+ union distinct
+ select 1 FROM t1 where a=1 ' ;
+execute stmt1 using @arg00;
+?
+1
+set @arg00=1 ;
+select 1 FROM t1 where a=1
+union distinct
+select @arg00 FROM t1 where a=1;
+1
+1
+prepare stmt1 from ' select 1 FROM t1 where a=1
+ union distinct
+ select ? FROM t1 where a=1 ' ;
+execute stmt1 using @arg00;
+1
+1
+set @arg00='a' ;
+select @arg00 FROM t1 where a=1
+union distinct
+select @arg00 FROM t1 where a=1;
+@arg00
+a
+prepare stmt1 from ' select ? FROM t1 where a=1
+ union distinct
+ select ? FROM t1 where a=1 ';
+execute stmt1 using @arg00, @arg00;
+?
+a
+prepare stmt1 from ' select ?
+ union distinct
+ select ? ';
+execute stmt1 using @arg00, @arg00;
+?
+a
+set @arg00='a' ;
+set @arg01=1 ;
+set @arg02='a' ;
+set @arg03=2 ;
+select @arg00 FROM t1 where a=@arg01
+union distinct
+select @arg02 FROM t1 where a=@arg03;
+@arg00
+a
+prepare stmt1 from ' select ? FROM t1 where a=?
+ union distinct
+ select ? FROM t1 where a=? ' ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03;
+?
+a
+set @arg00=1 ;
+prepare stmt1 from ' select sum(a) + 200, ? from t1
+union distinct
+select sum(a) + 200, 1 from t1
+group by b ' ;
+execute stmt1 using @arg00;
+sum(a) + 200 ?
+210 1
+204 1
+201 1
+203 1
+202 1
+set @Oporto='Oporto' ;
+set @Lisboa='Lisboa' ;
+set @0=0 ;
+set @1=1 ;
+set @2=2 ;
+set @3=3 ;
+set @4=4 ;
+select @Oporto,@Lisboa,@0,@1,@2,@3,@4 ;
+@Oporto @Lisboa @0 @1 @2 @3 @4
+Oporto Lisboa 0 1 2 3 4
+select sum(a) + 200 as the_sum, @Oporto as the_town from t1
+group by b
+union distinct
+select sum(a) + 200, @Lisboa from t1
+group by b ;
+the_sum the_town
+204 Oporto
+201 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+201 Lisboa
+203 Lisboa
+202 Lisboa
+prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
+ group by b
+ union distinct
+ select sum(a) + 200, ? from t1
+ group by b ' ;
+execute stmt1 using @Oporto, @Lisboa;
+the_sum the_town
+204 Oporto
+201 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+201 Lisboa
+203 Lisboa
+202 Lisboa
+select sum(a) + 200 as the_sum, @Oporto as the_town from t1
+where a > @1
+group by b
+union distinct
+select sum(a) + 200, @Lisboa from t1
+where a > @2
+group by b ;
+the_sum the_town
+204 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+203 Lisboa
+prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
+ where a > ?
+ group by b
+ union distinct
+ select sum(a) + 200, ? from t1
+ where a > ?
+ group by b ' ;
+execute stmt1 using @Oporto, @1, @Lisboa, @2;
+the_sum the_town
+204 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+203 Lisboa
+select sum(a) + 200 as the_sum, @Oporto as the_town from t1
+where a > @1
+group by b
+having avg(a) > @2
+union distinct
+select sum(a) + 200, @Lisboa from t1
+where a > @2
+group by b
+having avg(a) > @3;
+the_sum the_town
+204 Oporto
+203 Oporto
+204 Lisboa
+prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
+ where a > ?
+ group by b
+ having avg(a) > ?
+ union distinct
+ select sum(a) + 200, ? from t1
+ where a > ?
+ group by b
+ having avg(a) > ? ';
+execute stmt1 using @Oporto, @1, @2, @Lisboa, @2, @3;
+the_sum the_town
+204 Oporto
+203 Oporto
+204 Lisboa
+test_sequence
+------ explain select tests ------
+prepare stmt1 from ' explain select * from t9 ' ;
+execute stmt1;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def id 8 3 1 N 32801 0 8
+def select_type 253 19 6 N 1 31 8
+def table 253 64 2 N 1 31 8
+def type 253 10 3 N 1 31 8
+def possible_keys 253 4096 0 Y 0 31 8
+def key 253 64 0 Y 0 31 8
+def key_len 8 3 0 Y 32800 0 8
+def ref 253 1024 0 Y 0 31 8
+def rows 8 10 1 N 32801 0 8
+def Extra 253 255 0 N 1 31 8
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t9 ALL NULL NULL NULL NULL 2
+test_sequence
+------ delete tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+prepare stmt1 from 'delete from t1 where a=2' ;
+execute stmt1;
+select a,b from t1 where a=2;
+a b
+execute stmt1;
+insert into t1 values(0,NULL);
+set @arg00=NULL;
+prepare stmt1 from 'delete from t1 where b=?' ;
+execute stmt1 using @arg00;
+select a,b from t1 where b is NULL ;
+a b
+0 NULL
+set @arg00='one';
+execute stmt1 using @arg00;
+select a,b from t1 where b=@arg00;
+a b
+prepare stmt1 from 'truncate table t1' ;
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+test_sequence
+------ update tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ;
+execute stmt1;
+select a,b from t1 where a=2;
+a b
+2 a=two
+execute stmt1;
+select a,b from t1 where a=2;
+a b
+2 a=two
+set @arg00=NULL;
+prepare stmt1 from 'update t1 set b=? where a=2' ;
+execute stmt1 using @arg00;
+select a,b from t1 where a=2;
+a b
+2 NULL
+set @arg00='two';
+execute stmt1 using @arg00;
+select a,b from t1 where a=2;
+a b
+2 two
+set @arg00=2;
+prepare stmt1 from 'update t1 set b=NULL where a=?' ;
+execute stmt1 using @arg00;
+select a,b from t1 where a=@arg00;
+a b
+2 NULL
+update t1 set b='two' where a=@arg00;
+set @arg00=2000;
+execute stmt1 using @arg00;
+select a,b from t1 where a=@arg00;
+a b
+set @arg00=2;
+set @arg01=22;
+prepare stmt1 from 'update t1 set a=? where a=?' ;
+execute stmt1 using @arg00, @arg00;
+select a,b from t1 where a=@arg00;
+a b
+2 two
+execute stmt1 using @arg01, @arg00;
+select a,b from t1 where a=@arg01;
+a b
+22 two
+execute stmt1 using @arg00, @arg01;
+select a,b from t1 where a=@arg00;
+a b
+2 two
+set @arg00=NULL;
+set @arg01=2;
+execute stmt1 using @arg00, @arg01;
+Warnings:
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1
+select a,b from t1 order by a;
+a b
+0 two
+1 one
+3 three
+4 four
+set @arg00=0;
+execute stmt1 using @arg01, @arg00;
+select a,b from t1 order by a;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00=23;
+set @arg01='two';
+set @arg02=2;
+set @arg03='two';
+set @arg04=2;
+drop table if exists t2;
+create table t2 as select a,b from t1 ;
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 where a = @arg00 ;
+a b
+23 two
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a not in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 order by a ;
+a b
+1 one
+2 two
+3 three
+4 four
+drop table t2 ;
+create table t2
+(
+a int, b varchar(30),
+primary key(a)
+) engine = 'MYISAM' ;
+insert into t2(a,b) select a, b from t1 ;
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 where a = @arg00 ;
+a b
+23 two
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a not in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 order by a ;
+a b
+1 one
+2 two
+3 three
+4 four
+drop table t2 ;
+set @arg00=1;
+prepare stmt1 from 'update t1 set b=''bla''
+where a=2
+limit 1';
+execute stmt1 ;
+select a,b from t1 where b = 'bla' ;
+a b
+2 bla
+prepare stmt1 from 'update t1 set b=''bla''
+where a=2
+limit ?';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 3
+test_sequence
+------ insert tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+prepare stmt1 from 'insert into t1 values(5, ''five'' )';
+execute stmt1;
+select a,b from t1 where a = 5;
+a b
+5 five
+set @arg00='six' ;
+prepare stmt1 from 'insert into t1 values(6, ? )';
+execute stmt1 using @arg00;
+select a,b from t1 where b = @arg00;
+a b
+6 six
+execute stmt1 using @arg00;
+ERROR 23000: Duplicate entry '6' for key 1
+set @arg00=NULL ;
+prepare stmt1 from 'insert into t1 values(0, ? )';
+execute stmt1 using @arg00;
+select a,b from t1 where b is NULL;
+a b
+0 NULL
+set @arg00=8 ;
+set @arg01='eight' ;
+prepare stmt1 from 'insert into t1 values(?, ? )';
+execute stmt1 using @arg00, @arg01 ;
+select a,b from t1 where b = @arg01;
+a b
+8 eight
+set @NULL= null ;
+set @arg00= 'abc' ;
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg00 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg00 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 abc
+10002 abc
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @NULL ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @NULL ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 NULL
+10002 NULL
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 10 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 9 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 8 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 7 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 6 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 5 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 4 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 3 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg01 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 10001
+10002 10002
+10003 10003
+10004 10004
+10005 10005
+10006 10006
+10007 10007
+10008 10008
+10009 10009
+10010 10010
+delete from t1 where a > 10000 ;
+set @arg00=81 ;
+set @arg01='8-1' ;
+set @arg02=82 ;
+set @arg03='8-2' ;
+prepare stmt1 from 'insert into t1 values(?,?),(?,?)';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
+select a,b from t1 where a in (@arg00,@arg02) ;
+a b
+81 8-1
+82 8-2
+set @arg00=9 ;
+set @arg01='nine' ;
+prepare stmt1 from 'insert into t1 set a=?, b=? ';
+execute stmt1 using @arg00, @arg01 ;
+select a,b from t1 where a = @arg00 ;
+a b
+9 nine
+set @arg00=6 ;
+set @arg01=1 ;
+prepare stmt1 from 'insert into t1 set a=?, b=''sechs''
+ on duplicate key update a=a + ?, b=concat(b,''modified'') ';
+execute stmt1 using @arg00, @arg01;
+select * from t1 order by a;
+a b
+0 NULL
+1 one
+2 two
+3 three
+4 four
+5 five
+7 sixmodified
+8 eight
+9 nine
+81 8-1
+82 8-2
+set @arg00=81 ;
+set @arg01=1 ;
+execute stmt1 using @arg00, @arg01;
+ERROR 23000: Duplicate entry '82' for key 1
+drop table if exists t2 ;
+create table t2 (id int auto_increment primary key)
+ENGINE= 'MYISAM' ;
+prepare stmt1 from ' select last_insert_id() ' ;
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+1
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+2
+drop table t2 ;
+set @1000=1000 ;
+set @x1000_2="x1000_2" ;
+set @x1000_3="x1000_3" ;
+set @x1000="x1000" ;
+set @1100=1100 ;
+set @x1100="x1100" ;
+set @100=100 ;
+set @updated="updated" ;
+insert into t1 values(1000,'x1000_1') ;
+insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3)
+on duplicate key update a = a + @100, b = concat(b,@updated) ;
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 x1000_3
+1100 x1000_1updated
+delete from t1 where a >= 1000 ;
+insert into t1 values(1000,'x1000_1') ;
+prepare stmt1 from ' insert into t1 values(?,?),(?,?)
+ on duplicate key update a = a + ?, b = concat(b,?) ';
+execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ;
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 x1000_3
+1100 x1000_1updated
+delete from t1 where a >= 1000 ;
+insert into t1 values(1000,'x1000_1') ;
+execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ;
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1200 x1000_1updatedupdated
+delete from t1 where a >= 1000 ;
+prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
+execute stmt1;
+execute stmt1;
+execute stmt1;
+test_sequence
+------ multi table tests ------
+delete from t1 ;
+delete from t9 ;
+insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
+insert into t9 (c1,c21)
+values (1, 'one'), (2, 'two'), (3, 'three') ;
+prepare stmt_delete from " delete t1, t9
+ from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
+prepare stmt_update from " update t1, t9
+ set t1.b='updated', t9.c21='updated'
+ where t1.a=t9.c1 and t1.a=? ";
+prepare stmt_select1 from " select a, b from t1 order by a" ;
+prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
+set @arg00= 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+2 two
+3 three
+execute stmt_select2 ;
+c1 c21
+2 two
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+3 three
+execute stmt_select2 ;
+c1 c21
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+execute stmt_select2 ;
+c1 c21
+set @arg00= @arg00 + 1 ;
+drop table if exists t5 ;
+set @arg01= 8;
+set @arg02= 8.0;
+set @arg03= 80.00000000000e-1;
+set @arg04= 'abc' ;
+set @arg05= CAST('abc' as binary) ;
+set @arg06= '1991-08-05' ;
+set @arg07= CAST('1991-08-05' as date);
+set @arg08= '1991-08-05 01:01:01' ;
+set @arg09= CAST('1991-08-05 01:01:01' as datetime) ;
+set @arg10= unix_timestamp('1991-01-01 01:01:01');
+set @arg11= YEAR('1991-01-01 01:01:01');
+set @arg12= 8 ;
+set @arg12= NULL ;
+set @arg13= 8.0 ;
+set @arg13= NULL ;
+set @arg14= 'abc';
+set @arg14= NULL ;
+set @arg15= CAST('abc' as binary) ;
+set @arg15= NULL ;
+create table t5 as select
+8 as const01, @arg01 as param01,
+8.0 as const02, @arg02 as param02,
+80.00000000000e-1 as const03, @arg03 as param03,
+'abc' as const04, @arg04 as param04,
+CAST('abc' as binary) as const05, @arg05 as param05,
+'1991-08-05' as const06, @arg06 as param06,
+CAST('1991-08-05' as date) as const07, @arg07 as param07,
+'1991-08-05 01:01:01' as const08, @arg08 as param08,
+CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09,
+unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10,
+YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11,
+NULL as const12, @arg12 as param12,
+@arg13 as param13,
+@arg14 as param14,
+@arg15 as param15;
+show create table t5 ;
+Table Create Table
+t5 CREATE TABLE `t5` (
+ `const01` bigint(1) NOT NULL default '0',
+ `param01` bigint(20) default NULL,
+ `const02` double(3,1) NOT NULL default '0.0',
+ `param02` double default NULL,
+ `const03` double NOT NULL default '0',
+ `param03` double default NULL,
+ `const04` char(3) NOT NULL default '',
+ `param04` longtext,
+ `const05` binary(3) NOT NULL default '',
+ `param05` longblob,
+ `const06` varchar(10) NOT NULL default '',
+ `param06` longtext,
+ `const07` date default NULL,
+ `param07` longblob,
+ `const08` varchar(19) NOT NULL default '',
+ `param08` longtext,
+ `const09` datetime default NULL,
+ `param09` longblob,
+ `const10` int(10) NOT NULL default '0',
+ `param10` bigint(20) default NULL,
+ `const11` int(4) default NULL,
+ `param11` bigint(20) default NULL,
+ `const12` binary(0) default NULL,
+ `param12` bigint(20) default NULL,
+ `param13` double default NULL,
+ `param14` longtext,
+ `param15` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t5 ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t5 t5 const01 const01 8 1 1 N 32769 0 63
+def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
+def test t5 t5 const02 const02 5 3 3 N 32769 1 63
+def test t5 t5 param02 param02 5 20 1 Y 32768 31 63
+def test t5 t5 const03 const03 5 23 1 N 32769 31 63
+def test t5 t5 param03 param03 5 20 1 Y 32768 31 63
+def test t5 t5 const04 const04 254 3 3 N 1 0 8
+def test t5 t5 param04 param04 252 16777215 3 Y 16 0 8
+def test t5 t5 const05 const05 254 3 3 N 129 0 63
+def test t5 t5 param05 param05 252 16777215 3 Y 144 0 63
+def test t5 t5 const06 const06 253 10 10 N 1 0 8
+def test t5 t5 param06 param06 252 16777215 10 Y 16 0 8
+def test t5 t5 const07 const07 10 10 10 Y 128 0 63
+def test t5 t5 param07 param07 252 16777215 10 Y 144 0 63
+def test t5 t5 const08 const08 253 19 19 N 1 0 8
+def test t5 t5 param08 param08 252 16777215 19 Y 16 0 8
+def test t5 t5 const09 const09 12 19 19 Y 128 0 63
+def test t5 t5 param09 param09 252 16777215 19 Y 144 0 63
+def test t5 t5 const10 const10 3 10 9 N 32769 0 63
+def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
+def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
+def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
+def test t5 t5 const12 const12 254 0 0 Y 128 0 63
+def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
+def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
+def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
+const01 8
+param01 8
+const02 8.0
+param02 8
+const03 8
+param03 8
+const04 abc
+param04 abc
+const05 abc
+param05 abc
+const06 1991-08-05
+param06 1991-08-05
+const07 1991-08-05
+param07 1991-08-05
+const08 1991-08-05 01:01:01
+param08 1991-08-05 01:01:01
+const09 1991-08-05 01:01:01
+param09 1991-08-05 01:01:01
+const10 662680861
+param10 662680861
+const11 1991
+param11 1991
+const12 NULL
+param12 NULL
+param13 NULL
+param14 NULL
+param15 NULL
+drop table t5 ;
+test_sequence
+------ data type conversion tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ;
+select * from t9 order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+test_sequence
+------ select @parameter:= column ------
+prepare full_info from "select @arg01, @arg02, @arg03, @arg04,
+ @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12,
+ @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20,
+ @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28,
+ @arg29, @arg30, @arg31, @arg32" ;
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 1 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 0 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select
+ @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+ @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+ @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+ @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+ @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+ @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+ @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+ @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':= c1 from t9 where c1= 1' at line 1
+test_sequence
+------ select column, .. into @parm,.. ------
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 1 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 0 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+ c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+ c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? from t9 where c1= 1' at line 1
+test_sequence
+-- insert into numeric columns --
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ;
+set @arg00= 21 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ;
+execute stmt1 ;
+set @arg00= 23;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
+30.0, 30.0, 30.0 ) ;
+set @arg00= 31.0 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0,
+ 32.0, 32.0, 32.0 )" ;
+execute stmt1 ;
+set @arg00= 33.0;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( '40', '40', '40', '40', '40', '40', '40', '40',
+'40', '40', '40' ) ;
+set @arg00= '41' ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( '42', '42', '42', '42', '42', '42', '42', '42',
+ '42', '42', '42' )" ;
+execute stmt1 ;
+set @arg00= '43';
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ;
+set @arg00= CAST('51' as binary) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ;
+execute stmt1 ;
+set @arg00= CAST('53' as binary) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 2 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+NULL, NULL, NULL ) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 61, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL )" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 8.0 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 71, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 'abc' ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 81, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c1 >= 20
+order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12
+20 20 20 20 20 20 20 20 20 20 20.0000
+21 21 21 21 21 21 21 21 21 21 21.0000
+22 22 22 22 22 22 22 22 22 22 22.0000
+23 23 23 23 23 23 23 23 23 23 23.0000
+30 30 30 30 30 30 30 30 30 30 30.0000
+31 31 31 31 31 31 31 31 31 31 31.0000
+32 32 32 32 32 32 32 32 32 32 32.0000
+33 33 33 33 33 33 33 33 33 33 33.0000
+40 40 40 40 40 40 40 40 40 40 40.0000
+41 41 41 41 41 41 41 41 41 41 41.0000
+42 42 42 42 42 42 42 42 42 42 42.0000
+43 43 43 43 43 43 43 43 43 43 43.0000
+50 50 50 50 50 50 50 50 50 50 50.0000
+51 51 51 51 51 51 51 51 51 51 51.0000
+52 52 52 52 52 52 52 52 52 52 52.0000
+53 53 53 53 53 53 53 53 53 53 53.0000
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where numeric column = .. --
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+and c8= 20 and c9= 20 and c10= 20 and c12= 20;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+ and c8= 20 and c9= 20 and c10= 20 and c12= 20 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+ and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20';
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' ";
+execute stmt1 ;
+found
+true
+set @arg00= '20';
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+c12= CAST('20' as binary);
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+ c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+ c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+ c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+ c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+ c12= CAST('20' as binary) ";
+execute stmt1 ;
+found
+true
+set @arg00= CAST('20' as binary) ;
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- some numeric overflow experiments --
+prepare my_insert from "insert into t9
+ ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c21 = 'O' ";
+prepare my_delete from "delete from t9 where c21 = 'O' ";
+set @arg00= 9223372036854775807 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= '9223372036854775807' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= -9223372036854775808 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-9223372036854775808' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= 1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= '1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 1
+c2 1
+c3 1
+c4 1
+c5 1
+c6 1
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= -1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -1
+c2 -1
+c3 -1
+c4 -1
+c5 -1
+c6 -1
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+test_sequence
+-- insert into string columns --
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30
+from t9 where c1 >= 20
+order by c1 ;
+c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
+20 2 20 20 20 20 20 20 20 20 20 20
+21 2 21 21 21 21 21 21 21 21 21 21
+22 2 22 22 22 22 22 22 22 22 22 22
+23 2 23 23 23 23 23 23 23 23 23 23
+30 3 30 30 30 30 30 30 30 30 30 30
+31 3 31 31 31 31 31 31 31 31 31 31
+32 3 32 32 32 32 32 32 32 32 32 32
+33 3 33 33 33 33 33 33 33 33 33 33
+40 4 40 40 40 40 40 40 40 40 40 40
+41 4 41 41 41 41 41 41 41 41 41 41
+42 4 42 42 42 42 42 42 42 42 42 42
+43 4 43 43 43 43 43 43 43 43 43 43
+50 5 50 50 50.00 50.00 50.00 50.00 50.00 50.00 50.00 50.00
+51 5 51 51 51 51 51 51 51 51 51 51
+52 5 52 52 52.00 52.00 52.00 52.00 52.00 52.00 52.00 52.00
+53 5 53 53 53.00 53.00 53.00 53.00 53.00 53.00 53.00 53.00
+54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00
+55 5 55 55 55 55 55 55 55 55 55 55
+56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00
+57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where string column = .. --
+set @arg00= '20';
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+c27= '20' and c28= '20' and c29= '20' and c30= '20' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+ c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+ c27= '20' and c28= '20' and c29= '20' and c30= '20'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('20' as binary);
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+= CAST('20' as binary) and c21= CAST('20' as binary)
+and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+c30= CAST('20' as binary) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and
+c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+ = CAST('20' as binary) and c21= CAST('20' as binary)
+ and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+ c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+ c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+ c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+ c30= CAST('20' as binary)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and
+ c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and
+ c29= ? and c30= ?";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+c27= 20 and c28= 20 and c29= 20 and c30= 20 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+ c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+ c27= 20 and c28= 20 and c29= 20 and c30= 20" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+ c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+ c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- insert into date/time columns --
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
+c1 c13 c14 c15 c16 c17
+20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+21 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+22 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+23 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+30 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+60 NULL NULL 1991-01-01 01:01:01 NULL NULL
+61 NULL NULL 1991-01-01 01:01:01 NULL NULL
+62 NULL NULL 1991-01-01 01:01:01 NULL NULL
+63 NULL NULL 1991-01-01 01:01:01 NULL NULL
+71 NULL NULL 1991-01-01 01:01:01 NULL NULL
+73 NULL NULL 1991-01-01 01:01:01 NULL NULL
+81 NULL NULL 1991-01-01 01:01:01 NULL NULL
+83 NULL NULL 1991-01-01 01:01:01 NULL NULL
+test_sequence
+-- select .. where date/time column = .. --
+set @arg00= '1991-01-01 01:01:01' ;
+select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+c17= '1991-01-01 01:01:01' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+ c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+ c17= '1991-01-01 01:01:01'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
+select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+c14= CAST('1991-01-01 01:01:01' as datetime) and
+c15= CAST('1991-01-01 01:01:01' as datetime) and
+c16= CAST('1991-01-01 01:01:01' as datetime) and
+c17= CAST('1991-01-01 01:01:01' as datetime) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+ c14= CAST('1991-01-01 01:01:01' as datetime) and
+ c15= CAST('1991-01-01 01:01:01' as datetime) and
+ c16= CAST('1991-01-01 01:01:01' as datetime) and
+ c17= CAST('1991-01-01 01:01:01' as datetime)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 1991 ;
+select 'true' as found from t9
+where c1= 20 and c17= 1991 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= 1991" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= ?" ;
+execute stmt1 using @arg00 ;
+found
+true
+set @arg00= 1.991e+3 ;
+select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and abs(c17 - @arg00) < 0.01 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - ?) < 0.01" ;
+execute stmt1 using @arg00 ;
+found
+true
+drop table t1, t1_1, t1_2,
+t9_1, t9_2, t9;
diff --git a/mysql-test/r/ps_6bdb.result b/mysql-test/r/ps_6bdb.result
new file mode 100644
index 00000000000..baf273c84c0
--- /dev/null
+++ b/mysql-test/r/ps_6bdb.result
@@ -0,0 +1,3116 @@
+use test;
+drop table if exists t1, t9 ;
+create table t1
+(
+a int, b varchar(30),
+primary key(a)
+) engine = 'BDB' ;
+create table t9
+(
+c1 tinyint, c2 smallint, c3 mediumint, c4 int,
+c5 integer, c6 bigint, c7 float, c8 double,
+c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
+c13 date, c14 datetime, c15 timestamp(14), c16 time,
+c17 year, c18 bit, c19 bool, c20 char,
+c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
+c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
+c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
+c32 set('monday', 'tuesday', 'wednesday'),
+primary key(c1)
+) engine = 'BDB' ;
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+test_sequence
+------ simple select tests ------
+prepare stmt1 from ' select * from t9 order by c1 ' ;
+execute stmt1;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t9 t9 c1 c1 1 4 1 N 49155 0 63
+def test t9 t9 c2 c2 2 6 1 Y 32768 0 63
+def test t9 t9 c3 c3 9 9 1 Y 32768 0 63
+def test t9 t9 c4 c4 3 11 1 Y 32768 0 63
+def test t9 t9 c5 c5 3 11 1 Y 32768 0 63
+def test t9 t9 c6 c6 8 20 1 Y 32768 0 63
+def test t9 t9 c7 c7 4 12 1 Y 32768 31 63
+def test t9 t9 c8 c8 5 22 1 Y 32768 31 63
+def test t9 t9 c9 c9 5 22 1 Y 32768 31 63
+def test t9 t9 c10 c10 5 22 1 Y 32768 31 63
+def test t9 t9 c11 c11 0 9 6 Y 32768 4 63
+def test t9 t9 c12 c12 0 10 6 Y 32768 4 63
+def test t9 t9 c13 c13 10 10 10 Y 128 0 63
+def test t9 t9 c14 c14 12 19 19 Y 128 0 63
+def test t9 t9 c15 c15 7 19 19 N 1249 0 63
+def test t9 t9 c16 c16 11 8 8 Y 128 0 63
+def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
+def test t9 t9 c18 c18 1 1 1 Y 32768 0 63
+def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
+def test t9 t9 c20 c20 254 1 1 Y 0 0 8
+def test t9 t9 c21 c21 253 10 10 Y 0 0 8
+def test t9 t9 c22 c22 253 30 30 Y 0 0 8
+def test t9 t9 c23 c23 252 255 8 Y 144 0 63
+def test t9 t9 c24 c24 252 255 8 Y 16 0 8
+def test t9 t9 c25 c25 252 65535 4 Y 144 0 63
+def test t9 t9 c26 c26 252 65535 4 Y 16 0 8
+def test t9 t9 c27 c27 252 16777215 10 Y 144 0 63
+def test t9 t9 c28 c28 252 16777215 10 Y 16 0 8
+def test t9 t9 c29 c29 252 16777215 8 Y 144 0 63
+def test t9 t9 c30 c30 252 16777215 8 Y 16 0 8
+def test t9 t9 c31 c31 254 5 3 Y 256 0 8
+def test t9 t9 c32 c32 254 24 7 Y 2048 0 8
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+set @arg00='SELECT' ;
+prepare stmt1 from ' ? a from t1 where a=1 ';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1
+set @arg00=1 ;
+select @arg00, b from t1 where a=1 ;
+@arg00 b
+1 one
+prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+? b
+1 one
+set @arg00='lion' ;
+select @arg00, b from t1 where a=1 ;
+@arg00 b
+lion one
+prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+? b
+lion one
+set @arg00=NULL ;
+select @arg00, b from t1 where a=1 ;
+@arg00 b
+NULL one
+prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+? b
+NULL one
+set @arg00=1 ;
+select b, a - @arg00 from t1 where a=1 ;
+b a - @arg00
+one 0
+prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+b a - ?
+one 0
+set @arg00=null ;
+select @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select @arg00 + 1 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? + 1 as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select 1 + @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select 1 + ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+set @arg00='MySQL' ;
+select substr(@arg00,1,2) from t1 where a=1 ;
+substr(@arg00,1,2)
+My
+prepare stmt1 from ' select substr(?,1,2) from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+substr(?,1,2)
+My
+set @arg00=3 ;
+select substr('MySQL',@arg00,5) from t1 where a=1 ;
+substr('MySQL',@arg00,5)
+SQL
+prepare stmt1 from ' select substr(''MySQL'',?,5) from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+substr('MySQL',?,5)
+SQL
+select substr('MySQL',1,@arg00) from t1 where a=1 ;
+substr('MySQL',1,@arg00)
+MyS
+prepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+substr('MySQL',1,?)
+MyS
+set @arg00='MySQL' ;
+select a , concat(@arg00,b) from t1 order by a;
+a concat(@arg00,b)
+1 MySQLone
+2 MySQLtwo
+3 MySQLthree
+4 MySQLfour
+prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ;
+execute stmt1 using @arg00;
+a concat(?,b)
+1 MySQLone
+2 MySQLtwo
+3 MySQLthree
+4 MySQLfour
+select a , concat(b,@arg00) from t1 order by a ;
+a concat(b,@arg00)
+1 oneMySQL
+2 twoMySQL
+3 threeMySQL
+4 fourMySQL
+prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ;
+execute stmt1 using @arg00;
+a concat(b,?)
+1 oneMySQL
+2 twoMySQL
+3 threeMySQL
+4 fourMySQL
+set @arg00='MySQL' ;
+select group_concat(@arg00,b order by a) from t1
+group by 'a' ;
+group_concat(@arg00,b order by a)
+MySQLone,MySQLtwo,MySQLthree,MySQLfour
+prepare stmt1 from ' select group_concat(?,b order by a) from t1
+group by ''a'' ' ;
+execute stmt1 using @arg00;
+group_concat(?,b order by a)
+MySQLone,MySQLtwo,MySQLthree,MySQLfour
+select group_concat(b,@arg00 order by a) from t1
+group by 'a' ;
+group_concat(b,@arg00 order by a)
+oneMySQL,twoMySQL,threeMySQL,fourMySQL
+prepare stmt1 from ' select group_concat(b,? order by a) from t1
+group by ''a'' ' ;
+execute stmt1 using @arg00;
+group_concat(b,? order by a)
+oneMySQL,twoMySQL,threeMySQL,fourMySQL
+set @arg00='first' ;
+set @arg01='second' ;
+set @arg02=NULL;
+select @arg00, @arg01 from t1 where a=1 ;
+@arg00 @arg01
+first second
+prepare stmt1 from ' select ?, ? from t1 where a=1 ' ;
+execute stmt1 using @arg00, @arg01 ;
+? ?
+first second
+execute stmt1 using @arg02, @arg01 ;
+? ?
+NULL second
+execute stmt1 using @arg00, @arg02 ;
+? ?
+first NULL
+execute stmt1 using @arg02, @arg02 ;
+? ?
+NULL NULL
+drop table if exists t5 ;
+create table t5 (id1 int(11) not null default '0',
+value2 varchar(100), value1 varchar(100)) ;
+insert into t5 values (1,'hh','hh'),(2,'hh','hh'),
+(1,'ii','ii'),(2,'ii','ii') ;
+prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ;
+set @arg00=1 ;
+set @arg01='hh' ;
+execute stmt1 using @arg00, @arg01 ;
+id1 value1
+1 hh
+1 ii
+2 hh
+drop table t5 ;
+drop table if exists t5 ;
+create table t5(session_id char(9) not null) ;
+insert into t5 values ('abc') ;
+prepare stmt1 from ' select * from t5
+where ?=''1111'' and session_id = ''abc'' ' ;
+set @arg00='abc' ;
+execute stmt1 using @arg00 ;
+session_id
+set @arg00='1111' ;
+execute stmt1 using @arg00 ;
+session_id
+abc
+set @arg00='abc' ;
+execute stmt1 using @arg00 ;
+session_id
+drop table t5 ;
+set @arg00='FROM' ;
+select a @arg00 t1 where a=1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 t1 where a=1' at line 1
+prepare stmt1 from ' select a ? t1 where a=1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? t1 where a=1' at line 1
+set @arg00='t1' ;
+select a from @arg00 where a=1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 where a=1' at line 1
+prepare stmt1 from ' select a from ? where a=1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? where a=1' at line 1
+set @arg00='WHERE' ;
+select a from t1 @arg00 a=1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a=1' at line 1
+prepare stmt1 from ' select a from t1 ? a=1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a=1' at line 1
+set @arg00=1 ;
+select a FROM t1 where a=@arg00 ;
+a
+1
+prepare stmt1 from ' select a FROM t1 where a=? ' ;
+execute stmt1 using @arg00 ;
+a
+1
+set @arg00=1000 ;
+execute stmt1 using @arg00 ;
+a
+set @arg00=NULL ;
+select a FROM t1 where a=@arg00 ;
+a
+prepare stmt1 from ' select a FROM t1 where a=? ' ;
+execute stmt1 using @arg00 ;
+a
+set @arg00=4 ;
+select a FROM t1 where a=sqrt(@arg00) ;
+a
+2
+prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
+execute stmt1 using @arg00 ;
+a
+2
+set @arg00=NULL ;
+select a FROM t1 where a=sqrt(@arg00) ;
+a
+prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
+execute stmt1 using @arg00 ;
+a
+set @arg00=2 ;
+set @arg01=3 ;
+select a FROM t1 where a in (@arg00,@arg01) order by a;
+a
+2
+3
+prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a ';
+execute stmt1 using @arg00, @arg01;
+a
+2
+3
+set @arg00= 'one' ;
+set @arg01= 'two' ;
+set @arg02= 'five' ;
+prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ;
+execute stmt1 using @arg00, @arg01, @arg02 ;
+b
+one
+two
+prepare stmt1 from ' select b FROM t1 where b like ? ';
+set @arg00='two' ;
+execute stmt1 using @arg00 ;
+b
+two
+set @arg00='tw%' ;
+execute stmt1 using @arg00 ;
+b
+two
+set @arg00='%wo' ;
+execute stmt1 using @arg00 ;
+b
+two
+set @arg00=null ;
+insert into t9 set c1= 0, c5 = NULL ;
+select c5 from t9 where c5 > NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 > ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 < NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 < ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 = NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 = ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 <=> NULL ;
+c5
+NULL
+prepare stmt1 from ' select c5 from t9 where c5 <=> ? ';
+execute stmt1 using @arg00 ;
+c5
+NULL
+delete from t9 where c1= 0 ;
+set @arg00='>' ;
+select a FROM t1 where a @arg00 1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 1' at line 1
+prepare stmt1 from ' select a FROM t1 where a ? 1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? 1' at line 1
+set @arg00=1 ;
+select a,b FROM t1 where a is not NULL
+AND b is not NULL group by a - @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+prepare stmt1 from ' select a,b FROM t1 where a is not NULL
+AND b is not NULL group by a - ? ' ;
+execute stmt1 using @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00='two' ;
+select a,b FROM t1 where a is not NULL
+AND b is not NULL having b <> @arg00 order by a ;
+a b
+1 one
+3 three
+4 four
+prepare stmt1 from ' select a,b FROM t1 where a is not NULL
+AND b is not NULL having b <> ? order by a ' ;
+execute stmt1 using @arg00 ;
+a b
+1 one
+3 three
+4 four
+set @arg00=1 ;
+select a,b FROM t1 where a is not NULL
+AND b is not NULL order by a - @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+prepare stmt1 from ' select a,b FROM t1 where a is not NULL
+AND b is not NULL order by a - ? ' ;
+execute stmt1 using @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00=2 ;
+select a,b from t1 order by 2 ;
+a b
+4 four
+1 one
+3 three
+2 two
+prepare stmt1 from ' select a,b from t1
+order by ? ';
+execute stmt1 using @arg00;
+a b
+4 four
+1 one
+3 three
+2 two
+set @arg00=1 ;
+execute stmt1 using @arg00;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00=0 ;
+execute stmt1 using @arg00;
+ERROR 42S22: Unknown column '?' in 'order clause'
+set @arg00=1;
+prepare stmt1 from ' select a,b from t1 order by a
+limit 1 ';
+execute stmt1 ;
+a b
+1 one
+prepare stmt1 from ' select a,b from t1
+limit ? ';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 2
+set @arg00='b' ;
+set @arg01=0 ;
+set @arg02=2 ;
+set @arg03=2 ;
+select sum(a), @arg00 from t1 where a > @arg01
+and b is not null group by substr(b,@arg02)
+having sum(a) <> @arg03 ;
+sum(a) @arg00
+3 b
+1 b
+4 b
+prepare stmt1 from ' select sum(a), ? from t1 where a > ?
+and b is not null group by substr(b,?)
+having sum(a) <> ? ';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03;
+sum(a) ?
+3 b
+1 b
+4 b
+test_sequence
+------ join tests ------
+select first.a as a1, second.a as a2
+from t1 first, t1 second
+where first.a = second.a order by a1 ;
+a1 a2
+1 1
+2 2
+3 3
+4 4
+prepare stmt1 from ' select first.a as a1, second.a as a2
+ from t1 first, t1 second
+ where first.a = second.a order by a1 ';
+execute stmt1 ;
+a1 a2
+1 1
+2 2
+3 3
+4 4
+set @arg00='ABC';
+set @arg01='two';
+set @arg02='one';
+select first.a, @arg00, second.a FROM t1 first, t1 second
+where @arg01 = first.b or first.a = second.a or second.b = @arg02
+order by second.a, first.a;
+a @arg00 a
+1 ABC 1
+2 ABC 1
+3 ABC 1
+4 ABC 1
+2 ABC 2
+2 ABC 3
+3 ABC 3
+2 ABC 4
+4 ABC 4
+prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
+ where ? = first.b or first.a = second.a or second.b = ?
+ order by second.a, first.a';
+execute stmt1 using @arg00, @arg01, @arg02;
+a ? a
+1 ABC 1
+2 ABC 1
+3 ABC 1
+4 ABC 1
+2 ABC 2
+2 ABC 3
+3 ABC 3
+2 ABC 4
+4 ABC 4
+drop table if exists t2 ;
+create table t2 as select * from t1 ;
+set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
+set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
+set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
+set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
+set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
+set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
+set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
+the join statement is:
+SELECT * FROM t2 right join t1 using(a) order by t2.a
+prepare stmt1 from @query9 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural right join t1 order by t2.a
+prepare stmt1 from @query8 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query7 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 using(a) order by t2.a
+prepare stmt1 from @query6 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural left join t1 order by t2.a
+prepare stmt1 from @query5 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query4 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 join t1 using(a) order by t2.a
+prepare stmt1 from @query3 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural join t1 order by t2.a
+prepare stmt1 from @query2 ;
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+the join statement is:
+SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a
+prepare stmt1 from @query1 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+drop table t2 ;
+test_sequence
+------ subquery tests ------
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = ''two'') ';
+execute stmt1 ;
+a b
+2 two
+set @arg00='two' ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where b = 'two' ) and b=@arg00 ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = ''two'') and b=? ';
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00='two' ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where b = @arg00 ) and b='two' ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = ? ) and b=''two'' ' ;
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=3 ;
+set @arg01='three' ;
+select a,b FROM t1 where (a,b) in (select 3, 'three');
+a b
+3 three
+select a FROM t1 where (a,b) in (select @arg00,@arg01);
+a
+3
+prepare stmt1 from ' select a FROM t1 where (a,b) in (select ?, ?) ';
+execute stmt1 using @arg00, @arg01;
+a
+3
+set @arg00=1 ;
+set @arg01='two' ;
+set @arg02=2 ;
+set @arg03='two' ;
+select a, @arg00, b FROM t1 outer_table where
+b=@arg01 and a = (select @arg02 from t1 where b = @arg03 ) ;
+a @arg00 b
+2 1 two
+prepare stmt1 from ' select a, ?, b FROM t1 outer_table where
+ b=? and a = (select ? from t1 where b = ? ) ' ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
+a ? b
+2 1 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = outer_table.b ) order by a ';
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+set @arg00='two' ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where b = outer_table.b ) and b=@arg00 ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = outer_table.b) and b=? ';
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=2 ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where a = @arg00 and b = outer_table.b) and b='two' ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where a = ? and b = outer_table.b) and b=''two'' ' ;
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=2 ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where outer_table.a = @arg00 and a=2) and b='two' ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where outer_table.a = ? and a=2) and b=''two'' ' ;
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=1 ;
+set @arg01='two' ;
+set @arg02=2 ;
+set @arg03='two' ;
+select a, @arg00, b FROM t1 outer_table where
+b=@arg01 and a = (select @arg02 from t1 where outer_table.b = @arg03
+and outer_table.a=a ) ;
+a @arg00 b
+2 1 two
+prepare stmt1 from ' select a, ?, b FROM t1 outer_table where
+ b=? and a = (select ? from t1 where outer_table.b = ?
+ and outer_table.a=a ) ' ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
+a ? b
+2 1 two
+set @arg00=1 ;
+set @arg01=0 ;
+select a, @arg00
+from ( select a - @arg00 as a from t1 where a=@arg00 ) as t2
+where a=@arg01;
+a @arg00
+0 1
+prepare stmt1 from ' select a, ?
+ from ( select a - ? as a from t1 where a=? ) as t2
+ where a=? ';
+execute stmt1 using @arg00, @arg00, @arg00, @arg01 ;
+a ?
+0 1
+drop table if exists t2 ;
+create table t2 as select * from t1;
+prepare stmt1 from ' select a in (select a from t2) from t1 ' ;
+execute stmt1 ;
+a in (select a from t2)
+1
+1
+1
+1
+drop table if exists t5, t6, t7 ;
+create table t5 (a int , b int) ;
+create table t6 like t5 ;
+create table t7 like t5 ;
+insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
+(2, -1), (3, 10) ;
+insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ;
+insert into t7 values (3, 3), (2, 2), (1, 1) ;
+prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1) from t7 ' ;
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+drop table t5, t6, t7 ;
+drop table if exists t2 ;
+create table t2 as select * from t9;
+set @stmt= ' SELECT
+ (SELECT SUM(c1 + c12 + 0.0) FROM t2
+ where (t9.c2 - 0e-3) = t2.c2
+ GROUP BY t9.c15 LIMIT 1) as scalar_s,
+ exists (select 1.0e+0 from t2
+ where t2.c3 * 9.0000000000 = t9.c4) as exists_s,
+ c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s,
+ (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s
+FROM t9,
+(select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
+prepare stmt1 from @stmt ;
+execute stmt1 ;
+execute stmt1 ;
+set @stmt= concat('explain ',@stmt);
+prepare stmt1 from @stmt ;
+execute stmt1 ;
+execute stmt1 ;
+set @stmt= ' SELECT
+ (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
+ GROUP BY t9.c15 LIMIT 1) as scalar_s,
+ exists (select ? from t2
+ where t2.c3*?=t9.c4) as exists_s,
+ c5*? in (select c6+? from t2) as in_s,
+ (c7-?, c8-?) in (select c9+?, c10+? from t2) as in_row_s
+FROM t9,
+(select c25 x, c32 y from t2) tt WHERE x =c25 ' ;
+set @arg00= 0.0 ;
+set @arg01= 0e-3 ;
+set @arg02= 1.0e+0 ;
+set @arg03= 9.0000000000 ;
+set @arg04= 4 ;
+set @arg05= 0.3e+1 ;
+set @arg06= 4 ;
+set @arg07= 4 ;
+set @arg08= 4.0 ;
+set @arg09= 40e-1 ;
+prepare stmt1 from @stmt ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+set @stmt= concat('explain ',@stmt);
+prepare stmt1 from @stmt ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+drop table t2 ;
+select 1 < (select a from t1) ;
+ERROR 21000: Subquery returns more than 1 row
+prepare stmt1 from ' select 1 < (select a from t1) ' ;
+execute stmt1 ;
+ERROR 21000: Subquery returns more than 1 row
+select 1 as my_col ;
+my_col
+1
+test_sequence
+------ union tests ------
+prepare stmt1 from ' select a FROM t1 where a=1
+ union distinct
+ select a FROM t1 where a=1 ';
+execute stmt1 ;
+a
+1
+execute stmt1 ;
+a
+1
+prepare stmt1 from ' select a FROM t1 where a=1
+ union all
+ select a FROM t1 where a=1 ';
+execute stmt1 ;
+a
+1
+1
+prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+set @arg00=1 ;
+select @arg00 FROM t1 where a=1
+union distinct
+select 1 FROM t1 where a=1;
+@arg00
+1
+prepare stmt1 from ' select ? FROM t1 where a=1
+ union distinct
+ select 1 FROM t1 where a=1 ' ;
+execute stmt1 using @arg00;
+?
+1
+set @arg00=1 ;
+select 1 FROM t1 where a=1
+union distinct
+select @arg00 FROM t1 where a=1;
+1
+1
+prepare stmt1 from ' select 1 FROM t1 where a=1
+ union distinct
+ select ? FROM t1 where a=1 ' ;
+execute stmt1 using @arg00;
+1
+1
+set @arg00='a' ;
+select @arg00 FROM t1 where a=1
+union distinct
+select @arg00 FROM t1 where a=1;
+@arg00
+a
+prepare stmt1 from ' select ? FROM t1 where a=1
+ union distinct
+ select ? FROM t1 where a=1 ';
+execute stmt1 using @arg00, @arg00;
+?
+a
+prepare stmt1 from ' select ?
+ union distinct
+ select ? ';
+execute stmt1 using @arg00, @arg00;
+?
+a
+set @arg00='a' ;
+set @arg01=1 ;
+set @arg02='a' ;
+set @arg03=2 ;
+select @arg00 FROM t1 where a=@arg01
+union distinct
+select @arg02 FROM t1 where a=@arg03;
+@arg00
+a
+prepare stmt1 from ' select ? FROM t1 where a=?
+ union distinct
+ select ? FROM t1 where a=? ' ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03;
+?
+a
+set @arg00=1 ;
+prepare stmt1 from ' select sum(a) + 200, ? from t1
+union distinct
+select sum(a) + 200, 1 from t1
+group by b ' ;
+execute stmt1 using @arg00;
+sum(a) + 200 ?
+210 1
+204 1
+201 1
+203 1
+202 1
+set @Oporto='Oporto' ;
+set @Lisboa='Lisboa' ;
+set @0=0 ;
+set @1=1 ;
+set @2=2 ;
+set @3=3 ;
+set @4=4 ;
+select @Oporto,@Lisboa,@0,@1,@2,@3,@4 ;
+@Oporto @Lisboa @0 @1 @2 @3 @4
+Oporto Lisboa 0 1 2 3 4
+select sum(a) + 200 as the_sum, @Oporto as the_town from t1
+group by b
+union distinct
+select sum(a) + 200, @Lisboa from t1
+group by b ;
+the_sum the_town
+204 Oporto
+201 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+201 Lisboa
+203 Lisboa
+202 Lisboa
+prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
+ group by b
+ union distinct
+ select sum(a) + 200, ? from t1
+ group by b ' ;
+execute stmt1 using @Oporto, @Lisboa;
+the_sum the_town
+204 Oporto
+201 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+201 Lisboa
+203 Lisboa
+202 Lisboa
+select sum(a) + 200 as the_sum, @Oporto as the_town from t1
+where a > @1
+group by b
+union distinct
+select sum(a) + 200, @Lisboa from t1
+where a > @2
+group by b ;
+the_sum the_town
+204 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+203 Lisboa
+prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
+ where a > ?
+ group by b
+ union distinct
+ select sum(a) + 200, ? from t1
+ where a > ?
+ group by b ' ;
+execute stmt1 using @Oporto, @1, @Lisboa, @2;
+the_sum the_town
+204 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+203 Lisboa
+select sum(a) + 200 as the_sum, @Oporto as the_town from t1
+where a > @1
+group by b
+having avg(a) > @2
+union distinct
+select sum(a) + 200, @Lisboa from t1
+where a > @2
+group by b
+having avg(a) > @3;
+the_sum the_town
+204 Oporto
+203 Oporto
+204 Lisboa
+prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
+ where a > ?
+ group by b
+ having avg(a) > ?
+ union distinct
+ select sum(a) + 200, ? from t1
+ where a > ?
+ group by b
+ having avg(a) > ? ';
+execute stmt1 using @Oporto, @1, @2, @Lisboa, @2, @3;
+the_sum the_town
+204 Oporto
+203 Oporto
+204 Lisboa
+test_sequence
+------ explain select tests ------
+prepare stmt1 from ' explain select * from t9 ' ;
+execute stmt1;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def id 8 3 1 N 32801 0 8
+def select_type 253 19 6 N 1 31 8
+def table 253 64 2 N 1 31 8
+def type 253 10 3 N 1 31 8
+def possible_keys 253 4096 0 Y 0 31 8
+def key 253 64 0 Y 0 31 8
+def key_len 8 3 0 Y 32800 0 8
+def ref 253 1024 0 Y 0 31 8
+def rows 8 10 1 N 32801 0 8
+def Extra 253 255 0 N 1 31 8
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t9 ALL NULL NULL NULL NULL 3
+test_sequence
+------ delete tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+prepare stmt1 from 'delete from t1 where a=2' ;
+execute stmt1;
+select a,b from t1 where a=2;
+a b
+execute stmt1;
+insert into t1 values(0,NULL);
+set @arg00=NULL;
+prepare stmt1 from 'delete from t1 where b=?' ;
+execute stmt1 using @arg00;
+select a,b from t1 where b is NULL ;
+a b
+0 NULL
+set @arg00='one';
+execute stmt1 using @arg00;
+select a,b from t1 where b=@arg00;
+a b
+prepare stmt1 from 'truncate table t1' ;
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+test_sequence
+------ update tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ;
+execute stmt1;
+select a,b from t1 where a=2;
+a b
+2 a=two
+execute stmt1;
+select a,b from t1 where a=2;
+a b
+2 a=two
+set @arg00=NULL;
+prepare stmt1 from 'update t1 set b=? where a=2' ;
+execute stmt1 using @arg00;
+select a,b from t1 where a=2;
+a b
+2 NULL
+set @arg00='two';
+execute stmt1 using @arg00;
+select a,b from t1 where a=2;
+a b
+2 two
+set @arg00=2;
+prepare stmt1 from 'update t1 set b=NULL where a=?' ;
+execute stmt1 using @arg00;
+select a,b from t1 where a=@arg00;
+a b
+2 NULL
+update t1 set b='two' where a=@arg00;
+set @arg00=2000;
+execute stmt1 using @arg00;
+select a,b from t1 where a=@arg00;
+a b
+set @arg00=2;
+set @arg01=22;
+prepare stmt1 from 'update t1 set a=? where a=?' ;
+execute stmt1 using @arg00, @arg00;
+select a,b from t1 where a=@arg00;
+a b
+2 two
+execute stmt1 using @arg01, @arg00;
+select a,b from t1 where a=@arg01;
+a b
+22 two
+execute stmt1 using @arg00, @arg01;
+select a,b from t1 where a=@arg00;
+a b
+2 two
+set @arg00=NULL;
+set @arg01=2;
+execute stmt1 using @arg00, @arg01;
+Warnings:
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1
+select a,b from t1 order by a;
+a b
+0 two
+1 one
+3 three
+4 four
+set @arg00=0;
+execute stmt1 using @arg01, @arg00;
+select a,b from t1 order by a;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00=23;
+set @arg01='two';
+set @arg02=2;
+set @arg03='two';
+set @arg04=2;
+drop table if exists t2;
+create table t2 as select a,b from t1 ;
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 where a = @arg00 ;
+a b
+23 two
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a not in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 order by a ;
+a b
+1 one
+2 two
+3 three
+4 four
+drop table t2 ;
+create table t2
+(
+a int, b varchar(30),
+primary key(a)
+) engine = 'BDB' ;
+insert into t2(a,b) select a, b from t1 ;
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 where a = @arg00 ;
+a b
+23 two
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a not in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 order by a ;
+a b
+1 one
+2 two
+3 three
+4 four
+drop table t2 ;
+set @arg00=1;
+prepare stmt1 from 'update t1 set b=''bla''
+where a=2
+limit 1';
+execute stmt1 ;
+select a,b from t1 where b = 'bla' ;
+a b
+2 bla
+prepare stmt1 from 'update t1 set b=''bla''
+where a=2
+limit ?';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 3
+test_sequence
+------ insert tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+prepare stmt1 from 'insert into t1 values(5, ''five'' )';
+execute stmt1;
+select a,b from t1 where a = 5;
+a b
+5 five
+set @arg00='six' ;
+prepare stmt1 from 'insert into t1 values(6, ? )';
+execute stmt1 using @arg00;
+select a,b from t1 where b = @arg00;
+a b
+6 six
+execute stmt1 using @arg00;
+ERROR 23000: Duplicate entry '6' for key 1
+set @arg00=NULL ;
+prepare stmt1 from 'insert into t1 values(0, ? )';
+execute stmt1 using @arg00;
+select a,b from t1 where b is NULL;
+a b
+0 NULL
+set @arg00=8 ;
+set @arg01='eight' ;
+prepare stmt1 from 'insert into t1 values(?, ? )';
+execute stmt1 using @arg00, @arg01 ;
+select a,b from t1 where b = @arg01;
+a b
+8 eight
+set @NULL= null ;
+set @arg00= 'abc' ;
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg00 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg00 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 abc
+10002 abc
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @NULL ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @NULL ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 NULL
+10002 NULL
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 10 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 9 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 8 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 7 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 6 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 5 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 4 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 3 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg01 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 10001
+10002 10002
+10003 10003
+10004 10004
+10005 10005
+10006 10006
+10007 10007
+10008 10008
+10009 10009
+10010 10010
+delete from t1 where a > 10000 ;
+set @arg00=81 ;
+set @arg01='8-1' ;
+set @arg02=82 ;
+set @arg03='8-2' ;
+prepare stmt1 from 'insert into t1 values(?,?),(?,?)';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
+select a,b from t1 where a in (@arg00,@arg02) ;
+a b
+81 8-1
+82 8-2
+set @arg00=9 ;
+set @arg01='nine' ;
+prepare stmt1 from 'insert into t1 set a=?, b=? ';
+execute stmt1 using @arg00, @arg01 ;
+select a,b from t1 where a = @arg00 ;
+a b
+9 nine
+set @arg00=6 ;
+set @arg01=1 ;
+prepare stmt1 from 'insert into t1 set a=?, b=''sechs''
+ on duplicate key update a=a + ?, b=concat(b,''modified'') ';
+execute stmt1 using @arg00, @arg01;
+select * from t1 order by a;
+a b
+0 NULL
+1 one
+2 two
+3 three
+4 four
+5 five
+7 sixmodified
+8 eight
+9 nine
+81 8-1
+82 8-2
+set @arg00=81 ;
+set @arg01=1 ;
+execute stmt1 using @arg00, @arg01;
+ERROR 23000: Duplicate entry '82' for key 1
+drop table if exists t2 ;
+create table t2 (id int auto_increment primary key)
+ENGINE= 'BDB' ;
+prepare stmt1 from ' select last_insert_id() ' ;
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+1
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+2
+drop table t2 ;
+set @1000=1000 ;
+set @x1000_2="x1000_2" ;
+set @x1000_3="x1000_3" ;
+set @x1000="x1000" ;
+set @1100=1100 ;
+set @x1100="x1100" ;
+set @100=100 ;
+set @updated="updated" ;
+insert into t1 values(1000,'x1000_1') ;
+insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3)
+on duplicate key update a = a + @100, b = concat(b,@updated) ;
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 x1000_3
+1100 x1000_1updated
+delete from t1 where a >= 1000 ;
+insert into t1 values(1000,'x1000_1') ;
+prepare stmt1 from ' insert into t1 values(?,?),(?,?)
+ on duplicate key update a = a + ?, b = concat(b,?) ';
+execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ;
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 x1000_3
+1100 x1000_1updated
+delete from t1 where a >= 1000 ;
+insert into t1 values(1000,'x1000_1') ;
+execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ;
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1200 x1000_1updatedupdated
+delete from t1 where a >= 1000 ;
+prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
+execute stmt1;
+execute stmt1;
+execute stmt1;
+test_sequence
+------ multi table tests ------
+delete from t1 ;
+delete from t9 ;
+insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
+insert into t9 (c1,c21)
+values (1, 'one'), (2, 'two'), (3, 'three') ;
+prepare stmt_delete from " delete t1, t9
+ from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
+prepare stmt_update from " update t1, t9
+ set t1.b='updated', t9.c21='updated'
+ where t1.a=t9.c1 and t1.a=? ";
+prepare stmt_select1 from " select a, b from t1 order by a" ;
+prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
+set @arg00= 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+2 two
+3 three
+execute stmt_select2 ;
+c1 c21
+2 two
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+3 three
+execute stmt_select2 ;
+c1 c21
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+execute stmt_select2 ;
+c1 c21
+set @arg00= @arg00 + 1 ;
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+insert into t1 values(0,NULL) ;
+set @duplicate='duplicate ' ;
+set @1000=1000 ;
+set @5=5 ;
+select a,b from t1 where a < 5 order by a ;
+a b
+0 NULL
+1 one
+2 two
+3 three
+4 four
+insert into t1 select a + @1000, concat(@duplicate,b) from t1
+where a < @5 ;
+affected rows: 5
+info: Records: 5 Duplicates: 0 Warnings: 0
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 NULL
+1001 duplicate one
+1002 duplicate two
+1003 duplicate three
+1004 duplicate four
+delete from t1 where a >= 1000 ;
+prepare stmt1 from ' insert into t1 select a + ?, concat(?,b) from t1
+where a < ? ' ;
+execute stmt1 using @1000, @duplicate, @5;
+affected rows: 5
+info: Records: 5 Duplicates: 0 Warnings: 0
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 NULL
+1001 duplicate one
+1002 duplicate two
+1003 duplicate three
+1004 duplicate four
+delete from t1 where a >= 1000 ;
+set @1=1 ;
+set @2=2 ;
+set @100=100 ;
+set @float=1.00;
+set @five='five' ;
+drop table if exists t2;
+create table t2 like t1 ;
+insert into t2 (b,a)
+select @duplicate, sum(first.a) from t1 first, t1 second
+where first.a <> @5 and second.b = first.b
+and second.b <> @five
+group by second.b
+having sum(second.a) > @2
+union
+select b, a + @100 from t1
+where (a,b) in ( select sqrt(a+@1)+CAST(@float AS signed),b
+from t1);
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
+select a,b from t2 order by a ;
+a b
+3 duplicate
+4 duplicate
+103 three
+delete from t2 ;
+prepare stmt1 from ' insert into t2 (b,a)
+select ?, sum(first.a)
+ from t1 first, t1 second
+ where first.a <> ? and second.b = first.b and second.b <> ?
+ group by second.b
+ having sum(second.a) > ?
+union
+select b, a + ? from t1
+ where (a,b) in ( select sqrt(a+?)+CAST(? AS signed),b
+ from t1 ) ' ;
+execute stmt1 using @duplicate, @5, @five, @2, @100, @1, @float ;
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
+select a,b from t2 order by a ;
+a b
+3 duplicate
+4 duplicate
+103 three
+drop table t2;
+drop table if exists t5 ;
+set @arg01= 8;
+set @arg02= 8.0;
+set @arg03= 80.00000000000e-1;
+set @arg04= 'abc' ;
+set @arg05= CAST('abc' as binary) ;
+set @arg06= '1991-08-05' ;
+set @arg07= CAST('1991-08-05' as date);
+set @arg08= '1991-08-05 01:01:01' ;
+set @arg09= CAST('1991-08-05 01:01:01' as datetime) ;
+set @arg10= unix_timestamp('1991-01-01 01:01:01');
+set @arg11= YEAR('1991-01-01 01:01:01');
+set @arg12= 8 ;
+set @arg12= NULL ;
+set @arg13= 8.0 ;
+set @arg13= NULL ;
+set @arg14= 'abc';
+set @arg14= NULL ;
+set @arg15= CAST('abc' as binary) ;
+set @arg15= NULL ;
+create table t5 as select
+8 as const01, @arg01 as param01,
+8.0 as const02, @arg02 as param02,
+80.00000000000e-1 as const03, @arg03 as param03,
+'abc' as const04, @arg04 as param04,
+CAST('abc' as binary) as const05, @arg05 as param05,
+'1991-08-05' as const06, @arg06 as param06,
+CAST('1991-08-05' as date) as const07, @arg07 as param07,
+'1991-08-05 01:01:01' as const08, @arg08 as param08,
+CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09,
+unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10,
+YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11,
+NULL as const12, @arg12 as param12,
+@arg13 as param13,
+@arg14 as param14,
+@arg15 as param15;
+show create table t5 ;
+Table Create Table
+t5 CREATE TABLE `t5` (
+ `const01` bigint(1) NOT NULL default '0',
+ `param01` bigint(20) default NULL,
+ `const02` double(3,1) NOT NULL default '0.0',
+ `param02` double default NULL,
+ `const03` double NOT NULL default '0',
+ `param03` double default NULL,
+ `const04` char(3) NOT NULL default '',
+ `param04` longtext,
+ `const05` binary(3) NOT NULL default '',
+ `param05` longblob,
+ `const06` varchar(10) NOT NULL default '',
+ `param06` longtext,
+ `const07` date default NULL,
+ `param07` longblob,
+ `const08` varchar(19) NOT NULL default '',
+ `param08` longtext,
+ `const09` datetime default NULL,
+ `param09` longblob,
+ `const10` int(10) NOT NULL default '0',
+ `param10` bigint(20) default NULL,
+ `const11` int(4) default NULL,
+ `param11` bigint(20) default NULL,
+ `const12` binary(0) default NULL,
+ `param12` bigint(20) default NULL,
+ `param13` double default NULL,
+ `param14` longtext,
+ `param15` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t5 ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t5 t5 const01 const01 8 1 1 N 32769 0 63
+def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
+def test t5 t5 const02 const02 5 3 3 N 32769 1 63
+def test t5 t5 param02 param02 5 20 1 Y 32768 31 63
+def test t5 t5 const03 const03 5 23 1 N 32769 31 63
+def test t5 t5 param03 param03 5 20 1 Y 32768 31 63
+def test t5 t5 const04 const04 254 3 3 N 1 0 8
+def test t5 t5 param04 param04 252 16777215 3 Y 16 0 8
+def test t5 t5 const05 const05 254 3 3 N 129 0 63
+def test t5 t5 param05 param05 252 16777215 3 Y 144 0 63
+def test t5 t5 const06 const06 253 10 10 N 1 0 8
+def test t5 t5 param06 param06 252 16777215 10 Y 16 0 8
+def test t5 t5 const07 const07 10 10 10 Y 128 0 63
+def test t5 t5 param07 param07 252 16777215 10 Y 144 0 63
+def test t5 t5 const08 const08 253 19 19 N 1 0 8
+def test t5 t5 param08 param08 252 16777215 19 Y 16 0 8
+def test t5 t5 const09 const09 12 19 19 Y 128 0 63
+def test t5 t5 param09 param09 252 16777215 19 Y 144 0 63
+def test t5 t5 const10 const10 3 10 9 N 32769 0 63
+def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
+def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
+def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
+def test t5 t5 const12 const12 254 0 0 Y 128 0 63
+def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
+def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
+def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
+const01 8
+param01 8
+const02 8.0
+param02 8
+const03 8
+param03 8
+const04 abc
+param04 abc
+const05 abc
+param05 abc
+const06 1991-08-05
+param06 1991-08-05
+const07 1991-08-05
+param07 1991-08-05
+const08 1991-08-05 01:01:01
+param08 1991-08-05 01:01:01
+const09 1991-08-05 01:01:01
+param09 1991-08-05 01:01:01
+const10 662680861
+param10 662680861
+const11 1991
+param11 1991
+const12 NULL
+param12 NULL
+param13 NULL
+param14 NULL
+param15 NULL
+drop table t5 ;
+test_sequence
+------ data type conversion tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ;
+select * from t9 order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+test_sequence
+------ select @parameter:= column ------
+prepare full_info from "select @arg01, @arg02, @arg03, @arg04,
+ @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12,
+ @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20,
+ @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28,
+ @arg29, @arg30, @arg31, @arg32" ;
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 1 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 0 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select
+ @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+ @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+ @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+ @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+ @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+ @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+ @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+ @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':= c1 from t9 where c1= 1' at line 1
+test_sequence
+------ select column, .. into @parm,.. ------
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 1 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 0 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+ c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+ c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? from t9 where c1= 1' at line 1
+test_sequence
+-- insert into numeric columns --
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ;
+set @arg00= 21 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ;
+execute stmt1 ;
+set @arg00= 23;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
+30.0, 30.0, 30.0 ) ;
+set @arg00= 31.0 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0,
+ 32.0, 32.0, 32.0 )" ;
+execute stmt1 ;
+set @arg00= 33.0;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( '40', '40', '40', '40', '40', '40', '40', '40',
+'40', '40', '40' ) ;
+set @arg00= '41' ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( '42', '42', '42', '42', '42', '42', '42', '42',
+ '42', '42', '42' )" ;
+execute stmt1 ;
+set @arg00= '43';
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ;
+set @arg00= CAST('51' as binary) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ;
+execute stmt1 ;
+set @arg00= CAST('53' as binary) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 2 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+NULL, NULL, NULL ) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 61, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL )" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 8.0 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 71, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 'abc' ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 81, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c1 >= 20
+order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12
+20 20 20 20 20 20 20 20 20 20 20.0000
+21 21 21 21 21 21 21 21 21 21 21.0000
+22 22 22 22 22 22 22 22 22 22 22.0000
+23 23 23 23 23 23 23 23 23 23 23.0000
+30 30 30 30 30 30 30 30 30 30 30.0000
+31 31 31 31 31 31 31 31 31 31 31.0000
+32 32 32 32 32 32 32 32 32 32 32.0000
+33 33 33 33 33 33 33 33 33 33 33.0000
+40 40 40 40 40 40 40 40 40 40 40.0000
+41 41 41 41 41 41 41 41 41 41 41.0000
+42 42 42 42 42 42 42 42 42 42 42.0000
+43 43 43 43 43 43 43 43 43 43 43.0000
+50 50 50 50 50 50 50 50 50 50 50.0000
+51 51 51 51 51 51 51 51 51 51 51.0000
+52 52 52 52 52 52 52 52 52 52 52.0000
+53 53 53 53 53 53 53 53 53 53 53.0000
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where numeric column = .. --
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+and c8= 20 and c9= 20 and c10= 20 and c12= 20;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+ and c8= 20 and c9= 20 and c10= 20 and c12= 20 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+ and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20';
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' ";
+execute stmt1 ;
+found
+true
+set @arg00= '20';
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+c12= CAST('20' as binary);
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+ c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+ c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+ c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+ c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+ c12= CAST('20' as binary) ";
+execute stmt1 ;
+found
+true
+set @arg00= CAST('20' as binary) ;
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- some numeric overflow experiments --
+prepare my_insert from "insert into t9
+ ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c21 = 'O' ";
+prepare my_delete from "delete from t9 where c21 = 'O' ";
+set @arg00= 9223372036854775807 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= '9223372036854775807' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= -9223372036854775808 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-9223372036854775808' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= 1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= '1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 1
+c2 1
+c3 1
+c4 1
+c5 1
+c6 1
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= -1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -1
+c2 -1
+c3 -1
+c4 -1
+c5 -1
+c6 -1
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+test_sequence
+-- insert into string columns --
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30
+from t9 where c1 >= 20
+order by c1 ;
+c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
+20 2 20 20 20 20 20 20 20 20 20 20
+21 2 21 21 21 21 21 21 21 21 21 21
+22 2 22 22 22 22 22 22 22 22 22 22
+23 2 23 23 23 23 23 23 23 23 23 23
+30 3 30 30 30 30 30 30 30 30 30 30
+31 3 31 31 31 31 31 31 31 31 31 31
+32 3 32 32 32 32 32 32 32 32 32 32
+33 3 33 33 33 33 33 33 33 33 33 33
+40 4 40 40 40 40 40 40 40 40 40 40
+41 4 41 41 41 41 41 41 41 41 41 41
+42 4 42 42 42 42 42 42 42 42 42 42
+43 4 43 43 43 43 43 43 43 43 43 43
+50 5 50 50 50.00 50.00 50.00 50.00 50.00 50.00 50.00 50.00
+51 5 51 51 51 51 51 51 51 51 51 51
+52 5 52 52 52.00 52.00 52.00 52.00 52.00 52.00 52.00 52.00
+53 5 53 53 53.00 53.00 53.00 53.00 53.00 53.00 53.00 53.00
+54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00
+55 5 55 55 55 55 55 55 55 55 55 55
+56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00
+57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where string column = .. --
+set @arg00= '20';
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+c27= '20' and c28= '20' and c29= '20' and c30= '20' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+ c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+ c27= '20' and c28= '20' and c29= '20' and c30= '20'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('20' as binary);
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+= CAST('20' as binary) and c21= CAST('20' as binary)
+and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+c30= CAST('20' as binary) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and
+c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+ = CAST('20' as binary) and c21= CAST('20' as binary)
+ and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+ c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+ c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+ c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+ c30= CAST('20' as binary)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and
+ c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and
+ c29= ? and c30= ?";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+c27= 20 and c28= 20 and c29= 20 and c30= 20 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+ c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+ c27= 20 and c28= 20 and c29= 20 and c30= 20" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+ c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+ c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- insert into date/time columns --
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
+c1 c13 c14 c15 c16 c17
+20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+21 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+22 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+23 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+30 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+60 NULL NULL 1991-01-01 01:01:01 NULL NULL
+61 NULL NULL 1991-01-01 01:01:01 NULL NULL
+62 NULL NULL 1991-01-01 01:01:01 NULL NULL
+63 NULL NULL 1991-01-01 01:01:01 NULL NULL
+71 NULL NULL 1991-01-01 01:01:01 NULL NULL
+73 NULL NULL 1991-01-01 01:01:01 NULL NULL
+81 NULL NULL 1991-01-01 01:01:01 NULL NULL
+83 NULL NULL 1991-01-01 01:01:01 NULL NULL
+test_sequence
+-- select .. where date/time column = .. --
+set @arg00= '1991-01-01 01:01:01' ;
+select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+c17= '1991-01-01 01:01:01' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+ c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+ c17= '1991-01-01 01:01:01'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
+select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+c14= CAST('1991-01-01 01:01:01' as datetime) and
+c15= CAST('1991-01-01 01:01:01' as datetime) and
+c16= CAST('1991-01-01 01:01:01' as datetime) and
+c17= CAST('1991-01-01 01:01:01' as datetime) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+ c14= CAST('1991-01-01 01:01:01' as datetime) and
+ c15= CAST('1991-01-01 01:01:01' as datetime) and
+ c16= CAST('1991-01-01 01:01:01' as datetime) and
+ c17= CAST('1991-01-01 01:01:01' as datetime)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 1991 ;
+select 'true' as found from t9
+where c1= 20 and c17= 1991 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= 1991" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= ?" ;
+execute stmt1 using @arg00 ;
+found
+true
+set @arg00= 1.991e+3 ;
+select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and abs(c17 - @arg00) < 0.01 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - ?) < 0.01" ;
+execute stmt1 using @arg00 ;
+found
+true
+drop table t1, t9;
diff --git a/mysql-test/r/ps_7ndb.result b/mysql-test/r/ps_7ndb.result
new file mode 100644
index 00000000000..3dbe3ed6218
--- /dev/null
+++ b/mysql-test/r/ps_7ndb.result
@@ -0,0 +1,3116 @@
+use test;
+drop table if exists t1, t9 ;
+create table t1
+(
+a int, b varchar(30),
+primary key(a)
+) engine = 'NDB' ;
+create table t9
+(
+c1 tinyint, c2 smallint, c3 mediumint, c4 int,
+c5 integer, c6 bigint, c7 float, c8 double,
+c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
+c13 date, c14 datetime, c15 timestamp(14), c16 time,
+c17 year, c18 bit, c19 bool, c20 char,
+c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
+c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
+c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
+c32 set('monday', 'tuesday', 'wednesday'),
+primary key(c1)
+) engine = 'NDB' ;
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+test_sequence
+------ simple select tests ------
+prepare stmt1 from ' select * from t9 order by c1 ' ;
+execute stmt1;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t9 t9 c1 c1 1 4 1 N 49155 0 63
+def test t9 t9 c2 c2 2 6 1 Y 32768 0 63
+def test t9 t9 c3 c3 9 9 1 Y 32768 0 63
+def test t9 t9 c4 c4 3 11 1 Y 32768 0 63
+def test t9 t9 c5 c5 3 11 1 Y 32768 0 63
+def test t9 t9 c6 c6 8 20 1 Y 32768 0 63
+def test t9 t9 c7 c7 4 12 1 Y 32768 31 63
+def test t9 t9 c8 c8 5 22 1 Y 32768 31 63
+def test t9 t9 c9 c9 5 22 1 Y 32768 31 63
+def test t9 t9 c10 c10 5 22 1 Y 32768 31 63
+def test t9 t9 c11 c11 0 9 6 Y 32768 4 63
+def test t9 t9 c12 c12 0 10 6 Y 32768 4 63
+def test t9 t9 c13 c13 10 10 10 Y 128 0 63
+def test t9 t9 c14 c14 12 19 19 Y 128 0 63
+def test t9 t9 c15 c15 7 19 19 N 1249 0 63
+def test t9 t9 c16 c16 11 8 8 Y 128 0 63
+def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
+def test t9 t9 c18 c18 1 1 1 Y 32768 0 63
+def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
+def test t9 t9 c20 c20 254 1 1 Y 0 0 8
+def test t9 t9 c21 c21 253 10 10 Y 0 0 8
+def test t9 t9 c22 c22 253 30 30 Y 0 0 8
+def test t9 t9 c23 c23 252 255 8 Y 144 0 63
+def test t9 t9 c24 c24 252 255 8 Y 16 0 8
+def test t9 t9 c25 c25 252 65535 4 Y 144 0 63
+def test t9 t9 c26 c26 252 65535 4 Y 16 0 8
+def test t9 t9 c27 c27 252 16777215 10 Y 144 0 63
+def test t9 t9 c28 c28 252 16777215 10 Y 16 0 8
+def test t9 t9 c29 c29 252 16777215 8 Y 144 0 63
+def test t9 t9 c30 c30 252 16777215 8 Y 16 0 8
+def test t9 t9 c31 c31 254 5 3 Y 256 0 8
+def test t9 t9 c32 c32 254 24 7 Y 2048 0 8
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+set @arg00='SELECT' ;
+prepare stmt1 from ' ? a from t1 where a=1 ';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1
+set @arg00=1 ;
+select @arg00, b from t1 where a=1 ;
+@arg00 b
+1 one
+prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+? b
+1 one
+set @arg00='lion' ;
+select @arg00, b from t1 where a=1 ;
+@arg00 b
+lion one
+prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+? b
+lion one
+set @arg00=NULL ;
+select @arg00, b from t1 where a=1 ;
+@arg00 b
+NULL one
+prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+? b
+NULL one
+set @arg00=1 ;
+select b, a - @arg00 from t1 where a=1 ;
+b a - @arg00
+one 0
+prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+b a - ?
+one 0
+set @arg00=null ;
+select @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select @arg00 + 1 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? + 1 as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select 1 + @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select 1 + ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+set @arg00='MySQL' ;
+select substr(@arg00,1,2) from t1 where a=1 ;
+substr(@arg00,1,2)
+My
+prepare stmt1 from ' select substr(?,1,2) from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+substr(?,1,2)
+My
+set @arg00=3 ;
+select substr('MySQL',@arg00,5) from t1 where a=1 ;
+substr('MySQL',@arg00,5)
+SQL
+prepare stmt1 from ' select substr(''MySQL'',?,5) from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+substr('MySQL',?,5)
+SQL
+select substr('MySQL',1,@arg00) from t1 where a=1 ;
+substr('MySQL',1,@arg00)
+MyS
+prepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+substr('MySQL',1,?)
+MyS
+set @arg00='MySQL' ;
+select a , concat(@arg00,b) from t1 order by a;
+a concat(@arg00,b)
+1 MySQLone
+2 MySQLtwo
+3 MySQLthree
+4 MySQLfour
+prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ;
+execute stmt1 using @arg00;
+a concat(?,b)
+1 MySQLone
+2 MySQLtwo
+3 MySQLthree
+4 MySQLfour
+select a , concat(b,@arg00) from t1 order by a ;
+a concat(b,@arg00)
+1 oneMySQL
+2 twoMySQL
+3 threeMySQL
+4 fourMySQL
+prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ;
+execute stmt1 using @arg00;
+a concat(b,?)
+1 oneMySQL
+2 twoMySQL
+3 threeMySQL
+4 fourMySQL
+set @arg00='MySQL' ;
+select group_concat(@arg00,b order by a) from t1
+group by 'a' ;
+group_concat(@arg00,b order by a)
+MySQLone,MySQLtwo,MySQLthree,MySQLfour
+prepare stmt1 from ' select group_concat(?,b order by a) from t1
+group by ''a'' ' ;
+execute stmt1 using @arg00;
+group_concat(?,b order by a)
+MySQLone,MySQLtwo,MySQLthree,MySQLfour
+select group_concat(b,@arg00 order by a) from t1
+group by 'a' ;
+group_concat(b,@arg00 order by a)
+oneMySQL,twoMySQL,threeMySQL,fourMySQL
+prepare stmt1 from ' select group_concat(b,? order by a) from t1
+group by ''a'' ' ;
+execute stmt1 using @arg00;
+group_concat(b,? order by a)
+oneMySQL,twoMySQL,threeMySQL,fourMySQL
+set @arg00='first' ;
+set @arg01='second' ;
+set @arg02=NULL;
+select @arg00, @arg01 from t1 where a=1 ;
+@arg00 @arg01
+first second
+prepare stmt1 from ' select ?, ? from t1 where a=1 ' ;
+execute stmt1 using @arg00, @arg01 ;
+? ?
+first second
+execute stmt1 using @arg02, @arg01 ;
+? ?
+NULL second
+execute stmt1 using @arg00, @arg02 ;
+? ?
+first NULL
+execute stmt1 using @arg02, @arg02 ;
+? ?
+NULL NULL
+drop table if exists t5 ;
+create table t5 (id1 int(11) not null default '0',
+value2 varchar(100), value1 varchar(100)) ;
+insert into t5 values (1,'hh','hh'),(2,'hh','hh'),
+(1,'ii','ii'),(2,'ii','ii') ;
+prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ;
+set @arg00=1 ;
+set @arg01='hh' ;
+execute stmt1 using @arg00, @arg01 ;
+id1 value1
+1 hh
+1 ii
+2 hh
+drop table t5 ;
+drop table if exists t5 ;
+create table t5(session_id char(9) not null) ;
+insert into t5 values ('abc') ;
+prepare stmt1 from ' select * from t5
+where ?=''1111'' and session_id = ''abc'' ' ;
+set @arg00='abc' ;
+execute stmt1 using @arg00 ;
+session_id
+set @arg00='1111' ;
+execute stmt1 using @arg00 ;
+session_id
+abc
+set @arg00='abc' ;
+execute stmt1 using @arg00 ;
+session_id
+drop table t5 ;
+set @arg00='FROM' ;
+select a @arg00 t1 where a=1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 t1 where a=1' at line 1
+prepare stmt1 from ' select a ? t1 where a=1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? t1 where a=1' at line 1
+set @arg00='t1' ;
+select a from @arg00 where a=1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 where a=1' at line 1
+prepare stmt1 from ' select a from ? where a=1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? where a=1' at line 1
+set @arg00='WHERE' ;
+select a from t1 @arg00 a=1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a=1' at line 1
+prepare stmt1 from ' select a from t1 ? a=1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a=1' at line 1
+set @arg00=1 ;
+select a FROM t1 where a=@arg00 ;
+a
+1
+prepare stmt1 from ' select a FROM t1 where a=? ' ;
+execute stmt1 using @arg00 ;
+a
+1
+set @arg00=1000 ;
+execute stmt1 using @arg00 ;
+a
+set @arg00=NULL ;
+select a FROM t1 where a=@arg00 ;
+a
+prepare stmt1 from ' select a FROM t1 where a=? ' ;
+execute stmt1 using @arg00 ;
+a
+set @arg00=4 ;
+select a FROM t1 where a=sqrt(@arg00) ;
+a
+2
+prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
+execute stmt1 using @arg00 ;
+a
+2
+set @arg00=NULL ;
+select a FROM t1 where a=sqrt(@arg00) ;
+a
+prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
+execute stmt1 using @arg00 ;
+a
+set @arg00=2 ;
+set @arg01=3 ;
+select a FROM t1 where a in (@arg00,@arg01) order by a;
+a
+2
+3
+prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a ';
+execute stmt1 using @arg00, @arg01;
+a
+2
+3
+set @arg00= 'one' ;
+set @arg01= 'two' ;
+set @arg02= 'five' ;
+prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ;
+execute stmt1 using @arg00, @arg01, @arg02 ;
+b
+one
+two
+prepare stmt1 from ' select b FROM t1 where b like ? ';
+set @arg00='two' ;
+execute stmt1 using @arg00 ;
+b
+two
+set @arg00='tw%' ;
+execute stmt1 using @arg00 ;
+b
+two
+set @arg00='%wo' ;
+execute stmt1 using @arg00 ;
+b
+two
+set @arg00=null ;
+insert into t9 set c1= 0, c5 = NULL ;
+select c5 from t9 where c5 > NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 > ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 < NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 < ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 = NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 = ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 <=> NULL ;
+c5
+NULL
+prepare stmt1 from ' select c5 from t9 where c5 <=> ? ';
+execute stmt1 using @arg00 ;
+c5
+NULL
+delete from t9 where c1= 0 ;
+set @arg00='>' ;
+select a FROM t1 where a @arg00 1 ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 1' at line 1
+prepare stmt1 from ' select a FROM t1 where a ? 1 ' ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? 1' at line 1
+set @arg00=1 ;
+select a,b FROM t1 where a is not NULL
+AND b is not NULL group by a - @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+prepare stmt1 from ' select a,b FROM t1 where a is not NULL
+AND b is not NULL group by a - ? ' ;
+execute stmt1 using @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00='two' ;
+select a,b FROM t1 where a is not NULL
+AND b is not NULL having b <> @arg00 order by a ;
+a b
+1 one
+3 three
+4 four
+prepare stmt1 from ' select a,b FROM t1 where a is not NULL
+AND b is not NULL having b <> ? order by a ' ;
+execute stmt1 using @arg00 ;
+a b
+1 one
+3 three
+4 four
+set @arg00=1 ;
+select a,b FROM t1 where a is not NULL
+AND b is not NULL order by a - @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+prepare stmt1 from ' select a,b FROM t1 where a is not NULL
+AND b is not NULL order by a - ? ' ;
+execute stmt1 using @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00=2 ;
+select a,b from t1 order by 2 ;
+a b
+4 four
+1 one
+3 three
+2 two
+prepare stmt1 from ' select a,b from t1
+order by ? ';
+execute stmt1 using @arg00;
+a b
+4 four
+1 one
+3 three
+2 two
+set @arg00=1 ;
+execute stmt1 using @arg00;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00=0 ;
+execute stmt1 using @arg00;
+ERROR 42S22: Unknown column '?' in 'order clause'
+set @arg00=1;
+prepare stmt1 from ' select a,b from t1 order by a
+limit 1 ';
+execute stmt1 ;
+a b
+1 one
+prepare stmt1 from ' select a,b from t1
+limit ? ';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 2
+set @arg00='b' ;
+set @arg01=0 ;
+set @arg02=2 ;
+set @arg03=2 ;
+select sum(a), @arg00 from t1 where a > @arg01
+and b is not null group by substr(b,@arg02)
+having sum(a) <> @arg03 ;
+sum(a) @arg00
+3 b
+1 b
+4 b
+prepare stmt1 from ' select sum(a), ? from t1 where a > ?
+and b is not null group by substr(b,?)
+having sum(a) <> ? ';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03;
+sum(a) ?
+3 b
+1 b
+4 b
+test_sequence
+------ join tests ------
+select first.a as a1, second.a as a2
+from t1 first, t1 second
+where first.a = second.a order by a1 ;
+a1 a2
+1 1
+2 2
+3 3
+4 4
+prepare stmt1 from ' select first.a as a1, second.a as a2
+ from t1 first, t1 second
+ where first.a = second.a order by a1 ';
+execute stmt1 ;
+a1 a2
+1 1
+2 2
+3 3
+4 4
+set @arg00='ABC';
+set @arg01='two';
+set @arg02='one';
+select first.a, @arg00, second.a FROM t1 first, t1 second
+where @arg01 = first.b or first.a = second.a or second.b = @arg02
+order by second.a, first.a;
+a @arg00 a
+1 ABC 1
+2 ABC 1
+3 ABC 1
+4 ABC 1
+2 ABC 2
+2 ABC 3
+3 ABC 3
+2 ABC 4
+4 ABC 4
+prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
+ where ? = first.b or first.a = second.a or second.b = ?
+ order by second.a, first.a';
+execute stmt1 using @arg00, @arg01, @arg02;
+a ? a
+1 ABC 1
+2 ABC 1
+3 ABC 1
+4 ABC 1
+2 ABC 2
+2 ABC 3
+3 ABC 3
+2 ABC 4
+4 ABC 4
+drop table if exists t2 ;
+create table t2 as select * from t1 ;
+set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
+set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
+set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
+set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
+set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
+set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
+set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
+the join statement is:
+SELECT * FROM t2 right join t1 using(a) order by t2.a
+prepare stmt1 from @query9 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural right join t1 order by t2.a
+prepare stmt1 from @query8 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query7 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 using(a) order by t2.a
+prepare stmt1 from @query6 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural left join t1 order by t2.a
+prepare stmt1 from @query5 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query4 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 join t1 using(a) order by t2.a
+prepare stmt1 from @query3 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural join t1 order by t2.a
+prepare stmt1 from @query2 ;
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+the join statement is:
+SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a
+prepare stmt1 from @query1 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+drop table t2 ;
+test_sequence
+------ subquery tests ------
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = ''two'') ';
+execute stmt1 ;
+a b
+2 two
+set @arg00='two' ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where b = 'two' ) and b=@arg00 ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = ''two'') and b=? ';
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00='two' ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where b = @arg00 ) and b='two' ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = ? ) and b=''two'' ' ;
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=3 ;
+set @arg01='three' ;
+select a,b FROM t1 where (a,b) in (select 3, 'three');
+a b
+3 three
+select a FROM t1 where (a,b) in (select @arg00,@arg01);
+a
+3
+prepare stmt1 from ' select a FROM t1 where (a,b) in (select ?, ?) ';
+execute stmt1 using @arg00, @arg01;
+a
+3
+set @arg00=1 ;
+set @arg01='two' ;
+set @arg02=2 ;
+set @arg03='two' ;
+select a, @arg00, b FROM t1 outer_table where
+b=@arg01 and a = (select @arg02 from t1 where b = @arg03 ) ;
+a @arg00 b
+2 1 two
+prepare stmt1 from ' select a, ?, b FROM t1 outer_table where
+ b=? and a = (select ? from t1 where b = ? ) ' ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
+a ? b
+2 1 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = outer_table.b ) order by a ';
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+set @arg00='two' ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where b = outer_table.b ) and b=@arg00 ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = outer_table.b) and b=? ';
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=2 ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where a = @arg00 and b = outer_table.b) and b='two' ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where a = ? and b = outer_table.b) and b=''two'' ' ;
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=2 ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where outer_table.a = @arg00 and a=2) and b='two' ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where outer_table.a = ? and a=2) and b=''two'' ' ;
+execute stmt1 using @arg00;
+a b
+2 two
+set @arg00=1 ;
+set @arg01='two' ;
+set @arg02=2 ;
+set @arg03='two' ;
+select a, @arg00, b FROM t1 outer_table where
+b=@arg01 and a = (select @arg02 from t1 where outer_table.b = @arg03
+and outer_table.a=a ) ;
+a @arg00 b
+2 1 two
+prepare stmt1 from ' select a, ?, b FROM t1 outer_table where
+ b=? and a = (select ? from t1 where outer_table.b = ?
+ and outer_table.a=a ) ' ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
+a ? b
+2 1 two
+set @arg00=1 ;
+set @arg01=0 ;
+select a, @arg00
+from ( select a - @arg00 as a from t1 where a=@arg00 ) as t2
+where a=@arg01;
+a @arg00
+0 1
+prepare stmt1 from ' select a, ?
+ from ( select a - ? as a from t1 where a=? ) as t2
+ where a=? ';
+execute stmt1 using @arg00, @arg00, @arg00, @arg01 ;
+a ?
+0 1
+drop table if exists t2 ;
+create table t2 as select * from t1;
+prepare stmt1 from ' select a in (select a from t2) from t1 ' ;
+execute stmt1 ;
+a in (select a from t2)
+1
+1
+1
+1
+drop table if exists t5, t6, t7 ;
+create table t5 (a int , b int) ;
+create table t6 like t5 ;
+create table t7 like t5 ;
+insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
+(2, -1), (3, 10) ;
+insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ;
+insert into t7 values (3, 3), (2, 2), (1, 1) ;
+prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1) from t7 ' ;
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+drop table t5, t6, t7 ;
+drop table if exists t2 ;
+create table t2 as select * from t9;
+set @stmt= ' SELECT
+ (SELECT SUM(c1 + c12 + 0.0) FROM t2
+ where (t9.c2 - 0e-3) = t2.c2
+ GROUP BY t9.c15 LIMIT 1) as scalar_s,
+ exists (select 1.0e+0 from t2
+ where t2.c3 * 9.0000000000 = t9.c4) as exists_s,
+ c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s,
+ (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s
+FROM t9,
+(select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
+prepare stmt1 from @stmt ;
+execute stmt1 ;
+execute stmt1 ;
+set @stmt= concat('explain ',@stmt);
+prepare stmt1 from @stmt ;
+execute stmt1 ;
+execute stmt1 ;
+set @stmt= ' SELECT
+ (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
+ GROUP BY t9.c15 LIMIT 1) as scalar_s,
+ exists (select ? from t2
+ where t2.c3*?=t9.c4) as exists_s,
+ c5*? in (select c6+? from t2) as in_s,
+ (c7-?, c8-?) in (select c9+?, c10+? from t2) as in_row_s
+FROM t9,
+(select c25 x, c32 y from t2) tt WHERE x =c25 ' ;
+set @arg00= 0.0 ;
+set @arg01= 0e-3 ;
+set @arg02= 1.0e+0 ;
+set @arg03= 9.0000000000 ;
+set @arg04= 4 ;
+set @arg05= 0.3e+1 ;
+set @arg06= 4 ;
+set @arg07= 4 ;
+set @arg08= 4.0 ;
+set @arg09= 40e-1 ;
+prepare stmt1 from @stmt ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+set @stmt= concat('explain ',@stmt);
+prepare stmt1 from @stmt ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+drop table t2 ;
+select 1 < (select a from t1) ;
+ERROR 21000: Subquery returns more than 1 row
+prepare stmt1 from ' select 1 < (select a from t1) ' ;
+execute stmt1 ;
+ERROR 21000: Subquery returns more than 1 row
+select 1 as my_col ;
+my_col
+1
+test_sequence
+------ union tests ------
+prepare stmt1 from ' select a FROM t1 where a=1
+ union distinct
+ select a FROM t1 where a=1 ';
+execute stmt1 ;
+a
+1
+execute stmt1 ;
+a
+1
+prepare stmt1 from ' select a FROM t1 where a=1
+ union all
+ select a FROM t1 where a=1 ';
+execute stmt1 ;
+a
+1
+1
+prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+set @arg00=1 ;
+select @arg00 FROM t1 where a=1
+union distinct
+select 1 FROM t1 where a=1;
+@arg00
+1
+prepare stmt1 from ' select ? FROM t1 where a=1
+ union distinct
+ select 1 FROM t1 where a=1 ' ;
+execute stmt1 using @arg00;
+?
+1
+set @arg00=1 ;
+select 1 FROM t1 where a=1
+union distinct
+select @arg00 FROM t1 where a=1;
+1
+1
+prepare stmt1 from ' select 1 FROM t1 where a=1
+ union distinct
+ select ? FROM t1 where a=1 ' ;
+execute stmt1 using @arg00;
+1
+1
+set @arg00='a' ;
+select @arg00 FROM t1 where a=1
+union distinct
+select @arg00 FROM t1 where a=1;
+@arg00
+a
+prepare stmt1 from ' select ? FROM t1 where a=1
+ union distinct
+ select ? FROM t1 where a=1 ';
+execute stmt1 using @arg00, @arg00;
+?
+a
+prepare stmt1 from ' select ?
+ union distinct
+ select ? ';
+execute stmt1 using @arg00, @arg00;
+?
+a
+set @arg00='a' ;
+set @arg01=1 ;
+set @arg02='a' ;
+set @arg03=2 ;
+select @arg00 FROM t1 where a=@arg01
+union distinct
+select @arg02 FROM t1 where a=@arg03;
+@arg00
+a
+prepare stmt1 from ' select ? FROM t1 where a=?
+ union distinct
+ select ? FROM t1 where a=? ' ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03;
+?
+a
+set @arg00=1 ;
+prepare stmt1 from ' select sum(a) + 200, ? from t1
+union distinct
+select sum(a) + 200, 1 from t1
+group by b ' ;
+execute stmt1 using @arg00;
+sum(a) + 200 ?
+210 1
+204 1
+201 1
+203 1
+202 1
+set @Oporto='Oporto' ;
+set @Lisboa='Lisboa' ;
+set @0=0 ;
+set @1=1 ;
+set @2=2 ;
+set @3=3 ;
+set @4=4 ;
+select @Oporto,@Lisboa,@0,@1,@2,@3,@4 ;
+@Oporto @Lisboa @0 @1 @2 @3 @4
+Oporto Lisboa 0 1 2 3 4
+select sum(a) + 200 as the_sum, @Oporto as the_town from t1
+group by b
+union distinct
+select sum(a) + 200, @Lisboa from t1
+group by b ;
+the_sum the_town
+204 Oporto
+201 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+201 Lisboa
+203 Lisboa
+202 Lisboa
+prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
+ group by b
+ union distinct
+ select sum(a) + 200, ? from t1
+ group by b ' ;
+execute stmt1 using @Oporto, @Lisboa;
+the_sum the_town
+204 Oporto
+201 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+201 Lisboa
+203 Lisboa
+202 Lisboa
+select sum(a) + 200 as the_sum, @Oporto as the_town from t1
+where a > @1
+group by b
+union distinct
+select sum(a) + 200, @Lisboa from t1
+where a > @2
+group by b ;
+the_sum the_town
+204 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+203 Lisboa
+prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
+ where a > ?
+ group by b
+ union distinct
+ select sum(a) + 200, ? from t1
+ where a > ?
+ group by b ' ;
+execute stmt1 using @Oporto, @1, @Lisboa, @2;
+the_sum the_town
+204 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+203 Lisboa
+select sum(a) + 200 as the_sum, @Oporto as the_town from t1
+where a > @1
+group by b
+having avg(a) > @2
+union distinct
+select sum(a) + 200, @Lisboa from t1
+where a > @2
+group by b
+having avg(a) > @3;
+the_sum the_town
+204 Oporto
+203 Oporto
+204 Lisboa
+prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
+ where a > ?
+ group by b
+ having avg(a) > ?
+ union distinct
+ select sum(a) + 200, ? from t1
+ where a > ?
+ group by b
+ having avg(a) > ? ';
+execute stmt1 using @Oporto, @1, @2, @Lisboa, @2, @3;
+the_sum the_town
+204 Oporto
+203 Oporto
+204 Lisboa
+test_sequence
+------ explain select tests ------
+prepare stmt1 from ' explain select * from t9 ' ;
+execute stmt1;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def id 8 3 1 N 32801 0 8
+def select_type 253 19 6 N 1 31 8
+def table 253 64 2 N 1 31 8
+def type 253 10 3 N 1 31 8
+def possible_keys 253 4096 0 Y 0 31 8
+def key 253 64 0 Y 0 31 8
+def key_len 8 3 0 Y 32800 0 8
+def ref 253 1024 0 Y 0 31 8
+def rows 8 10 1 N 32801 0 8
+def Extra 253 255 0 N 1 31 8
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t9 ALL NULL NULL NULL NULL 2
+test_sequence
+------ delete tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+prepare stmt1 from 'delete from t1 where a=2' ;
+execute stmt1;
+select a,b from t1 where a=2;
+a b
+execute stmt1;
+insert into t1 values(0,NULL);
+set @arg00=NULL;
+prepare stmt1 from 'delete from t1 where b=?' ;
+execute stmt1 using @arg00;
+select a,b from t1 where b is NULL ;
+a b
+0 NULL
+set @arg00='one';
+execute stmt1 using @arg00;
+select a,b from t1 where b=@arg00;
+a b
+prepare stmt1 from 'truncate table t1' ;
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+test_sequence
+------ update tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ;
+execute stmt1;
+select a,b from t1 where a=2;
+a b
+2 a=two
+execute stmt1;
+select a,b from t1 where a=2;
+a b
+2 a=two
+set @arg00=NULL;
+prepare stmt1 from 'update t1 set b=? where a=2' ;
+execute stmt1 using @arg00;
+select a,b from t1 where a=2;
+a b
+2 NULL
+set @arg00='two';
+execute stmt1 using @arg00;
+select a,b from t1 where a=2;
+a b
+2 two
+set @arg00=2;
+prepare stmt1 from 'update t1 set b=NULL where a=?' ;
+execute stmt1 using @arg00;
+select a,b from t1 where a=@arg00;
+a b
+2 NULL
+update t1 set b='two' where a=@arg00;
+set @arg00=2000;
+execute stmt1 using @arg00;
+select a,b from t1 where a=@arg00;
+a b
+set @arg00=2;
+set @arg01=22;
+prepare stmt1 from 'update t1 set a=? where a=?' ;
+execute stmt1 using @arg00, @arg00;
+select a,b from t1 where a=@arg00;
+a b
+2 two
+execute stmt1 using @arg01, @arg00;
+select a,b from t1 where a=@arg01;
+a b
+22 two
+execute stmt1 using @arg00, @arg01;
+select a,b from t1 where a=@arg00;
+a b
+2 two
+set @arg00=NULL;
+set @arg01=2;
+execute stmt1 using @arg00, @arg01;
+Warnings:
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1
+select a,b from t1 order by a;
+a b
+0 two
+1 one
+3 three
+4 four
+set @arg00=0;
+execute stmt1 using @arg01, @arg00;
+select a,b from t1 order by a;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00=23;
+set @arg01='two';
+set @arg02=2;
+set @arg03='two';
+set @arg04=2;
+drop table if exists t2;
+create table t2 as select a,b from t1 ;
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 where a = @arg00 ;
+a b
+23 two
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a not in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 order by a ;
+a b
+1 one
+2 two
+3 three
+4 four
+drop table t2 ;
+create table t2
+(
+a int, b varchar(30),
+primary key(a)
+) engine = 'NDB' ;
+insert into t2(a,b) select a, b from t1 ;
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 where a = @arg00 ;
+a b
+23 two
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a not in (select ? from t2
+ where b = ? or a = ?)';
+execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 order by a ;
+a b
+1 one
+2 two
+3 three
+4 four
+drop table t2 ;
+set @arg00=1;
+prepare stmt1 from 'update t1 set b=''bla''
+where a=2
+limit 1';
+execute stmt1 ;
+select a,b from t1 where b = 'bla' ;
+a b
+2 bla
+prepare stmt1 from 'update t1 set b=''bla''
+where a=2
+limit ?';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 3
+test_sequence
+------ insert tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+prepare stmt1 from 'insert into t1 values(5, ''five'' )';
+execute stmt1;
+select a,b from t1 where a = 5;
+a b
+5 five
+set @arg00='six' ;
+prepare stmt1 from 'insert into t1 values(6, ? )';
+execute stmt1 using @arg00;
+select a,b from t1 where b = @arg00;
+a b
+6 six
+execute stmt1 using @arg00;
+ERROR 23000: Duplicate entry '6' for key 1
+set @arg00=NULL ;
+prepare stmt1 from 'insert into t1 values(0, ? )';
+execute stmt1 using @arg00;
+select a,b from t1 where b is NULL;
+a b
+0 NULL
+set @arg00=8 ;
+set @arg01='eight' ;
+prepare stmt1 from 'insert into t1 values(?, ? )';
+execute stmt1 using @arg00, @arg01 ;
+select a,b from t1 where b = @arg01;
+a b
+8 eight
+set @NULL= null ;
+set @arg00= 'abc' ;
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg00 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg00 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 abc
+10002 abc
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @NULL ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @NULL ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 NULL
+10002 NULL
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 10 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 9 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 8 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 7 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 6 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 5 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 4 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 3 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg01 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 10001
+10002 10002
+10003 10003
+10004 10004
+10005 10005
+10006 10006
+10007 10007
+10008 10008
+10009 10009
+10010 10010
+delete from t1 where a > 10000 ;
+set @arg00=81 ;
+set @arg01='8-1' ;
+set @arg02=82 ;
+set @arg03='8-2' ;
+prepare stmt1 from 'insert into t1 values(?,?),(?,?)';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
+select a,b from t1 where a in (@arg00,@arg02) ;
+a b
+81 8-1
+82 8-2
+set @arg00=9 ;
+set @arg01='nine' ;
+prepare stmt1 from 'insert into t1 set a=?, b=? ';
+execute stmt1 using @arg00, @arg01 ;
+select a,b from t1 where a = @arg00 ;
+a b
+9 nine
+set @arg00=6 ;
+set @arg01=1 ;
+prepare stmt1 from 'insert into t1 set a=?, b=''sechs''
+ on duplicate key update a=a + ?, b=concat(b,''modified'') ';
+execute stmt1 using @arg00, @arg01;
+select * from t1 order by a;
+a b
+0 NULL
+1 one
+2 two
+3 three
+4 four
+5 five
+7 sixmodified
+8 eight
+9 nine
+81 8-1
+82 8-2
+set @arg00=81 ;
+set @arg01=1 ;
+execute stmt1 using @arg00, @arg01;
+ERROR 23000: Duplicate entry '82' for key 1
+drop table if exists t2 ;
+create table t2 (id int auto_increment primary key)
+ENGINE= 'NDB' ;
+prepare stmt1 from ' select last_insert_id() ' ;
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+1
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+2
+drop table t2 ;
+set @1000=1000 ;
+set @x1000_2="x1000_2" ;
+set @x1000_3="x1000_3" ;
+set @x1000="x1000" ;
+set @1100=1100 ;
+set @x1100="x1100" ;
+set @100=100 ;
+set @updated="updated" ;
+insert into t1 values(1000,'x1000_1') ;
+insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3)
+on duplicate key update a = a + @100, b = concat(b,@updated) ;
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 x1000_3
+1100 x1000_1updated
+delete from t1 where a >= 1000 ;
+insert into t1 values(1000,'x1000_1') ;
+prepare stmt1 from ' insert into t1 values(?,?),(?,?)
+ on duplicate key update a = a + ?, b = concat(b,?) ';
+execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ;
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 x1000_3
+1100 x1000_1updated
+delete from t1 where a >= 1000 ;
+insert into t1 values(1000,'x1000_1') ;
+execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ;
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1200 x1000_1updatedupdated
+delete from t1 where a >= 1000 ;
+prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
+execute stmt1;
+execute stmt1;
+execute stmt1;
+test_sequence
+------ multi table tests ------
+delete from t1 ;
+delete from t9 ;
+insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
+insert into t9 (c1,c21)
+values (1, 'one'), (2, 'two'), (3, 'three') ;
+prepare stmt_delete from " delete t1, t9
+ from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
+prepare stmt_update from " update t1, t9
+ set t1.b='updated', t9.c21='updated'
+ where t1.a=t9.c1 and t1.a=? ";
+prepare stmt_select1 from " select a, b from t1 order by a" ;
+prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
+set @arg00= 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+2 two
+3 three
+execute stmt_select2 ;
+c1 c21
+2 two
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+3 three
+execute stmt_select2 ;
+c1 c21
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+execute stmt_select2 ;
+c1 c21
+set @arg00= @arg00 + 1 ;
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+insert into t1 values(0,NULL) ;
+set @duplicate='duplicate ' ;
+set @1000=1000 ;
+set @5=5 ;
+select a,b from t1 where a < 5 order by a ;
+a b
+0 NULL
+1 one
+2 two
+3 three
+4 four
+insert into t1 select a + @1000, concat(@duplicate,b) from t1
+where a < @5 ;
+affected rows: 5
+info: Records: 5 Duplicates: 0 Warnings: 0
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 NULL
+1001 duplicate one
+1002 duplicate two
+1003 duplicate three
+1004 duplicate four
+delete from t1 where a >= 1000 ;
+prepare stmt1 from ' insert into t1 select a + ?, concat(?,b) from t1
+where a < ? ' ;
+execute stmt1 using @1000, @duplicate, @5;
+affected rows: 5
+info: Records: 5 Duplicates: 0 Warnings: 0
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 NULL
+1001 duplicate one
+1002 duplicate two
+1003 duplicate three
+1004 duplicate four
+delete from t1 where a >= 1000 ;
+set @1=1 ;
+set @2=2 ;
+set @100=100 ;
+set @float=1.00;
+set @five='five' ;
+drop table if exists t2;
+create table t2 like t1 ;
+insert into t2 (b,a)
+select @duplicate, sum(first.a) from t1 first, t1 second
+where first.a <> @5 and second.b = first.b
+and second.b <> @five
+group by second.b
+having sum(second.a) > @2
+union
+select b, a + @100 from t1
+where (a,b) in ( select sqrt(a+@1)+CAST(@float AS signed),b
+from t1);
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
+select a,b from t2 order by a ;
+a b
+3 duplicate
+4 duplicate
+103 three
+delete from t2 ;
+prepare stmt1 from ' insert into t2 (b,a)
+select ?, sum(first.a)
+ from t1 first, t1 second
+ where first.a <> ? and second.b = first.b and second.b <> ?
+ group by second.b
+ having sum(second.a) > ?
+union
+select b, a + ? from t1
+ where (a,b) in ( select sqrt(a+?)+CAST(? AS signed),b
+ from t1 ) ' ;
+execute stmt1 using @duplicate, @5, @five, @2, @100, @1, @float ;
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
+select a,b from t2 order by a ;
+a b
+3 duplicate
+4 duplicate
+103 three
+drop table t2;
+drop table if exists t5 ;
+set @arg01= 8;
+set @arg02= 8.0;
+set @arg03= 80.00000000000e-1;
+set @arg04= 'abc' ;
+set @arg05= CAST('abc' as binary) ;
+set @arg06= '1991-08-05' ;
+set @arg07= CAST('1991-08-05' as date);
+set @arg08= '1991-08-05 01:01:01' ;
+set @arg09= CAST('1991-08-05 01:01:01' as datetime) ;
+set @arg10= unix_timestamp('1991-01-01 01:01:01');
+set @arg11= YEAR('1991-01-01 01:01:01');
+set @arg12= 8 ;
+set @arg12= NULL ;
+set @arg13= 8.0 ;
+set @arg13= NULL ;
+set @arg14= 'abc';
+set @arg14= NULL ;
+set @arg15= CAST('abc' as binary) ;
+set @arg15= NULL ;
+create table t5 as select
+8 as const01, @arg01 as param01,
+8.0 as const02, @arg02 as param02,
+80.00000000000e-1 as const03, @arg03 as param03,
+'abc' as const04, @arg04 as param04,
+CAST('abc' as binary) as const05, @arg05 as param05,
+'1991-08-05' as const06, @arg06 as param06,
+CAST('1991-08-05' as date) as const07, @arg07 as param07,
+'1991-08-05 01:01:01' as const08, @arg08 as param08,
+CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09,
+unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10,
+YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11,
+NULL as const12, @arg12 as param12,
+@arg13 as param13,
+@arg14 as param14,
+@arg15 as param15;
+show create table t5 ;
+Table Create Table
+t5 CREATE TABLE `t5` (
+ `const01` bigint(1) NOT NULL default '0',
+ `param01` bigint(20) default NULL,
+ `const02` double(3,1) NOT NULL default '0.0',
+ `param02` double default NULL,
+ `const03` double NOT NULL default '0',
+ `param03` double default NULL,
+ `const04` char(3) NOT NULL default '',
+ `param04` longtext,
+ `const05` binary(3) NOT NULL default '',
+ `param05` longblob,
+ `const06` varchar(10) NOT NULL default '',
+ `param06` longtext,
+ `const07` date default NULL,
+ `param07` longblob,
+ `const08` varchar(19) NOT NULL default '',
+ `param08` longtext,
+ `const09` datetime default NULL,
+ `param09` longblob,
+ `const10` int(10) NOT NULL default '0',
+ `param10` bigint(20) default NULL,
+ `const11` int(4) default NULL,
+ `param11` bigint(20) default NULL,
+ `const12` binary(0) default NULL,
+ `param12` bigint(20) default NULL,
+ `param13` double default NULL,
+ `param14` longtext,
+ `param15` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t5 ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t5 t5 const01 const01 8 1 1 N 32769 0 63
+def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
+def test t5 t5 const02 const02 5 3 3 N 32769 1 63
+def test t5 t5 param02 param02 5 20 1 Y 32768 31 63
+def test t5 t5 const03 const03 5 23 1 N 32769 31 63
+def test t5 t5 param03 param03 5 20 1 Y 32768 31 63
+def test t5 t5 const04 const04 254 3 3 N 1 0 8
+def test t5 t5 param04 param04 252 16777215 3 Y 16 0 8
+def test t5 t5 const05 const05 254 3 3 N 129 0 63
+def test t5 t5 param05 param05 252 16777215 3 Y 144 0 63
+def test t5 t5 const06 const06 253 10 10 N 1 0 8
+def test t5 t5 param06 param06 252 16777215 10 Y 16 0 8
+def test t5 t5 const07 const07 10 10 10 Y 128 0 63
+def test t5 t5 param07 param07 252 16777215 10 Y 144 0 63
+def test t5 t5 const08 const08 253 19 19 N 1 0 8
+def test t5 t5 param08 param08 252 16777215 19 Y 16 0 8
+def test t5 t5 const09 const09 12 19 19 Y 128 0 63
+def test t5 t5 param09 param09 252 16777215 19 Y 144 0 63
+def test t5 t5 const10 const10 3 10 9 N 32769 0 63
+def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
+def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
+def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
+def test t5 t5 const12 const12 254 0 0 Y 128 0 63
+def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
+def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
+def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
+const01 8
+param01 8
+const02 8.0
+param02 8
+const03 8
+param03 8
+const04 abc
+param04 abc
+const05 abc
+param05 abc
+const06 1991-08-05
+param06 1991-08-05
+const07 1991-08-05
+param07 1991-08-05
+const08 1991-08-05 01:01:01
+param08 1991-08-05 01:01:01
+const09 1991-08-05 01:01:01
+param09 1991-08-05 01:01:01
+const10 662680861
+param10 662680861
+const11 1991
+param11 1991
+const12 NULL
+param12 NULL
+param13 NULL
+param14 NULL
+param15 NULL
+drop table t5 ;
+test_sequence
+------ data type conversion tests ------
+delete from t1 ;
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+commit ;
+delete from t9 ;
+insert into t9
+set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
+c10= 1, c11= 1, c12 = 1,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=true, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
+insert into t9
+set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
+c10= 9, c11= 9, c12 = 9,
+c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
+c16= '11:11:11', c17= '2004',
+c18= 1, c19=false, c20= 'a', c21= '123456789a',
+c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
+c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
+c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
+insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ;
+select * from t9 order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+test_sequence
+------ select @parameter:= column ------
+prepare full_info from "select @arg01, @arg02, @arg03, @arg04,
+ @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12,
+ @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20,
+ @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28,
+ @arg29, @arg30, @arg31, @arg32" ;
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 1 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 0 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select
+ @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+ @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+ @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+ @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+ @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+ @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+ @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+ @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':= c1 from t9 where c1= 1' at line 1
+test_sequence
+------ select column, .. into @parm,.. ------
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 1 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 0 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+ c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+ c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? from t9 where c1= 1' at line 1
+test_sequence
+-- insert into numeric columns --
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ;
+set @arg00= 21 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ;
+execute stmt1 ;
+set @arg00= 23;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
+30.0, 30.0, 30.0 ) ;
+set @arg00= 31.0 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0,
+ 32.0, 32.0, 32.0 )" ;
+execute stmt1 ;
+set @arg00= 33.0;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( '40', '40', '40', '40', '40', '40', '40', '40',
+'40', '40', '40' ) ;
+set @arg00= '41' ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( '42', '42', '42', '42', '42', '42', '42', '42',
+ '42', '42', '42' )" ;
+execute stmt1 ;
+set @arg00= '43';
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ;
+set @arg00= CAST('51' as binary) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ;
+execute stmt1 ;
+set @arg00= CAST('53' as binary) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 2 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+NULL, NULL, NULL ) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 61, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL )" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 8.0 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 71, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 'abc' ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 81, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c1 >= 20
+order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12
+20 20 20 20 20 20 20 20 20 20 20.0000
+21 21 21 21 21 21 21 21 21 21 21.0000
+22 22 22 22 22 22 22 22 22 22 22.0000
+23 23 23 23 23 23 23 23 23 23 23.0000
+30 30 30 30 30 30 30 30 30 30 30.0000
+31 31 31 31 31 31 31 31 31 31 31.0000
+32 32 32 32 32 32 32 32 32 32 32.0000
+33 33 33 33 33 33 33 33 33 33 33.0000
+40 40 40 40 40 40 40 40 40 40 40.0000
+41 41 41 41 41 41 41 41 41 41 41.0000
+42 42 42 42 42 42 42 42 42 42 42.0000
+43 43 43 43 43 43 43 43 43 43 43.0000
+50 50 50 50 50 50 50 50 50 50 50.0000
+51 51 51 51 51 51 51 51 51 51 51.0000
+52 52 52 52 52 52 52 52 52 52 52.0000
+53 53 53 53 53 53 53 53 53 53 53.0000
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where numeric column = .. --
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+and c8= 20 and c9= 20 and c10= 20 and c12= 20;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+ and c8= 20 and c9= 20 and c10= 20 and c12= 20 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+ and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20';
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' ";
+execute stmt1 ;
+found
+true
+set @arg00= '20';
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+c12= CAST('20' as binary);
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+ c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+ c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+ c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+ c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+ c12= CAST('20' as binary) ";
+execute stmt1 ;
+found
+true
+set @arg00= CAST('20' as binary) ;
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- some numeric overflow experiments --
+prepare my_insert from "insert into t9
+ ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c21 = 'O' ";
+prepare my_delete from "delete from t9 where c21 = 'O' ";
+set @arg00= 9223372036854775807 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= '9223372036854775807' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= -9223372036854775808 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-9223372036854775808' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= 1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= '1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 1
+c2 1
+c3 1
+c4 1
+c5 1
+c6 1
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= -1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -1
+c2 -1
+c3 -1
+c4 -1
+c5 -1
+c6 -1
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+test_sequence
+-- insert into string columns --
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30
+from t9 where c1 >= 20
+order by c1 ;
+c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
+20 2 20 20 20 20 20 20 20 20 20 20
+21 2 21 21 21 21 21 21 21 21 21 21
+22 2 22 22 22 22 22 22 22 22 22 22
+23 2 23 23 23 23 23 23 23 23 23 23
+30 3 30 30 30 30 30 30 30 30 30 30
+31 3 31 31 31 31 31 31 31 31 31 31
+32 3 32 32 32 32 32 32 32 32 32 32
+33 3 33 33 33 33 33 33 33 33 33 33
+40 4 40 40 40 40 40 40 40 40 40 40
+41 4 41 41 41 41 41 41 41 41 41 41
+42 4 42 42 42 42 42 42 42 42 42 42
+43 4 43 43 43 43 43 43 43 43 43 43
+50 5 50 50 50.00 50.00 50.00 50.00 50.00 50.00 50.00 50.00
+51 5 51 51 51 51 51 51 51 51 51 51
+52 5 52 52 52.00 52.00 52.00 52.00 52.00 52.00 52.00 52.00
+53 5 53 53 53.00 53.00 53.00 53.00 53.00 53.00 53.00 53.00
+54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00
+55 5 55 55 55 55 55 55 55 55 55 55
+56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00
+57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where string column = .. --
+set @arg00= '20';
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+c27= '20' and c28= '20' and c29= '20' and c30= '20' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+ c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+ c27= '20' and c28= '20' and c29= '20' and c30= '20'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('20' as binary);
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+= CAST('20' as binary) and c21= CAST('20' as binary)
+and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+c30= CAST('20' as binary) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and
+c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+ = CAST('20' as binary) and c21= CAST('20' as binary)
+ and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+ c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+ c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+ c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+ c30= CAST('20' as binary)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and
+ c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and
+ c29= ? and c30= ?";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+c27= 20 and c28= 20 and c29= 20 and c30= 20 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+ c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+ c27= 20 and c28= 20 and c29= 20 and c30= 20" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+ c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+ c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- insert into date/time columns --
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
+c1 c13 c14 c15 c16 c17
+20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+21 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+22 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+23 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+30 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+60 NULL NULL 1991-01-01 01:01:01 NULL NULL
+61 NULL NULL 1991-01-01 01:01:01 NULL NULL
+62 NULL NULL 1991-01-01 01:01:01 NULL NULL
+63 NULL NULL 1991-01-01 01:01:01 NULL NULL
+71 NULL NULL 1991-01-01 01:01:01 NULL NULL
+73 NULL NULL 1991-01-01 01:01:01 NULL NULL
+81 NULL NULL 1991-01-01 01:01:01 NULL NULL
+83 NULL NULL 1991-01-01 01:01:01 NULL NULL
+test_sequence
+-- select .. where date/time column = .. --
+set @arg00= '1991-01-01 01:01:01' ;
+select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+c17= '1991-01-01 01:01:01' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+ c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+ c17= '1991-01-01 01:01:01'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
+select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+c14= CAST('1991-01-01 01:01:01' as datetime) and
+c15= CAST('1991-01-01 01:01:01' as datetime) and
+c16= CAST('1991-01-01 01:01:01' as datetime) and
+c17= CAST('1991-01-01 01:01:01' as datetime) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+ c14= CAST('1991-01-01 01:01:01' as datetime) and
+ c15= CAST('1991-01-01 01:01:01' as datetime) and
+ c16= CAST('1991-01-01 01:01:01' as datetime) and
+ c17= CAST('1991-01-01 01:01:01' as datetime)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 1991 ;
+select 'true' as found from t9
+where c1= 20 and c17= 1991 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= 1991" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= ?" ;
+execute stmt1 using @arg00 ;
+found
+true
+set @arg00= 1.991e+3 ;
+select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and abs(c17 - @arg00) < 0.01 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - ?) < 0.01" ;
+execute stmt1 using @arg00 ;
+found
+true
+drop table t1, t9;
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index 85fe77b1f10..9f61b029391 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -44,7 +44,7 @@ create table t1 (a int not null);
insert into t1 values (1),(2),(3);
create table t2 (a int not null);
insert into t2 values (4),(5),(6);
-create table t3 (a int not null) type=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST;
+create table t3 (a int not null) engine=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST;
select * from t3;
a
1
@@ -292,7 +292,7 @@ DATABASE()
select ENCRYPT("test") from t1;
ENCRYPT("test")
select LAST_INSERT_ID() from t1;
-last_insert_id()
+LAST_INSERT_ID()
select RAND() from t1;
RAND()
select UNIX_TIMESTAMP() from t1;
@@ -301,6 +301,11 @@ select USER() from t1;
USER()
select benchmark(1,1) from t1;
benchmark(1,1)
+explain extended select benchmark(1,1) from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
+Warnings:
+Note 1003 select sql_no_cache benchmark(1,1) AS `benchmark(1,1)` from test.t1
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
@@ -382,8 +387,9 @@ show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
drop table t1;
-create table t1 (a char(1) not null);
-insert into t1 values("á");
+create table t1 (a char(1) not null collate koi8r_general_ci);
+insert into t1 values(_koi8r"á");
+set CHARACTER SET koi8r;
select * from t1;
a
á
@@ -510,6 +516,74 @@ drop table t1;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
+show global variables like "query_cache_min_res_unit";
+Variable_name Value
+query_cache_min_res_unit 4096
+set GLOBAL query_cache_min_res_unit=1001;
+show global variables like "query_cache_min_res_unit";
+Variable_name Value
+query_cache_min_res_unit 1008
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+create table t2 (a int not null);
+insert into t2 values (1),(2),(3);
+select * from t1;
+a
+1
+2
+3
+select * from t1;
+a
+1
+2
+3
+select * from t2;
+a
+1
+2
+3
+select * from t2;
+a
+1
+2
+3
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 11
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+drop table t1;
+select a from t2;
+a
+1
+2
+3
+select a from t2;
+a
+1
+2
+3
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 12
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+drop table t2;
+set GLOBAL query_cache_min_res_unit=default;
+show global variables like "query_cache_min_res_unit";
+Variable_name Value
+query_cache_min_res_unit 4096
+create table t1 (a int not null);
+insert into t1 values (1);
+select "aaa" from t1;
+aaa
+aaa
+select "AAA" from t1;
+AAA
+AAA
+drop table t1;
create table t1 (a int);
set GLOBAL query_cache_size=1000;
show global variables like "query_cache_size";
@@ -518,24 +592,32 @@ query_cache_size 0
select * from t1;
a
set GLOBAL query_cache_size=1024;
+Warnings:
+Warning 1282 Query cache failed to set size 1024; new query cache size is 0
show global variables like "query_cache_size";
Variable_name Value
query_cache_size 0
select * from t1;
a
set GLOBAL query_cache_size=10240;
+Warnings:
+Warning 1282 Query cache failed to set size 10240; new query cache size is 0
show global variables like "query_cache_size";
Variable_name Value
query_cache_size 0
select * from t1;
a
set GLOBAL query_cache_size=20480;
+Warnings:
+Warning 1282 Query cache failed to set size 20480; new query cache size is 0
show global variables like "query_cache_size";
Variable_name Value
query_cache_size 0
select * from t1;
a
set GLOBAL query_cache_size=40960;
+Warnings:
+Warning 1282 Query cache failed to set size 40960; new query cache size is 0
show global variables like "query_cache_size";
Variable_name Value
query_cache_size 0
@@ -585,6 +667,7 @@ i
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 2
+update t1 set i=(select distinct 1 from (select * from t2) a);
drop table t1, t2, t3;
use mysql;
select * from db;
@@ -603,28 +686,32 @@ id
2
alter table t1 rename to t2;
select * from t1 where id=2;
-Table 'test.t1' doesn't exist
+ERROR 42S02: Table 'test.t1' doesn't exist
drop table t2;
select * from t1 where id=2;
-Table 'test.t1' doesn't exist
+ERROR 42S02: Table 'test.t1' doesn't exist
create table t1 (word char(20) not null);
select * from t1;
word
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
-load data infile '../../std_data/words.dat' into table t1;
+load data infile 'TEST_DIR/std_data/words.dat' into table t1;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
+select count(*) from t1;
+count(*)
+70
drop table t1;
-drop table if exists t1;
create table t1 (a int);
insert into t1 values (1),(2),(3);
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
-select * from t1 into outfile "query_caceh.out.file";
+select * from t1 into outfile "query_cache.out.file";
+select * from t1 into outfile "query_cache.out.file";
+ERROR HY000: File 'query_cache.out.file' already exists
select * from t1 limit 1 into dumpfile "query_cache.dump.file";
show status like "Qcache_queries_in_cache";
Variable_name Value
@@ -717,4 +804,122 @@ select * from t1;
a
drop table t1;
drop table t1;
-set GLOBAL query_cache_size=0;
+SET NAMES koi8r;
+CREATE TABLE t1 (a char(1) character set koi8r);
+INSERT INTO t1 VALUES (_koi8r'á'),(_koi8r'Á');
+SELECT a,'Â','â'='Â' FROM t1;
+a  'â'='Â'
+á Â 1
+Á Â 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 6
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+set collation_connection=koi8r_bin;
+SELECT a,'Â','â'='Â' FROM t1;
+a  'â'='Â'
+á Â 0
+Á Â 0
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 6
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+set character_set_client=cp1251;
+SELECT a,'Â','â'='Â' FROM t1;
+a ÷ '×'='÷'
+á ÷ 0
+Á ÷ 0
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 6
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 3
+set character_set_results=cp1251;
+SELECT a,'Â','â'='Â' FROM t1;
+a  'â'='Â'
+À Â 0
+à Â 0
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 6
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 4
+DROP TABLE t1;
+CREATE TABLE t1 (a int(1));
+CREATE DATABASE mysqltest;
+USE mysqltest;
+DROP DATABASE mysqltest;
+SELECT * FROM test.t1;
+a
+USE test;
+DROP TABLE t1;
+set character_set_results=null;
+select @@character_set_results;
+@@character_set_results
+NULL
+set character_set_results=default;
+set GLOBAL query_cache_size=1355776;
+create table t1 (id int auto_increment primary key, c char(25));
+insert into t1 set c = repeat('x',24);
+insert into t1 set c = concat(repeat('x',24),'x');
+insert into t1 set c = concat(repeat('x',24),'w');
+insert into t1 set c = concat(repeat('x',24),'y');
+set max_sort_length=200;
+select c from t1 order by c, id;
+c
+xxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxw
+xxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxy
+reset query cache;
+set max_sort_length=20;
+select c from t1 order by c, id;
+c
+xxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxw
+xxxxxxxxxxxxxxxxxxxxxxxxy
+set max_sort_length=200;
+select c from t1 order by c, id;
+c
+xxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxw
+xxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxy
+set max_sort_length=default;
+select '1' || '3' from t1;
+'1' || '3'
+1
+1
+1
+1
+set SQL_MODE=oracle;
+select '1' || '3' from t1;
+'1' || '3'
+13
+13
+13
+13
+set SQL_MODE=default;
+drop table t1;
+create table t1 (a varchar(20), b int);
+insert into t1 values ('12345678901234567890', 1);
+set group_concat_max_len=10;
+select group_concat(a) FROM t1 group by b;
+group_concat(a)
+1234567890
+Warnings:
+Warning 1260 1 line(s) were cut by GROUP_CONCAT()
+set group_concat_max_len=1024;
+select group_concat(a) FROM t1 group by b;
+group_concat(a)
+12345678901234567890
+set group_concat_max_len=default;
+drop table t1;
+SET GLOBAL query_cache_size=0;
diff --git a/mysql-test/r/query_cache.result.es b/mysql-test/r/query_cache.result.es
new file mode 100644
index 00000000000..7e75a3cee4c
--- /dev/null
+++ b/mysql-test/r/query_cache.result.es
@@ -0,0 +1,925 @@
+set GLOBAL query_cache_size=1355776;
+flush query cache;
+flush query cache;
+reset query cache;
+flush status;
+drop table if exists t1,t2,t3,t4,t11,t21;
+drop database if exists mysqltest;
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+select * from t1;
+a
+1
+2
+3
+select * from t1;
+a
+1
+2
+3
+select sql_no_cache * from t1;
+a
+1
+2
+3
+select length(now()) from t1;
+length(now())
+19
+19
+19
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 1
+drop table t1;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+create table t2 (a int not null);
+insert into t2 values (4),(5),(6);
+create table t3 (a int not null) engine=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST;
+select * from t3;
+a
+1
+2
+3
+4
+5
+6
+select * from t3;
+a
+1
+2
+3
+4
+5
+6
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 2
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+insert into t2 values (7);
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select * from t1;
+a
+1
+2
+3
+select * from t1;
+a
+1
+2
+3
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+insert into t3 values (8);
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select * from t3;
+a
+1
+2
+3
+8
+4
+5
+6
+7
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+update t2 set a=9 where a=7;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select * from t1;
+a
+1
+2
+3
+8
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+update t3 set a=10 where a=1;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select * from t3;
+a
+10
+2
+3
+8
+4
+5
+6
+9
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+delete from t2 where a=9;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select * from t1;
+a
+10
+2
+3
+8
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+delete from t3 where a=10;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+drop table t1, t2, t3;
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+create table t2 (a int not null);
+insert into t2 values (1),(2),(3);
+select * from t1;
+a
+1
+2
+3
+select * from t2;
+a
+1
+2
+3
+insert into t1 values (4);
+show status like "Qcache_free_blocks";
+Variable_name Value
+Qcache_free_blocks 2
+flush query cache;
+show status like "Qcache_free_blocks";
+Variable_name Value
+Qcache_free_blocks 1
+drop table t1, t2;
+create table t1 (a text not null);
+create table t11 (a text not null);
+create table t2 (a text not null);
+create table t21 (a text not null);
+create table t3 (a text not null);
+insert into t1 values("1111111111111111111111111111111111111111111111111111");
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t11 select * from t1;
+insert into t21 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t3 select * from t1;
+insert into t3 select * from t2;
+insert into t3 select * from t1;
+select * from t11;
+select * from t21;
+show status like "Qcache_total_blocks";
+Variable_name Value
+Qcache_total_blocks 7
+show status like "Qcache_free_blocks";
+Variable_name Value
+Qcache_free_blocks 1
+insert into t11 values("");
+select * from t3;
+show status like "Qcache_total_blocks";
+Variable_name Value
+Qcache_total_blocks 8
+show status like "Qcache_free_blocks";
+Variable_name Value
+Qcache_free_blocks 2
+flush query cache;
+show status like "Qcache_total_blocks";
+Variable_name Value
+Qcache_total_blocks 7
+show status like "Qcache_free_blocks";
+Variable_name Value
+Qcache_free_blocks 1
+drop table t1, t2, t3, t11, t21;
+set query_cache_type=demand;
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+select * from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select sql_cache * from t1 union select * from t1;
+a
+1
+2
+3
+set query_cache_type=2;
+select sql_cache * from t1 union select * from t1;
+a
+1
+2
+3
+select * from t1 union select sql_cache * from t1;
+a
+1
+2
+3
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 4
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+set query_cache_type=on;
+reset query cache;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select sql_no_cache * from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+drop table t1;
+create table t1 (a text not null);
+select CONNECTION_ID() from t1;
+CONNECTION_ID()
+select FOUND_ROWS();
+FOUND_ROWS()
+0
+select NOW() from t1;
+NOW()
+select CURDATE() from t1;
+CURDATE()
+select CURTIME() from t1;
+CURTIME()
+select DATABASE() from t1;
+DATABASE()
+select ENCRYPT("test") from t1;
+ENCRYPT("test")
+select LAST_INSERT_ID() from t1;
+LAST_INSERT_ID()
+select RAND() from t1;
+RAND()
+select UNIX_TIMESTAMP() from t1;
+UNIX_TIMESTAMP()
+select USER() from t1;
+USER()
+select benchmark(1,1) from t1;
+benchmark(1,1)
+explain extended select benchmark(1,1) from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
+Warnings:
+Note 1003 select sql_no_cache benchmark(1,1) AS `benchmark(1,1)` from test.t1
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+create table t2 (a text not null);
+insert into t1 values("1111111111111111111111111111111111111111111111111111");
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 4
+show status like "Qcache_lowmem_prunes";
+Variable_name Value
+Qcache_lowmem_prunes 0
+select a as a1, a as a2 from t1;
+select a as a2, a as a3 from t1;
+select a as a3, a as a4 from t1;
+select a as a1, a as a2 from t1;
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 4
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+show status like "Qcache_lowmem_prunes";
+Variable_name Value
+Qcache_lowmem_prunes 2
+reset query cache;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+select * from t1;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+drop table t1,t2;
+create database mysqltest;
+create table mysqltest.t1 (i int not null auto_increment, a int, primary key (i));
+insert into mysqltest.t1 (a) values (1);
+select * from mysqltest.t1 where i is null;
+i a
+1 1
+create table t1(a int);
+select * from t1;
+a
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+select * from mysqltest.t1;
+i a
+1 1
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 3
+drop database mysqltest;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+drop table t1;
+create table t1 (a char(1) not null collate koi8r_general_ci);
+insert into t1 values(_koi8r"á");
+set CHARACTER SET koi8r;
+select * from t1;
+a
+set CHARACTER SET cp1251_koi8;
+select * from t1;
+a
+set CHARACTER SET DEFAULT;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 4
+drop table t1;
+create database if not exists mysqltest;
+create table mysqltest.t1 (i int not null);
+create table t1 (i int not null);
+insert into mysqltest.t1 (i) values (1);
+insert into t1 (i) values (2);
+select * from t1;
+i
+2
+use mysqltest;
+select * from t1;
+i
+1
+select * from t1;
+i
+1
+use test;
+select * from t1;
+i
+2
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 6
+drop database mysqltest;
+drop table t1;
+create table t1 (i int not null);
+insert into t1 (i) values (1),(2),(3),(4);
+select SQL_CALC_FOUND_ROWS * from t1 limit 2;
+i
+1
+2
+select FOUND_ROWS();
+FOUND_ROWS()
+4
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 6
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+select * from t1 where i=1;
+i
+1
+select FOUND_ROWS();
+FOUND_ROWS()
+1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 6
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+select SQL_CALC_FOUND_ROWS * from t1 limit 2;
+i
+1
+2
+select FOUND_ROWS();
+FOUND_ROWS()
+4
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 7
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+select * from t1 where i=1;
+i
+1
+select FOUND_ROWS();
+FOUND_ROWS()
+1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 8
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+drop table t1;
+flush query cache;
+reset query cache;
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+select * from t1;
+a
+1
+2
+3
+select * from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+insert delayed into t1 values (4);
+select a from t1;
+a
+1
+2
+3
+4
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+drop table t1;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+show global variables like "query_cache_min_res_unit";
+Variable_name Value
+query_cache_min_res_unit 4096
+set GLOBAL query_cache_min_res_unit=1001;
+show global variables like "query_cache_min_res_unit";
+Variable_name Value
+query_cache_min_res_unit 1008
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+create table t2 (a int not null);
+insert into t2 values (1),(2),(3);
+select * from t1;
+a
+1
+2
+3
+select * from t1;
+a
+1
+2
+3
+select * from t2;
+a
+1
+2
+3
+select * from t2;
+a
+1
+2
+3
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 11
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+drop table t1;
+select a from t2;
+a
+1
+2
+3
+select a from t2;
+a
+1
+2
+3
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 12
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+drop table t2;
+set GLOBAL query_cache_min_res_unit=default;
+show global variables like "query_cache_min_res_unit";
+Variable_name Value
+query_cache_min_res_unit 4096
+create table t1 (a int not null);
+insert into t1 values (1);
+select "aaa" from t1;
+aaa
+aaa
+select "AAA" from t1;
+AAA
+AAA
+drop table t1;
+create table t1 (a int);
+set GLOBAL query_cache_size=1000;
+show global variables like "query_cache_size";
+Variable_name Value
+query_cache_size 0
+select * from t1;
+a
+set GLOBAL query_cache_size=1024;
+Warnings:
+Warning 1282 Query cache failed to set size 1024; new query cache size is 0
+show global variables like "query_cache_size";
+Variable_name Value
+query_cache_size 0
+select * from t1;
+a
+set GLOBAL query_cache_size=10240;
+Warnings:
+Warning 1282 Query cache failed to set size 10240; new query cache size is 0
+show global variables like "query_cache_size";
+Variable_name Value
+query_cache_size 0
+select * from t1;
+a
+set GLOBAL query_cache_size=20480;
+Warnings:
+Warning 1282 Query cache failed to set size 20480; new query cache size is 0
+show global variables like "query_cache_size";
+Variable_name Value
+query_cache_size 0
+select * from t1;
+a
+set GLOBAL query_cache_size=40960;
+Warnings:
+Warning 1282 Query cache failed to set size 40960; new query cache size is 0
+show global variables like "query_cache_size";
+Variable_name Value
+query_cache_size 0
+select * from t1;
+a
+set GLOBAL query_cache_size=51200;
+show global variables like "query_cache_size";
+Variable_name Value
+query_cache_size 51200
+select * from t1;
+a
+set GLOBAL query_cache_size=61440;
+show global variables like "query_cache_size";
+Variable_name Value
+query_cache_size 61440
+select * from t1;
+a
+set GLOBAL query_cache_size=81920;
+show global variables like "query_cache_size";
+Variable_name Value
+query_cache_size 81920
+select * from t1;
+a
+set GLOBAL query_cache_size=102400;
+show global variables like "query_cache_size";
+Variable_name Value
+query_cache_size 102400
+select * from t1;
+a
+drop table t1;
+set GLOBAL query_cache_size=1048576;
+create table t1 (i int not null);
+create table t2 (i int not null);
+select * from t1;
+i
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+create temporary table t3 (i int not null);
+select * from t2;
+i
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+select * from t3;
+i
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+update t1 set i=(select distinct 1 from (select * from t2) a);
+drop table t1, t2, t3;
+use mysql;
+select * from db;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+use test;
+select * from mysql.db;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+create table t1(id int auto_increment primary key);
+insert into t1 values (NULL), (NULL), (NULL);
+select * from t1 where id=2;
+id
+2
+alter table t1 rename to t2;
+select * from t1 where id=2;
+ERROR 42S02: Table 'test.t1' doesn't exist
+drop table t2;
+select * from t1 where id=2;
+ERROR 42S02: Table 'test.t1' doesn't exist
+create table t1 (word char(20) not null);
+select * from t1;
+word
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+load data infile 'TEST_DIR/std_data/words.dat' into table t1;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select count(*) from t1;
+count(*)
+70
+drop table t1;
+create table t1 (a int);
+insert into t1 values (1),(2),(3);
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select * from t1 into outfile "query_cache.out.file";
+select * from t1 into outfile "query_cache.out.file";
+ERROR HY000: File 'query_cache.out.file' already exists
+select * from t1 limit 1 into dumpfile "query_cache.dump.file";
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+drop table t1;
+create table t1 (a int);
+insert into t1 values (1),(2);
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select * from t1;
+a
+1
+2
+SET OPTION SQL_SELECT_LIMIT=1;
+select * from t1;
+a
+1
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+SET OPTION SQL_SELECT_LIMIT=DEFAULT;
+drop table t1;
+flush query cache;
+reset query cache;
+flush status;
+set GLOBAL query_cache_size=1048576;
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+create table t2 (a text not null);
+create table t3 (a text not null);
+insert into t3 values("1111111111111111111111111111111111111111111111111111");
+insert into t2 select * from t3;
+insert into t3 select * from t2;
+insert into t2 select * from t3;
+insert into t3 select * from t2;
+insert into t2 select * from t3;
+insert into t3 select * from t2;
+insert into t2 select * from t3;
+insert into t3 select * from t2;
+insert into t2 select * from t3;
+insert into t3 select * from t2;
+drop table t2;
+create table t2 (a int not null);
+insert into t2 values (1),(2),(3);
+create table t4 (a int not null);
+insert into t4 values (1),(2),(3);
+select * from t4;
+select * from t2;
+select * from t1 as tt, t1 as ttt where tt.a=1 and ttt.a=2;
+select * from t2;
+select * from t4;
+select * from t1 as tt, t1 as ttt where tt.a=1 and ttt.a=2;
+select * from t2;
+select * from t4;
+select * from t1 as tt, t1 as ttt where tt.a=1 and ttt.a=2;
+delete from t2 where a=1;
+flush query cache;
+select * from t3;
+delete from t4 where a=1;
+flush query cache;
+drop table t1,t2,t3,t4;
+set query_cache_wlock_invalidate=1;
+create table t1 (a int not null);
+create table t2 (a int not null);
+select * from t1;
+a
+select * from t2;
+a
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+lock table t1 write, t2 read;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+unlock table;
+drop table t1,t2;
+set query_cache_wlock_invalidate=default;
+CREATE TABLE t1 (id INT PRIMARY KEY);
+insert into t1 values (1),(2),(3);
+select * from t1;
+id
+1
+2
+3
+create temporary table t1 (a int not null auto_increment
+primary key);
+select * from t1;
+a
+drop table t1;
+drop table t1;
+SET NAMES koi8r;
+CREATE TABLE t1 (a char(1) character set koi8r);
+INSERT INTO t1 VALUES (_koi8r'á'),(_koi8r'Á');
+SELECT a,'Â','â'='Â' FROM t1;
+a  'â'='Â'
+á Â 1
+Á Â 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 6
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+set collation_connection=koi8r_bin;
+SELECT a,'Â','â'='Â' FROM t1;
+a  'â'='Â'
+á Â 0
+Á Â 0
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 6
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+set character_set_client=cp1251;
+SELECT a,'Â','â'='Â' FROM t1;
+a ÷ '×'='÷'
+á ÷ 0
+Á ÷ 0
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 6
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 3
+set character_set_results=cp1251;
+SELECT a,'Â','â'='Â' FROM t1;
+a  'â'='Â'
+À Â 0
+à Â 0
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 6
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 4
+DROP TABLE t1;
+CREATE TABLE t1 (a int(1));
+CREATE DATABASE mysqltest;
+USE mysqltest;
+DROP DATABASE mysqltest;
+SELECT * FROM test.t1;
+a
+USE test;
+DROP TABLE t1;
+set character_set_results=null;
+select @@character_set_results;
+@@character_set_results
+NULL
+set character_set_results=default;
+set GLOBAL query_cache_size=1355776;
+create table t1 (id int auto_increment primary key, c char(25));
+insert into t1 set c = repeat('x',24);
+insert into t1 set c = concat(repeat('x',24),'x');
+insert into t1 set c = concat(repeat('x',24),'w');
+insert into t1 set c = concat(repeat('x',24),'y');
+set max_sort_length=200;
+select c from t1 order by c, id;
+c
+xxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxw
+xxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxy
+reset query cache;
+set max_sort_length=20;
+select c from t1 order by c, id;
+c
+xxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxw
+xxxxxxxxxxxxxxxxxxxxxxxxy
+set max_sort_length=200;
+select c from t1 order by c, id;
+c
+xxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxw
+xxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxy
+set max_sort_length=default;
+select '1' || '3' from t1;
+'1' || '3'
+1
+1
+1
+1
+set SQL_MODE=oracle;
+select '1' || '3' from t1;
+'1' || '3'
+13
+13
+13
+13
+set SQL_MODE=default;
+drop table t1;
+create table t1 (a varchar(20), b int);
+insert into t1 values ('12345678901234567890', 1);
+set group_concat_max_len=10;
+select group_concat(a) FROM t1 group by b;
+group_concat(a)
+1234567890
+Warnings:
+Warning 1260 1 line(s) were cut by GROUP_CONCAT()
+set group_concat_max_len=1024;
+select group_concat(a) FROM t1 group by b;
+group_concat(a)
+12345678901234567890
+set group_concat_max_len=default;
+drop table t1;
+SET GLOBAL query_cache_size=0;
diff --git a/mysql-test/r/raid.result b/mysql-test/r/raid.result
index 408e3b5480f..459da1cdf49 100644
--- a/mysql-test/r/raid.result
+++ b/mysql-test/r/raid.result
@@ -1,16 +1,17 @@
-create database test_raid;
-create table test_raid.r1 (i int) raid_type=1;
-create table test_raid.r2 (i int) raid_type=1 raid_chunks=32;
-drop database test_raid;
-create database test_raid;
-create table test_raid.r2 (i int) raid_type=1 raid_chunks=257;
-show create table test_raid.r2;
+DROP TABLE IF EXISTS t1,t2;
+DROP DATABASE IF EXISTS test_$1;
+create database test_$1;
+create table test_$1.r1 (i int) raid_type=1;
+create table test_$1.r2 (i int) raid_type=1 raid_chunks=32;
+drop database test_$1;
+create database test_$1;
+create table test_$1.r2 (i int) raid_type=1 raid_chunks=257;
+show create table test_$1.r2;
Table Create Table
r2 CREATE TABLE `r2` (
`i` int(11) default NULL
-) TYPE=MyISAM RAID_TYPE=striped RAID_CHUNKS=255 RAID_CHUNKSIZE=256
-drop database test_raid;
-DROP TABLE IF EXISTS t1,t2;
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 RAID_TYPE=striped RAID_CHUNKS=255 RAID_CHUNKSIZE=256
+drop database test_$1;
CREATE TABLE t1 (
id int unsigned not null auto_increment primary key,
c char(255) not null
@@ -108,7 +109,6 @@ count(*)
450
DROP TABLE t2;
/* variable rows */
-DROP TABLE IF EXISTS t2;
CREATE TABLE t1 (
id int unsigned not null auto_increment primary key,
c varchar(255) not null
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
index 55e03731fc7..fc2b4a78469 100644
--- a/mysql-test/r/range.result
+++ b/mysql-test/r/range.result
@@ -1,4 +1,4 @@
-drop table if exists t1;
+drop table if exists t1, t2;
CREATE TABLE t1 (
event_date date DEFAULT '0000-00-00' NOT NULL,
type int(11) DEFAULT '0' NOT NULL,
@@ -32,8 +32,8 @@ event_date type event_id
1999-07-13 100600 26
1999-07-14 100600 10
explain select event_date,type,event_id from t1 WHERE type = 100601 and event_date >= "1999-07-01" AND event_date < "1999-07-15" AND (type=100600 OR type=100100) ORDER BY event_date;
-Comment
-Impossible WHERE
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
select event_date,type,event_id from t1 WHERE event_date >= "1999-07-01" AND event_date <= "1999-07-15" AND (type=100600 OR type=100100) or event_date >= "1999-07-01" AND event_date <= "1999-07-15" AND type=100099;
event_date type event_id
1999-07-10 100100 24
@@ -150,7 +150,7 @@ believe in myself
drop table t1;
CREATE TABLE t1 (
t1ID int(10) unsigned NOT NULL auto_increment,
-art char(1) binary NOT NULL default '',
+art binary(1) NOT NULL default '',
KNR char(5) NOT NULL default '',
RECHNR char(6) NOT NULL default '',
POSNR char(2) NOT NULL default '',
@@ -160,7 +160,7 @@ PRIMARY KEY (t1ID),
KEY IdxArt (art),
KEY IdxKnr (KNR),
KEY IdxArtnr (ARTNR)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 (art) VALUES ('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
@@ -201,7 +201,7 @@ INSERT INTO t1 (art) VALUES ('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'
('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j');
select count(*) from t1 where upper(art) = 'J';
count(*)
-602
+213
select count(*) from t1 where art = 'J' or art = 'j';
count(*)
602
@@ -215,78 +215,63 @@ select count(*) from t1 where art = 'J';
count(*)
213
drop table t1;
-create table t1 ( id1 int not null, id2 int not null, idnull int null, c char(20), primary key (id1,id2));
-insert into t1 values (0,1,NULL,"aaa"), (1,1,NULL,"aaa"), (2,1,NULL,"aaa"),
-(3,1,NULL,"aaa"), (4,1,NULL,"aaa"), (5,1,NULL,"aaa"),
-(6,1,NULL,"aaa"), (7,1,NULL,"aaa"), (8,1,NULL,"aaa"),
-(9,1,NULL,"aaa"), (10,1,NULL,"aaa"), (11,1,NULL,"aaa"),
-(12,1,NULL,"aaa"), (13,1,NULL,"aaa"), (14,1,NULL,"aaa"),
-(15,1,NULL,"aaa"), (16,1,NULL,"aaa"), (17,1,NULL,"aaa"),
-(18,1,NULL,"aaa"), (19,1,NULL,"aaa"), (20,1,NULL,"aaa");
-select a.id1, b.idnull from t1 as a, t1 as b where a.id2=1 and a.id1=1 and b.id1=a.idnull order by b.id2 desc limit 1;
-id1 idnull
-drop table t1;
create table t1 (x int, y int, index(x), index(y));
insert into t1 (x) values (1),(2),(3),(4),(5),(6),(7),(8),(9);
update t1 set y=x;
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 7 and t1.y+0;
-table type possible_keys key key_len ref rows Extra
-t1 ref y y 5 const 1 Using where
-t2 range x x 5 NULL 4 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref y y 5 const 1 Using where
+1 SIMPLE t2 range x x 5 NULL 4 Range checked for each record (index map: 0x1)
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 7 and t2.x <= t1.y+0;
-table type possible_keys key key_len ref rows Extra
-t1 ref y y 5 const 1 Using where
-t2 range x x 5 NULL 4 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref y y 5 const 1 Using where
+1 SIMPLE t2 range x x 5 NULL 4 Using where
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between t1.y-1 and t1.y+1;
-table type possible_keys key key_len ref rows Extra
-t1 ref y y 5 const 1 Using where
-t2 ALL x NULL NULL NULL 9 Range checked for each record (index map: 1)
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref y y 5 const 1 Using where
+1 SIMPLE t2 ALL x NULL NULL NULL 9 Range checked for each record (index map: 0x1)
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= t1.y-1 and t2.x <= t1.y+1;
-table type possible_keys key key_len ref rows Extra
-t1 ref y y 5 const 1 Using where
-t2 ALL x NULL NULL NULL 9 Range checked for each record (index map: 1)
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref y y 5 const 1 Using where
+1 SIMPLE t2 ALL x NULL NULL NULL 9 Range checked for each record (index map: 0x1)
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 0 and t1.y;
-table type possible_keys key key_len ref rows Extra
-t1 ref y y 5 const 1 Using where
-t2 ALL x NULL NULL NULL 9 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref y y 5 const 1 Using where
+1 SIMPLE t2 ALL x NULL NULL NULL 9 Range checked for each record (index map: 0x1)
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 0 and t2.x <= t1.y;
-table type possible_keys key key_len ref rows Extra
-t1 ref y y 5 const 1 Using where
-t2 range x x 5 NULL 2 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref y y 5 const 1 Using where
+1 SIMPLE t2 range x x 5 NULL 2 Using where
explain select count(*) from t1 where x in (1);
-table type possible_keys key key_len ref rows Extra
-t1 ref x x 5 const 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref x x 5 const 1 Using where; Using index
explain select count(*) from t1 where x in (1,2);
-table type possible_keys key key_len ref rows Extra
-t1 range x x 5 NULL 2 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range x x 5 NULL 2 Using where; Using index
drop table t1;
-CREATE TABLE t1 (key1 int(11) NOT NULL default '0', KEY i1 (key1), KEY i2 (key1));
+CREATE TABLE t1 (key1 int(11) NOT NULL default '0', KEY i1 (key1));
INSERT INTO t1 VALUES (0),(0),(1),(1);
CREATE TABLE t2 (keya int(11) NOT NULL default '0', KEY j1 (keya));
INSERT INTO t2 VALUES (0),(0),(1),(1),(2),(2);
explain select * from t1, t2 where (t1.key1 <t2.keya + 1) and t2.keya=3;
-table type possible_keys key key_len ref rows Extra
-t2 ref j1 j1 4 const 1 Using where; Using index
-t1 ALL i1,i2 NULL NULL NULL 4 Range checked for each record (index map: 3)
-explain select * from t1 force index(i2), t2 where (t1.key1 <t2.keya + 1) and t2.keya=3;
-table type possible_keys key key_len ref rows Extra
-t2 ref j1 j1 4 const 1 Using where; Using index
-t1 ALL i2 NULL NULL NULL 4 Range checked for each record (index map: 2)
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref j1 j1 4 const 1 Using where; Using index
+1 SIMPLE t1 ALL i1 NULL NULL NULL 4 Range checked for each record (index map: 0x1)
DROP TABLE t1,t2;
CREATE TABLE t1 (
a int(11) default NULL,
b int(11) default NULL,
KEY a (a),
KEY b (b)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES
(1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,2),(10,2),
(13,2),(14,2),(15,2),(16,2),(17,3),(17,3),(16,3),(17,3),(19,3),(20,3),
(21,4),(22,5),(23,5),(24,5),(25,5),(26,5),(30,5),(31,5),(32,5),(33,5),
(33,5),(33,5),(33,5),(33,5),(34,5),(35,5);
EXPLAIN SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
-table type possible_keys key key_len ref rows Extra
-t1 range a,b a 5 NULL 2 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a,b a 5 NULL 2 Using where
SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
a b
DROP TABLE t1;
@@ -335,3 +320,260 @@ id columnid tableid content showid line ordinal
13 13 1 188 1 5 0
15 15 1 188 1 1 0
drop table t1;
+create table t1 (id int(10) primary key);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9);
+select id from t1 where id in (2,5,9) ;
+id
+2
+5
+9
+select id from t1 where id=2 or id=5 or id=9 ;
+id
+2
+5
+9
+drop table t1;
+create table t1 ( id1 int not null, id2 int not null, idnull int null, c char(20), primary key (id1,id2));
+insert into t1 values (0,1,NULL,"aaa"), (1,1,NULL,"aaa"), (2,1,NULL,"aaa"),
+(3,1,NULL,"aaa"), (4,1,NULL,"aaa"), (5,1,NULL,"aaa"),
+(6,1,NULL,"aaa"), (7,1,NULL,"aaa"), (8,1,NULL,"aaa"),
+(9,1,NULL,"aaa"), (10,1,NULL,"aaa"), (11,1,NULL,"aaa"),
+(12,1,NULL,"aaa"), (13,1,NULL,"aaa"), (14,1,NULL,"aaa"),
+(15,1,NULL,"aaa"), (16,1,NULL,"aaa"), (17,1,NULL,"aaa"),
+(18,1,NULL,"aaa"), (19,1,NULL,"aaa"), (20,1,NULL,"aaa");
+select a.id1, b.idnull from t1 as a, t1 as b where a.id2=1 and a.id1=1 and b.id1=a.idnull order by b.id2 desc limit 1;
+id1 idnull
+drop table t1;
+create table t1 (
+id int not null auto_increment,
+name char(1) not null,
+uid int not null,
+primary key (id),
+index uid_index (uid));
+create table t2 (
+id int not null auto_increment,
+name char(1) not null,
+uid int not null,
+primary key (id),
+index uid_index (uid));
+insert into t1(id, uid, name) values(1, 0, ' ');
+insert into t1(uid, name) values(0, ' ');
+insert into t2(uid, name) select uid, name from t1;
+insert into t1(uid, name) select uid, name from t2;
+insert into t2(uid, name) select uid, name from t1;
+insert into t1(uid, name) select uid, name from t2;
+insert into t2(uid, name) select uid, name from t1;
+insert into t1(uid, name) select uid, name from t2;
+insert into t2(uid, name) select uid, name from t1;
+insert into t1(uid, name) select uid, name from t2;
+insert into t2(uid, name) select uid, name from t1;
+insert into t1(uid, name) select uid, name from t2;
+insert into t2(uid, name) select uid, name from t1;
+insert into t2(uid, name) select uid, name from t1;
+insert into t2(uid, name) select uid, name from t1;
+insert into t2(uid, name) select uid, name from t1;
+insert into t1(uid, name) select uid, name from t2;
+delete from t2;
+insert into t2(uid, name) values
+(1, CHAR(64+1)),
+(2, CHAR(64+2)),
+(3, CHAR(64+3)),
+(4, CHAR(64+4)),
+(5, CHAR(64+5)),
+(6, CHAR(64+6)),
+(7, CHAR(64+7)),
+(8, CHAR(64+8)),
+(9, CHAR(64+9)),
+(10, CHAR(64+10)),
+(11, CHAR(64+11)),
+(12, CHAR(64+12)),
+(13, CHAR(64+13)),
+(14, CHAR(64+14)),
+(15, CHAR(64+15)),
+(16, CHAR(64+16)),
+(17, CHAR(64+17)),
+(18, CHAR(64+18)),
+(19, CHAR(64+19)),
+(20, CHAR(64+20)),
+(21, CHAR(64+21)),
+(22, CHAR(64+22)),
+(23, CHAR(64+23)),
+(24, CHAR(64+24)),
+(25, CHAR(64+25)),
+(26, CHAR(64+26));
+insert into t1(uid, name) select uid, name from t2;
+delete from t2;
+insert into t2(id, uid, name) select id, uid, name from t1;
+select count(*) from t1;
+count(*)
+1026
+select count(*) from t2;
+count(*)
+1026
+explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range uid_index uid_index 4 NULL 128 Using where
+1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38
+explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range uid_index uid_index 4 NULL 129 Using where
+1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38
+select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
+id name uid id name uid
+1001 A 1 1001 A 1
+1002 B 2 1002 B 2
+1003 C 3 1003 C 3
+1004 D 4 1004 D 4
+1005 E 5 1005 E 5
+1006 F 6 1006 F 6
+1007 G 7 1007 G 7
+1008 H 8 1008 H 8
+1009 I 9 1009 I 9
+1010 J 10 1010 J 10
+1011 K 11 1011 K 11
+1012 L 12 1012 L 12
+1013 M 13 1013 M 13
+1014 N 14 1014 N 14
+1015 O 15 1015 O 15
+1016 P 16 1016 P 16
+1017 Q 17 1017 Q 17
+1018 R 18 1018 R 18
+1019 S 19 1019 S 19
+1020 T 20 1020 T 20
+1021 U 21 1021 U 21
+1022 V 22 1022 V 22
+1023 W 23 1023 W 23
+1024 X 24 1024 X 24
+1025 Y 25 1025 Y 25
+1026 Z 26 1026 Z 26
+select * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0;
+id name uid id name uid
+1001 A 1 1001 A 1
+1002 B 2 1002 B 2
+1003 C 3 1003 C 3
+1004 D 4 1004 D 4
+1005 E 5 1005 E 5
+1006 F 6 1006 F 6
+1007 G 7 1007 G 7
+1008 H 8 1008 H 8
+1009 I 9 1009 I 9
+1010 J 10 1010 J 10
+1011 K 11 1011 K 11
+1012 L 12 1012 L 12
+1013 M 13 1013 M 13
+1014 N 14 1014 N 14
+1015 O 15 1015 O 15
+1016 P 16 1016 P 16
+1017 Q 17 1017 Q 17
+1018 R 18 1018 R 18
+1019 S 19 1019 S 19
+1020 T 20 1020 T 20
+1021 U 21 1021 U 21
+1022 V 22 1022 V 22
+1023 W 23 1023 W 23
+1024 X 24 1024 X 24
+1025 Y 25 1025 Y 25
+1026 Z 26 1026 Z 26
+drop table t1,t2;
+create table t1 (x bigint unsigned not null);
+insert into t1(x) values (0xfffffffffffffff0);
+insert into t1(x) values (0xfffffffffffffff1);
+select * from t1;
+x
+18446744073709551600
+18446744073709551601
+select count(*) from t1 where x>0;
+count(*)
+2
+select count(*) from t1 where x=0;
+count(*)
+0
+select count(*) from t1 where x<0;
+count(*)
+0
+select count(*) from t1 where x < -16;
+count(*)
+0
+select count(*) from t1 where x = -16;
+count(*)
+0
+select count(*) from t1 where x > -16;
+count(*)
+2
+select count(*) from t1 where x = 18446744073709551601;
+count(*)
+1
+create table t2 (x bigint not null);
+insert into t2(x) values (0xfffffffffffffff0);
+insert into t2(x) values (0xfffffffffffffff1);
+select * from t2;
+x
+-16
+-15
+select count(*) from t2 where x>0;
+count(*)
+0
+select count(*) from t2 where x=0;
+count(*)
+0
+select count(*) from t2 where x<0;
+count(*)
+2
+select count(*) from t2 where x < -16;
+count(*)
+0
+select count(*) from t2 where x = -16;
+count(*)
+1
+select count(*) from t2 where x > -16;
+count(*)
+1
+select count(*) from t2 where x = 18446744073709551601;
+count(*)
+0
+drop table t1;
+create table t1 (x bigint unsigned not null primary key) engine=innodb;
+insert into t1(x) values (0xfffffffffffffff0);
+insert into t1(x) values (0xfffffffffffffff1);
+select * from t1;
+x
+18446744073709551600
+18446744073709551601
+select count(*) from t1 where x>0;
+count(*)
+2
+select count(*) from t1 where x=0;
+count(*)
+0
+select count(*) from t1 where x<0;
+count(*)
+0
+select count(*) from t1 where x < -16;
+count(*)
+0
+select count(*) from t1 where x = -16;
+count(*)
+0
+select count(*) from t1 where x > -16;
+count(*)
+1
+select count(*) from t1 where x = 18446744073709551601;
+count(*)
+1
+drop table t1;
+set names latin1;
+create table t1 (a char(10), b text, key (a)) character set latin1;
+INSERT INTO t1 (a) VALUES
+('111'),('222'),('222'),('222'),('222'),('444'),('aaa'),('AAA'),('bbb');
+explain select * from t1 where a='aaa';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 11 const 2 Using where
+explain select * from t1 where a=binary 'aaa';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 11 NULL 2 Using where
+explain select * from t1 where a='aaa' collate latin1_bin;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 11 NULL 2 Using where
+explain select * from t1 where a='aaa' collate latin1_german1_ci;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL a NULL NULL NULL 9 Using where
diff --git a/mysql-test/r/rename.result b/mysql-test/r/rename.result
index b2bb659502a..76c0f4422fe 100644
--- a/mysql-test/r/rename.result
+++ b/mysql-test/r/rename.result
@@ -1,4 +1,5 @@
drop table if exists t0,t1,t2,t3,t4;
+drop table if exists t0,t5,t6,t7,t8,t9,t1_1,t1_2,t9_1,t9_2;
create table t0 SELECT 1,"table 1";
create table t2 SELECT 2,"table 2";
create table t3 SELECT 3,"table 3";
@@ -37,3 +38,19 @@ select * from t3;
3 table 3
3 table 3
drop table if exists t1,t2,t3,t4;
+Warnings:
+Note 1051 Unknown table 't4'
+CREATE TABLE t1 (a int);
+CREATE TABLE t3 (a int);
+FLUSH TABLES WITH READ LOCK;
+ RENAME TABLE t1 TO t2, t3 to t4;
+show tables;
+Tables_in_test
+t1
+t3
+UNLOCK TABLES;
+show tables;
+Tables_in_test
+t2
+t4
+drop table t2, t4;
diff --git a/mysql-test/r/repair.result b/mysql-test/r/repair.result
index 6c2107b2cf3..dbca5c39a6c 100644
--- a/mysql-test/r/repair.result
+++ b/mysql-test/r/repair.result
@@ -4,12 +4,36 @@ repair table t1 use_frm;
Table Op Msg_type Msg_text
test.t1 repair warning Number of rows changed from 0 to 1
test.t1 repair status OK
-alter table t1 TYPE=HEAP;
+alter table t1 ENGINE=HEAP;
repair table t1 use_frm;
Table Op Msg_type Msg_text
-test.t1 repair error The handler for the table doesn't support repair
+test.t1 repair note The storage engine for the table doesn't support repair
+drop table t1;
+create table t1(id int PRIMARY KEY, st varchar(10), KEY st_key(st));
+insert into t1 values(1, "One");
+alter table t1 disable keys;
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 id A 1 NULL NULL BTREE
+t1 1 st_key 1 st A NULL NULL NULL YES BTREE disabled
+repair table t1 extended;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 id A 1 NULL NULL BTREE
+t1 1 st_key 1 st A NULL NULL NULL YES BTREE disabled
drop table t1;
repair table t1 use_frm;
Table Op Msg_type Msg_text
test.t1 repair error Table 'test.t1' doesn't exist
-create table t1 type=myisam SELECT 1,"table 1";
+create table t1 engine=myisam SELECT 1,"table 1";
+flush tables;
+repair table t1;
+Table Op Msg_type Msg_text
+test.t1 repair error Can't open file: 't1.MYI' (errno: 130)
+repair table t1 use_frm;
+Table Op Msg_type Msg_text
+test.t1 repair warning Number of rows changed from 0 to 1
+test.t1 repair status OK
+drop table t1;
diff --git a/mysql-test/r/repair_part2.result b/mysql-test/r/repair_part2.result
deleted file mode 100644
index 77aa98c3da9..00000000000
--- a/mysql-test/r/repair_part2.result
+++ /dev/null
@@ -1,8 +0,0 @@
-repair table t1;
-Table Op Msg_type Msg_text
-test.t1 repair error Can't open file: 't1.MYI'. (errno: 130)
-repair table t1 use_frm;
-Table Op Msg_type Msg_text
-test.t1 repair warning Number of rows changed from 0 to 1
-test.t1 repair status OK
-drop table t1;
diff --git a/mysql-test/r/replace.result b/mysql-test/r/replace.result
index 0aa80e18ccc..83cde76215a 100644
--- a/mysql-test/r/replace.result
+++ b/mysql-test/r/replace.result
@@ -3,24 +3,26 @@ CREATE TABLE t1 (
gesuchnr int(11) DEFAULT '0' NOT NULL,
benutzer_id int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (gesuchnr,benutzer_id)
-) type=ISAM;
+) engine=ISAM;
replace into t1 (gesuchnr,benutzer_id) values (2,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
-alter table t1 type=myisam;
+alter table t1 engine=myisam;
replace into t1 (gesuchnr,benutzer_id) values (1,1);
-alter table t1 type=heap;
+alter table t1 engine=heap;
replace into t1 (gesuchnr,benutzer_id) values (1,1);
drop table t1;
-create table t1 (a tinyint not null auto_increment primary key, b char(20));
-insert into t1 values (126,"first"),(0,"last");
+create table t1 (a tinyint not null auto_increment primary key, b char(20) default "default_value");
+insert into t1 values (126,"first"),(63, "middle"),(0,"last");
insert into t1 values (0,"error");
-Duplicate entry '127' for key 1
+ERROR 23000: Duplicate entry '127' for key 1
replace into t1 values (0,"error");
-Duplicate entry '127' for key 1
+ERROR 23000: Duplicate entry '127' for key 1
replace into t1 values (126,"first updated");
+replace into t1 values (63,default);
select * from t1;
a b
126 first updated
+63 default_value
127 last
drop table t1;
diff --git a/mysql-test/r/rollback.result b/mysql-test/r/rollback.result
index a5eb6f8729f..e562b73c981 100644
--- a/mysql-test/r/rollback.result
+++ b/mysql-test/r/rollback.result
@@ -1,12 +1,29 @@
drop table if exists t1;
-create table t1 (n int not null primary key) type=myisam;
+create table t1 (n int not null primary key) engine=myisam;
begin work;
insert into t1 values (4);
insert into t1 values (5);
rollback;
-Warning: Some non-transactional changed tables couldn't be rolled back
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+select @@warning_count;
+@@warning_count
+1
+select @@error_count;
+@@error_count
+0
+show warnings;
+Level Code Message
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+show errors;
+Level Code Message
select * from t1;
n
4
5
+select @@warning_count;
+@@warning_count
+0
+show warnings;
+Level Code Message
drop table t1;
diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result
new file mode 100644
index 00000000000..76d6fa13766
--- /dev/null
+++ b/mysql-test/r/row.result
@@ -0,0 +1,172 @@
+drop table if exists t1;
+select (1,2,3) IN ((3,2,3), (1,2,3), (1,3,3));
+(1,2,3) IN ((3,2,3), (1,2,3), (1,3,3))
+1
+select row(10,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3));
+row(10,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3))
+0
+select row(1,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3));
+row(1,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3))
+1
+select row(10,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3));
+row(10,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3))
+0
+select row('a',1.5,3) IN (row(1,2,3), row('a',1.5,3), row('a','a','a'));
+row('a',1.5,3) IN (row(1,2,3), row('a',1.5,3), row('a','a','a'))
+1
+select row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3));
+row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3))
+1
+select row('a',0,3) IN (row(3,2,3), row('a','a','3'), row(1,3,3));
+row('a',0,3) IN (row(3,2,3), row('a','a','3'), row(1,3,3))
+1
+select row('a',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3));
+row('a',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3))
+1
+select row('b',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3));
+row('b',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3))
+0
+select row('b',1.5,3) IN (row('b',NULL,3), row('a',1.5,3), row(1,3,3));
+row('b',1.5,3) IN (row('b',NULL,3), row('a',1.5,3), row(1,3,3))
+NULL
+select row('b',1.5,3) IN (row('b',NULL,4), row('a',1.5,3), row(1,3,3));
+row('b',1.5,3) IN (row('b',NULL,4), row('a',1.5,3), row(1,3,3))
+0
+select (1,2,(3,4)) IN ((3,2,(3,4)), (1,2,(3,4)));
+(1,2,(3,4)) IN ((3,2,(3,4)), (1,2,(3,4)))
+1
+select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,4));
+ERROR 21000: Operand should contain 2 column(s)
+select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)));
+row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)))
+NULL
+explain extended select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)));
+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 ((1,2,(3,4)) in ((3,2,(3,4)),(1,2,(3,NULL)))) AS `row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)))`
+SELECT (1,2,3)=(0,NULL,3);
+(1,2,3)=(0,NULL,3)
+0
+SELECT (1,2,3)=(1,NULL,3);
+(1,2,3)=(1,NULL,3)
+NULL
+SELECT (1,2,3)=(1,NULL,0);
+(1,2,3)=(1,NULL,0)
+NULL
+SELECT ROW(1,2,3)=ROW(1,2,3);
+ROW(1,2,3)=ROW(1,2,3)
+1
+SELECT ROW(2,2,3)=ROW(1+1,2,3);
+ROW(2,2,3)=ROW(1+1,2,3)
+1
+SELECT ROW(1,2,3)=ROW(1+1,2,3);
+ROW(1,2,3)=ROW(1+1,2,3)
+0
+SELECT ROW(1,2,3)<ROW(1+1,2,3);
+ROW(1,2,3)<ROW(1+1,2,3)
+1
+SELECT ROW(1,2,3)>ROW(1+1,2,3);
+ROW(1,2,3)>ROW(1+1,2,3)
+0
+SELECT ROW(1,2,3)<=ROW(1+1,2,3);
+ROW(1,2,3)<=ROW(1+1,2,3)
+1
+SELECT ROW(1,2,3)>=ROW(1+1,2,3);
+ROW(1,2,3)>=ROW(1+1,2,3)
+0
+SELECT ROW(1,2,3)<>ROW(1+1,2,3);
+ROW(1,2,3)<>ROW(1+1,2,3)
+1
+SELECT ROW(NULL,2,3)=ROW(NULL,2,3);
+ROW(NULL,2,3)=ROW(NULL,2,3)
+NULL
+SELECT ROW(NULL,2,3)<=>ROW(NULL,2,3);
+ROW(NULL,2,3)<=>ROW(NULL,2,3)
+1
+SELECT ROW(1,2,ROW(3,4,5))=ROW(1,2,ROW(3,4,5));
+ROW(1,2,ROW(3,4,5))=ROW(1,2,ROW(3,4,5))
+1
+SELECT ROW('test',2,3.33)=ROW('test',2,3.33);
+ROW('test',2,3.33)=ROW('test',2,3.33)
+1
+SELECT ROW('test',2,3.33)=ROW('test',2,3.33,4);
+ERROR 21000: Operand should contain 3 column(s)
+SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,33));
+ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,33))
+1
+SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,3));
+ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,3))
+0
+SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,NULL));
+ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,NULL))
+NULL
+SELECT ROW('test',2,ROW(3,33))=ROW('test',2,4);
+ERROR 21000: Operand should contain 2 column(s)
+create table t1 ( a int, b int, c int);
+insert into t1 values (1,2,3), (2,3,1), (3,2,1), (1,2,NULL);
+select * from t1 where ROW(1,2,3)=ROW(a,b,c);
+a b c
+1 2 3
+select * from t1 where ROW(0,2,3)=ROW(a,b,c);
+a b c
+select * from t1 where ROW(1,2,3)<ROW(a,b,c);
+a b c
+2 3 1
+3 2 1
+select ROW(a,2,3) IN(row(1,b,c), row(2,3,1)) from t1;
+ROW(a,2,3) IN(row(1,b,c), row(2,3,1))
+1
+0
+0
+NULL
+select ROW(c,2,3) IN(row(1,b,a), row(2,3,1)) from t1;
+ROW(c,2,3) IN(row(1,b,a), row(2,3,1))
+0
+0
+1
+NULL
+select ROW(a,b,c) IN(row(1,2,3), row(3,2,1)) from t1;
+ROW(a,b,c) IN(row(1,2,3), row(3,2,1))
+1
+0
+1
+NULL
+select ROW(1,2,3) IN(row(a,b,c), row(1,2,3)) from t1;
+ROW(1,2,3) IN(row(a,b,c), row(1,2,3))
+1
+1
+1
+1
+drop table t1;
+select ROW(1,1);
+ERROR 21000: Operand should contain 1 column(s)
+create table t1 (i int);
+select 1 from t1 where ROW(1,1);
+ERROR 21000: Operand should contain 1 column(s)
+select count(*) from t1 order by ROW(1,1);
+ERROR 21000: Operand should contain 1 column(s)
+select count(*) from t1 having (1,1) order by i;
+ERROR 21000: Operand should contain 1 column(s)
+drop table t1;
+create table t1 (a int, b int);
+insert into t1 values (1, 4);
+insert into t1 values (10, 40);
+insert into t1 values (1, 4);
+insert into t1 values (10, 43);
+insert into t1 values (1, 4);
+insert into t1 values (10, 41);
+insert into t1 values (1, 4);
+insert into t1 values (10, 43);
+insert into t1 values (1, 4);
+select a, MAX(b), (1, MAX(b)) = (1, 4) from t1 group by a;
+a MAX(b) (1, MAX(b)) = (1, 4)
+1 4 1
+10 43 0
+drop table t1;
+SELECT ROW(2,10) <=> ROW(3,4);
+ROW(2,10) <=> ROW(3,4)
+0
+SELECT ROW(NULL,10) <=> ROW(3,NULL);
+ROW(NULL,10) <=> ROW(3,NULL)
+0
diff --git a/mysql-test/r/rpl000001.result b/mysql-test/r/rpl000001.result
index f3b52b43b19..eef986d8f8c 100644
--- a/mysql-test/r/rpl000001.result
+++ b/mysql-test/r/rpl000001.result
@@ -1,10 +1,9 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
-drop table if exists t1,t2,t3;
+start slave;
create table t1 (word char(20) not null);
load data infile '../../std_data/words.dat' into table t1;
load data local infile 'MYSQL_TEST_DIR/std_data/words.dat' into table t1;
@@ -20,9 +19,9 @@ abandoned
abandoning
abandonment
abandons
-slave stop;
+stop slave;
set password for root@"localhost" = password('foo');
-slave start;
+start slave;
set password for root@"localhost" = password('');
create table t3(n int);
insert into t3 values(1),(2);
@@ -35,16 +34,26 @@ sum(length(word))
1022
drop table t1,t3;
reset master;
-slave stop;
+stop slave;
reset slave;
create table t1(n int);
select get_lock("hold_slave",10);
get_lock("hold_slave",10)
1
-slave start;
+explain extended select get_lock("hold_slave",10);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select sql_no_cache get_lock(_latin1'hold_slave',10) AS `get_lock("hold_slave",10)`
+start slave;
select release_lock("hold_slave");
release_lock("hold_slave")
1
+explain extended select release_lock("hold_slave");
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select sql_no_cache release_lock(_latin1'hold_slave') AS `release_lock("hold_slave")`
unlock tables;
create table t2(id int);
insert into t2 values(connection_id());
@@ -56,9 +65,9 @@ select (@id := id) - id from t2;
0
kill @id;
drop table t2;
-Server shutdown in progress
+ERROR 08S01: Server shutdown in progress
set global sql_slave_skip_counter=1;
-slave start;
+start slave;
select count(*) from t1;
count(*)
5000
@@ -67,17 +76,17 @@ create table t1 (n int);
insert into t1 values(3456);
insert into mysql.user (Host, User, Password)
VALUES ("10.10.10.%", "blafasel2", password("blafasel2"));
-select select_priv,user from mysql.user where user = 'blafasel2';
+select select_priv,user from mysql.user where user = _binary'blafasel2';
select_priv user
N blafasel2
-update mysql.user set Select_priv = "Y" where User="blafasel2";
-select select_priv,user from mysql.user where user = 'blafasel2';
+update mysql.user set Select_priv = "Y" where User= _binary"blafasel2";
+select select_priv,user from mysql.user where user = _binary'blafasel2';
select_priv user
Y blafasel2
select n from t1;
n
3456
-select select_priv,user from mysql.user where user = 'blafasel2';
+select select_priv,user from mysql.user where user = _binary'blafasel2';
select_priv user
Y blafasel2
drop table t1;
diff --git a/mysql-test/r/rpl000002.result b/mysql-test/r/rpl000002.result
index 4c2b3bdfde6..e5e661795fe 100644
--- a/mysql-test/r/rpl000002.result
+++ b/mysql-test/r/rpl000002.result
@@ -1,10 +1,9 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
-drop table if exists t1;
+start slave;
create table t1 (n int auto_increment primary key);
set insert_id = 2000;
insert into t1 values (NULL),(NULL),(NULL);
@@ -17,16 +16,31 @@ show slave hosts;
Server_id Host Port Rpl_recovery_rank Master_id
2 127.0.0.1 9999 2 1
drop table t1;
-slave stop;
-drop table if exists t2;
+stop slave;
create table t2(id int auto_increment primary key, created datetime);
set timestamp=12345;
insert into t2 set created=now();
select * from t2;
id created
1 1970-01-01 06:25:45
-slave start;
+create table t3 like t2;
+create temporary table t4 like t2;
+create table t5 select * from t4;
+start slave;
select * from t2;
id created
1 1970-01-01 06:25:45
-drop table t2;
+show create table t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `id` int(11) NOT NULL auto_increment,
+ `created` datetime default NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+show create table t5;
+Table Create Table
+t5 CREATE TABLE `t5` (
+ `id` int(11) NOT NULL default '0',
+ `created` datetime default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t2,t3,t5;
diff --git a/mysql-test/r/rpl000003.result b/mysql-test/r/rpl000003.result
deleted file mode 100644
index b123b3d98c5..00000000000
--- a/mysql-test/r/rpl000003.result
+++ /dev/null
@@ -1,17 +0,0 @@
-slave stop;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
-drop table if exists t1;
-create table t1(n int primary key);
-insert into t1 values (1),(2),(2);
-Duplicate entry '2' for key 1
-insert into t1 values (3);
-select * from t1;
-n
-1
-2
-3
-drop table t1;
diff --git a/mysql-test/r/rpl000004.result b/mysql-test/r/rpl000004.result
index 3142adc50d6..9abb4db7974 100644
--- a/mysql-test/r/rpl000004.result
+++ b/mysql-test/r/rpl000004.result
@@ -1,22 +1,17 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
set SQL_LOG_BIN=0;
-drop table if exists t1;
create table t1 (word char(20) not null, index(word));
load data infile '../../std_data/words.dat' into table t1;
-drop table if exists t2;
create table t2 (word char(20) not null);
load data infile '../../std_data/words.dat' into table t2;
create table t3 (word char(20) not null primary key);
-drop table if exists t1;
load table t1 from master;
-drop table if exists t2;
load table t2 from master;
-drop table if exists t3;
load table t3 from master;
check table t1;
Table Op Msg_type Msg_text
diff --git a/mysql-test/r/rpl000005.result b/mysql-test/r/rpl000005.result
index 3e9028bf2cf..0202e43dcb2 100644
--- a/mysql-test/r/rpl000005.result
+++ b/mysql-test/r/rpl000005.result
@@ -1,10 +1,9 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
-drop table if exists t1;
+start slave;
CREATE TABLE t1 (name varchar(64), age smallint(3));
INSERT INTO t1 SET name='Andy', age=31;
INSERT t1 SET name='Jacob', age=2;
diff --git a/mysql-test/r/rpl000006.result b/mysql-test/r/rpl000006.result
index e7fc5151ac4..e4c2006c2f0 100644
--- a/mysql-test/r/rpl000006.result
+++ b/mysql-test/r/rpl000006.result
@@ -1,17 +1,15 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
set SQL_LOG_BIN=0,timestamp=200006;
-drop table if exists t1;
create table t1(t timestamp not null,a char(1));
insert into t1 ( a) values ('F');
select unix_timestamp(t) from t1;
unix_timestamp(t)
200006
-drop table if exists t1;
load table t1 from master;
select unix_timestamp(t) from t1;
unix_timestamp(t)
@@ -21,7 +19,7 @@ drop table t1;
set SQL_LOG_BIN=0;
CREATE TABLE t1 (
a int not null
-) TYPE=MyISAM MAX_ROWS=4000 CHECKSUM=1;
+) ENGINE=MyISAM MAX_ROWS=4000 CHECKSUM=1;
INSERT INTO t1 VALUES (1);
load table t1 from master;
check table t1;
diff --git a/mysql-test/r/rpl000008.result b/mysql-test/r/rpl000008.result
index a0230d55702..a88a3c690ed 100644
--- a/mysql-test/r/rpl000008.result
+++ b/mysql-test/r/rpl000008.result
@@ -1,25 +1,23 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
use test;
-drop table if exists foo;
-create table foo (n int);
-insert into foo values(4);
+drop table if exists mysqltest_foo;
+drop table if exists mysqltest_bar;
+create table mysqltest_foo (n int);
+insert into mysqltest_foo values(4);
use test;
-drop table if exists foo;
-create table foo (n int);
-insert into foo values(5);
-drop table if exists bar;
-create table bar (m int);
-insert into bar values(15);
-drop table if exists choo;
-create table choo (k int);
-insert into choo values(55);
-select foo.n,bar.m,choo.k from foo,bar,choo;
+create table mysqltest_foo (n int);
+insert into mysqltest_foo values(5);
+create table mysqltest_bar (m int);
+insert into mysqltest_bar values(15);
+create table t1 (k int);
+insert into t1 values(55);
+select mysqltest_foo.n,mysqltest_bar.m,t1.k from mysqltest_foo,mysqltest_bar,t1;
n m k
4 15 55
-drop table if exists foo,bar,choo;
-drop table if exists foo,bar,choo;
+drop table mysqltest_foo,mysqltest_bar,t1;
+drop table mysqltest_foo,mysqltest_bar,t1;
diff --git a/mysql-test/r/rpl000009.result b/mysql-test/r/rpl000009.result
index a4611cf7d42..bb82dcb1e6a 100644
--- a/mysql-test/r/rpl000009.result
+++ b/mysql-test/r/rpl000009.result
@@ -1,133 +1,136 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
-drop database if exists foo;
-create database foo;
-drop database if exists bar;
-create database bar;
-create database foo;
-drop table if exists foo.foo;
-create table foo.foo (n int);
-insert into foo.foo values(4);
-drop table if exists foo.foo;
-create table foo.foo (n int);
-insert into foo.foo values(5);
-drop table if exists bar.bar;
-create table bar.bar (m int);
-insert into bar.bar values(15);
-select foo.foo.n,bar.bar.m from foo.foo,bar.bar;
+start slave;
+drop database if exists mysqltest;
+drop database if exists mysqltest2;
+drop database if exists mysqltest3;
+drop database if exists mysqltest;
+drop database if exists mysqltest2;
+drop database if exists mysqltest3;
+create database mysqltest2;
+create database mysqltest;
+create database mysqltest2;
+create table mysqltest2.foo (n int);
+insert into mysqltest2.foo values(4);
+create table mysqltest2.foo (n int);
+insert into mysqltest2.foo values(5);
+create table mysqltest.bar (m int);
+insert into mysqltest.bar values(15);
+select mysqltest2.foo.n,mysqltest.bar.m from mysqltest2.foo,mysqltest.bar;
n m
4 15
-drop database bar;
-drop database if exists foo;
-drop database bar;
-Can't drop database 'bar'. Database doesn't exist
-drop database foo;
+drop database mysqltest;
+drop database if exists mysqltest2;
+drop database mysqltest;
+ERROR HY000: Can't drop database 'mysqltest'; database doesn't exist
+drop database mysqltest2;
set sql_log_bin = 0;
-create database foo;
-create database bar;
+create database mysqltest2;
+create database mysqltest;
show databases;
Database
-bar
-foo
mysql
+mysqltest
+mysqltest2
test
-create table foo.t1(n int, s char(20));
-create table foo.t2(n int, s text);
-insert into foo.t1 values (1, 'one'), (2, 'two'), (3, 'three');
-insert into foo.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen');
-create table bar.t1(n int, s char(20));
-create table bar.t2(n int, s text);
-insert into bar.t1 values (1, 'one bar'), (2, 'two bar'), (3, 'three bar');
-insert into bar.t2 values (11, 'eleven bar'), (12, 'twelve bar'),
-(13, 'thirteen bar');
+create table mysqltest2.t1(n int, s char(20));
+create table mysqltest2.t2(n int, s text);
+insert into mysqltest2.t1 values (1, 'one'), (2, 'two'), (3, 'three');
+insert into mysqltest2.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen');
+create table mysqltest.t1(n int, s char(20));
+create table mysqltest.t2(n int, s text);
+insert into mysqltest.t1 values (1, 'one test'), (2, 'two test'), (3, 'three test');
+insert into mysqltest.t2 values (11, 'eleven test'), (12, 'twelve test'),
+(13, 'thirteen test');
set sql_log_bin = 1;
show databases;
Database
mysql
test
-create database foo;
-create table foo.t1(n int, s char(20));
-insert into foo.t1 values (1, 'original foo.t1');
-create table foo.t3(n int, s char(20));
-insert into foo.t3 values (1, 'original foo.t3');
-create database foo2;
-create table foo2.t1(n int, s char(20));
-insert into foo2.t1 values (1, 'original foo2.t1');
-create database bar;
-create table bar.t1(n int, s char(20));
-insert into bar.t1 values (1, 'original bar.t1');
-create table bar.t3(n int, s char(20));
-insert into bar.t3 values (1, 'original bar.t3');
+create database mysqltest2;
+create table mysqltest2.t1(n int, s char(20));
+insert into mysqltest2.t1 values (1, 'original foo.t1');
+create table mysqltest2.t3(n int, s char(20));
+insert into mysqltest2.t3 values (1, 'original foo.t3');
+create database mysqltest3;
+create table mysqltest3.t1(n int, s char(20));
+insert into mysqltest3.t1 values (1, 'original foo2.t1');
+create database mysqltest;
+create table mysqltest.t1(n int, s char(20));
+insert into mysqltest.t1 values (1, 'original bar.t1');
+create table mysqltest.t3(n int, s char(20));
+insert into mysqltest.t3 values (1, 'original bar.t3');
load data from master;
show databases;
Database
-bar
-foo
-foo2
mysql
+mysqltest
+mysqltest2
+mysqltest3
test
-use foo;
+use mysqltest2;
show tables;
-Tables_in_foo
+Tables_in_mysqltest2
t1
t3
select * from t1;
n s
1 original foo.t1
-use foo2;
+use mysqltest3;
show tables;
-Tables_in_foo2
+Tables_in_mysqltest3
t1
select * from t1;
n s
1 original foo2.t1
-use bar;
+use mysqltest;
show tables;
-Tables_in_bar
+Tables_in_mysqltest
t1
t2
t3
-select * from bar.t1;
+select * from mysqltest.t1;
n s
-1 one bar
-2 two bar
-3 three bar
-select * from bar.t2;
+1 one test
+2 two test
+3 three test
+select * from mysqltest.t2;
n s
-11 eleven bar
-12 twelve bar
-13 thirteen bar
-select * from bar.t3;
+11 eleven test
+12 twelve test
+13 thirteen test
+select * from mysqltest.t3;
n s
1 original bar.t3
-insert into bar.t1 values (4, 'four bar');
-select * from bar.t1;
+insert into mysqltest.t1 values (4, 'four test');
+select * from mysqltest.t1;
n s
-1 one bar
-2 two bar
-3 three bar
-4 four bar
+1 one test
+2 two test
+3 three test
+4 four test
stop slave;
reset slave;
load data from master;
start slave;
-insert into bar.t1 values (5, 'five bar');
-select * from bar.t1;
+insert into mysqltest.t1 values (5, 'five bar');
+select * from mysqltest.t1;
n s
-1 one bar
-2 two bar
-3 three bar
-4 four bar
+1 one test
+2 two test
+3 three test
+4 four test
5 five bar
+load table mysqltest.t1 from master;
+ERROR 42S01: Table 't1' already exists
+drop table mysqltest.t1;
+load table mysqltest.t1 from master;
load table bar.t1 from master;
-Table 't1' already exists
-drop table bar.t1;
-load table bar.t1 from master;
-drop database bar;
-drop database foo;
-drop database foo;
-drop database foo2;
+ERROR HY000: Error from master: 'Table 'bar.t1' doesn't exist'
+drop database mysqltest;
+drop database mysqltest2;
+drop database mysqltest2;
+drop database mysqltest3;
diff --git a/mysql-test/r/rpl000010.result b/mysql-test/r/rpl000010.result
index 49538ed148e..65191ea411f 100644
--- a/mysql-test/r/rpl000010.result
+++ b/mysql-test/r/rpl000010.result
@@ -1,11 +1,9 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
-drop table if exists t1;
-drop table if exists t1;
+start slave;
create table t1 (n int not null auto_increment primary key);
insert into t1 values(NULL);
insert into t1 values(2);
diff --git a/mysql-test/r/rpl000011.result b/mysql-test/r/rpl000011.result
index 5d22c29bdba..dd0fa2fbe74 100644
--- a/mysql-test/r/rpl000011.result
+++ b/mysql-test/r/rpl000011.result
@@ -1,14 +1,13 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
-drop table if exists t1;
+start slave;
create table t1 (n int);
insert into t1 values(1);
-slave stop;
-slave start;
+stop slave;
+start slave;
insert into t1 values(2);
select * from t1;
n
diff --git a/mysql-test/r/rpl000012.result b/mysql-test/r/rpl000012.result
index 45de6502bbd..17fb53010ab 100644
--- a/mysql-test/r/rpl000012.result
+++ b/mysql-test/r/rpl000012.result
@@ -1,21 +1,19 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
-drop table if exists t1,t2,t3;
+start slave;
create table t2 (n int);
create temporary table t1 (n int);
insert into t1 values(1),(2),(3);
insert into t2 select * from t1;
-drop table if exists test.t3;
-create temporary table test.t3 (n int not null);
-alter table test.t3 add primary key(n);
+create temporary table t3 (n int not null);
+alter table t3 add primary key(n);
flush logs;
insert into t3 values (100);
insert into t2 select * from t3;
-drop table if exists test.t3;
+drop table if exists t3;
insert into t2 values (101);
create temporary table t1 (n int);
insert into t1 values (4),(5);
@@ -35,3 +33,5 @@ show status like 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 0
drop table if exists t1,t2;
+Warnings:
+Note 1051 Unknown table 't1'
diff --git a/mysql-test/r/rpl000013.result b/mysql-test/r/rpl000013.result
index 9e802da59c5..37838bb88e0 100644
--- a/mysql-test/r/rpl000013.result
+++ b/mysql-test/r/rpl000013.result
@@ -1,10 +1,9 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
-drop table if exists t2;
+start slave;
create table t2(n int);
create temporary table t1 (n int);
insert into t1 values(1),(2),(3);
@@ -25,3 +24,5 @@ show status like 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 0
drop table if exists t1,t2;
+Warnings:
+Note 1051 Unknown table 't1'
diff --git a/mysql-test/r/rpl000015.result b/mysql-test/r/rpl000015.result
index 7010349e5ff..8cbbe3ab0e8 100644
--- a/mysql-test/r/rpl000015.result
+++ b/mysql-test/r/rpl000015.result
@@ -1,23 +1,23 @@
reset master;
show master status;
-File Position Binlog_do_db Binlog_ignore_db
-master-bin.001 79
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 79
reset slave;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
change master to master_host='127.0.0.1';
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 test MASTER_PORT 7 4 slave-relay-bin.001 4 No No 0 0 0 4
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 test MASTER_PORT 7 4 slave-relay-bin.000001 4 No No 0 0 0 4 None 0 No #
change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=MASTER_PORT;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 7 4 slave-relay-bin.001 4 No No 0 0 0 4
-slave start;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 7 4 slave-relay-bin.000001 4 No No 0 0 0 4 None 0 No #
+start slave;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 7 master-bin.001 79 slave-relay-bin.001 120 master-bin.001 Yes Yes 0 0 79 120
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 7 master-bin.000001 79 slave-relay-bin.000001 123 master-bin.000001 Yes Yes 0 0 79 123 None 0 No #
drop table if exists t1;
create table t1 (n int);
insert into t1 values (10),(45),(90);
diff --git a/mysql-test/r/rpl000017.result b/mysql-test/r/rpl000017.result
index bac0573165d..64e13042e9c 100644
--- a/mysql-test/r/rpl000017.result
+++ b/mysql-test/r/rpl000017.result
@@ -1,7 +1,7 @@
reset master;
grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab';
grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaaaaaab';
-slave start;
+start slave;
drop table if exists t1;
create table t1(n int);
insert into t1 values(24);
diff --git a/mysql-test/r/rpl000018.result b/mysql-test/r/rpl000018.result
index 282c1e492a1..b71f6492b97 100644
--- a/mysql-test/r/rpl000018.result
+++ b/mysql-test/r/rpl000018.result
@@ -1,10 +1,10 @@
reset master;
reset slave;
-slave start;
-show master logs;
+start slave;
+show binary logs;
Log_name
-master-bin.001
-master-bin.002
+master-bin.000001
+master-bin.000002
drop table if exists t1;
create table t1(n int);
insert into t1 values (3351);
diff --git a/mysql-test/r/rpl_EE_error.result b/mysql-test/r/rpl_EE_error.result
index a5043250df6..49ad4832c81 100644
--- a/mysql-test/r/rpl_EE_error.result
+++ b/mysql-test/r/rpl_EE_error.result
@@ -1,16 +1,16 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
-create table t1 (a int) type=myisam;
+start slave;
+create table t1 (a int) engine=myisam;
flush tables;
drop table t1;
-create table t1 (a int, unique(a)) type=myisam;
+create table t1 (a int, unique(a)) engine=myisam;
set sql_log_bin=0;
insert into t1 values(2);
set sql_log_bin=1;
insert into t1 values(1),(2);
-Duplicate entry '2' for key 1
+ERROR 23000: Duplicate entry '2' for key 1
drop table t1;
diff --git a/mysql-test/r/rpl_alter.result b/mysql-test/r/rpl_alter.result
index 729c7df6808..6ef5ce3462a 100644
--- a/mysql-test/r/rpl_alter.result
+++ b/mysql-test/r/rpl_alter.result
@@ -1,21 +1,21 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
-drop database if exists test_$1;
-create database test_$1;
-create table test_$1.t1 ( n int);
-alter table test_$1.t1 add m int;
-insert into test_$1.t1 values (1,2);
-create table test_$1.t2 (n int);
-insert into test_$1.t2 values (45);
-rename table test_$1.t2 to test_$1.t3, test_$1.t1 to test_$1.t2;
-select * from test_$1.t2;
+start slave;
+drop database if exists mysqltest;
+create database mysqltest;
+create table mysqltest.t1 ( n int);
+alter table mysqltest.t1 add m int;
+insert into mysqltest.t1 values (1,2);
+create table mysqltest.t2 (n int);
+insert into mysqltest.t2 values (45);
+rename table mysqltest.t2 to mysqltest.t3, mysqltest.t1 to mysqltest.t2;
+select * from mysqltest.t2;
n m
1 2
-select * from test_$1.t3;
+select * from mysqltest.t3;
n
45
-drop database test_$1;
+drop database mysqltest;
diff --git a/mysql-test/r/rpl_change_master.result b/mysql-test/r/rpl_change_master.result
index 966f07af9d5..a6342d47b49 100644
--- a/mysql-test/r/rpl_change_master.result
+++ b/mysql-test/r/rpl_change_master.result
@@ -1,9 +1,9 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
select get_lock("a",5);
get_lock("a",5)
1
@@ -15,12 +15,12 @@ select * from t1;
n
1
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_MYPORT 1 master-bin.001 273 slave-relay-bin.002 255 master-bin.001 No No 0 0 214 314
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 273 slave-relay-bin.000002 258 master-bin.000001 No No 0 0 214 317 None 0 No #
change master to master_user='root';
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_MYPORT 1 master-bin.001 214 slave-relay-bin.001 4 master-bin.001 No No 0 0 214 4
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 214 slave-relay-bin.000001 4 master-bin.000001 No No 0 0 214 4 None 0 No #
select release_lock("a");
release_lock("a")
1
diff --git a/mysql-test/r/rpl_charset.result b/mysql-test/r/rpl_charset.result
new file mode 100644
index 00000000000..cab41344238
--- /dev/null
+++ b/mysql-test/r/rpl_charset.result
@@ -0,0 +1,209 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists mysqltest2;
+drop database if exists mysqltest3;
+create database mysqltest2 character set latin2;
+set @@character_set_server=latin5;
+create database mysqltest3;
+
+--- --master--
+show create database mysqltest2;
+Database Create Database
+mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 */
+show create database mysqltest3;
+Database Create Database
+mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET latin5 */
+
+--- --slave--
+show create database mysqltest2;
+Database Create Database
+mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 */
+show create database mysqltest3;
+Database Create Database
+mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET latin5 */
+set @@collation_server=armscii8_bin;
+drop database mysqltest3;
+create database mysqltest3;
+
+--- --master--
+show create database mysqltest3;
+Database Create Database
+mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii8_bin */
+
+--- --slave--
+show create database mysqltest3;
+Database Create Database
+mysqltest3 CREATE DATABASE `mysqltest3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii8_bin */
+use mysqltest2;
+create table t1 (a int auto_increment primary key, b varchar(100));
+set character_set_client=cp850, collation_connection=latin2_croatian_ci;
+insert into t1 (b) values(@@character_set_server);
+insert into t1 (b) values(@@collation_server);
+insert into t1 (b) values(@@character_set_client);
+insert into t1 (b) values(@@character_set_connection);
+insert into t1 (b) values(@@collation_connection);
+
+--- --master--
+select * from t1 order by a;
+a b
+1 armscii8
+2 armscii8_bin
+3 cp850
+4 latin2
+5 latin2_croatian_ci
+
+--- --slave--
+select * from mysqltest2.t1 order by a;
+a b
+1 armscii8
+2 armscii8_bin
+3 cp850
+4 latin2
+5 latin2_croatian_ci
+set character_set_client=latin1, collation_connection=latin1_german1_ci;
+truncate table t1;
+insert into t1 (b) values(@@collation_connection);
+insert into t1 (b) values(LEAST("Müller","Muffler"));
+set collation_connection=latin1_german2_ci;
+insert into t1 (b) values(@@collation_connection);
+insert into t1 (b) values(LEAST("Müller","Muffler"));
+
+--- --master--
+select * from t1 order by a;
+a b
+1 latin1_german1_ci
+2 Muffler
+3 latin1_german2_ci
+4 Müller
+
+--- --slave--
+select * from mysqltest2.t1 order by a;
+a b
+1 latin1_german1_ci
+2 Muffler
+3 latin1_german2_ci
+4 Müller
+load data infile '../../std_data/words.dat' into table t1 (b);
+set @a= _cp850 'Müller' collate cp850_general_ci;
+truncate table t1;
+insert into t1 (b) values(collation(@a));
+
+--- --master--
+select * from t1 order by a;
+a b
+1 cp850_general_ci
+
+--- --slave--
+select * from mysqltest2.t1 order by a;
+a b
+1 cp850_general_ci
+drop database mysqltest2;
+drop database mysqltest3;
+show binlog events from 79;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 79 Query 1 79 drop database if exists mysqltest2
+master-bin.000001 154 Query 1 154 drop database if exists mysqltest3
+master-bin.000001 229 Query 1 229 create database mysqltest2 character set latin2
+master-bin.000001 317 Query 1 317 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=30
+master-bin.000001 451 Query 1 451 create database mysqltest3
+master-bin.000001 518 Query 1 518 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64
+master-bin.000001 652 Query 1 652 drop database mysqltest3
+master-bin.000001 717 Query 1 717 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64
+master-bin.000001 851 Query 1 851 create database mysqltest3
+master-bin.000001 918 Query 1 918 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 1058 Query 1 1058 use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100))
+master-bin.000001 1165 Query 1 1165 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 1306 Intvar 1 1306 INSERT_ID=1
+master-bin.000001 1334 Query 1 1334 use `mysqltest2`; insert into t1 (b) values(@@character_set_server)
+master-bin.000001 1424 Query 1 1424 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 1565 Intvar 1 1565 INSERT_ID=2
+master-bin.000001 1593 Query 1 1593 use `mysqltest2`; insert into t1 (b) values(@@collation_server)
+master-bin.000001 1679 Query 1 1679 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 1820 Intvar 1 1820 INSERT_ID=3
+master-bin.000001 1848 Query 1 1848 use `mysqltest2`; insert into t1 (b) values(@@character_set_client)
+master-bin.000001 1938 Query 1 1938 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 2079 Intvar 1 2079 INSERT_ID=4
+master-bin.000001 2107 Query 1 2107 use `mysqltest2`; insert into t1 (b) values(@@character_set_connection)
+master-bin.000001 2201 Query 1 2201 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 2342 Intvar 1 2342 INSERT_ID=5
+master-bin.000001 2370 Query 1 2370 use `mysqltest2`; insert into t1 (b) values(@@collation_connection)
+master-bin.000001 2460 Query 1 2460 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 2600 Query 1 2600 use `mysqltest2`; truncate table t1
+master-bin.000001 2658 Query 1 2658 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 2798 Intvar 1 2798 INSERT_ID=1
+master-bin.000001 2826 Query 1 2826 use `mysqltest2`; insert into t1 (b) values(@@collation_connection)
+master-bin.000001 2916 Query 1 2916 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 3056 Intvar 1 3056 INSERT_ID=2
+master-bin.000001 3084 Query 1 3084 use `mysqltest2`; insert into t1 (b) values(LEAST("Müller","Muffler"))
+master-bin.000001 3177 Query 1 3177 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 3318 Intvar 1 3318 INSERT_ID=3
+master-bin.000001 3346 Query 1 3346 use `mysqltest2`; insert into t1 (b) values(@@collation_connection)
+master-bin.000001 3436 Query 1 3436 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 3577 Intvar 1 3577 INSERT_ID=4
+master-bin.000001 3605 Query 1 3605 use `mysqltest2`; insert into t1 (b) values(LEAST("Müller","Muffler"))
+master-bin.000001 3698 Query 1 3698 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 3839 Intvar 1 3839 INSERT_ID=74
+master-bin.000001 3867 Create_file 1 3867 db=mysqltest2;table=t1;file_id=1;block_len=581
+master-bin.000001 4540 Query 1 4540 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 4681 Intvar 1 4681 INSERT_ID=5
+master-bin.000001 4709 Exec_load 1 4709 ;file_id=1
+master-bin.000001 4732 Query 1 4732 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 4873 Query 1 4873 use `mysqltest2`; truncate table t1
+master-bin.000001 4931 Query 1 4931 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 5072 Intvar 1 5072 INSERT_ID=1
+master-bin.000001 5100 User var 1 5100 @`a`=_cp850 0x4DFC6C6C6572 COLLATE cp850_general_ci
+master-bin.000001 5140 Query 1 5140 use `mysqltest2`; insert into t1 (b) values(collation(@a))
+master-bin.000001 5221 Query 1 5221 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 5362 Query 1 5362 drop database mysqltest2
+master-bin.000001 5427 Query 1 5427 SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 5558 Query 1 5558 drop database mysqltest3
+set global character_set_server=latin2;
+ERROR HY000: Binary logging and replication forbid changing the global server character set or collation
+set global character_set_server=latin2;
+ERROR HY000: Binary logging and replication forbid changing the global server character set or collation
+set one_shot @@character_set_server=latin5;
+set @@max_join_size=1000;
+select @@character_set_server;
+@@character_set_server
+latin5
+select @@character_set_server;
+@@character_set_server
+latin1
+set @@character_set_server=latin5;
+select @@character_set_server;
+@@character_set_server
+latin5
+select @@character_set_server;
+@@character_set_server
+latin5
+set one_shot max_join_size=10;
+ERROR HY000: The SET ONE_SHOT syntax is reserved for purposes internal to the MySQL server
+set character_set_client=9999999;
+ERROR 42000: Unknown character set: '9999999'
+set collation_server=9999998;
+ERROR HY000: Unknown collation: '9999998'
+use test;
+CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255));
+SET CHARACTER_SET_CLIENT=koi8r,
+CHARACTER_SET_CONNECTION=cp1251,
+CHARACTER_SET_RESULTS=koi8r;
+INSERT INTO t1 (c1, c2) VALUES ('îÕ, ÚÁ ÒÙÂÁÌËÕ','îÕ, ÚÁ ÒÙÂÁÌËÕ');
+select hex(c1), hex(c2) from t1;
+hex(c1) hex(c2)
+CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
+select hex(c1), hex(c2) from t1;
+hex(c1) hex(c2)
+CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
+stop slave;
+delete from t1;
+change master to master_log_pos=5847;
+start slave until master_log_file='master-bin.000001', master_log_pos=5983;
+start slave;
+select hex(c1), hex(c2) from t1;
+hex(c1) hex(c2)
+CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
+drop table t1;
diff --git a/mysql-test/r/rpl_commit_after_flush.result b/mysql-test/r/rpl_commit_after_flush.result
index 8cdc7e986ab..d3aba779219 100644
--- a/mysql-test/r/rpl_commit_after_flush.result
+++ b/mysql-test/r/rpl_commit_after_flush.result
@@ -1,10 +1,10 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
-create table t1 (a int) type=innodb;
+start slave;
+create table t1 (a int) engine=innodb;
begin;
insert into t1 values(1);
flush tables with read lock;
diff --git a/mysql-test/r/rpl_create_database.result b/mysql-test/r/rpl_create_database.result
new file mode 100644
index 00000000000..2375e13bb5c
--- /dev/null
+++ b/mysql-test/r/rpl_create_database.result
@@ -0,0 +1,83 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP DATABASE IF EXISTS mysqltest_prometheus;
+DROP DATABASE IF EXISTS mysqltest_sisyfos;
+DROP DATABASE IF EXISTS mysqltest_bob;
+DROP DATABASE IF EXISTS mysqltest_bob;
+CREATE DATABASE mysqltest_prometheus;
+CREATE DATABASE mysqltest_sisyfos;
+CREATE DATABASE mysqltest_bob;
+USE mysqltest_sisyfos;
+CREATE TABLE t1 (b int);
+INSERT INTO t1 VALUES(1);
+USE mysqltest_bob;
+CREATE TABLE t2 (b int);
+INSERT INTO t2 VALUES(2);
+ALTER DATABASE mysqltest_sisyfos CHARACTER SET latin1;
+USE mysqltest_sisyfos;
+ALTER DATABASE mysqltest_bob CHARACTER SET latin1;
+SHOW DATABASES;
+Database
+mysql
+mysqltest_bob
+mysqltest_prometheus
+mysqltest_sisyfos
+test
+SHOW DATABASES;
+Database
+mysql
+mysqltest_prometheus
+mysqltest_sisyfos
+test
+DROP DATABASE IF EXISTS mysqltest_sisyfos;
+USE mysqltest_prometheus;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1);
+CREATE DATABASE mysqltest_sisyfos;
+USE mysqltest_sisyfos;
+CREATE TABLE t2 (a INT);
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
+master-bin.000001 79 Query 1 79 DROP DATABASE IF EXISTS mysqltest_prometheus
+master-bin.000001 174 Query 1 174 DROP DATABASE IF EXISTS mysqltest_sisyfos
+master-bin.000001 263 Query 1 263 CREATE DATABASE mysqltest_prometheus
+master-bin.000001 350 Query 1 350 CREATE DATABASE mysqltest_sisyfos
+master-bin.000001 431 Query 1 431 use `mysqltest_sisyfos`; CREATE TABLE t1 (b int)
+master-bin.000001 502 Query 1 502 use `mysqltest_sisyfos`; INSERT INTO t1 VALUES(1)
+master-bin.000001 574 Query 1 574 ALTER DATABASE mysqltest_sisyfos CHARACTER SET latin1
+master-bin.000001 675 Query 1 675 DROP DATABASE IF EXISTS mysqltest_sisyfos
+master-bin.000001 764 Query 1 764 use `mysqltest_prometheus`; CREATE TABLE t1 (a INT)
+master-bin.000001 838 Query 1 838 use `mysqltest_prometheus`; INSERT INTO t1 VALUES (1)
+master-bin.000001 914 Query 1 914 CREATE DATABASE mysqltest_sisyfos
+master-bin.000001 995 Query 1 995 use `mysqltest_sisyfos`; CREATE TABLE t2 (a INT)
+SHOW DATABASES;
+Database
+mysql
+mysqltest_bob
+mysqltest_prometheus
+mysqltest_sisyfos
+test
+SHOW DATABASES;
+Database
+mysql
+mysqltest_prometheus
+mysqltest_sisyfos
+test
+SHOW CREATE TABLE mysqltest_prometheus.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW CREATE TABLE mysqltest_sisyfos.t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP DATABASE IF EXISTS mysqltest_prometheus;
+DROP DATABASE IF EXISTS mysqltest_sisyfos;
+DROP DATABASE IF EXISTS mysqltest_bob;
diff --git a/mysql-test/r/rpl_delete_all.result b/mysql-test/r/rpl_delete_all.result
new file mode 100644
index 00000000000..5ed221823e8
--- /dev/null
+++ b/mysql-test/r/rpl_delete_all.result
@@ -0,0 +1,31 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create database mysqltest;
+drop database if exists mysqltest;
+Warnings:
+Note 1008 Can't drop database 'mysqltest'; database doesn't exist
+show tables from mysqltest;
+ERROR HY000: Can't read dir of './mysqltest/' (Errcode: X)
+create table t1 (a int);
+drop table if exists t1;
+Warnings:
+Note 1051 Unknown table 't1'
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+create table t1 (a int);
+insert into t1 values(1);
+delete from t1;
+select * from t1;
+a
+insert into t1 values(1);
+insert into t1 values(2);
+update t1 set a=2;
+select * from t1;
+a
+2
+2
+drop table t1;
diff --git a/mysql-test/r/rpl_do_grant.result b/mysql-test/r/rpl_do_grant.result
index fec935ae7ac..ff3e059503c 100644
--- a/mysql-test/r/rpl_do_grant.result
+++ b/mysql-test/r/rpl_do_grant.result
@@ -1,14 +1,14 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
-delete from mysql.user where user='rpl_do_grant';
-delete from mysql.db where user='rpl_do_grant';
+start slave;
+delete from mysql.user where user=_binary'rpl_do_grant';
+delete from mysql.db where user=_binary'rpl_do_grant';
flush privileges;
-delete from mysql.user where user='rpl_ignore_grant';
-delete from mysql.db where user='rpl_ignore_grant';
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
grant select on *.* to rpl_do_grant@localhost;
grant drop on test.* to rpl_do_grant@localhost;
@@ -17,10 +17,10 @@ Grants for rpl_do_grant@localhost
GRANT SELECT ON *.* TO 'rpl_do_grant'@'localhost'
GRANT DROP ON `test`.* TO 'rpl_do_grant'@'localhost'
set password for rpl_do_grant@localhost=password("does it work?");
-select password<>'' from mysql.user where user='rpl_do_grant';
-password<>''
+select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant';
+password<>_binary''
1
-delete from mysql.user where user='rpl_do_grant';
-delete from mysql.db where user='rpl_do_grant';
+delete from mysql.user where user=_binary'rpl_do_grant';
+delete from mysql.db where user=_binary'rpl_do_grant';
flush privileges;
flush privileges;
diff --git a/mysql-test/r/rpl_drop.result b/mysql-test/r/rpl_drop.result
index ce1f5b6ee81..b83594c9bb1 100644
--- a/mysql-test/r/rpl_drop.result
+++ b/mysql-test/r/rpl_drop.result
@@ -1,10 +1,10 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
drop table if exists t1, t2;
create table t1 (a int);
drop table t1, t2;
-Unknown table 't2'
+ERROR 42S02: Unknown table 't2'
diff --git a/mysql-test/r/rpl_empty_master_crash.result b/mysql-test/r/rpl_empty_master_crash.result
index 19e2bf28dcd..3e234d4ef59 100644
--- a/mysql-test/r/rpl_empty_master_crash.result
+++ b/mysql-test/r/rpl_empty_master_crash.result
@@ -1,13 +1,12 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
-drop table if exists t1;
+start slave;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
load table t1 from master;
-Error connecting to master: Master is not configured
+ERROR 08S01: Error connecting to master: Master is not configured
load table t1 from master;
-Error from master: 'Table 'test.t1' doesn't exist'
+ERROR HY000: Error from master: 'Table 'test.t1' doesn't exist'
diff --git a/mysql-test/r/rpl_error_ignored_table.result b/mysql-test/r/rpl_error_ignored_table.result
index 329af301073..4a562dbfc70 100644
--- a/mysql-test/r/rpl_error_ignored_table.result
+++ b/mysql-test/r/rpl_error_ignored_table.result
@@ -1,15 +1,15 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
create table t1 (a int primary key);
insert into t1 values (1),(1);
-Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 1
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.001 213 slave-relay-bin.002 254 master-bin.001 Yes Yes 0 0 213 254
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 213 slave-relay-bin.000002 257 master-bin.000001 Yes Yes test.t3,test.t1,test.t2 0 0 213 257 None 0 No #
show tables like 't1';
Tables_in_test (t1)
drop table t1;
@@ -26,15 +26,14 @@ select (@id := id) - id from t3;
0
kill @id;
drop table t2,t3;
-Got one of the listed errors
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.001 79 Query 1 79 use `test`; create table t1 (a int primary key)
-master-bin.001 149 Query 1 149 use `test`; insert into t1 values (1),(1)
-master-bin.001 213 Query 1 213 use `test`; drop table t1
-master-bin.001 261 Query 1 261 use `test`; create table t2 (a int primary key)
-master-bin.001 331 Query 1 331 use `test`; insert into t2 values(1)
-master-bin.001 390 Query 1 390 use `test`; create table t3 (id int)
-master-bin.001 449 Query 1 449 use `test`; insert into t3 values(connection_id())
-master-bin.001 522 Query 1 522 use `test`; update t2 set a = a + 1 + get_lock('crash_lock%20C', 10)
-master-bin.001 613 Query 1 613 use `test`; drop table t2,t3
+master-bin.000001 79 Query 1 79 use `test`; create table t1 (a int primary key)
+master-bin.000001 149 Query 1 149 use `test`; insert into t1 values (1),(1)
+master-bin.000001 213 Query 1 213 use `test`; drop table t1
+master-bin.000001 261 Query 1 261 use `test`; create table t2 (a int primary key)
+master-bin.000001 331 Query 1 331 use `test`; insert into t2 values(1)
+master-bin.000001 390 Query 1 390 use `test`; create table t3 (id int)
+master-bin.000001 449 Query 1 449 use `test`; insert into t3 values(connection_id())
+master-bin.000001 522 Query 1 522 use `test`; update t2 set a = a + 1 + get_lock('crash_lock%20C', 10)
+master-bin.000001 613 Query 1 613 use `test`; drop table t2,t3
diff --git a/mysql-test/r/rpl_failed_optimize.result b/mysql-test/r/rpl_failed_optimize.result
new file mode 100644
index 00000000000..1576ec60500
--- /dev/null
+++ b/mysql-test/r/rpl_failed_optimize.result
@@ -0,0 +1,15 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 ( a int ) ENGINE=InnoDB;
+BEGIN;
+INSERT INTO t1 VALUES (1);
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status Operation failed
+OPTIMIZE TABLE non_existing;
+Table Op Msg_type Msg_text
+test.non_existing optimize error Table 'test.non_existing' doesn't exist
diff --git a/mysql-test/r/rpl_failsafe.result b/mysql-test/r/rpl_failsafe.result
index 7e8aeea64f7..956555f9318 100644
--- a/mysql-test/r/rpl_failsafe.result
+++ b/mysql-test/r/rpl_failsafe.result
@@ -1,9 +1,9 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
show variables like 'rpl_recovery_rank';
Variable_name Value
rpl_recovery_rank 1
@@ -18,14 +18,14 @@ rpl_recovery_rank 2
show status like 'Rpl_status';
Variable_name Value
Rpl_status ACTIVE_SLAVE
-slave start;
+start slave;
show variables like 'rpl_recovery_rank';
Variable_name Value
rpl_recovery_rank 3
show status like 'Rpl_status';
Variable_name Value
Rpl_status ACTIVE_SLAVE
-slave start;
+start slave;
show variables like 'rpl_recovery_rank';
Variable_name Value
rpl_recovery_rank 4
diff --git a/mysql-test/r/rpl_flush_log_loop.result b/mysql-test/r/rpl_flush_log_loop.result
index 18786b1931b..25177a6bca3 100644
--- a/mysql-test/r/rpl_flush_log_loop.result
+++ b/mysql-test/r/rpl_flush_log_loop.result
@@ -1,17 +1,17 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=MASTER_PORT;
-slave start;
-slave stop;
+start slave;
+stop slave;
change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=SLAVE_PORT;
-slave start;
+start slave;
flush logs;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root SLAVE_PORT 60 slave-bin.001 79 relay-log.002 4 slave-bin.001 Yes Yes 0 0 79 4
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 161 relay-log.000002 4 slave-bin.000001 Yes Yes 0 0 161 4 None 0 No #
diff --git a/mysql-test/r/rpl_flush_tables.result b/mysql-test/r/rpl_flush_tables.result
new file mode 100644
index 00000000000..70e4774a920
--- /dev/null
+++ b/mysql-test/r/rpl_flush_tables.result
@@ -0,0 +1,40 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a int);
+insert into t1 values (10);
+create table t2 (a int);
+create table t3 (a int) engine=merge union(t1);
+create table t4 (a int);
+insert into t4 select * from t3;
+rename table t1 to t5, t2 to t1;
+flush no_write_to_binlog tables;
+show binlog events;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 4 Start 1 4 Server ver: SERVER_VERSION, Binlog ver: 3
+master-bin.000001 79 Query 1 79 use `test`; create table t1 (a int)
+master-bin.000001 137 Query 1 137 use `test`; insert into t1 values (10)
+master-bin.000001 198 Query 1 198 use `test`; create table t2 (a int)
+master-bin.000001 256 Query 1 256 use `test`; create table t3 (a int) engine=merge union(t1)
+master-bin.000001 337 Query 1 337 use `test`; create table t4 (a int)
+master-bin.000001 395 Query 1 395 use `test`; insert into t4 select * from t3
+master-bin.000001 461 Query 1 461 use `test`; rename table t1 to t5, t2 to t1
+select * from t3;
+a
+flush tables;
+show binlog events;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 4 Start 1 4 Server ver: SERVER_VERSION, Binlog ver: 3
+master-bin.000001 79 Query 1 79 use `test`; create table t1 (a int)
+master-bin.000001 137 Query 1 137 use `test`; insert into t1 values (10)
+master-bin.000001 198 Query 1 198 use `test`; create table t2 (a int)
+master-bin.000001 256 Query 1 256 use `test`; create table t3 (a int) engine=merge union(t1)
+master-bin.000001 337 Query 1 337 use `test`; create table t4 (a int)
+master-bin.000001 395 Query 1 395 use `test`; insert into t4 select * from t3
+master-bin.000001 461 Query 1 461 use `test`; rename table t1 to t5, t2 to t1
+master-bin.000001 527 Query 1 527 use `test`; flush tables
+select * from t3;
+a
diff --git a/mysql-test/r/rpl_free_items.result b/mysql-test/r/rpl_free_items.result
index 743fbbc8fc7..91c1e2aa6e5 100644
--- a/mysql-test/r/rpl_free_items.result
+++ b/mysql-test/r/rpl_free_items.result
@@ -1,9 +1,9 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
create table t1 (a int);
create table t2 (a int);
drop table t1;
diff --git a/mysql-test/r/rpl_get_lock.result b/mysql-test/r/rpl_get_lock.result
index a8e602be03f..26f33bfb42c 100644
--- a/mysql-test/r/rpl_get_lock.result
+++ b/mysql-test/r/rpl_get_lock.result
@@ -1,9 +1,9 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
create table t1(n int);
insert into t1 values(get_lock("lock",2));
select get_lock("lock",2);
@@ -18,9 +18,14 @@ get_lock("lock",3)
select * from t1;
n
1
-select is_free_lock("lock");
-is_free_lock("lock")
-0
+select is_free_lock("lock"), is_used_lock("lock") = connection_id();
+is_free_lock("lock") is_used_lock("lock") = connection_id()
+0 1
+explain extended select is_free_lock("lock"), is_used_lock("lock");
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select sql_no_cache is_free_lock(_latin1'lock') AS `is_free_lock("lock")`,is_used_lock(_latin1'lock') AS `is_used_lock("lock")`
select is_free_lock("lock2");
is_free_lock("lock2")
1
diff --git a/mysql-test/r/rpl_ignore_grant.result b/mysql-test/r/rpl_ignore_grant.result
index 6cd7d5b4c00..5169cc8e888 100644
--- a/mysql-test/r/rpl_ignore_grant.result
+++ b/mysql-test/r/rpl_ignore_grant.result
@@ -1,14 +1,14 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
-delete from mysql.user where user='rpl_ignore_grant';
-delete from mysql.db where user='rpl_ignore_grant';
+start slave;
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
-delete from mysql.user where user='rpl_ignore_grant';
-delete from mysql.db where user='rpl_ignore_grant';
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
grant select on *.* to rpl_ignore_grant@localhost;
grant drop on test.* to rpl_ignore_grant@localhost;
@@ -17,21 +17,21 @@ Grants for rpl_ignore_grant@localhost
GRANT SELECT ON *.* TO 'rpl_ignore_grant'@'localhost'
GRANT DROP ON `test`.* TO 'rpl_ignore_grant'@'localhost'
show grants for rpl_ignore_grant@localhost;
-There is no such grant defined for user 'rpl_ignore_grant' on host 'localhost'
-select count(*) from mysql.user where user='rpl_ignore_grant';
+ERROR 42000: There is no such grant defined for user 'rpl_ignore_grant' on host 'localhost'
+select count(*) from mysql.user where user=_binary'rpl_ignore_grant';
count(*)
0
-select count(*) from mysql.db where user='rpl_ignore_grant';
+select count(*) from mysql.db where user=_binary'rpl_ignore_grant';
count(*)
0
grant select on *.* to rpl_ignore_grant@localhost;
set password for rpl_ignore_grant@localhost=password("does it work?");
-select password<>'' from mysql.user where user='rpl_ignore_grant';
-password<>''
+select password<>_binary'' from mysql.user where user=_binary'rpl_ignore_grant';
+password<>_binary''
0
-delete from mysql.user where user='rpl_ignore_grant';
-delete from mysql.db where user='rpl_ignore_grant';
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
-delete from mysql.user where user='rpl_ignore_grant';
-delete from mysql.db where user='rpl_ignore_grant';
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
diff --git a/mysql-test/r/rpl_init_slave.result b/mysql-test/r/rpl_init_slave.result
new file mode 100644
index 00000000000..83d0a3289a2
--- /dev/null
+++ b/mysql-test/r/rpl_init_slave.result
@@ -0,0 +1,24 @@
+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;
+show variables like 'init_slave';
+Variable_name Value
+init_slave set global max_connections=500
+show variables like 'max_connections';
+Variable_name Value
+max_connections 500
+reset master;
+show variables like 'init_slave';
+Variable_name Value
+init_slave
+show variables like 'max_connections';
+Variable_name Value
+max_connections 100
+set global init_connect="set @c=1";
+show variables like 'init_connect';
+Variable_name Value
+init_connect set @c=1
+stop slave;
diff --git a/mysql-test/r/rpl_insert_id.result b/mysql-test/r/rpl_insert_id.result
index d2dfbb05675..8001cb59a35 100644
--- a/mysql-test/r/rpl_insert_id.result
+++ b/mysql-test/r/rpl_insert_id.result
@@ -1,10 +1,9 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
-drop table if exists t1;
+start slave;
create table t1(a int auto_increment, key(a));
create table t2(b int auto_increment, c int, key(b));
insert into t1 values (1),(2),(3);
@@ -21,8 +20,8 @@ b c
1 4
drop table t1;
drop table t2;
-create table t1(a int auto_increment, key(a)) type=innodb;
-create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) type=innodb;
+create table t1(a int auto_increment, key(a)) engine=innodb;
+create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) engine=innodb;
SET FOREIGN_KEY_CHECKS=0;
insert into t1 values (10);
insert into t1 values (null),(null),(null);
diff --git a/mysql-test/r/rpl_insert_ignore.result b/mysql-test/r/rpl_insert_ignore.result
new file mode 100644
index 00000000000..da24c86627c
--- /dev/null
+++ b/mysql-test/r/rpl_insert_ignore.result
@@ -0,0 +1,70 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (
+a int unsigned not null auto_increment primary key,
+b int unsigned,
+unique (b)
+) ENGINE=innodb;
+CREATE TABLE t2 (
+a int unsigned, # to force INSERT SELECT to have a certain order
+b int unsigned
+) ENGINE=innodb;
+INSERT INTO t1 VALUES (NULL, 1);
+INSERT INTO t1 VALUES (NULL, 2);
+INSERT INTO t1 VALUES (NULL, 3);
+INSERT INTO t1 VALUES (NULL, 4);
+INSERT INTO t2 VALUES (1, 1);
+INSERT INTO t2 VALUES (2, 2);
+INSERT INTO t2 VALUES (3, 5);
+INSERT INTO t2 VALUES (4, 3);
+INSERT INTO t2 VALUES (5, 4);
+INSERT INTO t2 VALUES (6, 6);
+INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
+SELECT * FROM t1 ORDER BY a;
+a b
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+SELECT * FROM t1 ORDER BY a;
+a b
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+drop table t1;
+CREATE TABLE t1 (
+a int unsigned not null auto_increment primary key,
+b int unsigned,
+unique (b)
+) ENGINE=myisam;
+INSERT INTO t1 VALUES (1, 1);
+INSERT INTO t1 VALUES (2, 2);
+INSERT INTO t1 VALUES (3, 3);
+INSERT INTO t1 VALUES (4, 4);
+INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
+SELECT * FROM t1 ORDER BY a;
+a b
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+SELECT * FROM t1 ORDER BY a;
+a b
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+drop table t1, t2;
diff --git a/mysql-test/r/rpl_loaddata.result b/mysql-test/r/rpl_loaddata.result
index 268e383ce69..65fc9d1b415 100644
--- a/mysql-test/r/rpl_loaddata.result
+++ b/mysql-test/r/rpl_loaddata.result
@@ -1,9 +1,9 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
reset master;
create table t1(a int not null auto_increment, b int, primary key(a) );
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
@@ -21,8 +21,8 @@ day id category name
2003-03-22 2161 c asdf
2003-03-22 2416 a bbbbb
show master status;
-File Position Binlog_do_db Binlog_ignore_db
-slave-bin.001 964
+File Position Binlog_Do_DB Binlog_Ignore_DB
+slave-bin.000001 964
drop table t1;
drop table t2;
drop table t3;
@@ -32,8 +32,8 @@ load data infile '../../std_data/rpl_loaddata.dat' into table t1;
set global sql_slave_skip_counter=1;
start slave;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.001 1311 slave-relay-bin.002 1352 master-bin.001 Yes Yes 0 0 1311 1352
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1311 slave-relay-bin.000002 1355 master-bin.000001 Yes Yes 0 0 1311 1355 None 0 No #
set sql_log_bin=0;
delete from t1;
set sql_log_bin=1;
@@ -42,8 +42,8 @@ stop slave;
change master to master_user='test';
change master to master_user='root';
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.001 1419 slave-relay-bin.001 4 master-bin.001 No No 0 0 1419 4
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1419 slave-relay-bin.000001 4 master-bin.000001 No No 0 0 1419 4 None 0 No #
set global sql_slave_skip_counter=1;
start slave;
set sql_log_bin=0;
@@ -53,16 +53,16 @@ load data infile '../../std_data/rpl_loaddata.dat' into table t1;
stop slave;
reset slave;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.001 4 No No 0 0 0 4
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.000001 4 No No 0 0 0 4 None 0 No #
reset master;
create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
unique(day));
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines;
-Duplicate entry '2003-03-22' for key 1
+ERROR 23000: Duplicate entry '2003-03-22' for key 1
show master status;
-File Position Binlog_do_db Binlog_ignore_db
-master-bin.001 491
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 491
drop table t2;
diff --git a/mysql-test/r/rpl_loaddata_rule_m.result b/mysql-test/r/rpl_loaddata_rule_m.result
index 8d8ed749c71..08f2c2ec071 100644
--- a/mysql-test/r/rpl_loaddata_rule_m.result
+++ b/mysql-test/r/rpl_loaddata_rule_m.result
@@ -1,14 +1,17 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
-reset master;
-create database test2;
+start slave;
+drop database if exists mysqltest;
+stop slave;
+create database mysqltest;
create table t1(a int, b int, unique(b));
-use test2;
+use mysqltest;
load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
-drop database test2;
+master-bin.000001 79 Query 1 79 drop database if exists mysqltest
+master-bin.000001 152 Query 1 152 create database mysqltest
+drop database mysqltest;
diff --git a/mysql-test/r/rpl_loaddata_rule_s.result b/mysql-test/r/rpl_loaddata_rule_s.result
index a84368501a9..26893cb1e9e 100644
--- a/mysql-test/r/rpl_loaddata_rule_s.result
+++ b/mysql-test/r/rpl_loaddata_rule_s.result
@@ -1,9 +1,9 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
reset master;
create table t1(a int, b int, unique(b));
load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
diff --git a/mysql-test/r/rpl_loaddatalocal.result b/mysql-test/r/rpl_loaddatalocal.result
index dc98b1b5bfb..b49ea842485 100644
--- a/mysql-test/r/rpl_loaddatalocal.result
+++ b/mysql-test/r/rpl_loaddatalocal.result
@@ -1,9 +1,9 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
create table t1(a int);
select * into outfile '../../var/master-data/rpl_loaddatalocal.select_outfile' from t1;
truncate table t1;
diff --git a/mysql-test/r/rpl_log.result b/mysql-test/r/rpl_log.result
index 7e2a8df75ac..2f8a54369c9 100644
--- a/mysql-test/r/rpl_log.result
+++ b/mysql-test/r/rpl_log.result
@@ -1,10 +1,10 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
-slave stop;
+start slave;
+stop slave;
reset master;
reset slave;
reset master;
@@ -19,83 +19,83 @@ count(*)
drop table t1;
show binlog events;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
-master-bin.001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
-master-bin.001 172 Intvar 1 172 INSERT_ID=1
-master-bin.001 200 Query 1 200 use `test`; insert into t1 values (NULL)
-master-bin.001 263 Query 1 263 use `test`; drop table t1
-master-bin.001 311 Query 1 311 use `test`; create table t1 (word char(20) not null)
-master-bin.001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=581
-master-bin.001 1056 Exec_load 1 1056 ;file_id=1
-master-bin.001 1079 Query 1 1079 use `test`; drop table t1
+master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
+master-bin.000001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
+master-bin.000001 172 Intvar 1 172 INSERT_ID=1
+master-bin.000001 200 Query 1 200 use `test`; insert into t1 values (NULL)
+master-bin.000001 263 Query 1 263 use `test`; drop table t1
+master-bin.000001 311 Query 1 311 use `test`; create table t1 (word char(20) not null)
+master-bin.000001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=581
+master-bin.000001 1056 Exec_load 1 1056 ;file_id=1
+master-bin.000001 1079 Query 1 1079 use `test`; drop table t1
show binlog events from 79 limit 1;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
+master-bin.000001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
show binlog events from 79 limit 2;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
-master-bin.001 172 Intvar 1 172 INSERT_ID=1
+master-bin.000001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
+master-bin.000001 172 Intvar 1 172 INSERT_ID=1
show binlog events from 79 limit 2,1;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.001 200 Query 1 200 use `test`; insert into t1 values (NULL)
+master-bin.000001 200 Query 1 200 use `test`; insert into t1 values (NULL)
flush logs;
create table t5 (a int);
drop table t5;
-slave start;
+start slave;
flush logs;
-slave stop;
+stop slave;
create table t1 (n int);
insert into t1 values (1);
drop table t1;
show binlog events;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
-master-bin.001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
-master-bin.001 172 Intvar 1 172 INSERT_ID=1
-master-bin.001 200 Query 1 200 use `test`; insert into t1 values (NULL)
-master-bin.001 263 Query 1 263 use `test`; drop table t1
-master-bin.001 311 Query 1 311 use `test`; create table t1 (word char(20) not null)
-master-bin.001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=581
-master-bin.001 1056 Exec_load 1 1056 ;file_id=1
-master-bin.001 1079 Query 1 1079 use `test`; drop table t1
-master-bin.001 1127 Rotate 1 1127 master-bin.002;pos=4
-show binlog events in 'master-bin.002';
+master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
+master-bin.000001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
+master-bin.000001 172 Intvar 1 172 INSERT_ID=1
+master-bin.000001 200 Query 1 200 use `test`; insert into t1 values (NULL)
+master-bin.000001 263 Query 1 263 use `test`; drop table t1
+master-bin.000001 311 Query 1 311 use `test`; create table t1 (word char(20) not null)
+master-bin.000001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=581
+master-bin.000001 1056 Exec_load 1 1056 ;file_id=1
+master-bin.000001 1079 Query 1 1079 use `test`; drop table t1
+master-bin.000001 1127 Rotate 1 1127 master-bin.000002;pos=4
+show binlog events in 'master-bin.000002';
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.002 4 Query 1 4 use `test`; create table t5 (a int)
-master-bin.002 62 Query 1 62 use `test`; drop table t5
-master-bin.002 110 Query 1 110 use `test`; create table t1 (n int)
-master-bin.002 168 Query 1 168 use `test`; insert into t1 values (1)
-master-bin.002 228 Query 1 228 use `test`; drop table t1
-show master logs;
+master-bin.000002 4 Query 1 4 use `test`; create table t5 (a int)
+master-bin.000002 62 Query 1 62 use `test`; drop table t5
+master-bin.000002 110 Query 1 110 use `test`; create table t1 (n int)
+master-bin.000002 168 Query 1 168 use `test`; insert into t1 values (1)
+master-bin.000002 228 Query 1 228 use `test`; drop table t1
+show binary logs;
Log_name
-master-bin.001
-master-bin.002
-slave start;
-show master logs;
+master-bin.000001
+master-bin.000002
+start slave;
+show binary logs;
Log_name
-slave-bin.001
-slave-bin.002
-show binlog events in 'slave-bin.001' from 4;
+slave-bin.000001
+slave-bin.000002
+show binlog events in 'slave-bin.000001' from 4;
Log_name Pos Event_type Server_id Orig_log_pos Info
-slave-bin.001 4 Start 2 4 Server ver: VERSION, Binlog ver: 3
-slave-bin.001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
-slave-bin.001 172 Intvar 1 172 INSERT_ID=1
-slave-bin.001 200 Query 1 200 use `test`; insert into t1 values (NULL)
-slave-bin.001 263 Query 1 263 use `test`; drop table t1
-slave-bin.001 311 Query 1 311 use `test`; create table t1 (word char(20) not null)
-slave-bin.001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=581
-slave-bin.001 1065 Exec_load 1 1065 ;file_id=1
-slave-bin.001 1088 Query 1 1088 use `test`; drop table t1
-slave-bin.001 1136 Query 1 1136 use `test`; create table t5 (a int)
-slave-bin.001 1194 Query 1 1194 use `test`; drop table t5
-slave-bin.001 1242 Rotate 2 1242 slave-bin.002;pos=4
-show binlog events in 'slave-bin.002' from 4;
+slave-bin.000001 4 Start 2 4 Server ver: VERSION, Binlog ver: 3
+slave-bin.000001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
+slave-bin.000001 172 Intvar 1 172 INSERT_ID=1
+slave-bin.000001 200 Query 1 200 use `test`; insert into t1 values (NULL)
+slave-bin.000001 263 Query 1 263 use `test`; drop table t1
+slave-bin.000001 311 Query 1 311 use `test`; create table t1 (word char(20) not null)
+slave-bin.000001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=581
+slave-bin.000001 1065 Exec_load 1 1065 ;file_id=1
+slave-bin.000001 1088 Query 1 1088 use `test`; drop table t1
+slave-bin.000001 1136 Query 1 1136 use `test`; create table t5 (a int)
+slave-bin.000001 1194 Query 1 1194 use `test`; drop table t5
+slave-bin.000001 1242 Rotate 2 1242 slave-bin.000002;pos=4
+show binlog events in 'slave-bin.000002' from 4;
Log_name Pos Event_type Server_id Orig_log_pos Info
-slave-bin.002 4 Query 1 4 use `test`; create table t1 (n int)
-slave-bin.002 62 Query 1 62 use `test`; insert into t1 values (1)
-slave-bin.002 122 Query 1 122 use `test`; drop table t1
+slave-bin.000002 4 Query 1 4 use `test`; create table t1 (n int)
+slave-bin.000002 62 Query 1 62 use `test`; insert into t1 values (1)
+slave-bin.000002 122 Query 1 122 use `test`; drop table t1
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.002 276 slave-relay-bin.003 211 master-bin.002 Yes Yes 0 0 276 211
-show binlog events in 'slave-bin.005' from 4;
-Error when executing command SHOW BINLOG EVENTS: Could not find target log
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 276 slave-relay-bin.000003 214 master-bin.000002 Yes Yes 0 0 276 214 None 0 No #
+show binlog events in 'slave-bin.000005' from 4;
+ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
diff --git a/mysql-test/r/rpl_log_pos.result b/mysql-test/r/rpl_log_pos.result
index f7e59e55577..10c78272de6 100644
--- a/mysql-test/r/rpl_log_pos.result
+++ b/mysql-test/r/rpl_log_pos.result
@@ -1,43 +1,43 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
show master status;
-File Position Binlog_do_db Binlog_ignore_db
-master-bin.001 79
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 79
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.001 79 slave-relay-bin.002 120 master-bin.001 Yes Yes 0 0 79 120
-slave stop;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 123 None 0 No #
+stop slave;
change master to master_log_pos=73;
-slave start;
-slave stop;
+start slave;
+stop slave;
change master to master_log_pos=73;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.001 73 slave-relay-bin.001 4 master-bin.001 No No 0 0 73 4
-slave start;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73 slave-relay-bin.000001 4 master-bin.000001 No No 0 0 73 4 None 0 No #
+start slave;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.001 73 slave-relay-bin.001 45 master-bin.001 No Yes 0 0 73 45
-slave stop;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73 slave-relay-bin.000001 48 master-bin.000001 No Yes 0 0 73 48 None 0 No #
+stop slave;
change master to master_log_pos=173;
-slave start;
+start slave;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.001 173 slave-relay-bin.001 4 master-bin.001 No Yes 0 0 173 4
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 173 slave-relay-bin.000001 4 master-bin.000001 No Yes 0 0 173 4 None 0 No #
show master status;
-File Position Binlog_do_db Binlog_ignore_db
-master-bin.001 79
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 79
create table if not exists t1 (n int);
drop table if exists t1;
create table t1 (n int);
insert into t1 values (1),(2),(3);
-slave stop;
+stop slave;
change master to master_log_pos=79;
-slave start;
+start slave;
select * from t1;
n
1
diff --git a/mysql-test/r/rpl_master_pos_wait.result b/mysql-test/r/rpl_master_pos_wait.result
index cb6ee31a54d..e92d1ffa361 100644
--- a/mysql-test/r/rpl_master_pos_wait.result
+++ b/mysql-test/r/rpl_master_pos_wait.result
@@ -1,12 +1,17 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
select master_pos_wait('master-bin.999999',0,2);
master_pos_wait('master-bin.999999',0,2)
-1
+explain extended select master_pos_wait('master-bin.999999',0,2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select sql_no_cache master_pos_wait(_latin1'master-bin.999999',0,2) AS `master_pos_wait('master-bin.999999',0,2)`
select master_pos_wait('master-bin.999999',0);
stop slave sql_thread;
master_pos_wait('master-bin.999999',0)
diff --git a/mysql-test/r/rpl_max_relay_size.result b/mysql-test/r/rpl_max_relay_size.result
index d74bc80c0ab..5c3360b0f66 100644
--- a/mysql-test/r/rpl_max_relay_size.result
+++ b/mysql-test/r/rpl_max_relay_size.result
@@ -1,9 +1,9 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
stop slave;
create table t1 (a int);
drop table t1;
@@ -15,8 +15,8 @@ select @@global.max_relay_log_size;
4096
start slave;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.001 50477 slave-relay-bin.014 1221 master-bin.001 Yes Yes 0 0 50477 1221
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 50477 slave-relay-bin.000014 1221 master-bin.000001 Yes Yes 0 0 50477 1221 None 0 No #
stop slave;
reset slave;
set global max_relay_log_size=(5*4096);
@@ -25,8 +25,8 @@ select @@global.max_relay_log_size;
20480
start slave;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.001 50477 slave-relay-bin.004 9457 master-bin.001 Yes Yes 0 0 50477 #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 50477 slave-relay-bin.000004 9457 master-bin.000001 Yes Yes 0 0 50477 9457 None 0 No #
stop slave;
reset slave;
set global max_relay_log_size=0;
@@ -35,27 +35,27 @@ select @@global.max_relay_log_size;
0
start slave;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.001 50477 slave-relay-bin.008 1283 master-bin.001 Yes Yes 0 0 50477 1283
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 50477 slave-relay-bin.000008 1283 master-bin.000001 Yes Yes 0 0 50477 1283 None 0 No #
stop slave;
reset slave;
flush logs;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.001 4 No No 0 0 0 4
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.000001 4 No No 0 0 0 4 None 0 No #
reset slave;
start slave;
flush logs;
create table t1 (a int);
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.001 50535 slave-relay-bin.009 62 master-bin.001 Yes Yes 0 0 50535 62
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 50535 slave-relay-bin.000009 62 master-bin.000001 Yes Yes 0 0 50535 62 None 0 No #
flush logs;
drop table t1;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.001 50583 slave-relay-bin.010 52 master-bin.001 Yes Yes 0 0 50583 52
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 50583 slave-relay-bin.000010 52 master-bin.000001 Yes Yes 0 0 50583 52 None 0 No #
flush logs;
show master status;
-File Position Binlog_do_db Binlog_ignore_db
-master-bin.002 4
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000002 4
diff --git a/mysql-test/r/rpl_misc_functions.result b/mysql-test/r/rpl_misc_functions.result
new file mode 100644
index 00000000000..a687063706d
--- /dev/null
+++ b/mysql-test/r/rpl_misc_functions.result
@@ -0,0 +1,21 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1(id int, i int, r1 int, r2 int, p varchar(100));
+insert into t1 values(1, connection_id(), 0, 0, "");
+insert into t1 values(2, 0, rand()*1000, rand()*1000, "");
+set sql_log_bin=0;
+insert into t1 values(6, 0, rand(), rand(), "");
+delete from t1 where id=6;
+set sql_log_bin=1;
+insert into t1 values(3, 0, 0, 0, password('does_this_work?'));
+insert into t1 values(4, connection_id(), rand()*1000, rand()*1000, password('does_this_still_work?'));
+select * into outfile 'rpl_misc_functions.outfile' from t1;
+create table t2 like t1;
+load data local infile './var/master-data/test/rpl_misc_functions.outfile' into table t2;
+select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and t1.r2=t2.r2 and t1.p=t2.p);
+id i r1 r2 p id i r1 r2 p
+stop slave;
diff --git a/mysql-test/r/rpl_multi_delete.result b/mysql-test/r/rpl_multi_delete.result
index fa254d76393..e94a4e7947e 100644
--- a/mysql-test/r/rpl_multi_delete.result
+++ b/mysql-test/r/rpl_multi_delete.result
@@ -1,9 +1,9 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
create table t1 (a int);
create table t2 (a int);
insert into t1 values (1);
diff --git a/mysql-test/r/rpl_multi_delete2.result b/mysql-test/r/rpl_multi_delete2.result
index 8b6d87801fe..c6c088111fc 100644
--- a/mysql-test/r/rpl_multi_delete2.result
+++ b/mysql-test/r/rpl_multi_delete2.result
@@ -1,9 +1,9 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
create table t1 (a int);
create table t2 (a int);
insert into t1 values (1);
@@ -15,7 +15,7 @@ select * from t2;
a
1
select * from t1;
-Table 'test.t1' doesn't exist
+ERROR 42S02: Table 'test.t1' doesn't exist
select * from t2;
-Table 'test.t2' doesn't exist
+ERROR 42S02: Table 'test.t2' doesn't exist
drop table t1,t2;
diff --git a/mysql-test/r/rpl_multi_update.result b/mysql-test/r/rpl_multi_update.result
index 0cd6ea2c6f7..34f99746c7d 100644
--- a/mysql-test/r/rpl_multi_update.result
+++ b/mysql-test/r/rpl_multi_update.result
@@ -1,18 +1,17 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
-drop table if exists t1,t2;
+start slave;
CREATE TABLE t1 (
a int unsigned not null auto_increment primary key,
b int unsigned
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
CREATE TABLE t2 (
a int unsigned not null auto_increment primary key,
b int unsigned
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (NULL, 0);
INSERT INTO t1 SELECT NULL, 0 FROM t1;
INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
diff --git a/mysql-test/r/rpl_mystery22.result b/mysql-test/r/rpl_mystery22.result
index 5dd665fe9d5..348b3211cd5 100644
--- a/mysql-test/r/rpl_mystery22.result
+++ b/mysql-test/r/rpl_mystery22.result
@@ -1,20 +1,20 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
create table t1(n int auto_increment primary key);
insert into t1 values (2);
insert into t1 values(NULL);
insert into t1 values(NULL);
delete from t1 where n = 2;
-slave start;
-slave stop;
+start slave;
+stop slave;
create table t2(n int);
drop table t2;
insert into t1 values(NULL);
-slave start;
+start slave;
select * from t1;
n
1
diff --git a/mysql-test/r/rpl_openssl.result b/mysql-test/r/rpl_openssl.result
new file mode 100644
index 00000000000..ad7251fd631
--- /dev/null
+++ b/mysql-test/r/rpl_openssl.result
@@ -0,0 +1,30 @@
+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;
+grant replication slave on *.* to replssl@'%' require ssl;
+create table t1 (t int);
+stop slave;
+change master to master_user='replssl',master_password='';
+start slave;
+insert into t1 values (1);
+select * from t1;
+t
+stop slave;
+change master to master_ssl=1 , master_ssl_ca ='MYSQL_TEST_DIR/std_data/cacert.pem', master_ssl_cert='MYSQL_TEST_DIR/std_data/client-cert.pem', master_ssl_key='MYSQL_TEST_DIR/std_data/client-key.pem';
+start slave;
+select * from t1;
+t
+1
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 replssl MASTER_MYPORT 1 master-bin.000001 289 slave-relay-bin.000001 108 master-bin.000001 Yes Yes 0 0 289 108 None 0 Yes MYSQL_TEST_DIR/std_data/cacert.pem MYSQL_TEST_DIR/std_data/client-cert.pem MYSQL_TEST_DIR/std_data/client-key.pem #
+stop slave;
+change master to master_user='root',master_password='', master_ssl=0;
+start slave;
+drop table t1;
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 337 slave-relay-bin.000001 96 master-bin.000001 Yes Yes 0 0 337 96 None 0 No MYSQL_TEST_DIR/std_data/cacert.pem MYSQL_TEST_DIR/std_data/client-cert.pem MYSQL_TEST_DIR/std_data/client-key.pem #
diff --git a/mysql-test/r/rpl_optimize.result b/mysql-test/r/rpl_optimize.result
index 5ed541516dc..79891169fbc 100644
--- a/mysql-test/r/rpl_optimize.result
+++ b/mysql-test/r/rpl_optimize.result
@@ -1,9 +1,9 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
create table t1 (a int not null auto_increment primary key, b int, key(b));
INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
INSERT INTO t1 (a) SELECT null FROM t1;
diff --git a/mysql-test/r/rpl_ps.result b/mysql-test/r/rpl_ps.result
new file mode 100644
index 00000000000..c969575de76
--- /dev/null
+++ b/mysql-test/r/rpl_ps.result
@@ -0,0 +1,28 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop table if exists t1;
+create table t1(n char(30));
+prepare stmt1 from 'insert into t1 values (?)';
+set @var1= "from-master-1";
+execute stmt1 using @var1;
+set @var1= "from-master-2-'',";
+execute stmt1 using @var1;
+select * from t1;
+n
+from-master-1
+from-master-2-'',
+set @var2= 'insert into t1 values (concat("from-var-", ?))';
+prepare stmt2 from @var2;
+set @var1='from-master-3';
+execute stmt2 using @var1;
+select * from t1;
+n
+from-master-1
+from-master-2-'',
+from-var-from-master-3
+drop table t1;
+stop slave;
diff --git a/mysql-test/r/rpl_redirect.result b/mysql-test/r/rpl_redirect.result
index 6103a075684..9dd51eaba4d 100644
--- a/mysql-test/r/rpl_redirect.result
+++ b/mysql-test/r/rpl_redirect.result
@@ -1,15 +1,14 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
SHOW SLAVE STATUS;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
SHOW SLAVE HOSTS;
Server_id Host Port Rpl_recovery_rank Master_id
2 127.0.0.1 SLAVE_PORT 2 1
-drop table if exists t1;
create table t1 ( n int);
insert into t1 values (1),(2),(3),(4);
insert into t1 values(5);
diff --git a/mysql-test/r/rpl_relayrotate.result b/mysql-test/r/rpl_relayrotate.result
new file mode 100644
index 00000000000..bf9bbbb9b93
--- /dev/null
+++ b/mysql-test/r/rpl_relayrotate.result
@@ -0,0 +1,19 @@
+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;
+create table t1 (a int) engine=innodb;
+reset slave;
+start slave;
+stop slave;
+start slave;
+select master_pos_wait('master-bin.001',3000)>=0;
+master_pos_wait('master-bin.001',3000)>=0
+1
+select * from t1 where a=8000;
+a
+8000
+drop table t1;
diff --git a/mysql-test/r/rpl_relayspace.result b/mysql-test/r/rpl_relayspace.result
index 721c6a882bd..1f2a739d3e3 100644
--- a/mysql-test/r/rpl_relayspace.result
+++ b/mysql-test/r/rpl_relayspace.result
@@ -1,9 +1,9 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
stop slave;
create table t1 (a int);
drop table t1;
diff --git a/mysql-test/r/rpl_replicate_do.result b/mysql-test/r/rpl_replicate_do.result
index 372d8c07f64..ca290d46fda 100644
--- a/mysql-test/r/rpl_replicate_do.result
+++ b/mysql-test/r/rpl_replicate_do.result
@@ -1,9 +1,9 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
drop table if exists t11;
drop table if exists t11;
create table t2 (n int);
@@ -24,5 +24,8 @@ select * from t2;
n
4
select * from t11;
-Table 'test.t11' doesn't exist
-drop table if exists t1,t2,t3,t11;
+ERROR 42S02: Table 'test.t11' doesn't exist
+drop table if exists t1,t2,t11;
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1340 slave-relay-bin.000002 1384 master-bin.000001 Yes Yes test.t1 0 0 1340 1384 None 0 No #
diff --git a/mysql-test/r/rpl_reset_slave.result b/mysql-test/r/rpl_reset_slave.result
index fb931064720..42d41533cb0 100644
--- a/mysql-test/r/rpl_reset_slave.result
+++ b/mysql-test/r/rpl_reset_slave.result
@@ -1,25 +1,25 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.001 79 slave-relay-bin.002 120 master-bin.001 Yes Yes 0 0 79 120
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 123 None 0 No #
stop slave;
change master to master_user='test';
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 test MASTER_PORT 1 master-bin.001 79 slave-relay-bin.001 4 master-bin.001 No No 0 0 79 4
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 test MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000001 4 master-bin.000001 No No 0 0 79 4 None 0 No #
reset slave;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.001 4 No No 0 0 0 4
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.000001 4 No No 0 0 0 4 None 0 No #
start slave;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.001 79 slave-relay-bin.002 120 master-bin.001 Yes Yes 0 0 79 120
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 123 None 0 No #
stop slave;
reset slave;
start slave;
diff --git a/mysql-test/r/rpl_rewrite_db.result b/mysql-test/r/rpl_rewrite_db.result
new file mode 100644
index 00000000000..a2c8706e3e1
--- /dev/null
+++ b/mysql-test/r/rpl_rewrite_db.result
@@ -0,0 +1,92 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists mysqltest1;
+create database mysqltest1;
+use mysqltest1;
+create table t1 (a int);
+insert into t1 values(9);
+select * from mysqltest1.t1;
+a
+9
+show databases like 'mysqltest1';
+Database (mysqltest1)
+mysqltest1
+select * from test.t1;
+a
+9
+drop table t1;
+drop database mysqltest1;
+drop database if exists rewrite;
+create database rewrite;
+use test;
+create table t1 (a date, b date, c date not null, d date);
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',';
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'c' at row 1
+Warning 1265 Data truncated for column 'd' at row 1
+Warning 1265 Data truncated for column 'a' at row 2
+Warning 1265 Data truncated for column 'b' at row 2
+Warning 1265 Data truncated for column 'd' at row 2
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
+select * from rewrite.t1;
+a b c d
+0000-00-00 NULL 0000-00-00 0000-00-00
+0000-00-00 0000-00-00 0000-00-00 0000-00-00
+2003-03-03 2003-03-03 2003-03-03 NULL
+2003-03-03 2003-03-03 2003-03-03 NULL
+truncate table t1;
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
+Warnings:
+Warning 1265 Data truncated for column 'c' at row 1
+Warning 1265 Data truncated for column 'd' at row 1
+Warning 1265 Data truncated for column 'b' at row 2
+Warning 1265 Data truncated for column 'd' at row 2
+select * from rewrite.t1;
+a b c d
+NULL NULL 0000-00-00 0000-00-00
+NULL 0000-00-00 0000-00-00 0000-00-00
+NULL 2003-03-03 2003-03-03 NULL
+drop table t1;
+create table t1 (a text, b text);
+load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
+Warnings:
+Warning 1261 Row 3 doesn't contain data for all columns
+select concat('|',a,'|'), concat('|',b,'|') from rewrite.t1;
+concat('|',a,'|') concat('|',b,'|')
+|Field A| |Field B|
+|Field 1| |Field 2'
+Field 3,'Field 4|
+|Field 5' ,'Field 6| NULL
+|Field 6| | 'Field 7'|
+drop table t1;
+create table t1 (a int, b char(10));
+load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 3
+Warning 1262 Row 3 was truncated; it contained more data than there were input columns
+Warning 1265 Data truncated for column 'a' at row 5
+Warning 1262 Row 5 was truncated; it contained more data than there were input columns
+select * from rewrite.t1;
+a b
+1 row 1
+2 row 2
+0 1234567890
+3 row 3
+0 1234567890
+truncate table t1;
+load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 4
+Warning 1261 Row 4 doesn't contain data for all columns
+select * from rewrite.t1;
+a b
+1 row 1
+2 row 2
+3 row 3
+0
+drop table t1;
diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result
index 89d7f4a795a..62e5522fad9 100644
--- a/mysql-test/r/rpl_rotate_logs.result
+++ b/mysql-test/r/rpl_rotate_logs.result
@@ -1,22 +1,22 @@
drop table if exists t1, t2, t3, t4;
drop table if exists t1, t2, t3, t4;
-slave start;
-Could not initialize master info structure, more error messages can be found in the MySQL error log
-slave start;
-Could not initialize master info structure, more error messages can be found in the MySQL error log
+start slave;
+ERROR HY000: Could not initialize master info structure; more error messages can be found in the MySQL error log
+start slave;
+ERROR HY000: Could not initialize master info structure; more error messages can be found in the MySQL error log
change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
-Could not initialize master info structure, more error messages can be found in the MySQL error log
+ERROR HY000: Could not initialize master info structure; more error messages can be found in the MySQL error log
reset slave;
change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
reset master;
-slave start;
+start slave;
create temporary table temp_table (a char(80) not null);
insert into temp_table values ("testing temporary tables");
create table t1 (s text);
insert into t1 values('Could not break slave'),('Tried hard');
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 60 master-bin.001 417 slave-relay-bin.001 458 master-bin.001 Yes Yes 0 0 417 #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 60 master-bin.000001 417 slave-relay-bin.000001 461 master-bin.000001 Yes Yes 0 0 417 461 None 0 No #
select * from t1;
s
Could not break slave
@@ -25,11 +25,11 @@ flush logs;
create table t2(m int not null auto_increment primary key);
insert into t2 values (34),(67),(123);
flush logs;
-show master logs;
+show binary logs;
Log_name
-master-bin.001
-master-bin.002
-master-bin.003
+master-bin.000001
+master-bin.000002
+master-bin.000003
create table t3 select * from temp_table;
select * from t3;
a
@@ -39,15 +39,25 @@ insert into t2 values(1234);
set insert_id=1234;
insert into t2 values(NULL);
set global sql_slave_skip_counter=1;
-slave start;
-purge master logs to 'master-bin.003';
+start slave;
+purge master logs to 'master-bin.000002';
show master logs;
Log_name
-master-bin.003
+master-bin.000002
+master-bin.000003
+purge binary logs to 'master-bin.000002';
+show binary logs;
+Log_name
+master-bin.000002
+master-bin.000003
+purge master logs before now();
+show binary logs;
+Log_name
+master-bin.000003
insert into t2 values (65);
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 60 master-bin.003 290 slave-relay-bin.001 1073 master-bin.003 Yes Yes 0 0 290 #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 60 master-bin.000003 290 slave-relay-bin.000001 1088 master-bin.000003 Yes Yes 0 0 290 1088 None 0 No #
select * from t2;
m
34
@@ -62,19 +72,19 @@ select count(*) from t3 where n >= 4;
count(*)
100
create table t4 select * from temp_table;
-show master logs;
+show binary logs;
Log_name
-master-bin.003
-master-bin.004
+master-bin.000003
+master-bin.000004
show master status;
-File Position Binlog_do_db Binlog_ignore_db
-master-bin.004 2886
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000004 2886
select * from t4;
a
testing temporary tables part 2
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 60 master-bin.004 2886 slave-relay-bin.001 7870 master-bin.004 Yes Yes 0 0 2886 #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 60 master-bin.000004 2886 slave-relay-bin.000001 7891 master-bin.000004 Yes Yes 0 0 2886 7891 None 0 No #
lock tables t3 read;
select count(*) from t3 where n >= 4;
count(*)
diff --git a/mysql-test/r/rpl_server_id1.result b/mysql-test/r/rpl_server_id1.result
index d8b23b9ca41..32e14b053d7 100644
--- a/mysql-test/r/rpl_server_id1.result
+++ b/mysql-test/r/rpl_server_id1.result
@@ -1,23 +1,19 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
-drop table if exists t1;
+start slave;
create table t1 (n int);
reset master;
stop slave;
change master to master_port=SLAVE_PORT;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.001 4 No No 0 0 0 #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+ 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 4 None 0 No NULL
start slave;
insert into t1 values (1);
show status like "slave_running";
Variable_name Value
-Slave_running ON
-select * from t1;
-n
-1
+Slave_running OFF
drop table t1;
diff --git a/mysql-test/r/rpl_server_id2.result b/mysql-test/r/rpl_server_id2.result
index 1b5d946998c..82ab1ff85a7 100644
--- a/mysql-test/r/rpl_server_id2.result
+++ b/mysql-test/r/rpl_server_id2.result
@@ -1,16 +1,16 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
create table t1 (n int);
reset master;
stop slave;
change master to master_port=SLAVE_PORT;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.001 4 No No 0 0 0 #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+ 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 4 None 0 No NULL
start slave;
insert into t1 values (1);
select * from t1;
diff --git a/mysql-test/r/rpl_set_charset.result b/mysql-test/r/rpl_set_charset.result
index 9c7ea73c741..480d926fbba 100644
--- a/mysql-test/r/rpl_set_charset.result
+++ b/mysql-test/r/rpl_set_charset.result
@@ -1,9 +1,9 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
drop database if exists mysqltest1;
create database mysqltest1 /*!40100 character set latin2 */;
use mysqltest1;
@@ -31,9 +31,6 @@ C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF C0
D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF D0
E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF E0
F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF F0
-show binlog events from 1979;
-Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.001 1979 Query 1 1979 use `mysqltest1`; SET CHARACTER SET DEFAULT
use mysqltest1;
select "--- on slave ---";
--- on slave ---
diff --git a/mysql-test/r/rpl_skip_error.result b/mysql-test/r/rpl_skip_error.result
index 946d64ad7c5..e52426c381c 100644
--- a/mysql-test/r/rpl_skip_error.result
+++ b/mysql-test/r/rpl_skip_error.result
@@ -1,10 +1,9 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
-drop table if exists t1;
+start slave;
create table t1 (n int not null primary key);
insert into t1 values (1);
insert into t1 values (1);
diff --git a/mysql-test/r/rpl_sporadic_master.result b/mysql-test/r/rpl_sporadic_master.result
index a6a58515f0a..789c3bf2b2b 100644
--- a/mysql-test/r/rpl_sporadic_master.result
+++ b/mysql-test/r/rpl_sporadic_master.result
@@ -1,16 +1,16 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
create table t2(n int);
create table t1(n int not null auto_increment primary key);
insert into t1 values (NULL),(NULL);
truncate table t1;
insert into t1 values (4),(NULL);
-slave stop;
-slave start;
+stop slave;
+start slave;
insert into t1 values (NULL),(NULL);
flush logs;
truncate table t1;
diff --git a/mysql-test/r/rpl_start_stop_slave.result b/mysql-test/r/rpl_start_stop_slave.result
index 1b4d87124d1..1fcb586d1fb 100644
--- a/mysql-test/r/rpl_start_stop_slave.result
+++ b/mysql-test/r/rpl_start_stop_slave.result
@@ -1,9 +1,9 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
stop slave;
create table t1(n int);
start slave;
diff --git a/mysql-test/r/rpl_temporary.result b/mysql-test/r/rpl_temporary.result
new file mode 100644
index 00000000000..b9865d282fa
--- /dev/null
+++ b/mysql-test/r/rpl_temporary.result
@@ -0,0 +1,91 @@
+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;
+reset master;
+SET @save_select_limit=@@session.sql_select_limit;
+SET @@session.sql_select_limit=10, @@session.pseudo_thread_id=100;
+ERROR HY000: Access denied; you need the SUPER privilege for this operation
+SELECT @@session.sql_select_limit = @save_select_limit;
+@@session.sql_select_limit = @save_select_limit
+1
+SET @@session.sql_select_limit=10, @@session.sql_log_bin=0;
+ERROR HY000: Access denied; you need the SUPER privilege for this operation
+SELECT @@session.sql_select_limit = @save_select_limit;
+@@session.sql_select_limit = @save_select_limit
+1
+SET @@session.pseudo_thread_id=100;
+SET @@session.pseudo_thread_id=connection_id();
+SET @@session.sql_log_bin=0;
+SET @@session.sql_log_bin=1;
+drop table if exists t1,t2;
+create table t1(f int);
+create table t2(f int);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+create temporary table t3(f int);
+insert into t3 select * from t1 where f<6;
+create temporary table t3(f int);
+insert into t2 select count(*) from t3;
+insert into t3 select * from t1 where f>=4;
+drop temporary table t3;
+insert into t2 select count(*) from t3;
+drop temporary table t3;
+select * from t2;
+f
+5
+7
+show binlog events;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
+master-bin.000001 79 Query 1 79 use `test`; drop table if exists t1,t2
+master-bin.000001 140 Query 1 140 use `test`; create table t1(f int)
+master-bin.000001 197 Query 1 197 use `test`; create table t2(f int)
+master-bin.000001 254 Query 1 254 use `test`; insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10)
+master-bin.000001 351 Query 1 351 use `test`; create temporary table t3(f int)
+master-bin.000001 418 Query 1 418 use `test`; insert into t3 select * from t1 where f<6
+master-bin.000001 494 Query 1 494 use `test`; create temporary table t3(f int)
+master-bin.000001 561 Query 1 561 use `test`; insert into t2 select count(*) from t3
+master-bin.000001 634 Query 1 634 use `test`; insert into t3 select * from t1 where f>=4
+master-bin.000001 711 Query 1 711 use `test`; drop temporary table t3
+master-bin.000001 769 Query 1 769 use `test`; insert into t2 select count(*) from t3
+master-bin.000001 842 Query 1 842 use `test`; drop temporary table t3
+drop table t1, t2;
+use test;
+SET TIMESTAMP=1040323920;
+create table t1(f int);
+SET TIMESTAMP=1040323931;
+create table t2(f int);
+SET TIMESTAMP=1040323938;
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+SET TIMESTAMP=1040323945;
+SET @@session.pseudo_thread_id=1;
+create temporary table t3(f int);
+SET TIMESTAMP=1040323952;
+SET @@session.pseudo_thread_id=1;
+insert into t3 select * from t1 where f<6;
+SET TIMESTAMP=1040324145;
+SET @@session.pseudo_thread_id=2;
+create temporary table t3(f int);
+SET TIMESTAMP=1040324186;
+SET @@session.pseudo_thread_id=1;
+insert into t2 select count(*) from t3;
+SET TIMESTAMP=1040324200;
+SET @@session.pseudo_thread_id=2;
+insert into t3 select * from t1 where f>=4;
+SET TIMESTAMP=1040324211;
+SET @@session.pseudo_thread_id=1;
+drop temporary table t3;
+SET TIMESTAMP=1040324219;
+SET @@session.pseudo_thread_id=2;
+insert into t2 select count(*) from t3;
+SET TIMESTAMP=1040324224;
+SET @@session.pseudo_thread_id=2;
+drop temporary table t3;
+select * from t2;
+f
+5
+7
+drop table t1,t2;
+create temporary table t3 (f int);
diff --git a/mysql-test/r/rpl_timezone.result b/mysql-test/r/rpl_timezone.result
new file mode 100644
index 00000000000..c7be3324533
--- /dev/null
+++ b/mysql-test/r/rpl_timezone.result
@@ -0,0 +1,77 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (t timestamp);
+create table t2 (t char(32));
+select @@time_zone;
+@@time_zone
+Europe/Moscow
+set time_zone='UTC';
+insert into t1 values ('20040101000000'), ('20040611093902');
+select * from t1;
+t
+2004-01-01 00:00:00
+2004-06-11 09:39:02
+select * from t1;
+t
+2004-01-01 03:00:00
+2004-06-11 13:39:02
+delete from t1;
+set time_zone='Europe/Moscow';
+insert into t1 values ('20040101000000'), ('20040611093902');
+select * from t1;
+t
+2004-01-01 00:00:00
+2004-06-11 09:39:02
+select * from t1;
+t
+2004-01-01 00:00:00
+2004-06-11 09:39:02
+show binlog events;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
+master-bin.000001 79 Query 1 79 use `test`; create table t1 (t timestamp)
+master-bin.000001 143 Query 1 143 use `test`; create table t2 (t char(32))
+master-bin.000001 206 Query 1 206 use `test`; SET ONE_SHOT TIME_ZONE='UTC'
+master-bin.000001 269 Query 1 269 use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
+master-bin.000001 364 Query 1 364 use `test`; delete from t1
+master-bin.000001 413 Query 1 413 use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
+set time_zone='MET';
+insert into t2 (select t from t1);
+select * from t1;
+t
+2003-12-31 22:00:00
+2004-06-11 07:39:02
+select * from t2;
+t
+2003-12-31 22:00:00
+2004-06-11 07:39:02
+delete from t2;
+set timestamp=1000072000;
+insert into t2 values (current_timestamp), (current_date), (current_time);
+set timestamp=1000072000;
+select current_timestamp, current_date, current_time;
+current_timestamp current_date current_time
+2001-09-10 01:46:40 2001-09-10 01:46:40
+select * from t2;
+t
+2001-09-09 23:46:40
+2001-09-09
+23:46:40
+delete from t2;
+insert into t2 values (from_unixtime(1000000000)),
+(unix_timestamp('2001-09-09 03:46:40'));
+select * from t2;
+t
+2001-09-09 03:46:40
+1000000000
+select * from t2;
+t
+2001-09-09 03:46:40
+1000000000
+set global time_zone='MET';
+ERROR HY000: Binary logging and replication forbid changing of the global server time zone
+drop table t1, t2;
diff --git a/mysql-test/r/rpl_trunc_binlog.result b/mysql-test/r/rpl_trunc_binlog.result
index 27b7c3c5677..085a2937584 100644
--- a/mysql-test/r/rpl_trunc_binlog.result
+++ b/mysql-test/r/rpl_trunc_binlog.result
@@ -1,13 +1,13 @@
-slave stop;
+stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
stop slave;
flush logs;
reset slave;
start slave;
show slave status;
-Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root MASTER_PORT 1 master-bin.002 4 slave-relay-bin.002 120 master-bin.001 Yes No 0 Rolling back unfinished transaction (no COMMIT or ROLLBACK) from relay log. A probable cause is that the master died while writing the transaction to its binary log. 0 79 #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 4 slave-relay-bin.000002 123 master-bin.000001 Yes No 0 Rolling back unfinished transaction (no COMMIT or ROLLBACK) from relay log. A probable cause is that the master died while writing the transaction to its binary log. 0 79 # None 0 No #
diff --git a/mysql-test/r/rpl_until.result b/mysql-test/r/rpl_until.result
new file mode 100644
index 00000000000..5772f176919
--- /dev/null
+++ b/mysql-test/r/rpl_until.result
@@ -0,0 +1,72 @@
+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;
+create table t1(n int not null auto_increment primary key);
+insert into t1 values (1),(2),(3),(4);
+drop table t1;
+create table t2(n int not null auto_increment primary key);
+insert into t2 values (1),(2);
+insert into t2 values (3),(4);
+drop table t2;
+show binlog events;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
+master-bin.000001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
+master-bin.000001 172 Query 1 172 use `test`; insert into t1 values (1),(2),(3),(4)
+master-bin.000001 244 Query 1 244 use `test`; drop table t1
+master-bin.000001 292 Query 1 292 use `test`; create table t2(n int not null auto_increment primary key)
+master-bin.000001 385 Query 1 385 use `test`; insert into t2 values (1),(2)
+master-bin.000001 449 Query 1 449 use `test`; insert into t2 values (3),(4)
+master-bin.000001 513 Query 1 513 use `test`; drop table t2
+start slave until master_log_file='master-bin.000001', master_log_pos=244;
+select * from t1;
+n
+1
+2
+3
+4
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 # master-bin.000001 Yes No 0 0 244 # Master master-bin.000001 244 No #
+start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
+select * from t1;
+n
+1
+2
+3
+4
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 # master-bin.000001 Yes No 0 0 244 # Master master-no-such-bin.000001 291 No #
+start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=537;
+select * from t2;
+n
+1
+2
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 # master-bin.000001 Yes No 0 0 449 # Relay slave-relay-bin.000002 537 No #
+start slave;
+stop slave;
+start slave until master_log_file='master-bin.000001', master_log_pos=561;
+show slave status;
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 # master-bin.000001 Yes No 0 0 561 # Master master-bin.000001 561 No #
+start slave until master_log_file='master-bin', master_log_pos=561;
+ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
+start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
+ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
+start slave until master_log_file='master-bin.000001';
+ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
+start slave until relay_log_file='slave-relay-bin.000002';
+ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
+start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
+ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
+start slave sql_thread;
+start slave until master_log_file='master-bin.000001', master_log_pos=561;
+Warnings:
+Note 1254 Slave is already running
diff --git a/mysql-test/r/rpl_user_variables.result b/mysql-test/r/rpl_user_variables.result
new file mode 100644
index 00000000000..85768270ba3
--- /dev/null
+++ b/mysql-test/r/rpl_user_variables.result
@@ -0,0 +1,109 @@
+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;
+reset master;
+create table t1(n char(30));
+set @i1:=12345678901234, @i2:=-12345678901234, @i3:=0, @i4:=-1;
+set @s1:='This is a test', @r1:=12.5, @r2:=-12.5;
+set @n1:=null;
+set @s2:='', @s3:='abc\'def', @s4:= 'abc\\def', @s5:= 'abc''def';
+insert into t1 values (@i1), (@i2), (@i3), (@i4);
+insert into t1 values (@r1), (@r2);
+insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5);
+insert into t1 values (@n1);
+insert into t1 values (@n2);
+insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1);
+insert into t1 values (@a+(@b:=@a+1));
+set @q:='abc';
+insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'));
+set @a:=5;
+insert into t1 values (@a),(@a);
+insert into t1 values (@a),(@a),(@a*5);
+select * from t1;
+n
+12345678901234
+-12345678901234
+0
+-1
+12.5
+-12.5
+This is a test
+
+abc'def
+abc\def
+abc'def
+NULL
+NULL
+0
+1
+2
+5
+abc
+abcn1
+abcn1n2
+5
+5
+NULL
+NULL
+NULL
+select * from t1;
+n
+12345678901234
+-12345678901234
+0
+-1
+12.5
+-12.5
+This is a test
+
+abc'def
+abc\def
+abc'def
+NULL
+NULL
+0
+1
+2
+5
+abc
+abcn1
+abcn1n2
+5
+5
+NULL
+NULL
+NULL
+show binlog events from 141;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+slave-bin.000001 141 User var 2 141 @`i1`=12345678901234
+slave-bin.000001 184 User var 2 184 @`i2`=-12345678901234
+slave-bin.000001 227 User var 2 227 @`i3`=0
+slave-bin.000001 270 User var 2 270 @`i4`=-1
+slave-bin.000001 313 Query 1 313 use `test`; insert into t1 values (@i1), (@i2), (@i3), (@i4)
+slave-bin.000001 396 User var 2 396 @`r1`=12.5
+slave-bin.000001 439 User var 2 439 @`r2`=-12.5
+slave-bin.000001 482 Query 1 482 use `test`; insert into t1 values (@r1), (@r2)
+slave-bin.000001 551 User var 2 551 @`s1`=_latin1 0x5468697320697320612074657374 COLLATE latin1_swedish_ci
+slave-bin.000001 600 User var 2 600 @`s2`=_latin1 "" COLLATE latin1_swedish_ci
+slave-bin.000001 635 User var 2 635 @`s3`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
+slave-bin.000001 677 User var 2 677 @`s4`=_latin1 0x6162635C646566 COLLATE latin1_swedish_ci
+slave-bin.000001 719 User var 2 719 @`s5`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
+slave-bin.000001 761 Query 1 761 use `test`; insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5)
+slave-bin.000001 851 User var 2 851 @`n1`=NULL
+slave-bin.000001 877 Query 1 877 use `test`; insert into t1 values (@n1)
+slave-bin.000001 939 User var 2 939 @`n2`=NULL
+slave-bin.000001 965 Query 1 965 use `test`; insert into t1 values (@n2)
+slave-bin.000001 1027 Query 1 1027 use `test`; insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1)
+slave-bin.000001 1115 User var 2 1115 @`a`=2
+slave-bin.000001 1157 Query 1 1157 use `test`; insert into t1 values (@a+(@b:=@a+1))
+slave-bin.000001 1229 User var 2 1229 @`q`=_latin1 0x616263 COLLATE latin1_swedish_ci
+slave-bin.000001 1266 Query 1 1266 use `test`; insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'))
+slave-bin.000001 1370 User var 2 1370 @`a`=5
+slave-bin.000001 1412 Query 1 1412 use `test`; insert into t1 values (@a),(@a)
+slave-bin.000001 1478 User var 2 1478 @`a`=NULL
+slave-bin.000001 1503 Query 1 1503 use `test`; insert into t1 values (@a),(@a),(@a*5)
+drop table t1;
+stop slave;
diff --git a/mysql-test/r/sel000001.result b/mysql-test/r/sel000001.result
deleted file mode 100644
index 6b6b9b7dffc..00000000000
--- a/mysql-test/r/sel000001.result
+++ /dev/null
@@ -1,21 +0,0 @@
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (s CHAR(20) PRIMARY KEY, id INT);
-INSERT INTO t1 VALUES ('cat', 1), ('mouse', 3), ('dog', 2), ('snake', 77);
-SELECT s, id FROM t1 WHERE s = 'mouse';
-s id
-mouse 3
-drop table t1;
-CREATE TABLE t1 (
-node int(11) NOT NULL default '0',
-maxchild int(11) NOT NULL default '0',
-PRIMARY KEY (`node`)
-);
-INSERT INTO t1 (node, maxchild) VALUES (4,4),(5,5),(1,244);
-SELECT * FROM t1 g1, t1 g2
-WHERE g1.node <= g2.node and g2.node <= g1.maxchild and g2.node = g2.maxchild;
-node maxchild node maxchild
-4 4 4 4
-5 5 5 5
-1 244 4 4
-1 244 5 5
-DROP TABLE t1;
diff --git a/mysql-test/r/sel000002.result b/mysql-test/r/sel000002.result
deleted file mode 100644
index b824de8de4a..00000000000
--- a/mysql-test/r/sel000002.result
+++ /dev/null
@@ -1,9 +0,0 @@
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (n INT);
-INSERT INTO t1 VALUES (1), (2), (3);
-SELECT * FROM t1;
-n
-1
-2
-3
-drop table t1;
diff --git a/mysql-test/r/sel000003.result b/mysql-test/r/sel000003.result
deleted file mode 100644
index c3853832f87..00000000000
--- a/mysql-test/r/sel000003.result
+++ /dev/null
@@ -1,8 +0,0 @@
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (name CHAR(20) NOT NULL PRIMARY KEY, score SMALLINT NOT NULL, KEY(score));
-INSERT INTO t1 VALUES ('Sasha', 20), ('Matt', 20), ('Monty', 10), ('David', 10), ('Tim', 10), ('Jeremy', 10);
-SELECT COUNT(*) as n, score FROM t1 GROUP BY score;
-n score
-4 10
-2 20
-drop table t1;
diff --git a/mysql-test/r/sel000031.result b/mysql-test/r/sel000031.result
deleted file mode 100644
index d3f01ab687f..00000000000
--- a/mysql-test/r/sel000031.result
+++ /dev/null
@@ -1,12 +0,0 @@
-drop table if exists t1,t2;
-create table t1 (id int(10) not null unique);
-create table t2 (id int(10) not null primary key,
-val int(10) not null);
-insert into t1 values (1),(2),(4);
-insert into t2 values (1,1),(2,1),(3,1),(4,2);
-select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id;
-id elt(two.val,'one','two')
-1 one
-2 one
-4 two
-drop table t1,t2;
diff --git a/mysql-test/r/sel000032.result b/mysql-test/r/sel000032.result
deleted file mode 100644
index 4cca245d75b..00000000000
--- a/mysql-test/r/sel000032.result
+++ /dev/null
@@ -1,12 +0,0 @@
-drop table if exists t1,t2;
-create table t1 (id int(10) not null unique);
-create table t2 (id int(10) not null primary key,
-val int(10) not null);
-insert into t1 values (1),(2),(4);
-insert into t2 values (1,1),(2,1),(3,1),(4,2);
-select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id;
-id elt(two.val,'one','two')
-1 one
-2 one
-4 two
-drop table t1,t2;
diff --git a/mysql-test/r/sel000033.result b/mysql-test/r/sel000033.result
deleted file mode 100644
index 1bfafaf5b27..00000000000
--- a/mysql-test/r/sel000033.result
+++ /dev/null
@@ -1,14 +0,0 @@
-drop table if exists t1;
-create table t1 (id int(10) primary key);
-insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9);
-select id from t1 where id in (2,5,9) ;
-id
-2
-5
-9
-select id from t1 where id=2 or id=5 or id=9 ;
-id
-2
-5
-9
-drop table t1;
diff --git a/mysql-test/r/sel000100.result b/mysql-test/r/sel000100.result
deleted file mode 100644
index 3ffa4004b84..00000000000
--- a/mysql-test/r/sel000100.result
+++ /dev/null
@@ -1,38 +0,0 @@
-DROP TABLE IF EXISTS t1,t2;
-CREATE TABLE t1 (
-ID int(11) NOT NULL auto_increment,
-NAME varchar(75) DEFAULT '' NOT NULL,
-LINK_ID int(11) DEFAULT '0' NOT NULL,
-PRIMARY KEY (ID),
-KEY NAME (NAME),
-KEY LINK_ID (LINK_ID)
-);
-INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (1,'Mike',0);
-INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (2,'Jack',0);
-INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (3,'Bill',0);
-CREATE TABLE t2 (
-ID int(11) NOT NULL auto_increment,
-NAME varchar(150) DEFAULT '' NOT NULL,
-PRIMARY KEY (ID),
-KEY NAME (NAME)
-);
-SELECT DISTINCT
-t2.id AS key_link_id,
-t2.name AS link
-FROM t1
-LEFT JOIN t2 ON t1.link_id=t2.id
-GROUP BY t1.id
-ORDER BY link;
-key_link_id link
-NULL NULL
-drop table t1,t2;
-CREATE TABLE t1 (
-html varchar(5) default NULL,
-rin int(11) default '0',
-out int(11) default '0'
-) TYPE=MyISAM;
-INSERT INTO t1 VALUES ('1',1,0);
-SELECT DISTINCT html,SUM(out)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin;
-html prod
-1 0.00
-drop table t1;
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index cc90547722f..a05b379ed88 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -1,4 +1,5 @@
drop table if exists t1,t2,t3,t4;
+drop table if exists t1_1,t1_2,t9_1,t9_2;
CREATE TABLE t1 (
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
@@ -127,31 +128,31 @@ fld3
select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%';
fld3
explain select t2.fld3 from t2 where fld3 = 'honeysuckle';
-table type possible_keys key key_len ref rows Extra
-t2 ref fld3 fld3 30 const 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle';
-table type possible_keys key key_len ref rows Extra
-t2 ALL NULL NULL NULL NULL 1199 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle';
-table type possible_keys key key_len ref rows Extra
-t2 ALL NULL NULL NULL NULL 1199 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle';
-table type possible_keys key key_len ref rows Extra
-t2 ref fld3 fld3 30 const 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle';
-table type possible_keys key key_len ref rows Extra
-t2 ref fld3 fld3 30 const 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
explain select fld3 from t2 ignore index (fld3,not_used);
-Key column 'not_used' doesn't exist in table
+ERROR 42000: Key column 'not_used' doesn't exist in table
explain select fld3 from t2 use index (not_used);
-Key column 'not_used' doesn't exist in table
+ERROR 42000: Key column 'not_used' doesn't exist in table
select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
fld3
honeysuckle
honoring
explain select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
-table type possible_keys key key_len ref rows Extra
-t2 range fld3 fld3 30 NULL 2 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range fld3 fld3 30 NULL 2 Using where; Using index
select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3;
fld1 fld3
148504 Colombo
@@ -170,8 +171,8 @@ fld1
250501
250502
explain select fld1 from t2 where fld1=250501 or fld1="250502";
-table type possible_keys key key_len ref rows Extra
-t2 range fld1 fld1 4 NULL 2 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range fld1 fld1 4 NULL 2 Using where; Using index
select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;
fld1
250501
@@ -179,8 +180,8 @@ fld1
250505
250601
explain select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;
-table type possible_keys key key_len ref rows Extra
-t2 range fld1 fld1 4 NULL 4 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range fld1 fld1 4 NULL 4 Using where; Using index
select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%';
fld1 fld3
218401 faithful
@@ -488,7 +489,7 @@ price2 double(11,0),
key (period),
key (name)
);
-create temporary table tmp type = myisam select * from t3;
+create temporary table tmp engine = myisam select * from t3;
insert into t3 select * from tmp;
insert into tmp select * from t3;
insert into t3 select * from tmp;
@@ -596,21 +597,21 @@ companynr rtrim(space(512+companynr))
select distinct fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by fld3;
fld3
explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by t3.t2nr,fld3;
-table type possible_keys key key_len ref rows Extra
-t2 ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort
-t3 eq_ref PRIMARY PRIMARY 4 t2.fld1 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
-table type possible_keys key key_len ref rows Extra
-t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
-t3 ref period period 4 t1.period 4181
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
+1 SIMPLE t3 ref period period 4 test.t1.period 4181
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
-table type possible_keys key key_len ref rows Extra
-t3 index period period 4 NULL 41810
-t1 ref period period 4 t3.period 4181
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 index period period 4 NULL 41810
+1 SIMPLE t1 ref period period 4 test.t3.period 4181
explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
-table type possible_keys key key_len ref rows Extra
-t1 index period period 4 NULL 41810
-t3 ref period period 4 t1.period 4181
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index period period 4 NULL 41810
+1 SIMPLE t3 ref period period 4 test.t1.period 4181
select period from t1;
period
9410
@@ -623,9 +624,9 @@ select fld3,period from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.
fld3 period
breaking 1001
explain select fld3,period from t2,t3 where t2.fld1 = 011401 and t3.t2nr=t2.fld1 and 1001 = t3.period;
-table type possible_keys key key_len ref rows Extra
-t2 const fld1 fld1 4 const 1
-t3 const PRIMARY,period PRIMARY 4 const 1
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 const fld1 fld1 4 const 1
+1 SIMPLE t3 const PRIMARY,period PRIMARY 4 const 1
select fld3,period from t2,t1 where companynr*10 = 37*10;
fld3 period
breaking 9410
@@ -1283,13 +1284,12 @@ fld1 fld3 period price price2
018601 vacuuming 1001 5987435 234724
018801 inch 1001 5987435 234724
018811 repetitions 1001 5987435 234724
-drop table if exists company;
create table t4 (
companynr tinyint(2) unsigned zerofill NOT NULL default '00',
companyname char(30) NOT NULL default '',
PRIMARY KEY (companynr),
UNIQUE KEY companyname(companyname)
-) TYPE=MyISAM MAX_ROWS=50 PACK_KEYS=1 COMMENT='companynames';
+) ENGINE=MyISAM MAX_ROWS=50 PACK_KEYS=1 COMMENT='companynames';
select STRAIGHT_JOIN t2.companynr,companyname from t4,t2 where t2.companynr=t4.companynr group by t2.companynr;
companynr companyname
00 Unknown
@@ -1356,46 +1356,46 @@ select count(*) from t2 left join t4 using (companynr) where t4.companynr is not
count(*)
1199
explain select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null;
-table type possible_keys key key_len ref rows Extra
-t2 ALL NULL NULL NULL NULL 1200
-t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where; Not exists
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1200
+1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where; Not exists
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr is null;
-table type possible_keys key key_len ref rows Extra
-t4 ALL NULL NULL NULL NULL 12
-t2 ALL NULL NULL NULL NULL 1200 Using where; Not exists
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t4 ALL NULL NULL NULL NULL 12
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1200 Using where; Not exists
delete from t2 where fld1=999999;
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0;
-table type possible_keys key key_len ref rows Extra
-t2 ALL NULL NULL NULL NULL 1199 Using where
-t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
+1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0;
-table type possible_keys key key_len ref rows Extra
-t2 ALL NULL NULL NULL NULL 1199 Using where
-t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
+1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0;
-table type possible_keys key key_len ref rows Extra
-t2 ALL NULL NULL NULL NULL 1199 Using where
-t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
+1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null;
-table type possible_keys key key_len ref rows Extra
-t4 ALL NULL NULL NULL NULL 12
-t2 ALL NULL NULL NULL NULL 1199 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t4 ALL NULL NULL NULL NULL 12
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0 or t4.companynr > 0;
-table type possible_keys key key_len ref rows Extra
-t4 ALL PRIMARY NULL NULL NULL 12
-t2 ALL NULL NULL NULL NULL 1199 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where ifnull(t2.companynr,1)>0;
-table type possible_keys key key_len ref rows Extra
-t4 ALL NULL NULL NULL NULL 12
-t2 ALL NULL NULL NULL NULL 1199 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t4 ALL NULL NULL NULL NULL 12
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
companynr companynr
37 36
41 40
explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
-table type possible_keys key key_len ref rows Extra
-t2 ALL NULL NULL NULL NULL 1199 Using temporary
-t4 index NULL PRIMARY 1 NULL 12 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using temporary
+1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using where; Using index
select t2.fld1,t2.companynr,fld3,period from t3,t2 where t2.fld1 = 38208 and t2.fld1=t3.t2nr and period = 1008 or t2.fld1 = 38008 and t2.fld1 =t3.t2nr and period = 1008;
fld1 companynr fld3 period
038008 37 reporters 1008
@@ -1464,14 +1464,19 @@ companynr count(*)
58 23
53 4
50 11
-select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1) from t2 where companynr = 34 and fld4<>"";
-count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1)
-70 absentee vest 17788966 254128.0857 3272.5940
-select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1) from t2 group by companynr limit 3;
-companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1)
-00 82 Anthony windmills 10355753 126289.6707 115550.9757
-29 95 abut wetness 14473298 152350.5053 8368.5480
-34 70 absentee vest 17788966 254128.0857 3272.5940
+select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>"";
+count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
+70 absentee vest 17788966 254128.0857 3272.5940 10709871.3069
+explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>"";
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
+Warnings:
+Note 1003 select count(0) AS `count(*)`,min(test.t2.fld4) AS `min(fld4)`,max(test.t2.fld4) AS `max(fld4)`,sum(test.t2.fld1) AS `sum(fld1)`,avg(test.t2.fld1) AS `avg(fld1)`,std(test.t2.fld1) AS `std(fld1)`,variance(test.t2.fld1) AS `variance(fld1)` from test.t2 where ((test.t2.companynr = 34) and (test.t2.fld4 <> _latin1''))
+select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
+companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
+00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087
+29 95 abut wetness 14473298 152350.5053 8368.5480 70032594.9026
+34 70 absentee vest 17788966 254128.0857 3272.5940 10709871.3069
select companynr,t2nr,count(price),sum(price),min(price),max(price),avg(price) from t3 where companynr = 37 group by companynr,t2nr limit 10;
companynr t2nr count(price) sum(price) min(price) max(price) avg(price)
37 1 1 5987435 5987435 5987435 5987435.0000
@@ -1904,11 +1909,11 @@ select t2.fld1,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr =
fld1 sum(price)
038008 234298
explain select fld3 from t2 where 1>2 or 2>3;
-Comment
-Impossible WHERE
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
explain select fld3 from t2 where fld1=fld1;
-table type possible_keys key key_len ref rows Extra
-t2 ALL NULL NULL NULL NULL 1199
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199
select companynr,fld1 from t2 HAVING fld1=250501 or fld1=250502;
companynr fld1
34 250501
@@ -1959,8 +1964,8 @@ select count(*) from t3 where companynr=512 and price2=76234234;
count(*)
4181
explain select min(fld1),max(fld1),count(*) from t2;
-Comment
-Select tables optimized away
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
select min(fld1),max(fld1),count(*) from t2;
min(fld1) max(fld1) count(*)
0 1232609 1199
@@ -2027,23 +2032,23 @@ Tables_in_test (s%)
show tables from test like "t?";
Tables_in_test (t?)
show full columns from t2;
-Field Type Null Key Default Extra Privileges
-auto int(11) PRI NULL auto_increment select,insert,update,references
-fld1 int(6) unsigned zerofill UNI 000000 select,insert,update,references
-companynr tinyint(2) unsigned zerofill 00 select,insert,update,references
-fld3 char(30) MUL select,insert,update,references
-fld4 char(35) select,insert,update,references
-fld5 char(35) select,insert,update,references
-fld6 char(4) select,insert,update,references
+Field Type Collation Null Key Default Extra Privileges Comment
+auto int(11) NULL PRI NULL auto_increment select,insert,update,references
+fld1 int(6) unsigned zerofill NULL UNI 000000 select,insert,update,references
+companynr tinyint(2) unsigned zerofill NULL 00 select,insert,update,references
+fld3 char(30) latin1_swedish_ci MUL select,insert,update,references
+fld4 char(35) latin1_swedish_ci select,insert,update,references
+fld5 char(35) latin1_swedish_ci select,insert,update,references
+fld6 char(4) latin1_swedish_ci select,insert,update,references
show full columns from t2 from test like 'f%';
-Field Type Null Key Default Extra Privileges
-fld1 int(6) unsigned zerofill UNI 000000 select,insert,update,references
-fld3 char(30) MUL select,insert,update,references
-fld4 char(35) select,insert,update,references
-fld5 char(35) select,insert,update,references
-fld6 char(4) select,insert,update,references
+Field Type Collation Null Key Default Extra Privileges Comment
+fld1 int(6) unsigned zerofill NULL UNI 000000 select,insert,update,references
+fld3 char(30) latin1_swedish_ci MUL select,insert,update,references
+fld4 char(35) latin1_swedish_ci select,insert,update,references
+fld5 char(35) latin1_swedish_ci select,insert,update,references
+fld6 char(4) latin1_swedish_ci select,insert,update,references
show full columns from t2 from test like 's%';
-Field Type Null Key Default Extra Privileges
+Field Type Collation Null Key Default Extra Privileges Comment
show keys from t2;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE
@@ -2052,6 +2057,10 @@ t2 1 fld3 1 fld3 A NULL NULL NULL BTREE
drop table t4, t3, t2, t1;
DO 1;
DO benchmark(100,1+1),1,1;
+do default;
+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
+do foobar;
+ERROR 42S22: Unknown column 'foobar' in 'field list'
CREATE TABLE t1 (
id mediumint(8) unsigned NOT NULL auto_increment,
pseudo varchar(35) NOT NULL default '',
@@ -2063,11 +2072,18 @@ INSERT INTO t1 (pseudo) VALUES ('test1');
SELECT 1 as rnd1 from t1 where rand() > 2;
rnd1
DROP TABLE t1;
-CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, mmid int(10) unsigned default NULL, hdid int(10) unsigned default NULL, fsid int(10) unsigned default NULL, ctid int(10) unsigned default NULL, dtid int(10) unsigned default NULL, cost int(10) unsigned default NULL, performance int(10) unsigned default NULL, serialnumber bigint(20) unsigned default NULL, monitored tinyint(3) unsigned default '1', removed tinyint(3) unsigned default '0', target tinyint(3) unsigned default '0', dt_modified timestamp(14) NOT NULL, name varchar(255) binary default NULL, description varchar(255) default NULL, UNIQUE KEY hmid (hmid,volid)) TYPE=MyISAM;
+CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, mmid int(10) unsigned default NULL, hdid int(10) unsigned default NULL, fsid int(10) unsigned default NULL, ctid int(10) unsigned default NULL, dtid int(10) unsigned default NULL, cost int(10) unsigned default NULL, performance int(10) unsigned default NULL, serialnumber bigint(20) unsigned default NULL, monitored tinyint(3) unsigned default '1', removed tinyint(3) unsigned default '0', target tinyint(3) unsigned default '0', dt_modified timestamp(14) NOT NULL, name varchar(255) binary default NULL, description varchar(255) default NULL, UNIQUE KEY hmid (hmid,volid)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (200001,2,1,1,100,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\E$',''),(200002,2,2,1,101,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\C$',''),(200003,1,3,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,0,1,20020425060427,'c:',NULL);
-CREATE TABLE t2 ( hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, sampletid smallint(5) unsigned default NULL, sampletime datetime default NULL, samplevalue bigint(20) unsigned default NULL, KEY idx1 (hmid,volid,sampletid,sampletime)) TYPE=MyISAM;
+CREATE TABLE t2 ( hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, sampletid smallint(5) unsigned default NULL, sampletime datetime default NULL, samplevalue bigint(20) unsigned default NULL, KEY idx1 (hmid,volid,sampletid,sampletime)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12:00:01',35);
-SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'NULL' AND b.sampletime < 'NULL' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
+SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'wrong-date-value' AND b.sampletime < 'wrong-date-value' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
+gvid the_success the_fail the_size the_time
+Warnings:
+Warning 1292 Truncated incorrect datetime value: 'wrong-date-value'
+Warning 1292 Truncated incorrect datetime value: 'wrong-date-value'
+Warning 1292 Truncated incorrect datetime value: 'wrong-date-value'
+Warning 1292 Truncated incorrect datetime value: 'wrong-date-value'
+SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= NULL AND b.sampletime < NULL AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
gvid the_success the_fail the_size the_time
DROP TABLE t1,t2;
create table t1 ( A_Id bigint(20) NOT NULL default '0', A_UpdateBy char(10) NOT NULL default '', A_UpdateDate bigint(20) NOT NULL default '0', A_UpdateSerial int(11) NOT NULL default '0', other_types bigint(20) NOT NULL default '0', wss_type bigint(20) NOT NULL default '0');
@@ -2085,6 +2101,16 @@ select wss_type from t1 where wss_type =102935229216544093;
wss_type
102935229216544093
drop table t1;
+select 1+2,"aaaa",3.13*2.0 into @a,@b,@c;
+select @a;
+@a
+3
+select @b;
+@b
+aaaa
+select @c;
+@c
+6.26
create table t1 (a int not null auto_increment primary key);
insert into t1 values ();
insert into t1 values ();
@@ -2265,19 +2291,19 @@ a a a
2 2 2
3 3 3
select * from t1 natural join (t1 as t2 left join t1 as t3 using (a));
-a a a
-1 1 1
-2 2 2
-3 3 3
+a a
+1 1
+2 2
+3 3
select * from (t1 as t2 left join t1 as t3 using (a)) natural join t1;
a a a
1 1 1
2 2 2
3 3 3
drop table t1;
-CREATE TABLE t1 ( aa char(2), id int(11) NOT NULL auto_increment, t2_id int(11) NOT NULL default '0', PRIMARY KEY (id), KEY replace_id (t2_id)) TYPE=MyISAM;
+CREATE TABLE t1 ( aa char(2), id int(11) NOT NULL auto_increment, t2_id int(11) NOT NULL default '0', PRIMARY KEY (id), KEY replace_id (t2_id)) ENGINE=MyISAM;
INSERT INTO t1 VALUES ("1",8264,2506),("2",8299,2517),("3",8301,2518),("4",8302,2519),("5",8303,2520),("6",8304,2521),("7",8305,2522);
-CREATE TABLE t2 ( id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) TYPE=MyISAM;
+CREATE TABLE t2 ( id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (2517), (2518), (2519), (2520), (2521), (2522);
select * from t1, t2 WHERE t1.t2_id = t2.id and t1.t2_id > 0 order by t1.id LIMIT 0, 5;
aa id t2_id id
@@ -2297,11 +2323,11 @@ insert into t2 values (1);
insert into t4 values (1,1);
explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
-table type possible_keys key key_len ref rows Extra
-t3 system NULL NULL NULL NULL 0 const row not found
-t1 ALL NULL NULL NULL NULL 2
-t2 ALL NULL NULL NULL NULL 1
-t4 ALL id4 NULL NULL NULL 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1
+1 SIMPLE t4 ALL id4 NULL NULL NULL 1 Using where
select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
id1 id2 id3 id4 id44
@@ -2332,17 +2358,17 @@ create table t2 (c integer, d integer, index(c), index(d));
insert into t1 values (1,2), (2,2), (3,2), (4,2);
insert into t2 values (1,3), (2,3), (3,4), (4,4);
explain select * from t1 left join t2 on a=c where d in (4);
-table type possible_keys key key_len ref rows Extra
-t2 ref c,d d 5 const 2 Using where
-t1 ALL a NULL NULL NULL 3 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref c,d d 5 const 2 Using where
+1 SIMPLE t1 ALL a NULL NULL NULL 3 Using where
select * from t1 left join t2 on a=c where d in (4);
a b c d
3 2 3 4
4 2 4 4
explain select * from t1 left join t2 on a=c where d = 4;
-table type possible_keys key key_len ref rows Extra
-t2 ref c,d d 5 const 2 Using where
-t1 ALL a NULL NULL NULL 3 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref c,d d 5 const 2 Using where
+1 SIMPLE t1 ALL a NULL NULL NULL 3 Using where
select * from t1 left join t2 on a=c where d = 4;
a b c d
3 2 3 4
@@ -2353,14 +2379,11 @@ i int(11) NOT NULL default '0',
c char(10) NOT NULL default '',
PRIMARY KEY (i),
UNIQUE KEY c (c)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,'a');
INSERT INTO t1 VALUES (2,'b');
INSERT INTO t1 VALUES (3,'c');
EXPLAIN SELECT i FROM t1 WHERE i=1;
-table type possible_keys key key_len ref rows Extra
-t1 const PRIMARY PRIMARY 4 const 1 Using index
-EXPLAIN SELECT i FROM t1 WHERE i=1;
-table type possible_keys key key_len ref rows Extra
-t1 const PRIMARY PRIMARY 4 const 1 Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
DROP TABLE t1;
diff --git a/mysql-test/r/select.result.es b/mysql-test/r/select.result.es
new file mode 100644
index 00000000000..da761ebb822
--- /dev/null
+++ b/mysql-test/r/select.result.es
@@ -0,0 +1,2389 @@
+drop table if exists t1,t2,t3,t4;
+drop table if exists t1_1,t1_2,t9_1,t9_2;
+CREATE TABLE t1 (
+Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
+Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
+);
+INSERT INTO t1 VALUES (9410,9412);
+select period from t1;
+period
+9410
+select * from t1;
+Period Varor_period
+9410 9412
+select t1.* from t1;
+Period Varor_period
+9410 9412
+CREATE TABLE t2 (
+auto int not null auto_increment,
+fld1 int(6) unsigned zerofill DEFAULT '000000' NOT NULL,
+companynr tinyint(2) unsigned zerofill DEFAULT '00' NOT NULL,
+fld3 char(30) DEFAULT '' NOT NULL,
+fld4 char(35) DEFAULT '' NOT NULL,
+fld5 char(35) DEFAULT '' NOT NULL,
+fld6 char(4) DEFAULT '' NOT NULL,
+UNIQUE fld1 (fld1),
+KEY fld3 (fld3),
+PRIMARY KEY (auto)
+);
+select t2.fld3 from t2 where companynr = 58 and fld3 like "%imaginable%";
+fld3
+imaginable
+select fld3 from t2 where fld3 like "%cultivation" ;
+fld3
+cultivation
+select t2.fld3,companynr from t2 where companynr = 57+1 order by fld3;
+fld3 companynr
+concoct 58
+druggists 58
+engrossing 58
+Eurydice 58
+exclaimers 58
+ferociousness 58
+hopelessness 58
+Huey 58
+imaginable 58
+judges 58
+merging 58
+ostrich 58
+peering 58
+Phelps 58
+presumes 58
+Ruth 58
+sentences 58
+Shylock 58
+straggled 58
+synergy 58
+thanking 58
+tying 58
+unlocks 58
+select fld3,companynr from t2 where companynr = 58 order by fld3;
+fld3 companynr
+concoct 58
+druggists 58
+engrossing 58
+Eurydice 58
+exclaimers 58
+ferociousness 58
+hopelessness 58
+Huey 58
+imaginable 58
+judges 58
+merging 58
+ostrich 58
+peering 58
+Phelps 58
+presumes 58
+Ruth 58
+sentences 58
+Shylock 58
+straggled 58
+synergy 58
+thanking 58
+tying 58
+unlocks 58
+select fld3 from t2 order by fld3 desc limit 10;
+fld3
+youthfulness
+yelped
+Wotan
+workers
+Witt
+witchcraft
+Winsett
+Willy
+willed
+wildcats
+select fld3 from t2 order by fld3 desc limit 5;
+fld3
+youthfulness
+yelped
+Wotan
+workers
+Witt
+select fld3 from t2 order by fld3 desc limit 5,5;
+fld3
+witchcraft
+Winsett
+Willy
+willed
+wildcats
+select t2.fld3 from t2 where fld3 = 'honeysuckle';
+fld3
+honeysuckle
+select t2.fld3 from t2 where fld3 LIKE 'honeysuckl_';
+fld3
+honeysuckle
+select t2.fld3 from t2 where fld3 LIKE 'hon_ysuckl_';
+fld3
+honeysuckle
+select t2.fld3 from t2 where fld3 LIKE 'honeysuckle%';
+fld3
+honeysuckle
+select t2.fld3 from t2 where fld3 LIKE 'h%le';
+fld3
+honeysuckle
+select t2.fld3 from t2 where fld3 LIKE 'honeysuckle_';
+fld3
+select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%';
+fld3
+explain select t2.fld3 from t2 where fld3 = 'honeysuckle';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
+explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
+explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
+explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
+explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
+explain select fld3 from t2 ignore index (fld3,not_used);
+ERROR 42000: Key column 'not_used' doesn't exist in table
+explain select fld3 from t2 use index (not_used);
+ERROR 42000: Key column 'not_used' doesn't exist in table
+select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
+fld3
+honeysuckle
+honoring
+explain select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range fld3 fld3 30 NULL 2 Using where; Using index
+select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3;
+fld1 fld3
+148504 Colombo
+068305 Colombo
+000000 nondecreasing
+select fld1,fld3 from t2 where companynr = 37 and fld3 = 'appendixes';
+fld1 fld3
+232605 appendixes
+1232605 appendixes
+1232606 appendixes
+1232607 appendixes
+1232608 appendixes
+1232609 appendixes
+select fld1 from t2 where fld1=250501 or fld1="250502";
+fld1
+250501
+250502
+explain select fld1 from t2 where fld1=250501 or fld1="250502";
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range fld1 fld1 4 NULL 2 Using where; Using index
+select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;
+fld1
+250501
+250502
+250505
+250601
+explain select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range fld1 fld1 4 NULL 4 Using where; Using index
+select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%';
+fld1 fld3
+218401 faithful
+018007 fanatic
+228311 fated
+018017 featherweight
+218022 feed
+088303 feminine
+058004 Fenton
+038017 fetched
+018054 fetters
+208101 fiftieth
+238007 filial
+013606 fingerings
+218008 finishers
+038205 firearm
+188505 fitting
+202301 Fitzpatrick
+238008 fixedly
+012001 flanking
+018103 flint
+018104 flopping
+188007 flurried
+013602 foldout
+226205 foothill
+232102 forgivably
+228306 forthcoming
+186002 freakish
+208113 freest
+231315 freezes
+036002 funereal
+226209 furnishings
+198006 furthermore
+select fld3 from t2 where fld3 like "L%" and fld3 = "ok";
+fld3
+select fld3 from t2 where (fld3 like "C%" and fld3 = "Chantilly");
+fld3
+Chantilly
+select fld1,fld3 from t2 where fld1 like "25050%";
+fld1 fld3
+250501 poisoning
+250502 Iraqis
+250503 heaving
+250504 population
+250505 bomb
+select fld1,fld3 from t2 where fld1 like "25050_";
+fld1 fld3
+250501 poisoning
+250502 Iraqis
+250503 heaving
+250504 population
+250505 bomb
+select distinct companynr from t2;
+companynr
+00
+37
+36
+50
+58
+29
+40
+53
+65
+41
+34
+68
+select distinct companynr from t2 order by companynr;
+companynr
+00
+29
+34
+36
+37
+40
+41
+50
+53
+58
+65
+68
+select distinct companynr from t2 order by companynr desc;
+companynr
+68
+65
+58
+53
+50
+41
+40
+37
+36
+34
+29
+00
+select distinct t2.fld3,period from t2,t1 where companynr=37 and fld3 like "O%";
+fld3 period
+obliterates 9410
+offload 9410
+opaquely 9410
+organizer 9410
+overestimating 9410
+overlay 9410
+select distinct fld3 from t2 where companynr = 34 order by fld3;
+fld3
+absentee
+accessed
+ahead
+alphabetic
+Asiaticizations
+attitude
+aye
+bankruptcies
+belays
+Blythe
+bomb
+boulevard
+bulldozes
+cannot
+caressing
+charcoal
+checksumming
+chess
+clubroom
+colorful
+cosy
+creator
+crying
+Darius
+diffusing
+duality
+Eiffel
+Epiphany
+Ernestine
+explorers
+exterminated
+famine
+forked
+Gershwins
+heaving
+Hodges
+Iraqis
+Italianization
+Lagos
+landslide
+libretto
+Majorca
+mastering
+narrowed
+occurred
+offerers
+Palestine
+Peruvianizes
+pharmaceutic
+poisoning
+population
+Pygmalion
+rats
+realest
+recording
+regimented
+retransmitting
+reviver
+rouses
+scars
+sicker
+sleepwalk
+stopped
+sugars
+translatable
+uncles
+unexpected
+uprisings
+versatility
+vest
+select distinct fld3 from t2 limit 10;
+fld3
+abates
+abiding
+Abraham
+abrogating
+absentee
+abut
+accessed
+accruing
+accumulating
+accuracies
+select distinct fld3 from t2 having fld3 like "A%" limit 10;
+fld3
+abates
+abiding
+Abraham
+abrogating
+absentee
+abut
+accessed
+accruing
+accumulating
+accuracies
+select distinct substring(fld3,1,3) from t2 where fld3 like "A%";
+substring(fld3,1,3)
+aba
+abi
+Abr
+abs
+abu
+acc
+acq
+acu
+Ade
+adj
+Adl
+adm
+Ado
+ads
+adv
+aer
+aff
+afi
+afl
+afo
+agi
+ahe
+aim
+air
+Ald
+alg
+ali
+all
+alp
+alr
+ama
+ame
+amm
+ana
+and
+ane
+Ang
+ani
+Ann
+Ant
+api
+app
+aqu
+Ara
+arc
+Arm
+arr
+Art
+Asi
+ask
+asp
+ass
+ast
+att
+aud
+Aug
+aut
+ave
+avo
+awe
+aye
+Azt
+select distinct substring(fld3,1,3) as a from t2 having a like "A%" order by a limit 10;
+a
+aba
+abi
+Abr
+abs
+abu
+acc
+acq
+acu
+Ade
+adj
+select distinct substring(fld3,1,3) from t2 where fld3 like "A%" limit 10;
+substring(fld3,1,3)
+aba
+abi
+Abr
+abs
+abu
+acc
+acq
+acu
+Ade
+adj
+select distinct substring(fld3,1,3) as a from t2 having a like "A%" limit 10;
+a
+aba
+abi
+Abr
+abs
+abu
+acc
+acq
+acu
+Ade
+adj
+create table t3 (
+period int not null,
+name char(32) not null,
+companynr int not null,
+price double(11,0),
+price2 double(11,0),
+key (period),
+key (name)
+);
+create temporary table tmp engine = myisam select * from t3;
+insert into t3 select * from tmp;
+insert into tmp select * from t3;
+insert into t3 select * from tmp;
+insert into tmp select * from t3;
+insert into t3 select * from tmp;
+insert into tmp select * from t3;
+insert into t3 select * from tmp;
+insert into tmp select * from t3;
+insert into t3 select * from tmp;
+insert into tmp select * from t3;
+insert into t3 select * from tmp;
+insert into tmp select * from t3;
+insert into t3 select * from tmp;
+insert into tmp select * from t3;
+insert into t3 select * from tmp;
+insert into tmp select * from t3;
+insert into t3 select * from tmp;
+alter table t3 add t2nr int not null auto_increment primary key first;
+drop table tmp;
+SET SQL_BIG_TABLES=1;
+select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
+namn
+Abraham Abraham
+abrogating abrogating
+admonishing admonishing
+Adolph Adolph
+afield afield
+aging aging
+ammonium ammonium
+analyzable analyzable
+animals animals
+animized animized
+SET SQL_BIG_TABLES=0;
+select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
+concat(fld3," ",fld3)
+Abraham Abraham
+abrogating abrogating
+admonishing admonishing
+Adolph Adolph
+afield afield
+aging aging
+ammonium ammonium
+analyzable analyzable
+animals animals
+animized animized
+select distinct fld5 from t2 limit 10;
+fld5
+neat
+Steinberg
+jarring
+tinily
+balled
+persist
+attainments
+fanatic
+measures
+rightfulness
+select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
+fld3 count(*)
+affixed 1
+and 1
+annoyers 1
+Anthony 1
+assayed 1
+assurers 1
+attendants 1
+bedlam 1
+bedpost 1
+boasted 1
+SET SQL_BIG_TABLES=1;
+select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
+fld3 count(*)
+affixed 1
+and 1
+annoyers 1
+Anthony 1
+assayed 1
+assurers 1
+attendants 1
+bedlam 1
+bedpost 1
+boasted 1
+SET SQL_BIG_TABLES=0;
+select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;
+fld3 repeat("a",length(fld3)) count(*)
+circus aaaaaa 1
+cited aaaaa 1
+Colombo aaaaaaa 1
+congresswoman aaaaaaaaaaaaa 1
+contrition aaaaaaaaaa 1
+corny aaaaa 1
+cultivation aaaaaaaaaaa 1
+definiteness aaaaaaaaaaaa 1
+demultiplex aaaaaaaaaaa 1
+disappointing aaaaaaaaaaaaa 1
+select distinct companynr,rtrim(space(512+companynr)) from t3 order by 1,2;
+companynr rtrim(space(512+companynr))
+37
+78
+101
+154
+311
+447
+512
+select distinct fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by fld3;
+fld3
+explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by t3.t2nr,fld3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index
+explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
+1 SIMPLE t3 ref period period 4 test.t1.period 4181
+explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 index period period 4 NULL 41810
+1 SIMPLE t1 ref period period 4 test.t3.period 4181
+explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index period period 4 NULL 41810
+1 SIMPLE t3 ref period period 4 test.t1.period 4181
+select period from t1;
+period
+9410
+select period from t1 where period=1900;
+period
+select fld3,period from t1,t2 where fld1 = 011401 order by period;
+fld3 period
+breaking 9410
+select fld3,period from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.period=1001;
+fld3 period
+breaking 1001
+explain select fld3,period from t2,t3 where t2.fld1 = 011401 and t3.t2nr=t2.fld1 and 1001 = t3.period;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 const fld1 fld1 4 const 1
+1 SIMPLE t3 const PRIMARY,period PRIMARY 4 const 1
+select fld3,period from t2,t1 where companynr*10 = 37*10;
+fld3 period
+breaking 9410
+Romans 9410
+intercepted 9410
+bewilderingly 9410
+astound 9410
+admonishing 9410
+sumac 9410
+flanking 9410
+combed 9410
+subjective 9410
+scatterbrain 9410
+Eulerian 9410
+Kane 9410
+overlay 9410
+perturb 9410
+goblins 9410
+annihilates 9410
+Wotan 9410
+snatching 9410
+concludes 9410
+laterally 9410
+yelped 9410
+grazing 9410
+Baird 9410
+celery 9410
+misunderstander 9410
+handgun 9410
+foldout 9410
+mystic 9410
+succumbed 9410
+Nabisco 9410
+fingerings 9410
+aging 9410
+afield 9410
+ammonium 9410
+boat 9410
+intelligibility 9410
+Augustine 9410
+teethe 9410
+dreaded 9410
+scholastics 9410
+audiology 9410
+wallet 9410
+parters 9410
+eschew 9410
+quitter 9410
+neat 9410
+Steinberg 9410
+jarring 9410
+tinily 9410
+balled 9410
+persist 9410
+attainments 9410
+fanatic 9410
+measures 9410
+rightfulness 9410
+capably 9410
+impulsive 9410
+starlet 9410
+terminators 9410
+untying 9410
+announces 9410
+featherweight 9410
+pessimist 9410
+daughter 9410
+decliner 9410
+lawgiver 9410
+stated 9410
+readable 9410
+attrition 9410
+cascade 9410
+motors 9410
+interrogate 9410
+pests 9410
+stairway 9410
+dopers 9410
+testicle 9410
+Parsifal 9410
+leavings 9410
+postulation 9410
+squeaking 9410
+contrasted 9410
+leftover 9410
+whiteners 9410
+erases 9410
+Punjab 9410
+Merritt 9410
+Quixotism 9410
+sweetish 9410
+dogging 9410
+scornfully 9410
+bellow 9410
+bills 9410
+cupboard 9410
+sureties 9410
+puddings 9410
+fetters 9410
+bivalves 9410
+incurring 9410
+Adolph 9410
+pithed 9410
+Miles 9410
+trimmings 9410
+tragedies 9410
+skulking 9410
+flint 9410
+flopping 9410
+relaxing 9410
+offload 9410
+suites 9410
+lists 9410
+animized 9410
+multilayer 9410
+standardizes 9410
+Judas 9410
+vacuuming 9410
+dentally 9410
+humanness 9410
+inch 9410
+Weissmuller 9410
+irresponsibly 9410
+luckily 9410
+culled 9410
+medical 9410
+bloodbath 9410
+subschema 9410
+animals 9410
+Micronesia 9410
+repetitions 9410
+Antares 9410
+ventilate 9410
+pityingly 9410
+interdependent 9410
+Graves 9410
+neonatal 9410
+chafe 9410
+honoring 9410
+realtor 9410
+elite 9410
+funereal 9410
+abrogating 9410
+sorters 9410
+Conley 9410
+lectured 9410
+Abraham 9410
+Hawaii 9410
+cage 9410
+hushes 9410
+Simla 9410
+reporters 9410
+Dutchman 9410
+descendants 9410
+groupings 9410
+dissociate 9410
+coexist 9410
+Beebe 9410
+Taoism 9410
+Connally 9410
+fetched 9410
+checkpoints 9410
+rusting 9410
+galling 9410
+obliterates 9410
+traitor 9410
+resumes 9410
+analyzable 9410
+terminator 9410
+gritty 9410
+firearm 9410
+minima 9410
+Selfridge 9410
+disable 9410
+witchcraft 9410
+betroth 9410
+Manhattanize 9410
+imprint 9410
+peeked 9410
+swelling 9410
+interrelationships 9410
+riser 9410
+Gandhian 9410
+peacock 9410
+bee 9410
+kanji 9410
+dental 9410
+scarf 9410
+chasm 9410
+insolence 9410
+syndicate 9410
+alike 9410
+imperial 9410
+convulsion 9410
+railway 9410
+validate 9410
+normalizes 9410
+comprehensive 9410
+chewing 9410
+denizen 9410
+schemer 9410
+chronicle 9410
+Kline 9410
+Anatole 9410
+partridges 9410
+brunch 9410
+recruited 9410
+dimensions 9410
+Chicana 9410
+announced 9410
+praised 9410
+employing 9410
+linear 9410
+quagmire 9410
+western 9410
+relishing 9410
+serving 9410
+scheduling 9410
+lore 9410
+eventful 9410
+arteriole 9410
+disentangle 9410
+cured 9410
+Fenton 9410
+avoidable 9410
+drains 9410
+detectably 9410
+husky 9410
+impelling 9410
+undoes 9410
+evened 9410
+squeezes 9410
+destroyer 9410
+rudeness 9410
+beaner 9410
+boorish 9410
+Everhart 9410
+encompass 9410
+mushrooms 9410
+Alison 9410
+externally 9410
+pellagra 9410
+cult 9410
+creek 9410
+Huffman 9410
+Majorca 9410
+governing 9410
+gadfly 9410
+reassigned 9410
+intentness 9410
+craziness 9410
+psychic 9410
+squabbled 9410
+burlesque 9410
+capped 9410
+extracted 9410
+DiMaggio 9410
+exclamation 9410
+subdirectory 9410
+Gothicism 9410
+feminine 9410
+metaphysically 9410
+sanding 9410
+Miltonism 9410
+freakish 9410
+index 9410
+straight 9410
+flurried 9410
+denotative 9410
+coming 9410
+commencements 9410
+gentleman 9410
+gifted 9410
+Shanghais 9410
+sportswriting 9410
+sloping 9410
+navies 9410
+leaflet 9410
+shooter 9410
+Joplin 9410
+babies 9410
+assails 9410
+admiring 9410
+swaying 9410
+Goldstine 9410
+fitting 9410
+Norwalk 9410
+analogy 9410
+deludes 9410
+cokes 9410
+Clayton 9410
+exhausts 9410
+causality 9410
+sating 9410
+icon 9410
+throttles 9410
+communicants 9410
+dehydrate 9410
+priceless 9410
+publicly 9410
+incidentals 9410
+commonplace 9410
+mumbles 9410
+furthermore 9410
+cautioned 9410
+parametrized 9410
+registration 9410
+sadly 9410
+positioning 9410
+babysitting 9410
+eternal 9410
+hoarder 9410
+congregates 9410
+rains 9410
+workers 9410
+sags 9410
+unplug 9410
+garage 9410
+boulder 9410
+specifics 9410
+Teresa 9410
+Winsett 9410
+convenient 9410
+buckboards 9410
+amenities 9410
+resplendent 9410
+sews 9410
+participated 9410
+Simon 9410
+certificates 9410
+Fitzpatrick 9410
+Evanston 9410
+misted 9410
+textures 9410
+save 9410
+count 9410
+rightful 9410
+chaperone 9410
+Lizzy 9410
+clenched 9410
+effortlessly 9410
+accessed 9410
+beaters 9410
+Hornblower 9410
+vests 9410
+indulgences 9410
+infallibly 9410
+unwilling 9410
+excrete 9410
+spools 9410
+crunches 9410
+overestimating 9410
+ineffective 9410
+humiliation 9410
+sophomore 9410
+star 9410
+rifles 9410
+dialysis 9410
+arriving 9410
+indulge 9410
+clockers 9410
+languages 9410
+Antarctica 9410
+percentage 9410
+ceiling 9410
+specification 9410
+regimented 9410
+ciphers 9410
+pictures 9410
+serpents 9410
+allot 9410
+realized 9410
+mayoral 9410
+opaquely 9410
+hostess 9410
+fiftieth 9410
+incorrectly 9410
+decomposition 9410
+stranglings 9410
+mixture 9410
+electroencephalography 9410
+similarities 9410
+charges 9410
+freest 9410
+Greenberg 9410
+tinting 9410
+expelled 9410
+warm 9410
+smoothed 9410
+deductions 9410
+Romano 9410
+bitterroot 9410
+corset 9410
+securing 9410
+environing 9410
+cute 9410
+Crays 9410
+heiress 9410
+inform 9410
+avenge 9410
+universals 9410
+Kinsey 9410
+ravines 9410
+bestseller 9410
+equilibrium 9410
+extents 9410
+relatively 9410
+pressure 9410
+critiques 9410
+befouled 9410
+rightfully 9410
+mechanizing 9410
+Latinizes 9410
+timesharing 9410
+Aden 9410
+embassies 9410
+males 9410
+shapelessly 9410
+mastering 9410
+Newtonian 9410
+finishers 9410
+abates 9410
+teem 9410
+kiting 9410
+stodgy 9410
+feed 9410
+guitars 9410
+airships 9410
+store 9410
+denounces 9410
+Pyle 9410
+Saxony 9410
+serializations 9410
+Peruvian 9410
+taxonomically 9410
+kingdom 9410
+stint 9410
+Sault 9410
+faithful 9410
+Ganymede 9410
+tidiness 9410
+gainful 9410
+contrary 9410
+Tipperary 9410
+tropics 9410
+theorizers 9410
+renew 9410
+already 9410
+terminal 9410
+Hegelian 9410
+hypothesizer 9410
+warningly 9410
+journalizing 9410
+nested 9410
+Lars 9410
+saplings 9410
+foothill 9410
+labeled 9410
+imperiously 9410
+reporters 9410
+furnishings 9410
+precipitable 9410
+discounts 9410
+excises 9410
+Stalin 9410
+despot 9410
+ripeness 9410
+Arabia 9410
+unruly 9410
+mournfulness 9410
+boom 9410
+slaughter 9410
+Sabine 9410
+handy 9410
+rural 9410
+organizer 9410
+shipyard 9410
+civics 9410
+inaccuracy 9410
+rules 9410
+juveniles 9410
+comprised 9410
+investigations 9410
+stabilizes 9410
+seminaries 9410
+Hunter 9410
+sporty 9410
+test 9410
+weasels 9410
+CERN 9410
+tempering 9410
+afore 9410
+Galatean 9410
+techniques 9410
+error 9410
+veranda 9410
+severely 9410
+Cassites 9410
+forthcoming 9410
+guides 9410
+vanish 9410
+lied 9410
+sawtooth 9410
+fated 9410
+gradually 9410
+widens 9410
+preclude 9410
+evenhandedly 9410
+percentage 9410
+disobedience 9410
+humility 9410
+gleaning 9410
+petted 9410
+bloater 9410
+minion 9410
+marginal 9410
+apiary 9410
+measures 9410
+precaution 9410
+repelled 9410
+primary 9410
+coverings 9410
+Artemia 9410
+navigate 9410
+spatial 9410
+Gurkha 9410
+meanwhile 9410
+Melinda 9410
+Butterfield 9410
+Aldrich 9410
+previewing 9410
+glut 9410
+unaffected 9410
+inmate 9410
+mineral 9410
+impending 9410
+meditation 9410
+ideas 9410
+miniaturizes 9410
+lewdly 9410
+title 9410
+youthfulness 9410
+creak 9410
+Chippewa 9410
+clamored 9410
+freezes 9410
+forgivably 9410
+reduce 9410
+McGovern 9410
+Nazis 9410
+epistle 9410
+socializes 9410
+conceptions 9410
+Kevin 9410
+uncovering 9410
+chews 9410
+appendixes 9410
+appendixes 9410
+appendixes 9410
+appendixes 9410
+appendixes 9410
+appendixes 9410
+raining 9410
+infest 9410
+compartment 9410
+minting 9410
+ducks 9410
+roped 9410
+waltz 9410
+Lillian 9410
+repressions 9410
+chillingly 9410
+noncritical 9410
+lithograph 9410
+spongers 9410
+parenthood 9410
+posed 9410
+instruments 9410
+filial 9410
+fixedly 9410
+relives 9410
+Pandora 9410
+watering 9410
+ungrateful 9410
+secures 9410
+poison 9410
+dusted 9410
+encompasses 9410
+presentation 9410
+Kantian 9410
+select fld3,period,price,price2 from t2,t3 where t2.fld1=t3.t2nr and period >= 1001 and period <= 1002 and t2.companynr = 37 order by fld3,period, price;
+fld3 period price price2
+admonishing 1002 28357832 8723648
+analyzable 1002 28357832 8723648
+annihilates 1001 5987435 234724
+Antares 1002 28357832 8723648
+astound 1001 5987435 234724
+audiology 1001 5987435 234724
+Augustine 1002 28357832 8723648
+Baird 1002 28357832 8723648
+bewilderingly 1001 5987435 234724
+breaking 1001 5987435 234724
+Conley 1001 5987435 234724
+dentally 1002 28357832 8723648
+dissociate 1002 28357832 8723648
+elite 1001 5987435 234724
+eschew 1001 5987435 234724
+Eulerian 1001 5987435 234724
+flanking 1001 5987435 234724
+foldout 1002 28357832 8723648
+funereal 1002 28357832 8723648
+galling 1002 28357832 8723648
+Graves 1001 5987435 234724
+grazing 1001 5987435 234724
+groupings 1001 5987435 234724
+handgun 1001 5987435 234724
+humility 1002 28357832 8723648
+impulsive 1002 28357832 8723648
+inch 1001 5987435 234724
+intelligibility 1001 5987435 234724
+jarring 1001 5987435 234724
+lawgiver 1001 5987435 234724
+lectured 1002 28357832 8723648
+Merritt 1002 28357832 8723648
+neonatal 1001 5987435 234724
+offload 1002 28357832 8723648
+parters 1002 28357832 8723648
+pityingly 1002 28357832 8723648
+puddings 1002 28357832 8723648
+Punjab 1001 5987435 234724
+quitter 1002 28357832 8723648
+realtor 1001 5987435 234724
+relaxing 1001 5987435 234724
+repetitions 1001 5987435 234724
+resumes 1001 5987435 234724
+Romans 1002 28357832 8723648
+rusting 1001 5987435 234724
+scholastics 1001 5987435 234724
+skulking 1002 28357832 8723648
+stated 1002 28357832 8723648
+suites 1002 28357832 8723648
+sureties 1001 5987435 234724
+testicle 1002 28357832 8723648
+tinily 1002 28357832 8723648
+tragedies 1001 5987435 234724
+trimmings 1001 5987435 234724
+vacuuming 1001 5987435 234724
+ventilate 1001 5987435 234724
+wallet 1001 5987435 234724
+Weissmuller 1002 28357832 8723648
+Wotan 1002 28357832 8723648
+select t2.fld1,fld3,period,price,price2 from t2,t3 where t2.fld1>= 18201 and t2.fld1 <= 18811 and t2.fld1=t3.t2nr and period = 1001 and t2.companynr = 37;
+fld1 fld3 period price price2
+018201 relaxing 1001 5987435 234724
+018601 vacuuming 1001 5987435 234724
+018801 inch 1001 5987435 234724
+018811 repetitions 1001 5987435 234724
+create table t4 (
+companynr tinyint(2) unsigned zerofill NOT NULL default '00',
+companyname char(30) NOT NULL default '',
+PRIMARY KEY (companynr),
+UNIQUE KEY companyname(companyname)
+) ENGINE=MyISAM MAX_ROWS=50 PACK_KEYS=1 COMMENT='companynames';
+select STRAIGHT_JOIN t2.companynr,companyname from t4,t2 where t2.companynr=t4.companynr group by t2.companynr;
+companynr companyname
+00 Unknown
+29 company 1
+34 company 2
+36 company 3
+37 company 4
+40 company 5
+41 company 6
+50 company 11
+53 company 7
+58 company 8
+65 company 9
+68 company 10
+select SQL_SMALL_RESULT t2.companynr,companyname from t4,t2 where t2.companynr=t4.companynr group by t2.companynr;
+companynr companyname
+00 Unknown
+29 company 1
+34 company 2
+36 company 3
+37 company 4
+40 company 5
+41 company 6
+50 company 11
+53 company 7
+58 company 8
+65 company 9
+68 company 10
+select * from t1,t1 t12;
+Period Varor_period Period Varor_period
+9410 9412 9410 9412
+select t2.fld1,t22.fld1 from t2,t2 t22 where t2.fld1 >= 250501 and t2.fld1 <= 250505 and t22.fld1 >= 250501 and t22.fld1 <= 250505;
+fld1 fld1
+250501 250501
+250502 250501
+250503 250501
+250504 250501
+250505 250501
+250501 250502
+250502 250502
+250503 250502
+250504 250502
+250505 250502
+250501 250503
+250502 250503
+250503 250503
+250504 250503
+250505 250503
+250501 250504
+250502 250504
+250503 250504
+250504 250504
+250505 250504
+250501 250505
+250502 250505
+250503 250505
+250504 250505
+250505 250505
+insert into t2 (fld1, companynr) values (999999,99);
+select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null;
+companynr companyname
+99 NULL
+select count(*) from t2 left join t4 using (companynr) where t4.companynr is not null;
+count(*)
+1199
+explain select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1200
+1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where; Not exists
+explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr is null;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t4 ALL NULL NULL NULL NULL 12
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1200 Using where; Not exists
+delete from t2 where fld1=999999;
+explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
+1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1
+explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
+1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1
+explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
+1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where
+explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t4 ALL NULL NULL NULL NULL 12
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
+explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0 or t4.companynr > 0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
+explain select t2.companynr,companyname from t4 left join t2 using (companynr) where ifnull(t2.companynr,1)>0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t4 ALL NULL NULL NULL NULL 12
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
+select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
+companynr companynr
+37 36
+41 40
+explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using temporary
+1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using where; Using index
+select t2.fld1,t2.companynr,fld3,period from t3,t2 where t2.fld1 = 38208 and t2.fld1=t3.t2nr and period = 1008 or t2.fld1 = 38008 and t2.fld1 =t3.t2nr and period = 1008;
+fld1 companynr fld3 period
+038008 37 reporters 1008
+038208 37 Selfridge 1008
+select t2.fld1,t2.companynr,fld3,period from t3,t2 where (t2.fld1 = 38208 or t2.fld1 = 38008) and t2.fld1=t3.t2nr and period>=1008 and period<=1009;
+fld1 companynr fld3 period
+038008 37 reporters 1008
+038208 37 Selfridge 1008
+select t2.fld1,t2.companynr,fld3,period from t3,t2 where (t3.t2nr = 38208 or t3.t2nr = 38008) and t2.fld1=t3.t2nr and period>=1008 and period<=1009;
+fld1 companynr fld3 period
+038008 37 reporters 1008
+038208 37 Selfridge 1008
+select period from t1 where (((period > 0) or period < 10000 or (period = 1900)) and (period=1900 and period <= 1901) or (period=1903 and (period=1903)) and period>=1902) or ((period=1904 or period=1905) or (period=1906 or period>1907)) or (period=1908 and period = 1909);
+period
+9410
+select period from t1 where ((period > 0 and period < 1) or (((period > 0 and period < 100) and (period > 10)) or (period > 10)) or (period > 0 and (period > 5 or period > 6)));
+period
+9410
+select a.fld1 from t2 as a,t2 b where ((a.fld1 = 250501 and a.fld1=b.fld1) or a.fld1=250502 or a.fld1=250503 or (a.fld1=250505 and a.fld1<=b.fld1 and b.fld1>=a.fld1)) and a.fld1=b.fld1;
+fld1
+250501
+250502
+250503
+250505
+select fld1 from t2 where fld1 in (250502,98005,98006,250503,250605,250606) and fld1 >=250502 and fld1 not in (250605,250606);
+fld1
+250502
+250503
+select fld1 from t2 where fld1 between 250502 and 250504;
+fld1
+250502
+250503
+250504
+select fld3 from t2 where (((fld3 like "_%L%" ) or (fld3 like "%ok%")) and ( fld3 like "L%" or fld3 like "G%")) and fld3 like "L%" ;
+fld3
+label
+labeled
+labeled
+landslide
+laterally
+leaflet
+lewdly
+Lillian
+luckily
+select count(*) from t1;
+count(*)
+1
+select companynr,count(*),sum(fld1) from t2 group by companynr;
+companynr count(*) sum(fld1)
+00 82 10355753
+29 95 14473298
+34 70 17788966
+36 215 22786296
+37 588 83602098
+40 37 6618386
+41 52 12816335
+50 11 1595438
+53 4 793210
+58 23 2254293
+65 10 2284055
+68 12 3097288
+select companynr,count(*) from t2 group by companynr order by companynr desc limit 5;
+companynr count(*)
+68 12
+65 10
+58 23
+53 4
+50 11
+select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>"";
+count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
+70 absentee vest 17788966 254128.0857 3272.5940 10709871.3069
+explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>"";
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
+Warnings:
+Note 1003 select count(0) AS `count(*)`,min(test.t2.fld4) AS `min(fld4)`,max(test.t2.fld4) AS `max(fld4)`,sum(test.t2.fld1) AS `sum(fld1)`,avg(test.t2.fld1) AS `avg(fld1)`,std(test.t2.fld1) AS `std(fld1)`,variance(test.t2.fld1) AS `variance(fld1)` from test.t2 where ((test.t2.companynr = 34) and (test.t2.fld4 <> _latin1''))
+select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
+companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
+00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087
+29 95 abut wetness 14473298 152350.5053 8368.5480 70032594.9026
+34 70 absentee vest 17788966 254128.0857 3272.5940 10709871.3069
+select companynr,t2nr,count(price),sum(price),min(price),max(price),avg(price) from t3 where companynr = 37 group by companynr,t2nr limit 10;
+companynr t2nr count(price) sum(price) min(price) max(price) avg(price)
+37 1 1 5987435 5987435 5987435 5987435.0000
+37 2 1 28357832 28357832 28357832 28357832.0000
+37 3 1 39654943 39654943 39654943 39654943.0000
+37 11 1 5987435 5987435 5987435 5987435.0000
+37 12 1 28357832 28357832 28357832 28357832.0000
+37 13 1 39654943 39654943 39654943 39654943.0000
+37 21 1 5987435 5987435 5987435 5987435.0000
+37 22 1 28357832 28357832 28357832 28357832.0000
+37 23 1 39654943 39654943 39654943 39654943.0000
+37 31 1 5987435 5987435 5987435 5987435.0000
+select /*! SQL_SMALL_RESULT */ companynr,t2nr,count(price),sum(price),min(price),max(price),avg(price) from t3 where companynr = 37 group by companynr,t2nr limit 10;
+companynr t2nr count(price) sum(price) min(price) max(price) avg(price)
+37 1 1 5987435 5987435 5987435 5987435.0000
+37 2 1 28357832 28357832 28357832 28357832.0000
+37 3 1 39654943 39654943 39654943 39654943.0000
+37 11 1 5987435 5987435 5987435 5987435.0000
+37 12 1 28357832 28357832 28357832 28357832.0000
+37 13 1 39654943 39654943 39654943 39654943.0000
+37 21 1 5987435 5987435 5987435 5987435.0000
+37 22 1 28357832 28357832 28357832 28357832.0000
+37 23 1 39654943 39654943 39654943 39654943.0000
+37 31 1 5987435 5987435 5987435 5987435.0000
+select companynr,count(price),sum(price),min(price),max(price),avg(price) from t3 group by companynr ;
+companynr count(price) sum(price) min(price) max(price) avg(price)
+37 12543 309394878010 5987435 39654943 24666736.6667
+78 8362 414611089292 726498 98439034 49582766.0000
+101 4181 3489454238 834598 834598 834598.0000
+154 4181 4112197254950 983543950 983543950 983543950.0000
+311 4181 979599938 234298 234298 234298.0000
+447 4181 9929180954 2374834 2374834 2374834.0000
+512 4181 3288532102 786542 786542 786542.0000
+select distinct mod(companynr,10) from t4 group by companynr;
+mod(companynr,10)
+0
+9
+4
+6
+7
+1
+3
+8
+5
+select distinct 1 from t4 group by companynr;
+1
+1
+select count(distinct fld1) from t2;
+count(distinct fld1)
+1199
+select companynr,count(distinct fld1) from t2 group by companynr;
+companynr count(distinct fld1)
+00 82
+29 95
+34 70
+36 215
+37 588
+40 37
+41 52
+50 11
+53 4
+58 23
+65 10
+68 12
+select companynr,count(*) from t2 group by companynr;
+companynr count(*)
+00 82
+29 95
+34 70
+36 215
+37 588
+40 37
+41 52
+50 11
+53 4
+58 23
+65 10
+68 12
+select companynr,count(distinct concat(fld1,repeat(65,1000))) from t2 group by companynr;
+companynr count(distinct concat(fld1,repeat(65,1000)))
+00 82
+29 95
+34 70
+36 215
+37 588
+40 37
+41 52
+50 11
+53 4
+58 23
+65 10
+68 12
+select companynr,count(distinct concat(fld1,repeat(65,200))) from t2 group by companynr;
+companynr count(distinct concat(fld1,repeat(65,200)))
+00 82
+29 95
+34 70
+36 215
+37 588
+40 37
+41 52
+50 11
+53 4
+58 23
+65 10
+68 12
+select companynr,count(distinct floor(fld1/100)) from t2 group by companynr;
+companynr count(distinct floor(fld1/100))
+00 47
+29 35
+34 14
+36 69
+37 108
+40 16
+41 11
+50 9
+53 1
+58 1
+65 1
+68 1
+select companynr,count(distinct concat(repeat(65,1000),floor(fld1/100))) from t2 group by companynr;
+companynr count(distinct concat(repeat(65,1000),floor(fld1/100)))
+00 47
+29 35
+34 14
+36 69
+37 108
+40 16
+41 11
+50 9
+53 1
+58 1
+65 1
+68 1
+select sum(fld1),fld3 from t2 where fld3="Romans" group by fld1 limit 10;
+sum(fld1) fld3
+11402 Romans
+select name,count(*) from t3 where name='cloakroom' group by name;
+name count(*)
+cloakroom 4181
+select name,count(*) from t3 where name='cloakroom' and price>10 group by name;
+name count(*)
+cloakroom 4181
+select count(*) from t3 where name='cloakroom' and price2=823742;
+count(*)
+4181
+select name,count(*) from t3 where name='cloakroom' and price2=823742 group by name;
+name count(*)
+cloakroom 4181
+select name,count(*) from t3 where name >= "extramarital" and price <= 39654943 group by name;
+name count(*)
+extramarital 4181
+gazer 4181
+gems 4181
+Iranizes 4181
+spates 4181
+tucked 4181
+violinist 4181
+select t2.fld3,count(*) from t2,t3 where t2.fld1=158402 and t3.name=t2.fld3 group by t3.name;
+fld3 count(*)
+spates 4181
+select companynr|0,companyname from t4 group by 1;
+companynr|0 companyname
+0 Unknown
+29 company 1
+34 company 2
+36 company 3
+37 company 4
+40 company 5
+41 company 6
+50 company 11
+53 company 7
+58 company 8
+65 company 9
+68 company 10
+select t2.companynr,companyname,count(*) from t2,t4 where t2.companynr=t4.companynr group by t2.companynr order by companyname;
+companynr companyname count(*)
+29 company 1 95
+68 company 10 12
+50 company 11 11
+34 company 2 70
+36 company 3 215
+37 company 4 588
+40 company 5 37
+41 company 6 52
+53 company 7 4
+58 company 8 23
+65 company 9 10
+00 Unknown 82
+select t2.fld1,count(*) from t2,t3 where t2.fld1=158402 and t3.name=t2.fld3 group by t3.name;
+fld1 count(*)
+158402 4181
+select sum(Period)/count(*) from t1;
+sum(Period)/count(*)
+9410.00
+select companynr,count(price) as "count",sum(price) as "sum" ,abs(sum(price)/count(price)-avg(price)) as "diff",(0+count(price))*companynr as func from t3 group by companynr;
+companynr count sum diff func
+37 12543 309394878010 0.0000 464091
+78 8362 414611089292 0.0000 652236
+101 4181 3489454238 0.0000 422281
+154 4181 4112197254950 0.0000 643874
+311 4181 979599938 0.0000 1300291
+447 4181 9929180954 0.0000 1868907
+512 4181 3288532102 0.0000 2140672
+select companynr,sum(price)/count(price) as avg from t3 group by companynr having avg > 70000000 order by avg;
+companynr avg
+154 983543950.00
+select companynr,count(*) from t2 group by companynr order by 2 desc;
+companynr count(*)
+37 588
+36 215
+29 95
+00 82
+34 70
+41 52
+40 37
+58 23
+68 12
+50 11
+65 10
+53 4
+select companynr,count(*) from t2 where companynr > 40 group by companynr order by 2 desc;
+companynr count(*)
+41 52
+58 23
+68 12
+50 11
+65 10
+53 4
+select t2.fld4,t2.fld1,count(price),sum(price),min(price),max(price),avg(price) from t3,t2 where t3.companynr = 37 and t2.fld1 = t3.t2nr group by fld1,t2.fld4;
+fld4 fld1 count(price) sum(price) min(price) max(price) avg(price)
+teethe 000001 1 5987435 5987435 5987435 5987435.0000
+dreaded 011401 1 5987435 5987435 5987435 5987435.0000
+scholastics 011402 1 28357832 28357832 28357832 28357832.0000
+audiology 011403 1 39654943 39654943 39654943 39654943.0000
+wallet 011501 1 5987435 5987435 5987435 5987435.0000
+parters 011701 1 5987435 5987435 5987435 5987435.0000
+eschew 011702 1 28357832 28357832 28357832 28357832.0000
+quitter 011703 1 39654943 39654943 39654943 39654943.0000
+neat 012001 1 5987435 5987435 5987435 5987435.0000
+Steinberg 012003 1 39654943 39654943 39654943 39654943.0000
+balled 012301 1 5987435 5987435 5987435 5987435.0000
+persist 012302 1 28357832 28357832 28357832 28357832.0000
+attainments 012303 1 39654943 39654943 39654943 39654943.0000
+capably 012501 1 5987435 5987435 5987435 5987435.0000
+impulsive 012602 1 28357832 28357832 28357832 28357832.0000
+starlet 012603 1 39654943 39654943 39654943 39654943.0000
+featherweight 012701 1 5987435 5987435 5987435 5987435.0000
+pessimist 012702 1 28357832 28357832 28357832 28357832.0000
+daughter 012703 1 39654943 39654943 39654943 39654943.0000
+lawgiver 013601 1 5987435 5987435 5987435 5987435.0000
+stated 013602 1 28357832 28357832 28357832 28357832.0000
+readable 013603 1 39654943 39654943 39654943 39654943.0000
+testicle 013801 1 5987435 5987435 5987435 5987435.0000
+Parsifal 013802 1 28357832 28357832 28357832 28357832.0000
+leavings 013803 1 39654943 39654943 39654943 39654943.0000
+squeaking 013901 1 5987435 5987435 5987435 5987435.0000
+contrasted 016001 1 5987435 5987435 5987435 5987435.0000
+leftover 016201 1 5987435 5987435 5987435 5987435.0000
+whiteners 016202 1 28357832 28357832 28357832 28357832.0000
+erases 016301 1 5987435 5987435 5987435 5987435.0000
+Punjab 016302 1 28357832 28357832 28357832 28357832.0000
+Merritt 016303 1 39654943 39654943 39654943 39654943.0000
+sweetish 018001 1 5987435 5987435 5987435 5987435.0000
+dogging 018002 1 28357832 28357832 28357832 28357832.0000
+scornfully 018003 1 39654943 39654943 39654943 39654943.0000
+fetters 018012 1 28357832 28357832 28357832 28357832.0000
+bivalves 018013 1 39654943 39654943 39654943 39654943.0000
+skulking 018021 1 5987435 5987435 5987435 5987435.0000
+flint 018022 1 28357832 28357832 28357832 28357832.0000
+flopping 018023 1 39654943 39654943 39654943 39654943.0000
+Judas 018032 1 28357832 28357832 28357832 28357832.0000
+vacuuming 018033 1 39654943 39654943 39654943 39654943.0000
+medical 018041 1 5987435 5987435 5987435 5987435.0000
+bloodbath 018042 1 28357832 28357832 28357832 28357832.0000
+subschema 018043 1 39654943 39654943 39654943 39654943.0000
+interdependent 018051 1 5987435 5987435 5987435 5987435.0000
+Graves 018052 1 28357832 28357832 28357832 28357832.0000
+neonatal 018053 1 39654943 39654943 39654943 39654943.0000
+sorters 018061 1 5987435 5987435 5987435 5987435.0000
+epistle 018062 1 28357832 28357832 28357832 28357832.0000
+Conley 018101 1 5987435 5987435 5987435 5987435.0000
+lectured 018102 1 28357832 28357832 28357832 28357832.0000
+Abraham 018103 1 39654943 39654943 39654943 39654943.0000
+cage 018201 1 5987435 5987435 5987435 5987435.0000
+hushes 018202 1 28357832 28357832 28357832 28357832.0000
+Simla 018402 1 28357832 28357832 28357832 28357832.0000
+reporters 018403 1 39654943 39654943 39654943 39654943.0000
+coexist 018601 1 5987435 5987435 5987435 5987435.0000
+Beebe 018602 1 28357832 28357832 28357832 28357832.0000
+Taoism 018603 1 39654943 39654943 39654943 39654943.0000
+Connally 018801 1 5987435 5987435 5987435 5987435.0000
+fetched 018802 1 28357832 28357832 28357832 28357832.0000
+checkpoints 018803 1 39654943 39654943 39654943 39654943.0000
+gritty 018811 1 5987435 5987435 5987435 5987435.0000
+firearm 018812 1 28357832 28357832 28357832 28357832.0000
+minima 019101 1 5987435 5987435 5987435 5987435.0000
+Selfridge 019102 1 28357832 28357832 28357832 28357832.0000
+disable 019103 1 39654943 39654943 39654943 39654943.0000
+witchcraft 019201 1 5987435 5987435 5987435 5987435.0000
+betroth 030501 1 5987435 5987435 5987435 5987435.0000
+Manhattanize 030502 1 28357832 28357832 28357832 28357832.0000
+imprint 030503 1 39654943 39654943 39654943 39654943.0000
+swelling 031901 1 5987435 5987435 5987435 5987435.0000
+interrelationships 036001 1 5987435 5987435 5987435 5987435.0000
+riser 036002 1 28357832 28357832 28357832 28357832.0000
+bee 038001 1 5987435 5987435 5987435 5987435.0000
+kanji 038002 1 28357832 28357832 28357832 28357832.0000
+dental 038003 1 39654943 39654943 39654943 39654943.0000
+railway 038011 1 5987435 5987435 5987435 5987435.0000
+validate 038012 1 28357832 28357832 28357832 28357832.0000
+normalizes 038013 1 39654943 39654943 39654943 39654943.0000
+Kline 038101 1 5987435 5987435 5987435 5987435.0000
+Anatole 038102 1 28357832 28357832 28357832 28357832.0000
+partridges 038103 1 39654943 39654943 39654943 39654943.0000
+recruited 038201 1 5987435 5987435 5987435 5987435.0000
+dimensions 038202 1 28357832 28357832 28357832 28357832.0000
+Chicana 038203 1 39654943 39654943 39654943 39654943.0000
+select t3.companynr,fld3,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = 512 group by companynr,fld3;
+companynr fld3 sum(price)
+512 boat 786542
+512 capably 786542
+512 cupboard 786542
+512 decliner 786542
+512 descendants 786542
+512 dopers 786542
+512 erases 786542
+512 Micronesia 786542
+512 Miles 786542
+512 skies 786542
+select t2.companynr,count(*),min(fld3),max(fld3),sum(price),avg(price) from t2,t3 where t3.companynr >= 30 and t3.companynr <= 58 and t3.t2nr = t2.fld1 and 1+1=2 group by t2.companynr;
+companynr count(*) min(fld3) max(fld3) sum(price) avg(price)
+00 1 Omaha Omaha 5987435 5987435.0000
+36 1 dubbed dubbed 28357832 28357832.0000
+37 83 Abraham Wotan 1908978016 22999735.1325
+50 2 scribbled tapestry 68012775 34006387.5000
+select t3.companynr+0,t3.t2nr,fld3,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = 37 group by 1,t3.t2nr,fld3,fld3,fld3,fld3,fld3 order by fld1;
+t3.companynr+0 t2nr fld3 sum(price)
+37 1 Omaha 5987435
+37 11401 breaking 5987435
+37 11402 Romans 28357832
+37 11403 intercepted 39654943
+37 11501 bewilderingly 5987435
+37 11701 astound 5987435
+37 11702 admonishing 28357832
+37 11703 sumac 39654943
+37 12001 flanking 5987435
+37 12003 combed 39654943
+37 12301 Eulerian 5987435
+37 12302 dubbed 28357832
+37 12303 Kane 39654943
+37 12501 annihilates 5987435
+37 12602 Wotan 28357832
+37 12603 snatching 39654943
+37 12701 grazing 5987435
+37 12702 Baird 28357832
+37 12703 celery 39654943
+37 13601 handgun 5987435
+37 13602 foldout 28357832
+37 13603 mystic 39654943
+37 13801 intelligibility 5987435
+37 13802 Augustine 28357832
+37 13803 teethe 39654943
+37 13901 scholastics 5987435
+37 16001 audiology 5987435
+37 16201 wallet 5987435
+37 16202 parters 28357832
+37 16301 eschew 5987435
+37 16302 quitter 28357832
+37 16303 neat 39654943
+37 18001 jarring 5987435
+37 18002 tinily 28357832
+37 18003 balled 39654943
+37 18012 impulsive 28357832
+37 18013 starlet 39654943
+37 18021 lawgiver 5987435
+37 18022 stated 28357832
+37 18023 readable 39654943
+37 18032 testicle 28357832
+37 18033 Parsifal 39654943
+37 18041 Punjab 5987435
+37 18042 Merritt 28357832
+37 18043 Quixotism 39654943
+37 18051 sureties 5987435
+37 18052 puddings 28357832
+37 18053 tapestry 39654943
+37 18061 trimmings 5987435
+37 18062 humility 28357832
+37 18101 tragedies 5987435
+37 18102 skulking 28357832
+37 18103 flint 39654943
+37 18201 relaxing 5987435
+37 18202 offload 28357832
+37 18402 suites 28357832
+37 18403 lists 39654943
+37 18601 vacuuming 5987435
+37 18602 dentally 28357832
+37 18603 humanness 39654943
+37 18801 inch 5987435
+37 18802 Weissmuller 28357832
+37 18803 irresponsibly 39654943
+37 18811 repetitions 5987435
+37 18812 Antares 28357832
+37 19101 ventilate 5987435
+37 19102 pityingly 28357832
+37 19103 interdependent 39654943
+37 19201 Graves 5987435
+37 30501 neonatal 5987435
+37 30502 scribbled 28357832
+37 30503 chafe 39654943
+37 31901 realtor 5987435
+37 36001 elite 5987435
+37 36002 funereal 28357832
+37 38001 Conley 5987435
+37 38002 lectured 28357832
+37 38003 Abraham 39654943
+37 38011 groupings 5987435
+37 38012 dissociate 28357832
+37 38013 coexist 39654943
+37 38101 rusting 5987435
+37 38102 galling 28357832
+37 38103 obliterates 39654943
+37 38201 resumes 5987435
+37 38202 analyzable 28357832
+37 38203 terminator 39654943
+select sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = 512 and t3.t2nr = 38008 and t2.fld1 = 38008 or t2.fld1= t3.t2nr and t3.t2nr = 38008 and t2.fld1 = 38008;
+sum(price)
+234298
+select t2.fld1,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = 512 and t3.t2nr = 38008 and t2.fld1 = 38008 or t2.fld1 = t3.t2nr and t3.t2nr = 38008 and t2.fld1 = 38008 or t3.t2nr = t2.fld1 and t2.fld1 = 38008 group by t2.fld1;
+fld1 sum(price)
+038008 234298
+explain select fld3 from t2 where 1>2 or 2>3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+explain select fld3 from t2 where fld1=fld1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199
+select companynr,fld1 from t2 HAVING fld1=250501 or fld1=250502;
+companynr fld1
+34 250501
+34 250502
+select companynr,fld1 from t2 WHERE fld1>=250501 HAVING fld1<=250502;
+companynr fld1
+34 250501
+34 250502
+select companynr,count(*) as count,sum(fld1) as sum from t2 group by companynr having count > 40 and sum/count >= 120000;
+companynr count sum
+00 82 10355753
+29 95 14473298
+34 70 17788966
+37 588 83602098
+41 52 12816335
+select companynr from t2 group by companynr having count(*) > 40 and sum(fld1)/count(*) >= 120000 ;
+companynr
+00
+29
+34
+37
+41
+select t2.companynr,companyname,count(*) from t2,t4 where t2.companynr=t4.companynr group by companyname having t2.companynr >= 40;
+companynr companyname count(*)
+68 company 10 12
+50 company 11 11
+40 company 5 37
+41 company 6 52
+53 company 7 4
+58 company 8 23
+65 company 9 10
+select count(*) from t2;
+count(*)
+1199
+select count(*) from t2 where fld1 < 098024;
+count(*)
+387
+select min(fld1) from t2 where fld1>= 098024;
+min(fld1)
+98024
+select max(fld1) from t2 where fld1>= 098024;
+max(fld1)
+1232609
+select count(*) from t3 where price2=76234234;
+count(*)
+4181
+select count(*) from t3 where companynr=512 and price2=76234234;
+count(*)
+4181
+explain select min(fld1),max(fld1),count(*) from t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select min(fld1),max(fld1),count(*) from t2;
+min(fld1) max(fld1) count(*)
+0 1232609 1199
+select min(t2nr),max(t2nr) from t3 where t2nr=2115 and price2=823742;
+min(t2nr) max(t2nr)
+2115 2115
+select count(*),min(t2nr),max(t2nr) from t3 where name='spates' and companynr=78;
+count(*) min(t2nr) max(t2nr)
+4181 4 41804
+select t2nr,count(*) from t3 where name='gems' group by t2nr limit 20;
+t2nr count(*)
+9 1
+19 1
+29 1
+39 1
+49 1
+59 1
+69 1
+79 1
+89 1
+99 1
+109 1
+119 1
+129 1
+139 1
+149 1
+159 1
+169 1
+179 1
+189 1
+199 1
+select max(t2nr) from t3 where price=983543950;
+max(t2nr)
+41807
+select t1.period from t3 = t1 limit 1;
+period
+1001
+select t1.period from t1 as t1 limit 1;
+period
+9410
+select t1.period as "Nuvarande period" from t1 as t1 limit 1;
+Nuvarande period
+9410
+select period as ok_period from t1 limit 1;
+ok_period
+9410
+select period as ok_period from t1 group by ok_period limit 1;
+ok_period
+9410
+select 1+1 as summa from t1 group by summa limit 1;
+summa
+2
+select period as "Nuvarande period" from t1 group by "Nuvarande period" limit 1;
+Nuvarande period
+9410
+show tables;
+Tables_in_test
+t1
+t2
+t3
+t4
+show tables from test like "s%";
+Tables_in_test (s%)
+show tables from test like "t?";
+Tables_in_test (t?)
+show full columns from t2;
+Field Type Collation Null Key Default Extra Privileges Comment
+auto int(11) NULL PRI NULL auto_increment
+fld1 int(6) unsigned zerofill NULL UNI 000000
+companynr tinyint(2) unsigned zerofill NULL 00
+fld3 char(30) latin1_swedish_ci MUL
+fld4 char(35) latin1_swedish_ci
+fld5 char(35) latin1_swedish_ci
+fld6 char(4) latin1_swedish_ci
+show full columns from t2 from test like 'f%';
+Field Type Collation Null Key Default Extra Privileges Comment
+fld1 int(6) unsigned zerofill NULL UNI 000000
+fld3 char(30) latin1_swedish_ci MUL
+fld4 char(35) latin1_swedish_ci
+fld5 char(35) latin1_swedish_ci
+fld6 char(4) latin1_swedish_ci
+show full columns from t2 from test like 's%';
+Field Type Collation Null Key Default Extra Privileges Comment
+show keys from t2;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE
+t2 0 fld1 1 fld1 A 1199 NULL NULL BTREE
+t2 1 fld3 1 fld3 A NULL NULL NULL BTREE
+drop table t4, t3, t2, t1;
+DO 1;
+DO benchmark(100,1+1),1,1;
+do default;
+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
+do foobar;
+ERROR 42S22: Unknown column 'foobar' in 'field list'
+CREATE TABLE t1 (
+id mediumint(8) unsigned NOT NULL auto_increment,
+pseudo varchar(35) NOT NULL default '',
+PRIMARY KEY (id),
+UNIQUE KEY pseudo (pseudo)
+);
+INSERT INTO t1 (pseudo) VALUES ('test');
+INSERT INTO t1 (pseudo) VALUES ('test1');
+SELECT 1 as rnd1 from t1 where rand() > 2;
+rnd1
+DROP TABLE t1;
+CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, mmid int(10) unsigned default NULL, hdid int(10) unsigned default NULL, fsid int(10) unsigned default NULL, ctid int(10) unsigned default NULL, dtid int(10) unsigned default NULL, cost int(10) unsigned default NULL, performance int(10) unsigned default NULL, serialnumber bigint(20) unsigned default NULL, monitored tinyint(3) unsigned default '1', removed tinyint(3) unsigned default '0', target tinyint(3) unsigned default '0', dt_modified timestamp(14) NOT NULL, name varchar(255) binary default NULL, description varchar(255) default NULL, UNIQUE KEY hmid (hmid,volid)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (200001,2,1,1,100,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\E$',''),(200002,2,2,1,101,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\C$',''),(200003,1,3,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,0,1,20020425060427,'c:',NULL);
+CREATE TABLE t2 ( hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, sampletid smallint(5) unsigned default NULL, sampletime datetime default NULL, samplevalue bigint(20) unsigned default NULL, KEY idx1 (hmid,volid,sampletid,sampletime)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12:00:01',35);
+SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'wrong-date-value' AND b.sampletime < 'wrong-date-value' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
+gvid the_success the_fail the_size the_time
+Warnings:
+Warning 1292 Truncated incorrect datetime value: 'wrong-date-value'
+Warning 1292 Truncated incorrect datetime value: 'wrong-date-value'
+Warning 1292 Truncated incorrect datetime value: 'wrong-date-value'
+Warning 1292 Truncated incorrect datetime value: 'wrong-date-value'
+SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= NULL AND b.sampletime < NULL AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
+gvid the_success the_fail the_size the_time
+DROP TABLE t1,t2;
+create table t1 ( A_Id bigint(20) NOT NULL default '0', A_UpdateBy char(10) NOT NULL default '', A_UpdateDate bigint(20) NOT NULL default '0', A_UpdateSerial int(11) NOT NULL default '0', other_types bigint(20) NOT NULL default '0', wss_type bigint(20) NOT NULL default '0');
+INSERT INTO t1 VALUES (102935998719055004,'brade',1029359987,2,102935229116544068,102935229216544093);
+select wss_type from t1 where wss_type ='102935229216544106';
+wss_type
+select wss_type from t1 where wss_type ='102935229216544105';
+wss_type
+select wss_type from t1 where wss_type ='102935229216544104';
+wss_type
+select wss_type from t1 where wss_type ='102935229216544093';
+wss_type
+102935229216544093
+select wss_type from t1 where wss_type =102935229216544093;
+wss_type
+102935229216544093
+drop table t1;
+select 1+2,"aaaa",3.13*2.0 into @a,@b,@c;
+select @a;
+@a
+3
+select @b;
+@b
+aaaa
+select @c;
+@c
+6.26
+create table t1 (a int not null auto_increment primary key);
+insert into t1 values ();
+insert into t1 values ();
+insert into t1 values ();
+select * from (t1 as t2 left join t1 as t3 using (a)), t1;
+a a a
+1 1 1
+2 2 1
+3 3 1
+1 1 2
+2 2 2
+3 3 2
+1 1 3
+2 2 3
+3 3 3
+select * from t1, (t1 as t2 left join t1 as t3 using (a));
+a a a
+1 1 1
+2 1 1
+3 1 1
+1 2 2
+2 2 2
+3 2 2
+1 3 3
+2 3 3
+3 3 3
+select * from (t1 as t2 left join t1 as t3 using (a)) straight_join t1;
+a a a
+1 1 1
+2 2 1
+3 3 1
+1 1 2
+2 2 2
+3 3 2
+1 1 3
+2 2 3
+3 3 3
+select * from t1 straight_join (t1 as t2 left join t1 as t3 using (a));
+a a a
+1 1 1
+2 1 1
+3 1 1
+1 2 2
+2 2 2
+3 2 2
+1 3 3
+2 3 3
+3 3 3
+select * from (t1 as t2 left join t1 as t3 using (a)) inner join t1 on t1.a>1;
+a a a
+1 1 2
+1 1 3
+2 2 2
+2 2 3
+3 3 2
+3 3 3
+select * from t1 inner join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
+a a a
+1 1 NULL
+2 1 1
+3 1 1
+1 2 NULL
+2 2 2
+3 2 2
+1 3 NULL
+2 3 3
+3 3 3
+select * from (t1 as t2 left join t1 as t3 using (a)) inner join t1 using ( a );
+a a a
+1 1 1
+2 2 2
+3 3 3
+select * from t1 inner join (t1 as t2 left join t1 as t3 using (a)) using ( a );
+a a a
+1 1 1
+2 1 NULL
+3 1 NULL
+1 2 NULL
+2 2 2
+3 2 NULL
+1 3 NULL
+2 3 NULL
+3 3 3
+select * from (t1 as t2 left join t1 as t3 using (a)) left outer join t1 on t1.a>1;
+a a a
+1 1 2
+1 1 3
+2 2 2
+2 2 3
+3 3 2
+3 3 3
+select * from t1 left outer join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
+a a a
+1 1 NULL
+2 1 1
+3 1 1
+1 2 NULL
+2 2 2
+3 2 2
+1 3 NULL
+2 3 3
+3 3 3
+select * from (t1 as t2 left join t1 as t3 using (a)) left join t1 using ( a );
+a a a
+1 1 1
+2 2 2
+3 3 3
+select * from t1 left join (t1 as t2 left join t1 as t3 using (a)) using ( a );
+a a a
+1 1 1
+2 1 NULL
+3 1 NULL
+1 2 NULL
+2 2 2
+3 2 NULL
+1 3 NULL
+2 3 NULL
+3 3 3
+select * from (t1 as t2 left join t1 as t3 using (a)) natural left join t1;
+a a a
+1 1 1
+2 2 2
+3 3 3
+select * from t1 natural left join (t1 as t2 left join t1 as t3 using (a));
+a a a
+1 1 1
+2 2 2
+3 3 3
+select * from (t1 as t2 left join t1 as t3 using (a)) right join t1 on t1.a>1;
+a a a
+1 NULL 1
+2 NULL 1
+3 NULL 1
+1 1 2
+2 2 2
+3 3 2
+1 1 3
+2 2 3
+3 3 3
+select * from t1 right join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
+a a a
+2 1 1
+3 1 1
+2 2 2
+3 2 2
+2 3 3
+3 3 3
+select * from (t1 as t2 left join t1 as t3 using (a)) right outer join t1 using ( a );
+a a a
+1 1 1
+2 NULL 1
+3 NULL 1
+1 NULL 2
+2 2 2
+3 NULL 2
+1 NULL 3
+2 NULL 3
+3 3 3
+select * from t1 right outer join (t1 as t2 left join t1 as t3 using (a)) using ( a );
+a a a
+1 1 1
+2 2 2
+3 3 3
+select * from (t1 as t2 left join t1 as t3 using (a)) natural right join t1;
+a a a
+1 1 1
+2 NULL 1
+3 NULL 1
+1 NULL 2
+2 2 2
+3 NULL 2
+1 NULL 3
+2 NULL 3
+3 3 3
+select * from t1 natural right join (t1 as t2 left join t1 as t3 using (a));
+a a a
+1 1 1
+2 2 2
+3 3 3
+select * from t1 natural join (t1 as t2 left join t1 as t3 using (a));
+a a
+1 1
+2 2
+3 3
+select * from (t1 as t2 left join t1 as t3 using (a)) natural join t1;
+a a a
+1 1 1
+2 2 2
+3 3 3
+drop table t1;
+CREATE TABLE t1 ( aa char(2), id int(11) NOT NULL auto_increment, t2_id int(11) NOT NULL default '0', PRIMARY KEY (id), KEY replace_id (t2_id)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ("1",8264,2506),("2",8299,2517),("3",8301,2518),("4",8302,2519),("5",8303,2520),("6",8304,2521),("7",8305,2522);
+CREATE TABLE t2 ( id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (2517), (2518), (2519), (2520), (2521), (2522);
+select * from t1, t2 WHERE t1.t2_id = t2.id and t1.t2_id > 0 order by t1.id LIMIT 0, 5;
+aa id t2_id id
+2 8299 2517 2517
+3 8301 2518 2518
+4 8302 2519 2519
+5 8303 2520 2520
+6 8304 2521 2521
+drop table t1,t2;
+create table t1 (id1 int NOT NULL);
+create table t2 (id2 int NOT NULL);
+create table t3 (id3 int NOT NULL);
+create table t4 (id4 int NOT NULL, id44 int NOT NULL, KEY (id4));
+insert into t1 values (1);
+insert into t1 values (2);
+insert into t2 values (1);
+insert into t4 values (1,1);
+explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
+left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1
+1 SIMPLE t4 ALL id4 NULL NULL NULL 1 Using where
+select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
+left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
+id1 id2 id3 id4 id44
+1 1 NULL NULL NULL
+drop table t1,t2,t3,t4;
+create table t1(s varchar(10) not null);
+create table t2(s varchar(10) not null primary key);
+create table t3(s varchar(10) not null primary key);
+insert into t1 values ('one\t'), ('two\t');
+insert into t2 values ('one\r'), ('two\t');
+insert into t3 values ('one '), ('two\t');
+select * from t1 where s = 'one';
+s
+select * from t2 where s = 'one';
+s
+select * from t3 where s = 'one';
+s
+one
+select * from t1,t2 where t1.s = t2.s;
+s s
+two two
+select * from t2,t3 where t2.s = t3.s;
+s s
+two two
+drop table t1, t2, t3;
+create table t1 (a integer, b integer, index(a), index(b));
+create table t2 (c integer, d integer, index(c), index(d));
+insert into t1 values (1,2), (2,2), (3,2), (4,2);
+insert into t2 values (1,3), (2,3), (3,4), (4,4);
+explain select * from t1 left join t2 on a=c where d in (4);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref c,d d 5 const 2 Using where
+1 SIMPLE t1 ALL a NULL NULL NULL 3 Using where
+select * from t1 left join t2 on a=c where d in (4);
+a b c d
+3 2 3 4
+4 2 4 4
+explain select * from t1 left join t2 on a=c where d = 4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref c,d d 5 const 2 Using where
+1 SIMPLE t1 ALL a NULL NULL NULL 3 Using where
+select * from t1 left join t2 on a=c where d = 4;
+a b c d
+3 2 3 4
+4 2 4 4
+drop table t1, t2;
+CREATE TABLE t1 (
+i int(11) NOT NULL default '0',
+c char(10) NOT NULL default '',
+PRIMARY KEY (i),
+UNIQUE KEY c (c)
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,'a');
+INSERT INTO t1 VALUES (2,'b');
+INSERT INTO t1 VALUES (3,'c');
+EXPLAIN SELECT i FROM t1 WHERE i=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
+DROP TABLE t1;
diff --git a/mysql-test/r/select_found.result b/mysql-test/r/select_found.result
index 444124bcd67..00dbcb54d93 100644
--- a/mysql-test/r/select_found.result
+++ b/mysql-test/r/select_found.result
@@ -81,7 +81,10 @@ email varchar(50) NOT NULL default '',
PRIMARY KEY (id),
UNIQUE KEY e_n (email,name)
);
-INSERT INTO t2 VALUES (1,'name1','email1'),(2,'name2','email2'),(3,'name3','email3'),(4,'name4','email4'),(5,'name5','email5'),(6,'name6','email6'),(7,'name7','email7'),(8,'name8','email8'),(9,'name9','email9'),(10,'name10','email10'),(11,'name11','email11'),(12,'name12','email12'),(13,'name13','email13'),(14,'name14','email14'),(15,'name15','email15'),(16,'name16','email16'),(17,'name17','email17'),(18,'name18','email18'),(19,'name19','email19'),(20,'name20','email20'),(21,'name21','email21'),(22,'name22','email22'),(23,'name23','email23'),(24,'name24','email24'),(25,'name25','email25'),(26,'name26','email26'),(27,'name27','email27'),(28,'name28','email28'),(29,'name29','email29'),(30,'name30','email30'),(31,'name31','email31'),(32,'name32','email32'),(33,'name33','email33'),(34,'name34','email34'),(35,'name35','email35'),(36,'name36','email36'),(37,'name37','email37'),(38,'name38','email38'),(39,'name39','email39'),(40,'name40','email40'),(41,'name41','email41'),(42,'name42','email42'),(43,'name43','email43'),(44,'name44','email44'),(45,'name45','email45'),(46,'name46','email46'),(47,'name47','email47'),(48,'name48','email48'),(49,'name49','email49'),(50,'name50','email50'),(51,'name51','email51'),(52,'name52','email52'),(53,'name53','email53'),(54,'name54','email54'),(55,'name55','email55'),(56,'name56','email56'),(57,'name57','email57'),(58,'name58','email58'),(59,'name59','email59'),(60,'name60','email60'),(61,'name61','email61'),(62,'name62','email62'),(63,'name63','email63'),(64,'name64','email64'),(65,'name65','email65'),(66,'name66','email66'),(67,'name67','email67'),(68,'name68','email68'),(69,'name69','email69'),(70,'name70','email70'),(71,'name71','email71'),(72,'name72','email72'),(73,'name73','email73'),(74,'name74','email74'),(75,'name75','email75'),(76,'name76','email76'),(77,'name77','email77'),(78,'name78','email78'),(79,'name79','email79'),(80,'name80','email80'),(81,'name81','email81'),(82,'name82','email82'),(83,'name83','email83'),(84,'name84','email84'),(85,'name85','email85'),(86,'name86','email86'),(87,'name87','email87'),(88,'name88','email88'),(89,'name89','email89'),(90,'name90','email90'),(91,'name91','email91'),(92,'name92','email92'),(93,'name93','email93'),(94,'name94','email94'),(95,'name95','email95'),(96,'name96','email96'),(97,'name97','email97'),(98,'name98','email98'),(99,'name99','email99'),(100,'name100','email100'),(101,'name101','email101'),(102,'name102','email102'),(103,'name103','email103'),(104,'name104','email104'),(105,'name105','email105'),(106,'name106','email106'),(107,'name107','email107'),(108,'name108','email108'),(109,'name109','email109'),(110,'name110','email110'),(111,'name111','email111'),(112,'name112','email112'),(113,'name113','email113'),(114,'name114','email114'),(115,'name115','email115'),(116,'name116','email116'),(117,'name117','email117'),(118,'name118','email118'),(119,'name119','email119'),(120,'name120','email120'),(121,'name121','email121'),(122,'name122','email122'),(123,'name123','email123'),(124,'name124','email124'),(125,'name125','email125'),(126,'name126','email126'),(127,'name127','email127'),(128,'name128','email128'),(129,'name129','email129'),(130,'name130','email130'),(131,'name131','email131'),(132,'name132','email132'),(133,'name133','email133'),(134,'name134','email134'),(135,'name135','email135'),(136,'name136','email136'),(137,'name137','email137'),(138,'name138','email138'),(139,'name139','email139'),(140,'name140','email140'),(141,'name141','email141'),(142,'name142','email142'),(143,'name143','email143'),(144,'name144','email144'),(145,'name145','email145'),(146,'name146','email146'),(147,'name147','email147'),(148,'name148','email148'),(149,'name149','email149'),(150,'name150','email150'),(151,'name151','email151'),(152,'name152','email152'),(153,'name153','email153'),(154,'name154','email154'),(155,'name155','email155'),(156,'name156','email156'),(157,'name157','email157'),(158,'name158','email158'),(159,'name159','email159'),(160,'name160','email160'),(161,'name161','email161'),(162,'name162','email162'),(163,'name163','email163'),(164,'name164','email164'),(165,'name165','email165'),(166,'name166','email166'),(167,'name167','email167'),(168,'name168','email168'),(169,'name169','email169'),(170,'name170','email170'),(171,'name171','email171'),(172,'name172','email172'),(173,'name173','email173'),(174,'name174','email174'),(175,'name175','email175'),(176,'name176','email176'),(177,'name177','email177'),(178,'name178','email178'),(179,'name179','email179'),(180,'name180','email180'),(181,'name181','email181'),(182,'name182','email182'),(183,'name183','email183'),(184,'name184','email184'),(185,'name185','email185'),(186,'name186','email186'),(187,'name187','email187'),(188,'name188','email188'),(189,'name189','email189'),(190,'name190','email190'),(191,'name191','email191'),(192,'name192','email192'),(193,'name193','email193'),(194,'name194','email194'),(195,'name195','email195'),(196,'name196','email196'),(197,'name197','email197'),(198,'name198','email198'),(199,'name199','email199'),(200,'name200','email200');
+EXPLAIN SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system PRIMARY,kid NULL NULL NULL 0 const row not found
+1 SIMPLE t2 index NULL e_n 100 NULL 200
SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
email
email1
@@ -136,7 +139,7 @@ email104
email105
email106
email107
-INSERT INTO `t1` (`id`, `kid`) VALUES ('', '150');
+INSERT INTO `t1` (`id`, `kid`) VALUES ('0', '150');
SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
email
email1
@@ -159,7 +162,7 @@ CREATE TABLE `t1` (
`maxnumrep` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`numeropost`),
KEY `maxnumrep` (`maxnumrep`)
-) TYPE=MyISAM ROW_FORMAT=FIXED;
+) ENGINE=MyISAM ROW_FORMAT=FIXED;
INSERT INTO t1 (titre,maxnumrep) VALUES
('test1','1'),('test2','2'),('test3','3');
SELECT SQL_CALC_FOUND_ROWS titre,numeropost,maxnumrep FROM t1 WHERE numeropost IN (1,2) ORDER BY maxnumrep DESC LIMIT 0, 1;
@@ -168,6 +171,26 @@ test2 2 2
SELECT FOUND_ROWS();
FOUND_ROWS()
2
+SELECT SQL_CALC_FOUND_ROWS 1 FROM (SELECT 1) as a LIMIT 0;
+1
+SELECT FOUND_ROWS();
+FOUND_ROWS()
+1
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE numeropost > 1 LIMIT 0;
+titre numeropost maxnumrep
+SELECT FOUND_ROWS();
+FOUND_ROWS()
+2
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 0;
+titre numeropost maxnumrep
+SELECT FOUND_ROWS();
+FOUND_ROWS()
+3
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 ORDER BY numeropost LIMIT 0;
+titre numeropost maxnumrep
+SELECT FOUND_ROWS();
+FOUND_ROWS()
+3
drop table t1;
create table t1 (id int, primary key (id));
insert into t1 values (1), (2), (3), (4), (5);
diff --git a/mysql-test/r/select_safe.result b/mysql-test/r/select_safe.result
index 1ee1368d029..766ee8c0e14 100644
--- a/mysql-test/r/select_safe.result
+++ b/mysql-test/r/select_safe.result
@@ -20,17 +20,17 @@ select 1 from t1,t1 as t2,t1 as t3;
1
1
update t1 set b="a";
-You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
+ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
update t1 set b="a" where b="test";
-You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
+ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
delete from t1;
-You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
+ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
delete from t1 where b="test";
-You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
+ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
delete from t1 where a+0=1;
-You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
+ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
select 1 from t1,t1 as t2,t1 as t3,t1 as t4,t1 as t5;
-The SELECT would examine more rows than MAX_JOIN_SIZE. Check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is ok
+ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
update t1 set b="a" limit 1;
update t1 set b="a" where b="b" limit 2;
delete from t1 where b="test" limit 1;
@@ -38,11 +38,11 @@ delete from t1 where a+0=1 limit 2;
alter table t1 add key b (b);
SET MAX_JOIN_SIZE=2;
SELECT @@MAX_JOIN_SIZE, @@SQL_BIG_SELECTS;
-@@max_join_size @@sql_big_selects
+@@MAX_JOIN_SIZE @@SQL_BIG_SELECTS
2 0
insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a");
SELECT * from t1 order by a;
-The SELECT would examine more rows than MAX_JOIN_SIZE. Check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is ok
+ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
SET SQL_BIG_SELECTS=1;
SELECT * from t1 order by a;
a b
@@ -52,7 +52,7 @@ a b
5 a
SET MAX_JOIN_SIZE=2;
SELECT * from t1;
-The SELECT would examine more rows than MAX_JOIN_SIZE. Check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is ok
+ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
SET MAX_JOIN_SIZE=DEFAULT;
SELECT * from t1;
a b
@@ -61,21 +61,21 @@ a b
4 a
5 a
SELECT @@MAX_SEEKS_FOR_KEY;
-@@max_seeks_for_key
+@@MAX_SEEKS_FOR_KEY
4294967295
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a");
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
-table type possible_keys key key_len ref rows Extra
-t1 ALL b NULL NULL NULL 21
-t2 ref b b 21 t1.b 6 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL b NULL NULL NULL 21
+1 SIMPLE t2 ref b b 21 test.t1.b 6 Using where
set MAX_SEEKS_FOR_KEY=1;
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
-table type possible_keys key key_len ref rows Extra
-t1 ALL b NULL NULL NULL 21
-t2 ref b b 21 t1.b 6 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL b NULL NULL NULL 21
+1 SIMPLE t2 ref b b 21 test.t1.b 6 Using where
SET MAX_SEEKS_FOR_KEY=DEFAULT;
drop table t1;
SET SQL_SAFE_UPDATES=0,SQL_SELECT_LIMIT=DEFAULT, SQL_MAX_JOIN_SIZE=DEFAULT;
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index f40b0693585..0afe45eb5e5 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -1,4 +1,8 @@
drop table if exists t1,t2;
+drop database if exists mysqltest;
+delete from mysql.user where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
+delete from mysql.db where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
+flush privileges;
create table t1 (a int not null primary key, b int not null,c int not null, key(b,c));
insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4);
check table t1 fast;
@@ -26,7 +30,7 @@ t1 0 PRIMARY 1 a A 5 NULL NULL BTREE
t1 1 b 1 b A 1 NULL NULL BTREE
t1 1 b 2 c A 5 NULL NULL BTREE
insert into t1 values (5,5,5);
-Duplicate entry '5' for key 1
+ERROR 23000: Duplicate entry '5' for key 1
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
@@ -43,7 +47,7 @@ wait_timeout 28800
show variables like "this_doesn't_exists%";
Variable_name Value
show table status from test like "this_doesn't_exists%";
-Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Create_options Comment
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
show databases;
Database
mysql
@@ -77,24 +81,48 @@ show create table t1;
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
`a` int(11) NOT NULL default '0'
-) TYPE=MyISAM
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 rename t2;
show create table t2;
Table Create Table
t2 CREATE TEMPORARY TABLE `t2` (
`a` int(11) NOT NULL default '0'
-) TYPE=MyISAM
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t2;
create table t1 (
test_set set( 'val1', 'val2', 'val3' ) not null default '',
-name char(20) default 'O''Brien'
+name char(20) default 'O''Brien' comment 'O''Brien as default',
+c int not null comment 'int column',
+`c-b` int comment 'name with a minus',
+`space 2` int comment 'name with a space'
) comment = 'it\'s a table' ;
-show create table t1 ;
+show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`test_set` set('val1','val2','val3') NOT NULL default '',
- `name` char(20) default 'O''Brien'
-) TYPE=MyISAM COMMENT='it''s a table'
+ `name` char(20) default 'O''Brien' COMMENT 'O''Brien as default',
+ `c` int(11) NOT NULL default '0' COMMENT 'int column',
+ `c-b` int(11) default NULL COMMENT 'name with a minus',
+ `space 2` int(11) default NULL COMMENT 'name with a space'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table'
+set sql_quote_show_create=0;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE t1 (
+ test_set set('val1','val2','val3') NOT NULL default '',
+ name char(20) default 'O''Brien' COMMENT 'O''Brien as default',
+ c int(11) NOT NULL default '0' COMMENT 'int column',
+ `c-b` int(11) default NULL COMMENT 'name with a minus',
+ `space 2` int(11) default NULL COMMENT 'name with a space'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table'
+set sql_quote_show_create=1;
+show full columns from t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+test_set set('val1','val2','val3') latin1_swedish_ci select,insert,update,references
+name char(20) latin1_swedish_ci YES O'Brien select,insert,update,references O'Brien as default
+c int(11) NULL 0 select,insert,update,references int column
+c-b int(11) NULL YES NULL select,insert,update,references name with a minus
+space 2 int(11) NULL YES NULL select,insert,update,references name with a space
drop table t1;
create table t1 (a int not null, unique aa (a));
show create table t1;
@@ -102,7 +130,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
UNIQUE KEY `aa` (`a`)
-) TYPE=MyISAM
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int not null, primary key (a));
show create table t1;
@@ -110,7 +138,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
PRIMARY KEY (`a`)
-) TYPE=MyISAM
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
flush tables;
show open tables;
@@ -121,14 +149,14 @@ show open tables;
Database Table In_use Name_locked
test t1 0 0
drop table t1;
-create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" TYPE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed;
+create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" ENGINE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`b` char(10) default NULL,
KEY `b` (`b`)
-) TYPE=MyISAM MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test'
alter table t1 MAX_ROWS=200 ROW_FORMAT=dynamic PACK_KEYS=0;
show create table t1;
Table Create Table
@@ -136,7 +164,7 @@ t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`b` varchar(10) default NULL,
KEY `b` (`b`)
-) TYPE=MyISAM MIN_ROWS=10 MAX_ROWS=200 AVG_ROW_LENGTH=10 PACK_KEYS=0 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC COMMENT='test'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=200 AVG_ROW_LENGTH=10 PACK_KEYS=0 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC COMMENT='test'
ALTER TABLE t1 AVG_ROW_LENGTH=0 CHECKSUM=0 COMMENT="" MIN_ROWS=0 MAX_ROWS=0 PACK_KEYS=DEFAULT DELAY_KEY_WRITE=0 ROW_FORMAT=default;
show create table t1;
Table Create Table
@@ -144,7 +172,7 @@ t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`b` varchar(10) default NULL,
KEY `b` (`b`)
-) TYPE=MyISAM
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a decimal(9,2), b decimal (9,0), e double(9,2), f double(5,0), h float(3,2), i float(3,0));
show columns from t1;
@@ -155,6 +183,14 @@ e double(9,2) YES NULL
f double(5,0) YES NULL
h float(3,2) YES NULL
i float(3,0) YES NULL
+show full columns from t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+a decimal(9,2) NULL YES NULL select,insert,update,references
+b decimal(9,0) NULL YES NULL select,insert,update,references
+e double(9,2) NULL YES NULL select,insert,update,references
+f double(5,0) NULL YES NULL select,insert,update,references
+h float(3,2) NULL YES NULL select,insert,update,references
+i float(3,0) NULL YES NULL select,insert,update,references
drop table t1;
create table t1 (
type_bool bool not null,
@@ -179,7 +215,7 @@ type_blob blob,
type_medium_blob mediumblob,
type_long_blob longblob,
index(type_short)
-) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" TYPE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed CHARSET=latin1;
+) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" ENGINE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed CHARSET=latin1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -193,7 +229,7 @@ t1 CREATE TABLE `t1` (
`empty_char` char(0) default NULL,
`type_char` char(2) default NULL,
`type_varchar` varchar(10) default NULL,
- `type_timestamp` timestamp(14) NOT NULL,
+ `type_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`type_date` date NOT NULL default '0000-00-00',
`type_time` time NOT NULL default '00:00:00',
`type_datetime` datetime NOT NULL default '0000-00-00 00:00:00',
@@ -206,11 +242,11 @@ t1 CREATE TABLE `t1` (
`type_long_blob` longblob,
PRIMARY KEY (`type_tiny`),
KEY `type_short` (`type_short`)
-) TYPE=MyISAM MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test'
insert into t1 (type_timestamp) values ("2003-02-07 10:00:01");
select * from t1;
type_bool type_tiny type_short type_mediumint type_bigint type_decimal type_numeric empty_char type_char type_varchar type_timestamp type_date type_time type_datetime type_year type_enum type_set type_tinyblob type_blob type_medium_blob type_long_blob
-0 1 NULL NULL NULL NULL NULL NULL NULL NULL 20030207100001 0000-00-00 00:00:00 0000-00-00 00:00:00 NULL NULL NULL NULL NULL NULL NULL
+0 1 NULL NULL NULL NULL NULL NULL NULL NULL 2003-02-07 10:00:01 0000-00-00 00:00:00 0000-00-00 00:00:00 NULL NULL NULL NULL NULL NULL NULL
drop table t1;
create table t1 (a int not null);
create table t2 select max(a) from t1;
@@ -233,3 +269,139 @@ c decimal(4,3) YES NULL
d double(4,3) YES NULL
f float(4,3) YES NULL
drop table t1;
+SET @old_sql_mode= @@sql_mode, sql_mode= '';
+SET @old_sql_quote_show_create= @@sql_quote_show_create, sql_quote_show_create= OFF;
+CREATE TABLE `a/b` (i INT);
+ERROR 42000: Incorrect table name 'a/b'
+SET sql_mode= 'ANSI_QUOTES';
+SET sql_mode= '';
+SET sql_quote_show_create= OFF;
+CREATE TABLE t1 (i INT);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE t1 (
+ i int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE `table` (i INT);
+SHOW CREATE TABLE `table`;
+Table Create Table
+table CREATE TABLE `table` (
+ i int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE `table`;
+SET sql_quote_show_create= @old_sql_quote_show_create;
+SET sql_mode= @old_sql_mode;
+select @@max_heap_table_size;
+@@max_heap_table_size
+1047552
+CREATE TABLE t1 (
+a int(11) default NULL,
+KEY a TYPE BTREE (a)
+) ENGINE=HEAP;
+CREATE TABLE t2 (
+b int(11) default NULL,
+index(b)
+) ENGINE=HEAP;
+CREATE TABLE t3 (
+a int(11) default NULL,
+b int(11) default NULL,
+KEY a TYPE BTREE (a),
+index(b)
+) ENGINE=HEAP;
+insert into t1 values (1),(2);
+insert into t2 values (1),(2);
+insert into t3 values (1,1),(2,2);
+show table status;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t1 HEAP 9 Fixed 2 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+t2 HEAP 9 Fixed 2 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+t3 HEAP 9 Fixed 2 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+insert into t1 values (3),(4);
+insert into t2 values (3),(4);
+insert into t3 values (3,3),(4,4);
+show table status;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t1 HEAP 9 Fixed 4 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+t2 HEAP 9 Fixed 4 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+t3 HEAP 9 Fixed 4 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+insert into t1 values (5);
+insert into t2 values (5);
+insert into t3 values (5,5);
+show table status;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t1 HEAP 9 Fixed 5 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+t2 HEAP 9 Fixed 5 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+t3 HEAP 9 Fixed 5 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+delete from t1 where a=3;
+delete from t2 where b=3;
+delete from t3 where a=3;
+show table status;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t1 HEAP 9 Fixed 4 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
+t2 HEAP 9 Fixed 4 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
+t3 HEAP 9 Fixed 4 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
+delete from t1;
+delete from t2;
+delete from t3;
+show table status;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t1 HEAP 9 Fixed 0 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+t2 HEAP 9 Fixed 0 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+t3 HEAP 9 Fixed 0 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+insert into t1 values (5);
+insert into t2 values (5);
+insert into t3 values (5,5);
+show table status;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t1 HEAP 9 Fixed 1 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+t2 HEAP 9 Fixed 1 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+t3 HEAP 9 Fixed 1 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+delete from t1 where a=5;
+delete from t2 where b=5;
+delete from t3 where a=5;
+show table status;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t1 HEAP 9 Fixed 0 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
+t2 HEAP 9 Fixed 0 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
+t3 HEAP 9 Fixed 0 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
+drop table t1, t2, t3;
+create database mysqltest;
+show create database mysqltest;
+Database Create Database
+mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */
+create table mysqltest.t1(a int);
+insert into mysqltest.t1 values(1);
+grant select on `mysqltest`.* to mysqltest_1@localhost;
+grant usage on `mysqltest`.* to mysqltest_2@localhost;
+grant drop on `mysqltest`.* to mysqltest_3@localhost;
+select * from t1;
+a
+1
+show create database mysqltest;
+Database Create Database
+mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */
+drop table t1;
+ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest'
+drop database mysqltest;
+ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest'
+select * from mysqltest.t1;
+ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysqltest'
+show create database mysqltest;
+ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysqltest'
+drop table mysqltest.t1;
+ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysqltest'
+drop database mysqltest;
+ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysqltest'
+select * from mysqltest.t1;
+ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest'
+show create database mysqltest;
+ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest'
+drop table mysqltest.t1;
+drop database mysqltest;
+set names binary;
+delete from mysql.user
+where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
+delete from mysql.db
+where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
+flush privileges;
diff --git a/mysql-test/r/sql_mode.result b/mysql-test/r/sql_mode.result
new file mode 100644
index 00000000000..c18be2df403
--- /dev/null
+++ b/mysql-test/r/sql_mode.result
@@ -0,0 +1,140 @@
+drop table if exists t1;
+CREATE TABLE `t1` (
+a int not null auto_increment,
+`pseudo` varchar(35) character set latin2 NOT NULL default '',
+`email` varchar(60) character set latin2 NOT NULL default '',
+PRIMARY KEY (a),
+UNIQUE KEY `email` USING BTREE (`email`)
+) ENGINE=HEAP CHARSET=latin1 ROW_FORMAT DYNAMIC;
+set @@sql_mode="";
+show variables like 'sql_mode';
+Variable_name Value
+sql_mode
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL auto_increment,
+ `pseudo` varchar(35) character set latin2 NOT NULL default '',
+ `email` varchar(60) character set latin2 NOT NULL default '',
+ PRIMARY KEY (`a`),
+ UNIQUE KEY `email` TYPE BTREE (`email`)
+) ENGINE=HEAP DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
+set @@sql_mode="ansi_quotes";
+show variables like 'sql_mode';
+Variable_name Value
+sql_mode ANSI_QUOTES
+show create table t1;
+Table Create Table
+t1 CREATE TABLE "t1" (
+ "a" int(11) NOT NULL auto_increment,
+ "pseudo" varchar(35) character set latin2 NOT NULL default '',
+ "email" varchar(60) character set latin2 NOT NULL default '',
+ PRIMARY KEY ("a"),
+ UNIQUE KEY "email" TYPE BTREE ("email")
+) ENGINE=HEAP DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
+set @@sql_mode="no_table_options";
+show variables like 'sql_mode';
+Variable_name Value
+sql_mode NO_TABLE_OPTIONS
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL auto_increment,
+ `pseudo` varchar(35) character set latin2 NOT NULL default '',
+ `email` varchar(60) character set latin2 NOT NULL default '',
+ PRIMARY KEY (`a`),
+ UNIQUE KEY `email` TYPE BTREE (`email`)
+)
+set @@sql_mode="no_key_options";
+show variables like 'sql_mode';
+Variable_name Value
+sql_mode NO_KEY_OPTIONS
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL auto_increment,
+ `pseudo` varchar(35) character set latin2 NOT NULL default '',
+ `email` varchar(60) character set latin2 NOT NULL default '',
+ PRIMARY KEY (`a`),
+ UNIQUE KEY `email` (`email`)
+) ENGINE=HEAP DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
+set @@sql_mode="no_field_options,mysql323,mysql40";
+show variables like 'sql_mode';
+Variable_name Value
+sql_mode NO_FIELD_OPTIONS,MYSQL323,MYSQL40
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL auto_increment,
+ `pseudo` varchar(35) NOT NULL default '',
+ `email` varchar(60) NOT NULL default '',
+ PRIMARY KEY (`a`),
+ UNIQUE KEY `email` (`email`)
+) TYPE=HEAP ROW_FORMAT=DYNAMIC
+set sql_mode="postgresql,oracle,mssql,db2,maxdb";
+select @@sql_mode;
+@@sql_mode
+PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,POSTGRESQL,ORACLE,MSSQL,DB2,MAXDB,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS
+show create table t1;
+Table Create Table
+t1 CREATE TABLE "t1" (
+ "a" int(11) NOT NULL,
+ "pseudo" varchar(35) NOT NULL default '',
+ "email" varchar(60) NOT NULL default '',
+ PRIMARY KEY ("a"),
+ UNIQUE KEY "email" ("email")
+)
+drop table t1;
+CREATE TABLE t1 (
+a char(10),
+b char(10) collate latin1_bin,
+c binary(10)
+) character set latin1;
+set @@sql_mode="";
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) default NULL,
+ `b` char(10) character set latin1 collate latin1_bin default NULL,
+ `c` binary(10) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+set @@sql_mode="mysql323";
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) default NULL,
+ `b` char(10) binary default NULL,
+ `c` binary(10) default NULL
+) TYPE=MyISAM
+set @@sql_mode="mysql40";
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) default NULL,
+ `b` char(10) binary default NULL,
+ `c` binary(10) default NULL
+) TYPE=MyISAM
+drop table t1;
+set session sql_mode = '';
+create table t1 ( min_num dec(6,6) default .000001);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `min_num` decimal(7,6) default '0.000001'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1 ;
+set session sql_mode = 'IGNORE_SPACE';
+create table t1 ( min_num dec(6,6) default 0.000001);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `min_num` decimal(7,6) default '0.000001'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1 ;
+create table t1 ( min_num dec(6,6) default .000001);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `min_num` decimal(7,6) default '0.000001'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1 ;
diff --git a/mysql-test/r/status.result b/mysql-test/r/status.result
index 3ef6cec32b3..e9616232fa1 100644
--- a/mysql-test/r/status.result
+++ b/mysql-test/r/status.result
@@ -5,7 +5,7 @@ Table_locks_immediate 0
Table_locks_waited 0
SET SQL_LOG_BIN=0;
drop table if exists t1;
-create table t1(n int) type=myisam;
+create table t1(n int) engine=myisam;
insert into t1 values(1);
lock tables t1 read;
unlock tables;
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
new file mode 100644
index 00000000000..0735f133e6f
--- /dev/null
+++ b/mysql-test/r/subselect.result
@@ -0,0 +1,2127 @@
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12;
+select (select 2);
+(select 2)
+2
+explain extended select (select 2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1249 Select 2 was reduced during optimization
+Note 1003 select 2 AS `(select 2)`
+SELECT (SELECT 1) UNION SELECT (SELECT 2);
+(SELECT 1)
+1
+2
+explain extended SELECT (SELECT 1) UNION SELECT (SELECT 2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
+3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL
+Warnings:
+Note 1249 Select 2 was reduced during optimization
+Note 1249 Select 4 was reduced during optimization
+Note 1003 select 1 AS `(SELECT 1)` union select 2 AS `(SELECT 2)`
+SELECT (SELECT (SELECT 0 UNION SELECT 0));
+(SELECT (SELECT 0 UNION SELECT 0))
+0
+explain extended SELECT (SELECT (SELECT 0 UNION SELECT 0));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
+4 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL
+Warnings:
+Note 1249 Select 2 was reduced during optimization
+Note 1003 select (select 0 AS `0` union select 0 AS `0`) AS `(SELECT (SELECT 0 UNION SELECT 0))`
+SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a;
+ERROR 42S22: Reference 'a' not supported (forward reference in item list)
+SELECT (SELECT 1 FROM (SELECT 1) as b HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) as c HAVING a=1) as b;
+ERROR 42S22: Reference 'b' not supported (forward reference in item list)
+SELECT (SELECT 1),MAX(1) FROM (SELECT 1) as a;
+(SELECT 1) MAX(1)
+1 1
+SELECT (SELECT a) as a;
+ERROR 42S22: Reference 'a' not supported (forward reference in item list)
+EXPLAIN EXTENDED SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> system NULL NULL NULL NULL 1
+3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
+2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1276 Field or reference 'a' of SELECT #3 was resolved in SELECT #1
+Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
+Note 1003 select 1 AS `1` from (select 1 AS `a`) b having ((select b.a AS `a`) = 1)
+SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
+1
+1
+SELECT (SELECT 1), a;
+ERROR 42S22: Unknown column 'a' in 'field list'
+SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1;
+a
+1
+SELECT 1 FROM (SELECT (SELECT a) b) c;
+ERROR 42S22: Unknown column 'a' in 'field list'
+SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id);
+id
+1
+SELECT * FROM (SELECT 1) a WHERE 1 IN (SELECT 1,1);
+ERROR 21000: Operand should contain 1 column(s)
+SELECT 1 IN (SELECT 1);
+1 IN (SELECT 1)
+1
+SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
+1
+1
+select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
+ERROR HY000: Incorrect usage of PROCEDURE and subquery
+SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
+ERROR HY000: Incorrect parameters to procedure 'ANALYSE'
+SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
+a
+SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
+a
+1
+SELECT (SELECT 1,2,3) = ROW(1,2,3);
+(SELECT 1,2,3) = ROW(1,2,3)
+1
+SELECT (SELECT 1,2,3) = ROW(1,2,1);
+(SELECT 1,2,3) = ROW(1,2,1)
+0
+SELECT (SELECT 1,2,3) < ROW(1,2,1);
+(SELECT 1,2,3) < ROW(1,2,1)
+0
+SELECT (SELECT 1,2,3) > ROW(1,2,1);
+(SELECT 1,2,3) > ROW(1,2,1)
+1
+SELECT (SELECT 1,2,3) = ROW(1,2,NULL);
+(SELECT 1,2,3) = ROW(1,2,NULL)
+NULL
+SELECT ROW(1,2,3) = (SELECT 1,2,3);
+ROW(1,2,3) = (SELECT 1,2,3)
+1
+SELECT ROW(1,2,3) = (SELECT 1,2,1);
+ROW(1,2,3) = (SELECT 1,2,1)
+0
+SELECT ROW(1,2,3) < (SELECT 1,2,1);
+ROW(1,2,3) < (SELECT 1,2,1)
+0
+SELECT ROW(1,2,3) > (SELECT 1,2,1);
+ROW(1,2,3) > (SELECT 1,2,1)
+1
+SELECT ROW(1,2,3) = (SELECT 1,2,NULL);
+ROW(1,2,3) = (SELECT 1,2,NULL)
+NULL
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a');
+(SELECT 1.5,2,'a') = ROW(1.5,2,'a')
+1
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b');
+(SELECT 1.5,2,'a') = ROW(1.5,2,'b')
+0
+SELECT (SELECT 1.5,2,'a') = ROW('b',2,'b');
+(SELECT 1.5,2,'a') = ROW('b',2,'b')
+0
+SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a');
+(SELECT 'b',2,'a') = ROW(1.5,2,'a')
+0
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,'c','a');
+(SELECT 1.5,2,'a') = ROW(1.5,'c','a')
+0
+SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a');
+(SELECT 1.5,'c','a') = ROW(1.5,2,'a')
+0
+SELECT (SELECT * FROM (SELECT 'test' a,'test' b) a);
+ERROR 21000: Operand should contain 1 column(s)
+SELECT 1 as a,(SELECT a+a) b,(SELECT b);
+a b (SELECT b)
+1 2 2
+create table t1 (a int);
+create table t2 (a int, b int);
+create table t3 (a int);
+create table t4 (a int not null, b int not null);
+insert into t1 values (2);
+insert into t2 values (1,7),(2,7);
+insert into t4 values (4,8),(3,8),(5,9);
+select (select a from t1 where t1.a = a1) as a2, (select b from t2 where t2.b=a2) as a1;
+ERROR 42S22: Reference 'a1' not supported (forward reference in item list)
+select (select a from t1 where t1.a=t2.a), a from t2;
+(select a from t1 where t1.a=t2.a) a
+NULL 1
+2 2
+select (select a from t1 where t1.a=t2.b), a from t2;
+(select a from t1 where t1.a=t2.b) a
+NULL 1
+NULL 2
+select (select a from t1), a, (select 1 union select 2 limit 1) from t2;
+(select a from t1) a (select 1 union select 2 limit 1)
+2 1 1
+2 2 1
+select (select a from t3), a from t2;
+(select a from t3) a
+NULL 1
+NULL 2
+select * from t2 where t2.a=(select a from t1);
+a b
+2 7
+insert into t3 values (6),(7),(3);
+select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1);
+a b
+1 7
+2 7
+(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 order by a limit 2) limit 3;
+a b
+1 7
+2 7
+3 8
+(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a);
+a b
+1 7
+2 7
+4 8
+3 8
+explain extended (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
+2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 Using filesort
+3 UNION t4 ALL NULL NULL NULL NULL 3 Using where
+4 SUBQUERY t2 ALL NULL NULL NULL NULL 2
+NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 (select test.t2.a AS `a`,test.t2.b AS `b` from test.t2 where (test.t2.b = (select test.t3.a AS `a` from test.t3 order by test.t3.a desc limit 1))) union (select test.t4.a AS `a`,test.t4.b AS `b` from test.t4 where (test.t4.b = (select (max(test.t2.a) * 4) AS `max(t2.a)*4` from test.t2)) order by a)
+select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
+(select a from t3 where a<t2.a*4 order by 1 desc limit 1) a
+3 1
+7 2
+select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from
+(select * from t2 where a>1) as tt;
+(select t3.a from t3 where a<8 order by 1 desc limit 1) a
+7 2
+explain extended select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from
+(select * from t2 where a>1) as tt;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived3> system NULL NULL NULL NULL 1
+3 DERIVED t2 ALL NULL NULL NULL NULL 2 Using where
+2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 Using where; Using filesort
+Warnings:
+Note 1003 select (select test.t3.a AS `a` from test.t3 where (test.t3.a < 8) order by test.t3.a desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,tt.a AS `a` from (select test.t2.a AS `a`,test.t2.b AS `b` from test.t2 where (test.t2.a > 1)) tt
+select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1);
+a
+2
+select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a > t1.a) order by 1 desc limit 1);
+a
+2
+select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a < t1.a) order by 1 desc limit 1);
+a
+select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
+b (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)
+8 7.5000
+8 4.5000
+9 7.5000
+explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t4 ALL NULL NULL NULL NULL 3
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2
+3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 Using where
+Warnings:
+Note 1276 Field or reference 't4.a' of SELECT #3 was resolved in SELECT #1
+Note 1003 select test.t4.b AS `b`,(select avg((test.t2.a + (select min(test.t3.a) AS `min(t3.a)` from test.t3 where (test.t3.a >= test.t4.a)))) AS `avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a))` from test.t2) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from test.t4
+select * from t3 where exists (select * from t2 where t2.b=t3.a);
+a
+7
+select * from t3 where not exists (select * from t2 where t2.b=t3.a);
+a
+6
+3
+select * from t3 where a in (select b from t2);
+a
+7
+select * from t3 where a not in (select b from t2);
+a
+6
+3
+select * from t3 where a = some (select b from t2);
+a
+7
+select * from t3 where a <> any (select b from t2);
+a
+6
+3
+select * from t3 where a = all (select b from t2);
+a
+7
+select * from t3 where a <> all (select b from t2);
+a
+6
+3
+insert into t2 values (100, 5);
+select * from t3 where a < any (select b from t2);
+a
+6
+3
+select * from t3 where a < all (select b from t2);
+a
+3
+select * from t3 where a >= any (select b from t2);
+a
+6
+7
+explain extended select * from t3 where a >= any (select b from t2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 3
+Warnings:
+Note 1003 select test.t3.a AS `a` from test.t3 where <nop>((test.t3.a >= (select min(test.t2.b) from test.t2)))
+select * from t3 where a >= all (select b from t2);
+a
+7
+delete from t2 where a=100;
+select * from t3 where a in (select a,b from t2);
+ERROR 21000: Operand should contain 1 column(s)
+select * from t3 where a in (select * from t2);
+ERROR 21000: Operand should contain 1 column(s)
+insert into t4 values (12,7),(1,7),(10,9),(9,6),(7,6),(3,9),(1,10);
+select b,max(a) as ma from t4 group by b having b < (select max(t2.a) from t2 where t2.b=t4.b);
+b ma
+insert into t2 values (2,10);
+select b,max(a) as ma from t4 group by b having ma < (select max(t2.a) from t2 where t2.b=t4.b);
+b ma
+10 1
+delete from t2 where a=2 and b=10;
+select b,max(a) as ma from t4 group by b having b >= (select max(t2.a) from t2 where t2.b=t4.b);
+b ma
+7 12
+create table t5 (a int);
+select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a
+NULL 1
+2 2
+insert into t5 values (5);
+select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a
+NULL 1
+2 2
+insert into t5 values (2);
+select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a
+NULL 1
+2 2
+explain extended select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2
+2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1
+3 DEPENDENT UNION t5 ALL NULL NULL NULL NULL 2 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+Warnings:
+Note 1276 Field or reference 't2.a' of SELECT #2 was resolved in SELECT #1
+Note 1276 Field or reference 't2.a' of SELECT #3 was resolved in SELECT #1
+Note 1003 select (select test.t1.a AS `a` from test.t1 where (test.t1.a = test.t2.a) union select test.t5.a AS `a` from test.t5 where (test.t5.a = test.t2.a)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,test.t2.a AS `a` from test.t2
+select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
+ERROR 21000: Subquery returns more than 1 row
+create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
+create table t7( uq int primary key, name char(25));
+insert into t7 values(1,"Oblastnaia bolnitsa"),(2,"Bolnitsa Krasnogo Kresta");
+insert into t6 values (1,1),(1,2),(2,2),(1,3);
+select * from t6 where exists (select * from t7 where uq = clinic_uq);
+patient_uq clinic_uq
+1 1
+1 2
+2 2
+explain extended select * from t6 where exists (select * from t7 where uq = clinic_uq);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t6 ALL NULL NULL NULL NULL 4 Using where
+2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 Using index
+Warnings:
+Note 1276 Field or reference 'clinic_uq' of SELECT #2 was resolved in SELECT #1
+Note 1003 select test.t6.patient_uq AS `patient_uq`,test.t6.clinic_uq AS `clinic_uq` from test.t6 where exists(select 1 AS `Not_used` from test.t7 where (test.t7.uq = test.t6.clinic_uq))
+select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
+ERROR 23000: Column 'a' in field list is ambiguous
+drop table t1,t2,t3;
+CREATE TABLE t3 (a varchar(20),b char(1) NOT NULL default '0');
+INSERT INTO t3 VALUES ('W','a'),('A','c'),('J','b');
+CREATE TABLE t2 (a varchar(20),b int NOT NULL default '0');
+INSERT INTO t2 VALUES ('W','1'),('A','3'),('J','2');
+CREATE TABLE t1 (a varchar(20),b date NOT NULL default '0000-00-00');
+INSERT INTO t1 VALUES ('W','1732-02-22'),('A','1735-10-30'),('J','1743-04-13');
+SELECT * FROM t1 WHERE b = (SELECT MIN(b) FROM t1);
+a b
+W 1732-02-22
+SELECT * FROM t2 WHERE b = (SELECT MIN(b) FROM t2);
+a b
+W 1
+SELECT * FROM t3 WHERE b = (SELECT MIN(b) FROM t3);
+a b
+W a
+CREATE TABLE `t8` (
+`pseudo` varchar(35) character set latin1 NOT NULL default '',
+`email` varchar(60) character set latin1 NOT NULL default '',
+PRIMARY KEY (`pseudo`),
+UNIQUE KEY `email` (`email`)
+) ENGINE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC;
+INSERT INTO t8 (pseudo,email) VALUES ('joce','test');
+INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1');
+INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1');
+EXPLAIN EXTENDED SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t8 const PRIMARY PRIMARY 35 const 1 Using index
+4 SUBQUERY t8 const PRIMARY PRIMARY 35 1 Using index
+2 SUBQUERY t8 const PRIMARY PRIMARY 35 const 1
+3 SUBQUERY t8 const PRIMARY PRIMARY 35 1 Using index
+Warnings:
+Note 1003 select test.t8.pseudo AS `pseudo`,(select test.t8.email AS `email` from test.t8 where (test.t8.pseudo = (select test.t8.pseudo AS `pseudo` from test.t8 where (test.t8.pseudo = _latin1'joce')))) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from test.t8 where (test.t8.pseudo = (select test.t8.pseudo AS `pseudo` from test.t8 where (test.t8.pseudo = _latin1'joce')))
+SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
+t8 WHERE pseudo='joce');
+ERROR 21000: Operand should contain 1 column(s)
+SELECT pseudo FROM t8 WHERE pseudo=(SELECT * FROM t8 WHERE
+pseudo='joce');
+ERROR 21000: Operand should contain 1 column(s)
+SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
+pseudo
+joce
+SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo LIKE '%joce%');
+ERROR 21000: Subquery returns more than 1 row
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8;
+CREATE TABLE `t1` (
+`topic` mediumint(8) unsigned NOT NULL default '0',
+`date` date NOT NULL default '0000-00-00',
+`pseudo` varchar(35) character set latin1 NOT NULL default '',
+PRIMARY KEY (`pseudo`,`date`,`topic`),
+KEY `topic` (`topic`)
+) ENGINE=MyISAM ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 (topic,date,pseudo) VALUES
+('43506','2002-10-02','joce'),('40143','2002-08-03','joce');
+EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 41 NULL 2 Using where; Using index
+Warnings:
+Note 1003 select distinct test.t1.date AS `date` from test.t1 where (test.t1.date = 20020803)
+EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
+2 SUBQUERY t1 index NULL PRIMARY 41 NULL 2 Using where; Using index
+Warnings:
+Note 1003 select (select distinct test.t1.date AS `date` from test.t1 where (test.t1.date = 20020803)) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
+SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
+date
+2002-08-03
+SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
+(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')
+2002-08-03
+SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1) UNION ALL SELECT 1;
+1
+1
+1
+1
+SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1) UNION SELECT 1;
+ERROR 21000: Subquery returns more than 1 row
+EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index NULL topic 3 NULL 2 Using index
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
+3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 select 1 AS `1` from test.t1
+drop table t1;
+CREATE TABLE `t1` (
+`numeropost` mediumint(8) unsigned NOT NULL auto_increment,
+`maxnumrep` int(10) unsigned NOT NULL default '0',
+PRIMARY KEY (`numeropost`),
+UNIQUE KEY `maxnumrep` (`maxnumrep`)
+) ENGINE=MyISAM ROW_FORMAT=FIXED;
+INSERT INTO t1 (numeropost,maxnumrep) VALUES (40143,1),(43506,2);
+CREATE TABLE `t2` (
+`mot` varchar(30) NOT NULL default '',
+`topic` mediumint(8) unsigned NOT NULL default '0',
+`date` date NOT NULL default '0000-00-00',
+`pseudo` varchar(35) NOT NULL default '',
+PRIMARY KEY (`mot`,`pseudo`,`date`,`topic`)
+) ENGINE=MyISAM ROW_FORMAT=DYNAMIC;
+INSERT INTO t2 (mot,topic,date,pseudo) VALUES ('joce','40143','2002-10-22','joce'), ('joce','43506','2002-10-22','joce');
+select numeropost as a FROM t1 GROUP BY (SELECT 1 FROM t1 HAVING a=1);
+a
+40143
+SELECT numeropost,maxnumrep FROM t1 WHERE exists (SELECT 1 FROM t2 WHERE (mot='joce') AND date >= '2002-10-21' AND t1.numeropost = t2.topic) ORDER BY maxnumrep DESC LIMIT 0, 20;
+numeropost maxnumrep
+43506 2
+40143 1
+SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) b;
+ERROR 42S22: Unknown column 'a' in 'having clause'
+SELECT 1 IN (SELECT 1 FROM t2 HAVING a);
+ERROR 42S22: Unknown column 'a' in 'having clause'
+SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic);
+mot topic date pseudo
+joce 40143 2002-10-22 joce
+joce 43506 2002-10-22 joce
+SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100);
+mot topic date pseudo
+SELECT * from t2 where topic IN (SELECT SUM(topic) FROM t1);
+mot topic date pseudo
+SELECT * from t2 where topic = any (SELECT topic FROM t2 GROUP BY topic);
+mot topic date pseudo
+joce 40143 2002-10-22 joce
+joce 43506 2002-10-22 joce
+SELECT * from t2 where topic = any (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100);
+mot topic date pseudo
+SELECT * from t2 where topic = any (SELECT SUM(topic) FROM t1);
+mot topic date pseudo
+SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic);
+mot topic date pseudo
+SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100);
+mot topic date pseudo
+joce 40143 2002-10-22 joce
+joce 43506 2002-10-22 joce
+SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) from t2;
+mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100)
+joce 40143 2002-10-22 joce 1
+joce 43506 2002-10-22 joce 1
+SELECT * from t2 where topic = all (SELECT SUM(topic) FROM t2);
+mot topic date pseudo
+SELECT * from t2 where topic <> any (SELECT SUM(topic) FROM t2);
+mot topic date pseudo
+joce 40143 2002-10-22 joce
+joce 43506 2002-10-22 joce
+SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000);
+mot topic date pseudo
+joce 40143 2002-10-22 joce
+SELECT * from t2 where topic = any (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000);
+mot topic date pseudo
+joce 40143 2002-10-22 joce
+SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000);
+mot topic date pseudo
+joce 40143 2002-10-22 joce
+SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) from t2;
+mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000)
+joce 40143 2002-10-22 joce 1
+joce 43506 2002-10-22 joce 0
+drop table t1,t2;
+CREATE TABLE `t1` (
+`numeropost` mediumint(8) unsigned NOT NULL auto_increment,
+`maxnumrep` int(10) unsigned NOT NULL default '0',
+PRIMARY KEY (`numeropost`),
+UNIQUE KEY `maxnumrep` (`maxnumrep`)
+) ENGINE=MyISAM ROW_FORMAT=FIXED;
+INSERT INTO t1 (numeropost,maxnumrep) VALUES (1,0),(2,1);
+select numeropost as a FROM t1 GROUP BY (SELECT 1 FROM t1 HAVING a=1);
+ERROR 21000: Subquery returns more than 1 row
+select numeropost as a FROM t1 ORDER BY (SELECT 1 FROM t1 HAVING a=1);
+ERROR 21000: Subquery returns more than 1 row
+drop table t1;
+create table t1 (a int);
+insert into t1 values (1),(2),(3);
+(select * from t1) union (select * from t1) order by (select a from t1 limit 1);
+a
+1
+2
+3
+drop table t1;
+CREATE TABLE t1 (field char(1) NOT NULL DEFAULT 'b');
+INSERT INTO t1 VALUES ();
+SELECT field FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1 FROM (SELECT 1) a HAVING field='b');
+ERROR 21000: Subquery returns more than 1 row
+drop table t1;
+CREATE TABLE `t1` (
+`numeropost` mediumint(8) unsigned NOT NULL default '0',
+`numreponse` int(10) unsigned NOT NULL auto_increment,
+`pseudo` varchar(35) NOT NULL default '',
+PRIMARY KEY (`numeropost`,`numreponse`),
+UNIQUE KEY `numreponse` (`numreponse`),
+KEY `pseudo` (`pseudo`,`numeropost`)
+) ENGINE=MyISAM;
+SELECT (SELECT numeropost FROM t1 HAVING numreponse=a),numreponse FROM (SELECT * FROM t1) as a;
+ERROR 42S22: Reference 'numreponse' not supported (forward reference in item list)
+SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=a) FROM (SELECT * FROM t1) as a;
+ERROR 42S22: Unknown column 'a' in 'having clause'
+SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT * FROM t1) as a;
+numreponse (SELECT numeropost FROM t1 HAVING numreponse=1)
+INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
+EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
+ERROR 21000: Subquery returns more than 1 row
+EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+Warnings:
+Note 1003 select max(test.t1.numreponse) AS `MAX(numreponse)` from test.t1 where (test.t1.numeropost = _latin1'1')
+EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 Using index
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+Warnings:
+Note 1003 select test.t1.numreponse AS `numreponse` from test.t1 where ((test.t1.numeropost = _latin1'1') and (test.t1.numreponse = 3))
+drop table t1;
+CREATE TABLE t1 (a int(1));
+INSERT INTO t1 VALUES (1);
+SELECT 1 FROM (SELECT a FROM t1) b HAVING (SELECT b.a)=1;
+1
+1
+drop table t1;
+create table t1 (a int NOT NULL, b int, primary key (a));
+create table t2 (a int NOT NULL, b int, primary key (a));
+insert into t1 values (0, 10),(1, 11),(2, 12);
+insert into t2 values (1, 21),(2, 22),(3, 23);
+select * from t1;
+a b
+0 10
+1 11
+2 12
+update t1 set b= (select b from t1);
+ERROR HY000: You can't specify target table 't1' for update in FROM clause
+update t1 set b= (select b from t2);
+ERROR 21000: Subquery returns more than 1 row
+update t1 set b= (select b from t2 where t1.a = t2.a);
+select * from t1;
+a b
+0 NULL
+1 21
+2 22
+drop table t1, t2;
+create table t1 (a int NOT NULL, b int, primary key (a));
+create table t2 (a int NOT NULL, b int, primary key (a));
+insert into t1 values (0, 10),(1, 11),(2, 12);
+insert into t2 values (1, 21),(2, 12),(3, 23);
+select * from t1;
+a b
+0 10
+1 11
+2 12
+select * from t1 where b = (select b from t2 where t1.a = t2.a);
+a b
+2 12
+delete from t1 where b = (select b from t1);
+ERROR HY000: You can't specify target table 't1' for update in FROM clause
+delete from t1 where b = (select b from t2);
+ERROR 21000: Subquery returns more than 1 row
+delete from t1 where b = (select b from t2 where t1.a = t2.a);
+select * from t1;
+a b
+0 10
+1 11
+drop table t1, t2;
+create table t11 (a int NOT NULL, b int, primary key (a));
+create table t12 (a int NOT NULL, b int, primary key (a));
+create table t2 (a int NOT NULL, b int, primary key (a));
+insert into t11 values (0, 10),(1, 11),(2, 12);
+insert into t12 values (33, 10),(22, 11),(2, 12);
+insert into t2 values (1, 21),(2, 12),(3, 23);
+select * from t11;
+a b
+0 10
+1 11
+2 12
+select * from t12;
+a b
+33 10
+22 11
+2 12
+delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
+ERROR HY000: You can't specify target table 't12' for update in FROM clause
+delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
+ERROR 21000: Subquery returns more than 1 row
+delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
+select * from t11;
+a b
+0 10
+1 11
+select * from t12;
+a b
+33 10
+22 11
+drop table t11, t12, t2;
+CREATE TABLE t1 (x int);
+create table t2 (a int);
+create table t3 (b int);
+insert into t2 values (1);
+insert into t3 values (1),(2);
+INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
+ERROR HY000: You can't specify target table 't1' for update in FROM clause
+INSERT INTO t1 (x) VALUES ((SELECT b FROM t3));
+ERROR 21000: Subquery returns more than 1 row
+INSERT INTO t1 (x) VALUES ((SELECT a FROM t2));
+select * from t1;
+x
+1
+insert into t2 values (1);
+INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
+select * from t1;
+x
+1
+2
+INSERT INTO t1 (x) select (SELECT SUM(a)+1 FROM t2) FROM t2;
+select * from t1;
+x
+1
+2
+3
+3
+INSERT INTO t1 (x) select (SELECT SUM(x)+2 FROM t1) FROM t2;
+INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(x) FROM t2));
+ERROR 42S22: Unknown column 'x' in 'field list'
+INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
+select * from t1;
+x
+1
+2
+3
+3
+11
+11
+2
+drop table t1, t2, t3;
+CREATE TABLE t1 (x int not null, y int, primary key (x));
+create table t2 (a int);
+create table t3 (a int);
+insert into t2 values (1);
+insert into t3 values (1),(2);
+select * from t1;
+x y
+replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2));
+ERROR HY000: You can't specify target table 't1' for update in FROM clause
+replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2));
+ERROR 21000: Subquery returns more than 1 row
+replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2));
+select * from t1;
+x y
+1 2
+replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+2 FROM t2));
+select * from t1;
+x y
+1 3
+replace DELAYED into t1 (x, y) VALUES ((SELECT a+3 FROM t2), (SELECT a FROM t2));
+select * from t1;
+x y
+1 3
+4 1
+replace DELAYED into t1 (x, y) VALUES ((SELECT a+3 FROM t2), (SELECT a+1 FROM t2));
+select * from t1;
+x y
+1 3
+4 2
+replace LOW_PRIORITY into t1 (x, y) VALUES ((SELECT a+1 FROM t2), (SELECT a FROM t2));
+select * from t1;
+x y
+1 3
+4 2
+2 1
+drop table t1, t2, t3;
+SELECT * FROM (SELECT 1) b WHERE 1 IN (SELECT *);
+ERROR HY000: No tables used
+CREATE TABLE t2 (id int(11) default NULL, KEY id (id)) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t2 VALUES (1),(2);
+SELECT * FROM t2 WHERE id IN (SELECT 1);
+id
+1
+EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ref id id 5 const 1 Using where; Using index
+Warnings:
+Note 1249 Select 2 was reduced during optimization
+Note 1003 select test.t2.id AS `id` from test.t2 where (test.t2.id = 1)
+SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
+id
+1
+SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1));
+id
+2
+EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ref id id 5 const 1 Using where; Using index
+Warnings:
+Note 1249 Select 3 was reduced during optimization
+Note 1249 Select 2 was reduced during optimization
+Note 1003 select test.t2.id AS `id` from test.t2 where (test.t2.id = (1 + 1))
+EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 index NULL id 5 NULL 2 Using where; Using index
+2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
+3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 select test.t2.id AS `id` from test.t2 where <in_optimizer>(test.t2.id,<exists>(select 1 AS `Not_used` having (<cache>(test.t2.id) = <null_helper>(1)) union select 1 AS `Not_used` having (<cache>(test.t2.id) = <null_helper>(3))))
+SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3);
+id
+SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
+id
+2
+INSERT INTO t2 VALUES ((SELECT * FROM t2));
+ERROR HY000: You can't specify target table 't2' for update in FROM clause
+INSERT INTO t2 VALUES ((SELECT id FROM t2));
+ERROR HY000: You can't specify target table 't2' for update in FROM clause
+SELECT * FROM t2;
+id
+1
+2
+CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t1 values (1),(1);
+UPDATE t2 SET id=(SELECT * FROM t1);
+ERROR 21000: Subquery returns more than 1 row
+drop table t2, t1;
+create table t1 (a int);
+insert into t1 values (1),(2),(3);
+select 1 IN (SELECT * from t1);
+1 IN (SELECT * from t1)
+1
+select 10 IN (SELECT * from t1);
+10 IN (SELECT * from t1)
+0
+select NULL IN (SELECT * from t1);
+NULL IN (SELECT * from t1)
+NULL
+update t1 set a=NULL where a=2;
+select 1 IN (SELECT * from t1);
+1 IN (SELECT * from t1)
+1
+select 3 IN (SELECT * from t1);
+3 IN (SELECT * from t1)
+1
+select 10 IN (SELECT * from t1);
+10 IN (SELECT * from t1)
+NULL
+select 1 > ALL (SELECT * from t1);
+1 > ALL (SELECT * from t1)
+0
+select 10 > ALL (SELECT * from t1);
+10 > ALL (SELECT * from t1)
+NULL
+select 1 > ANY (SELECT * from t1);
+1 > ANY (SELECT * from t1)
+NULL
+select 10 > ANY (SELECT * from t1);
+10 > ANY (SELECT * from t1)
+1
+drop table t1;
+create table t1 (a varchar(20));
+insert into t1 values ('A'),('BC'),('DEF');
+select 'A' IN (SELECT * from t1);
+'A' IN (SELECT * from t1)
+1
+select 'XYZS' IN (SELECT * from t1);
+'XYZS' IN (SELECT * from t1)
+0
+select NULL IN (SELECT * from t1);
+NULL IN (SELECT * from t1)
+NULL
+update t1 set a=NULL where a='BC';
+select 'A' IN (SELECT * from t1);
+'A' IN (SELECT * from t1)
+1
+select 'DEF' IN (SELECT * from t1);
+'DEF' IN (SELECT * from t1)
+1
+select 'XYZS' IN (SELECT * from t1);
+'XYZS' IN (SELECT * from t1)
+NULL
+select 'A' > ALL (SELECT * from t1);
+'A' > ALL (SELECT * from t1)
+0
+select 'XYZS' > ALL (SELECT * from t1);
+'XYZS' > ALL (SELECT * from t1)
+NULL
+select 'A' > ANY (SELECT * from t1);
+'A' > ANY (SELECT * from t1)
+NULL
+select 'XYZS' > ANY (SELECT * from t1);
+'XYZS' > ANY (SELECT * from t1)
+1
+drop table t1;
+create table t1 (a float);
+insert into t1 values (1.5),(2.5),(3.5);
+select 1.5 IN (SELECT * from t1);
+1.5 IN (SELECT * from t1)
+1
+select 10.5 IN (SELECT * from t1);
+10.5 IN (SELECT * from t1)
+0
+select NULL IN (SELECT * from t1);
+NULL IN (SELECT * from t1)
+NULL
+update t1 set a=NULL where a=2.5;
+select 1.5 IN (SELECT * from t1);
+1.5 IN (SELECT * from t1)
+1
+select 3.5 IN (SELECT * from t1);
+3.5 IN (SELECT * from t1)
+1
+select 10.5 IN (SELECT * from t1);
+10.5 IN (SELECT * from t1)
+NULL
+select 1.5 > ALL (SELECT * from t1);
+1.5 > ALL (SELECT * from t1)
+0
+select 10.5 > ALL (SELECT * from t1);
+10.5 > ALL (SELECT * from t1)
+NULL
+select 1.5 > ANY (SELECT * from t1);
+1.5 > ANY (SELECT * from t1)
+NULL
+select 10.5 > ANY (SELECT * from t1);
+10.5 > ANY (SELECT * from t1)
+1
+explain extended select (select a+1) from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 3
+Warnings:
+Note 1276 Field or reference 'a' of SELECT #2 was resolved in SELECT #1
+Note 1249 Select 2 was reduced during optimization
+Note 1003 select (test.t1.a + 1) AS `(select a+1)` from test.t1
+select (select a+1) from t1;
+(select a+1)
+2.5
+NULL
+4.5
+drop table t1;
+CREATE TABLE t1 (a int(11) NOT NULL default '0', PRIMARY KEY (a));
+CREATE TABLE t2 (a int(11) default '0', INDEX (a));
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+INSERT INTO t2 VALUES (1),(2),(3);
+SELECT t1.a, t1.a in (select t2.a from t2) FROM t1;
+a t1.a in (select t2.a from t2)
+1 1
+2 1
+3 1
+4 0
+explain extended SELECT t1.a, t1.a in (select t2.a from t2) FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 Using index
+2 DEPENDENT SUBQUERY t2 index_subquery a a 5 func 2 Using index
+Warnings:
+Note 1003 select test.t1.a AS `a`,<in_optimizer>(test.t1.a,<exists>(<index_lookup>(<cache>(test.t1.a) in t2 on a chicking NULL))) AS `t1.a in (select t2.a from t2)` from test.t1
+CREATE TABLE t3 (a int(11) default '0');
+INSERT INTO t3 VALUES (1),(2),(3);
+SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1;
+a t1.a in (select t2.a from t2,t3 where t3.a=t2.a)
+1 1
+2 1
+3 1
+4 0
+explain extended SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 Using index
+2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 Using where; Using index
+2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 Using where
+Warnings:
+Note 1003 select test.t1.a AS `a`,<in_optimizer>(test.t1.a,<exists>(select 1 AS `Not_used` from test.t2 join test.t3 where ((test.t3.a = test.t2.a) and ((<cache>(test.t1.a) = test.t2.a) or isnull(test.t2.a))) having <is_not_null_test>(test.t2.a))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from test.t1
+drop table t1,t2,t3;
+create table t1 (a float);
+select 10.5 IN (SELECT * from t1 LIMIT 1);
+ERROR 42000: This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
+select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5);
+ERROR 42000: This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
+drop table t1;
+create table t1 (a int, b int, c varchar(10));
+create table t2 (a int);
+insert into t1 values (1,2,'a'),(2,3,'b'),(3,4,'c');
+insert into t2 values (1),(2),(NULL);
+select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a'),(select c from t1 where a=t2.a) from t2;
+a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a') (select c from t1 where a=t2.a)
+1 1 a
+2 0 b
+NULL NULL NULL
+select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2;
+a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b') (select c from t1 where a=t2.a)
+1 0 a
+2 1 b
+NULL NULL NULL
+select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c'),(select c from t1 where a=t2.a) from t2;
+a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c') (select c from t1 where a=t2.a)
+1 0 a
+2 0 b
+NULL NULL NULL
+drop table t1,t2;
+create table t1 (a int, b real, c varchar(10));
+insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b');
+select ROW(1, 1, 'a') IN (select a,b,c from t1);
+ROW(1, 1, 'a') IN (select a,b,c from t1)
+1
+select ROW(1, 2, 'a') IN (select a,b,c from t1);
+ROW(1, 2, 'a') IN (select a,b,c from t1)
+NULL
+select ROW(1, 1, 'a') IN (select b,a,c from t1);
+ROW(1, 1, 'a') IN (select b,a,c from t1)
+1
+select ROW(1, 1, 'a') IN (select a,b,c from t1 where a is not null);
+ROW(1, 1, 'a') IN (select a,b,c from t1 where a is not null)
+1
+select ROW(1, 2, 'a') IN (select a,b,c from t1 where a is not null);
+ROW(1, 2, 'a') IN (select a,b,c from t1 where a is not null)
+0
+select ROW(1, 1, 'a') IN (select b,a,c from t1 where a is not null);
+ROW(1, 1, 'a') IN (select b,a,c from t1 where a is not null)
+1
+select ROW(1, 1, 'a') IN (select a,b,c from t1 where c='b' or c='a');
+ROW(1, 1, 'a') IN (select a,b,c from t1 where c='b' or c='a')
+1
+select ROW(1, 2, 'a') IN (select a,b,c from t1 where c='b' or c='a');
+ROW(1, 2, 'a') IN (select a,b,c from t1 where c='b' or c='a')
+NULL
+select ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a');
+ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a')
+1
+select ROW(1, 1, 'a') IN (select b,a,c from t1 limit 2);
+ERROR 42000: This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
+drop table t1;
+create table t1 (a int);
+insert into t1 values (1);
+do @a:=(SELECT a from t1);
+select @a;
+@a
+1
+set @a:=2;
+set @a:=(SELECT a from t1);
+select @a;
+@a
+1
+drop table t1;
+do (SELECT a from t1);
+ERROR 42S02: Table 'test.t1' doesn't exist
+set @a:=(SELECT a from t1);
+ERROR 42S02: Table 'test.t1' doesn't exist
+CREATE TABLE t1 (a int, KEY(a));
+HANDLER t1 OPEN;
+HANDLER t1 READ a=((SELECT 1));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT 1))' at line 1
+HANDLER t1 CLOSE;
+drop table t1;
+create table t1 (a int);
+create table t2 (b int);
+insert into t1 values (1),(2);
+insert into t2 values (1);
+select a from t1 where a in (select a from t1 where a in (select b from t2));
+a
+1
+drop table t1, t2;
+create table t1 (a int, b int);
+create table t2 like t1;
+insert into t1 values (1,2),(1,3),(1,4),(1,5);
+insert into t2 values (1,2),(1,3);
+select * from t1 where row(a,b) in (select a,b from t2);
+a b
+1 2
+1 3
+drop table t1, t2;
+CREATE TABLE `t1` (`i` int(11) NOT NULL default '0',PRIMARY KEY (`i`)) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t1 VALUES (1);
+UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
+select * from t1;
+i
+1
+drop table t1;
+CREATE TABLE t1 (a int(1));
+EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 const row not found
+Warnings:
+Note 1003 select sql_no_cache (select sql_no_cache rand() AS `RAND()` from test.t1) AS `(SELECT RAND() FROM t1)` from test.t1
+EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 const row not found
+Warnings:
+Note 1003 select sql_no_cache (select sql_no_cache ecrypt(_latin1'test') AS `ENCRYPT('test')` from test.t1) AS `(SELECT ENCRYPT('test') FROM t1)` from test.t1
+EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 const row not found
+Warnings:
+Note 1003 select sql_no_cache (select sql_no_cache benchmark(1,1) AS `BENCHMARK(1,1)` from test.t1) AS `(SELECT BENCHMARK(1,1) FROM t1)` from test.t1
+drop table t1;
+CREATE TABLE `t1` (
+`mot` varchar(30) character set latin1 NOT NULL default '',
+`topic` mediumint(8) unsigned NOT NULL default '0',
+`date` date NOT NULL default '0000-00-00',
+`pseudo` varchar(35) character set latin1 NOT NULL default '',
+PRIMARY KEY (`mot`,`pseudo`,`date`,`topic`),
+KEY `pseudo` (`pseudo`,`date`,`topic`),
+KEY `topic` (`topic`)
+) ENGINE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC;
+CREATE TABLE `t2` (
+`mot` varchar(30) character set latin1 NOT NULL default '',
+`topic` mediumint(8) unsigned NOT NULL default '0',
+`date` date NOT NULL default '0000-00-00',
+`pseudo` varchar(35) character set latin1 NOT NULL default '',
+PRIMARY KEY (`mot`,`pseudo`,`date`,`topic`),
+KEY `pseudo` (`pseudo`,`date`,`topic`),
+KEY `topic` (`topic`)
+) ENGINE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC;
+CREATE TABLE `t3` (
+`numeropost` mediumint(8) unsigned NOT NULL auto_increment,
+`maxnumrep` int(10) unsigned NOT NULL default '0',
+PRIMARY KEY (`numeropost`),
+UNIQUE KEY `maxnumrep` (`maxnumrep`)
+) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t1 VALUES ('joce','1','','joce'),('test','2','','test');
+Warnings:
+Warning 1265 Data truncated for column 'date' at row 1
+Warning 1265 Data truncated for column 'date' at row 2
+INSERT INTO t2 VALUES ('joce','1','','joce'),('test','2','','test');
+Warnings:
+Warning 1265 Data truncated for column 'date' at row 1
+Warning 1265 Data truncated for column 'date' at row 2
+INSERT INTO t3 VALUES (1,1);
+SELECT DISTINCT topic FROM t2 WHERE NOT EXISTS(SELECT * FROM t3 WHERE
+numeropost=topic);
+topic
+2
+select * from t1;
+mot topic date pseudo
+joce 1 0000-00-00 joce
+test 2 0000-00-00 test
+DELETE FROM t1 WHERE topic IN (SELECT DISTINCT topic FROM t2 WHERE NOT
+EXISTS(SELECT * FROM t3 WHERE numeropost=topic));
+select * from t1;
+mot topic date pseudo
+joce 1 0000-00-00 joce
+drop table t1, t2, t3;
+SELECT * FROM (SELECT 1 as a,(SELECT a)) a;
+a (SELECT a)
+1 1
+CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT 1)) a;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) NOT NULL default '0',
+ `(SELECT 1)` bigint(20) NOT NULL default '0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a)) a;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) NOT NULL default '0',
+ `(SELECT a)` bigint(20) NOT NULL default '0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) NOT NULL default '0',
+ `(SELECT a+0)` bigint(20) NOT NULL default '0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a;
+select * from t1;
+a
+2
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) NOT NULL default '0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (a int);
+insert into t1 values (1), (2), (3);
+explain extended select a,(select (select rand() from t1 limit 1) from t1 limit 1)
+from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 3
+2 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3
+3 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3
+Warnings:
+Note 1003 select sql_no_cache test.t1.a AS `a`,(select sql_no_cache (select sql_no_cache rand() AS `rand()` from test.t1 limit 1) AS `(select rand() from t1 limit 1)` from test.t1 limit 1) AS `(select (select rand() from t1 limit 1) from t1 limit 1)` from test.t1
+drop table t1;
+select t1.Continent, t2.Name, t2.Population from t1 LEFT JOIN t2 ON t1.Code = t2.Country where t2.Population IN (select max(t2.Population) AS Population from t2, t1 where t2.Country = t1.Code group by Continent);
+ERROR 42S02: Table 'test.t1' doesn't exist
+CREATE TABLE t1 (
+ID int(11) NOT NULL auto_increment,
+name char(35) NOT NULL default '',
+t2 char(3) NOT NULL default '',
+District char(20) NOT NULL default '',
+Population int(11) NOT NULL default '0',
+PRIMARY KEY (ID)
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (130,'Sydney','AUS','New South Wales',3276207);
+INSERT INTO t1 VALUES (131,'Melbourne','AUS','Victoria',2865329);
+INSERT INTO t1 VALUES (132,'Brisbane','AUS','Queensland',1291117);
+CREATE TABLE t2 (
+Code char(3) NOT NULL default '',
+Name char(52) NOT NULL default '',
+Continent enum('Asia','Europe','North America','Africa','Oceania','Antarctica','South America') NOT NULL default 'Asia',
+Region char(26) NOT NULL default '',
+SurfaceArea float(10,2) NOT NULL default '0.00',
+IndepYear smallint(6) default NULL,
+Population int(11) NOT NULL default '0',
+LifeExpectancy float(3,1) default NULL,
+GNP float(10,2) default NULL,
+GNPOld float(10,2) default NULL,
+LocalName char(45) NOT NULL default '',
+GovernmentForm char(45) NOT NULL default '',
+HeadOfState char(60) default NULL,
+Capital int(11) default NULL,
+Code2 char(2) NOT NULL default '',
+PRIMARY KEY (Code)
+) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('AUS','Australia','Oceania','Australia and New Zealand',7741220.00,1901,18886000,79.8,351182.00,392911.00,'Australia','Constitutional Monarchy, Federation','Elisabeth II',135,'AU');
+INSERT INTO t2 VALUES ('AZE','Azerbaijan','Asia','Middle East',86600.00,1991,7734000,62.9,4127.00,4100.00,'Azärbaycan','Federal Republic','Heydär Äliyev',144,'AZ');
+select t2.Continent, t1.Name, t1.Population from t2 LEFT JOIN t1 ON t2.Code = t1.t2 where t1.Population IN (select max(t1.Population) AS Population from t1, t2 where t1.t2 = t2.Code group by Continent);
+Continent Name Population
+Oceania Sydney 3276207
+drop table t1, t2;
+CREATE TABLE `t1` (
+`id` mediumint(8) unsigned NOT NULL auto_increment,
+`pseudo` varchar(35) character set latin1 NOT NULL default '',
+PRIMARY KEY (`id`),
+UNIQUE KEY `pseudo` (`pseudo`)
+) ENGINE=MyISAM PACK_KEYS=1 ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 (pseudo) VALUES ('test');
+SELECT 0 IN (SELECT 1 FROM t1 a);
+0 IN (SELECT 1 FROM t1 a)
+0
+EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
+2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+Warnings:
+Note 1003 select <in_optimizer>(0,<exists>(select 1 AS `Not_used` from test.t1 a)) AS `0 IN (SELECT 1 FROM t1 a)`
+INSERT INTO t1 (pseudo) VALUES ('test1');
+SELECT 0 IN (SELECT 1 FROM t1 a);
+0 IN (SELECT 1 FROM t1 a)
+0
+EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
+2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+Warnings:
+Note 1003 select <in_optimizer>(0,<exists>(select 1 AS `Not_used` from test.t1 a)) AS `0 IN (SELECT 1 FROM t1 a)`
+drop table t1;
+CREATE TABLE `t1` (
+`i` int(11) NOT NULL default '0',
+PRIMARY KEY (`i`)
+) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t1 VALUES (1);
+UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i));
+UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
+UPDATE t1 SET t.i=i+(SELECT MAX(i) FROM (SELECT 1) t);
+ERROR 42S02: Unknown table 't' in field list
+select * from t1;
+i
+1
+drop table t1;
+CREATE TABLE t1 (
+id int(11) default NULL
+) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t1 VALUES (1),(1),(2),(2),(1),(3);
+CREATE TABLE t2 (
+id int(11) default NULL,
+name varchar(15) default NULL
+) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t2 VALUES (4,'vita'), (1,'vita'), (2,'vita'), (1,'vita');
+update t1, t2 set t2.name='lenka' where t2.id in (select id from t1);
+select * from t2;
+id name
+4 vita
+1 lenka
+2 lenka
+1 lenka
+drop table t1,t2;
+create table t1 (a int, unique index indexa (a));
+insert into t1 values (-1), (-4), (-2), (NULL);
+select -10 IN (select a from t1 FORCE INDEX (indexa));
+-10 IN (select a from t1 FORCE INDEX (indexa))
+NULL
+drop table t1;
+create table t1 (id int not null auto_increment primary key, salary int, key(salary));
+insert into t1 (salary) values (100),(1000),(10000),(10),(500),(5000),(50000);
+explain extended SELECT id FROM t1 where salary = (SELECT MAX(salary) FROM t1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ref salary salary 5 const 1 Using where
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+Warnings:
+Note 1003 select test.t1.id AS `id` from test.t1 where (test.t1.salary = (select max(test.t1.salary) AS `MAX(salary)` from test.t1))
+drop table t1;
+CREATE TABLE t1 (
+ID int(10) unsigned NOT NULL auto_increment,
+SUB_ID int(3) unsigned NOT NULL default '0',
+REF_ID int(10) unsigned default NULL,
+REF_SUB int(3) unsigned default '0',
+PRIMARY KEY (ID,SUB_ID),
+UNIQUE KEY t1_PK (ID,SUB_ID),
+KEY t1_FK (REF_ID,REF_SUB),
+KEY t1_REFID (REF_ID)
+) ENGINE=MyISAM CHARSET=cp1251;
+INSERT INTO t1 VALUES (1,0,NULL,NULL),(2,0,NULL,NULL);
+SELECT DISTINCT REF_ID FROM t1 WHERE ID= (SELECT DISTINCT REF_ID FROM t1 WHERE ID=2);
+REF_ID
+DROP TABLE t1;
+create table t1 (a int, b int);
+create table t2 (a int, b int);
+insert into t1 values (1,0), (2,0), (3,0);
+insert into t2 values (1,1), (2,1), (3,1), (2,2);
+update ignore t1 set b=(select b from t2 where t1.a=t2.a);
+Warnings:
+Error 1242 Subquery returns more than 1 row
+select * from t1;
+a b
+1 1
+2 NULL
+3 1
+drop table t1, t2;
+CREATE TABLE `t1` (
+`id` mediumint(8) unsigned NOT NULL auto_increment,
+`pseudo` varchar(35) NOT NULL default '',
+`email` varchar(60) NOT NULL default '',
+PRIMARY KEY (`id`),
+UNIQUE KEY `email` (`email`),
+UNIQUE KEY `pseudo` (`pseudo`)
+) ENGINE=MyISAM CHARSET=latin1 PACK_KEYS=1 ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 (id,pseudo,email) VALUES (1,'test','test'),(2,'test1','test1');
+SELECT pseudo as a, pseudo as b FROM t1 GROUP BY (SELECT a) ORDER BY (SELECT id*1);
+a b
+test test
+test1 test1
+drop table if exists t1;
+(SELECT 1 as a) UNION (SELECT 1) ORDER BY (SELECT a+0);
+a
+1
+create table t1 (a int not null, b int, primary key (a));
+create table t2 (a int not null, primary key (a));
+create table t3 (a int not null, b int, primary key (a));
+insert into t1 values (1,10), (2,20), (3,30), (4,40);
+insert into t2 values (2), (3), (4), (5);
+insert into t3 values (10,3), (20,4), (30,5);
+select * from t2 where t2.a in (select a from t1);
+a
+2
+3
+4
+explain extended select * from t2 where t2.a in (select a from t1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 Using where; Using index
+2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 Using index
+Warnings:
+Note 1003 select test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(<primary_index_lookup>(<cache>(test.t2.a) in t1 on PRIMARY)))
+select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
+a
+2
+4
+explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 Using where; Using index
+2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 Using index; Using where
+Warnings:
+Note 1003 select test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(<primary_index_lookup>(<cache>(test.t2.a) in t1 on PRIMARY where (test.t1.b <> 30))))
+select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
+a
+2
+3
+explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 Using where; Using index
+2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 func 1 Using where
+2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 Using where; Using index
+Warnings:
+Note 1003 select test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(select 1 AS `Not_used` from test.t1 join test.t3 where ((test.t1.b = test.t3.a) and (<cache>(test.t2.a) = test.t1.a))))
+drop table t1, t2, t3;
+create table t1 (a int, b int, index a (a,b));
+create table t2 (a int, index a (a));
+create table t3 (a int, b int, index a (a));
+insert into t1 values (1,10), (2,20), (3,30), (4,40);
+insert into t2 values (2), (3), (4), (5);
+insert into t3 values (10,3), (20,4), (30,5);
+select * from t2 where t2.a in (select a from t1);
+a
+2
+3
+4
+explain extended select * from t2 where t2.a in (select a from t1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 index NULL a 5 NULL 4 Using where; Using index
+2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 Using index
+Warnings:
+Note 1003 select test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(<index_lookup>(<cache>(test.t2.a) in t1 on a)))
+select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
+a
+2
+4
+explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 index NULL a 5 NULL 4 Using where; Using index
+2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 Using index; Using where
+Warnings:
+Note 1003 select test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(<index_lookup>(<cache>(test.t2.a) in t1 on a where (test.t1.b <> 30))))
+select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
+a
+2
+3
+explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 index NULL a 5 NULL 4 Using where; Using index
+2 DEPENDENT SUBQUERY t1 ref a a 5 func 1001 Using where; Using index
+2 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 Using where; Using index
+Warnings:
+Note 1003 select test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(select 1 AS `Not_used` from test.t1 join test.t3 where ((test.t1.b = test.t3.a) and (<cache>(test.t2.a) = test.t1.a))))
+insert into t1 values (3,31);
+select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
+a
+2
+3
+4
+select * from t2 where t2.a in (select a from t1 where t1.b <> 30 and t1.b <> 31);
+a
+2
+4
+explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 index NULL a 5 NULL 4 Using where; Using index
+2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 Using index; Using where
+Warnings:
+Note 1003 select test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(<index_lookup>(<cache>(test.t2.a) in t1 on a where (test.t1.b <> 30))))
+drop table t1, t2, t3;
+create table t1 (a int, b int);
+create table t2 (a int, b int);
+create table t3 (a int, b int);
+insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10);
+insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1);
+insert into t3 values (3,3), (2,2), (1,1);
+select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3;
+a (select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1)
+3 1
+2 2
+1 2
+drop table t1,t2,t3;
+create table t1 (s1 int);
+create table t2 (s1 int);
+insert into t1 values (1);
+insert into t2 values (1);
+select * from t1 where exists (select s1 from t2 having max(t2.s1)=t1.s1);
+s1
+1
+drop table t1,t2;
+create table t1 (s1 int);
+create table t2 (s1 int);
+insert into t1 values (1);
+insert into t2 values (1);
+update t1 set s1 = s1 + 1 where 1 = (select x.s1 as A from t2 WHERE t2.s1 > t1.s1 order by A);
+ERROR 42S22: Unknown column 'x.s1' in 'field list'
+DROP TABLE t1, t2;
+CREATE TABLE t1 (s1 CHAR(5) COLLATE latin1_german1_ci,
+s2 CHAR(5) COLLATE latin1_swedish_ci);
+INSERT INTO t1 VALUES ('z','?');
+select * from t1 where s1 > (select max(s2) from t1);
+ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '>'
+select * from t1 where s1 > any (select max(s2) from t1);
+ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '>'
+drop table t1;
+create table t1(toid int,rd int);
+create table t2(userid int,pmnew int,pmtotal int);
+insert into t2 values(1,0,0),(2,0,0);
+insert into t1 values(1,0),(1,0),(1,0),(1,12),(1,15),(1,123),(1,12312),(1,12312),(1,123),(2,0),(2,0),(2,1),(2,2);
+select userid,pmtotal,pmnew, (select count(rd) from t1 where toid=t2.userid) calc_total, (select count(rd) from t1 where rd=0 and toid=t2.userid) calc_new from t2 where userid in (select distinct toid from t1);
+userid pmtotal pmnew calc_total calc_new
+1 0 0 9 3
+2 0 0 4 2
+drop table t1, t2;
+create table t1 (s1 char(5));
+select (select 'a','b' from t1 union select 'a','b' from t1) from t1;
+ERROR 21000: Operand should contain 1 column(s)
+insert into t1 values ('tttt');
+select * from t1 where ('a','b')=(select 'a','b' from t1 union select 'a','b' from t1);
+s1
+tttt
+explain extended (select * from t1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 1
+Warnings:
+Note 1003 (select test.t1.s1 AS `s1` from test.t1)
+(select * from t1);
+s1
+tttt
+drop table t1;
+create table t1 (s1 char(5), index s1(s1));
+create table t2 (s1 char(5), index s1(s1));
+insert into t1 values ('a1'),('a2'),('a3');
+insert into t2 values ('a1'),('a2');
+select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
+s1 s1 NOT IN (SELECT s1 FROM t2)
+a1 0
+a2 0
+a3 1
+select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
+s1 s1 = ANY (SELECT s1 FROM t2)
+a1 1
+a2 1
+a3 0
+select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
+s1 s1 <> ALL (SELECT s1 FROM t2)
+a1 0
+a2 0
+a3 1
+select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
+s1 s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')
+a1 0
+a2 1
+a3 1
+explain extended select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index NULL s1 6 NULL 3 Using index
+2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 Using index
+Warnings:
+Note 1003 select test.t1.s1 AS `s1`,not(<in_optimizer>(test.t1.s1,<exists>(<index_lookup>(<cache>(test.t1.s1) in t2 on s1 chicking NULL)))) AS `s1 NOT IN (SELECT s1 FROM t2)` from test.t1
+explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index NULL s1 6 NULL 3 Using index
+2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 Using index
+Warnings:
+Note 1003 select test.t1.s1 AS `s1`,<in_optimizer>(test.t1.s1,<exists>(<index_lookup>(<cache>(test.t1.s1) in t2 on s1 chicking NULL))) AS `s1 = ANY (SELECT s1 FROM t2)` from test.t1
+explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index NULL s1 6 NULL 3 Using index
+2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 Using index
+Warnings:
+Note 1003 select test.t1.s1 AS `s1`,not(<in_optimizer>(test.t1.s1,<exists>(<index_lookup>(<cache>(test.t1.s1) in t2 on s1 chicking NULL)))) AS `s1 <> ALL (SELECT s1 FROM t2)` from test.t1
+explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index NULL s1 6 NULL 3 Using index
+2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 1 Using index; Using where
+Warnings:
+Note 1003 select test.t1.s1 AS `s1`,not(<in_optimizer>(test.t1.s1,<exists>(<index_lookup>(<cache>(test.t1.s1) in t2 on s1 chicking NULL where (test.t2.s1 < _latin1'a2'))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from test.t1
+drop table t1,t2;
+create table t2 (a int, b int);
+create table t3 (a int);
+insert into t3 values (6),(7),(3);
+select * from t3 where a >= all (select b from t2);
+a
+6
+7
+3
+explain extended select * from t3 where a >= all (select b from t2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+Warnings:
+Note 1003 select test.t3.a AS `a` from test.t3 where <not>((test.t3.a < (select max(test.t2.b) from test.t2)))
+select * from t3 where a >= some (select b from t2);
+a
+explain extended select * from t3 where a >= some (select b from t2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+Warnings:
+Note 1003 select test.t3.a AS `a` from test.t3 where <nop>((test.t3.a >= (select min(test.t2.b) from test.t2)))
+select * from t3 where a >= all (select b from t2 group by 1);
+a
+6
+7
+3
+explain extended select * from t3 where a >= all (select b from t2 group by 1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+Warnings:
+Note 1003 select test.t3.a AS `a` from test.t3 where <not>((test.t3.a < <max>(select test.t2.b AS `b` from test.t2 group by test.t2.b)))
+select * from t3 where a >= some (select b from t2 group by 1);
+a
+explain extended select * from t3 where a >= some (select b from t2 group by 1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+Warnings:
+Note 1003 select test.t3.a AS `a` from test.t3 where <nop>((test.t3.a >= <min>(select test.t2.b AS `b` from test.t2 group by test.t2.b)))
+select * from t3 where NULL >= any (select b from t2);
+a
+explain extended select * from t3 where NULL >= any (select b from t2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+Warnings:
+Note 1003 select test.t3.a AS `a` from test.t3
+select * from t3 where NULL >= any (select b from t2 group by 1);
+a
+explain extended select * from t3 where NULL >= any (select b from t2 group by 1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+Warnings:
+Note 1003 select test.t3.a AS `a` from test.t3
+select * from t3 where NULL >= some (select b from t2);
+a
+explain extended select * from t3 where NULL >= some (select b from t2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+Warnings:
+Note 1003 select test.t3.a AS `a` from test.t3
+select * from t3 where NULL >= some (select b from t2 group by 1);
+a
+explain extended select * from t3 where NULL >= some (select b from t2 group by 1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+Warnings:
+Note 1003 select test.t3.a AS `a` from test.t3
+insert into t2 values (2,2), (2,1), (3,3), (3,1);
+select * from t3 where a > all (select max(b) from t2 group by a);
+a
+6
+7
+explain extended select * from t3 where a > all (select max(b) from t2 group by a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort
+Warnings:
+Note 1003 select test.t3.a AS `a` from test.t3 where <not>((test.t3.a <= <max>(select max(test.t2.b) AS `max(b)` from test.t2 group by test.t2.a)))
+drop table t2, t3;
+CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ;
+INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now());
+CREATE TABLE `t2` (`db_id` int(11) NOT NULL auto_increment,`name` varchar(200) NOT NULL default '',`primary_uid` smallint(6) NOT NULL default '0',`secondary_uid` smallint(6) NOT NULL default '0',PRIMARY KEY (`db_id`),UNIQUE KEY `name_2` (`name`),FULLTEXT KEY `name` (`name`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=2147483647;
+INSERT INTO `t2` (`db_id`, `name`, `primary_uid`, `secondary_uid`) VALUES (18, 'Not Set 1', 0, 0),(19, 'Valid', 1, 2),(20, 'Valid 2', 1, 2),(21, 'Should Not Return', 1, 2),(26, 'Not Set 2', 0, 0),(-1, 'ALL DB\'S', 0, 0);
+CREATE TABLE `t3` (`taskgenid` mediumint(9) NOT NULL auto_increment,`dbid` int(11) NOT NULL default '0',`taskid` int(11) NOT NULL default '0',`mon` tinyint(4) NOT NULL default '1',`tues` tinyint(4) NOT NULL default '1',`wed` tinyint(4) NOT NULL default '1',`thur` tinyint(4) NOT NULL default '1',`fri` tinyint(4) NOT NULL default '1',`sat` tinyint(4) NOT NULL default '0',`sun` tinyint(4) NOT NULL default '0',`how_often` smallint(6) NOT NULL default '1',`userid` smallint(6) NOT NULL default '0',`active` tinyint(4) NOT NULL default '1',PRIMARY KEY (`taskgenid`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=2 ;
+INSERT INTO `t3` (`taskgenid`, `dbid`, `taskid`, `mon`, `tues`,`wed`, `thur`, `fri`, `sat`, `sun`, `how_often`, `userid`, `active`) VALUES (1,-1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1);
+CREATE TABLE `t4` (`task_id` smallint(6) NOT NULL default '0',`description` varchar(200) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO `t4` (`task_id`, `description`) VALUES (1, 'Daily Check List'),(2, 'Weekly Status');
+select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid;
+dbid name (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01')
+-1 Valid 1
+-1 Valid 2 1
+-1 Should Not Return 0
+SELECT dbid, name FROM t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND ((date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01')) AND t4.task_id = taskid;
+dbid name
+-1 Valid
+-1 Valid 2
+drop table t1,t2,t3,t4;
+CREATE TABLE t1 (id int(11) default NULL) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t1 VALUES (1),(5);
+CREATE TABLE t2 (id int(11) default NULL) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t2 VALUES (2),(6);
+select * from t1 where (1,2,6) in (select * from t2);
+ERROR 21000: Operand should contain 3 column(s)
+DROP TABLE t1,t2;
+create table t1 (s1 int);
+insert into t1 values (1);
+insert into t1 values (2);
+set sort_buffer_size = (select s1 from t1);
+ERROR 21000: Subquery returns more than 1 row
+do (select * from t1);
+drop table t1;
+create table t1 (s1 char);
+insert into t1 values ('e');
+select * from t1 where 'f' > any (select s1 from t1);
+s1
+e
+select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1);
+s1
+e
+explain extended select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 1
+2 SUBQUERY t1 system NULL NULL NULL NULL 1
+3 UNION t1 system NULL NULL NULL NULL 1
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 select test.t1.s1 AS `s1` from test.t1
+drop table t1;
+CREATE TABLE t1 (number char(11) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t1 VALUES ('69294728265'),('18621828126'),('89356874041'),('95895001874');
+CREATE TABLE t2 (code char(5) NOT NULL default '',UNIQUE KEY code (code)) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t2 VALUES ('1'),('1226'),('1245'),('1862'),('18623'),('1874'),('1967'),('6');
+select c.number as phone,(select p.code from t2 p where c.number like concat(p.code, '%') order by length(p.code) desc limit 1) as code from t1 c;
+phone code
+69294728265 6
+18621828126 1862
+89356874041 NULL
+95895001874 NULL
+drop table t1, t2;
+create table t1 (s1 int);
+create table t2 (s1 int);
+select * from t1 where (select count(*) from t2 where t1.s2) = 1;
+ERROR 42S22: Unknown column 't1.s2' in 'where clause'
+select * from t1 where (select count(*) from t2 group by t1.s2) = 1;
+ERROR 42S22: Unknown column 't1.s2' in 'group statement'
+select count(*) from t2 group by t1.s2;
+ERROR 42S02: Unknown table 't1' in group statement
+drop table t1, t2;
+CREATE TABLE t1(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC VARCHAR(20) DEFAULT NULL,PRIMARY KEY (COLA, COLB));
+CREATE TABLE t2(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC CHAR(1) NOT NULL,PRIMARY KEY (COLA));
+INSERT INTO t1 VALUES (1,1,'1A3240'), (1,2,'4W2365');
+INSERT INTO t2 VALUES (100, 200, 'C');
+SELECT DISTINCT COLC FROM t1 WHERE COLA = (SELECT COLA FROM t2 WHERE COLB = 200 AND COLC ='C' LIMIT 1);
+COLC
+DROP TABLE t1, t2;
+CREATE TABLE t1 (a int(1));
+INSERT INTO t1 VALUES (1),(1),(1),(1),(1),(2),(3),(4),(5);
+SELECT DISTINCT (SELECT a) FROM t1 LIMIT 100;
+(SELECT a)
+1
+2
+3
+4
+5
+DROP TABLE t1;
+create table t1 (a int, b decimal(13, 3));
+insert into t1 values (1, 0.123);
+select a, (select max(b) from t1) into outfile "subselect.out.file.1" from t1;
+delete from t1;
+load data infile "subselect.out.file.1" into table t1;
+select * from t1;
+a b
+1 0.123
+drop table t1;
+CREATE TABLE `t1` (
+`id` int(11) NOT NULL auto_increment,
+`id_cns` tinyint(3) unsigned NOT NULL default '0',
+`tipo` enum('','UNO','DUE') NOT NULL default '',
+`anno_dep` smallint(4) unsigned zerofill NOT NULL default '0000',
+`particolare` mediumint(8) unsigned NOT NULL default '0',
+`generale` mediumint(8) unsigned NOT NULL default '0',
+`bis` tinyint(3) unsigned NOT NULL default '0',
+PRIMARY KEY (`id`),
+UNIQUE KEY `idx_cns_gen_anno` (`anno_dep`,`id_cns`,`generale`,`particolare`),
+UNIQUE KEY `idx_cns_par_anno` (`id_cns`,`anno_dep`,`tipo`,`particolare`,`bis`)
+);
+INSERT INTO `t1` VALUES (1,16,'UNO',1987,2048,9681,0),(2,50,'UNO',1987,1536,13987,0),(3,16,'UNO',1987,2432,14594,0),(4,16,'UNO',1987,1792,13422,0),(5,16,'UNO',1987,1025,10240,0),(6,16,'UNO',1987,1026,7089,0);
+CREATE TABLE `t2` (
+`id` tinyint(3) unsigned NOT NULL auto_increment,
+`max_anno_dep` smallint(6) unsigned NOT NULL default '0',
+PRIMARY KEY (`id`)
+);
+INSERT INTO `t2` VALUES (16,1987),(50,1990),(51,1990);
+SELECT cns.id, cns.max_anno_dep, cns.max_anno_dep = (SELECT s.anno_dep FROM t1 AS s WHERE s.id_cns = cns.id ORDER BY s.anno_dep DESC LIMIT 1) AS PIPPO FROM t2 AS cns;
+id max_anno_dep PIPPO
+16 1987 1
+50 1990 0
+51 1990 NULL
+DROP TABLE t1, t2;
+create table t1 (a int);
+insert into t1 values (1), (2), (3);
+SET SQL_SELECT_LIMIT=1;
+select sum(a) from (select * from t1) as a;
+sum(a)
+6
+select 2 in (select * from t1);
+2 in (select * from t1)
+1
+SET SQL_SELECT_LIMIT=default;
+drop table t1;
+CREATE TABLE t1 (a int, b int, INDEX (a));
+INSERT INTO t1 VALUES (1, 1), (1, 2), (1, 3);
+SELECT * FROM t1 WHERE a = (SELECT MAX(a) FROM t1 WHERE a = 1) ORDER BY b;
+a b
+1 1
+1 2
+1 3
+DROP TABLE t1;
+create table t1(val varchar(10));
+insert into t1 values ('aaa'), ('bbb'),('eee'),('mmm'),('ppp');
+select count(*) from t1 as w1 where w1.val in (select w2.val from t1 as w2 where w2.val like 'm%') and w1.val in (select w3.val from t1 as w3 where w3.val like 'e%');
+count(*)
+0
+drop table t1;
+create table t1 (id int not null, text varchar(20) not null default '', primary key (id));
+insert into t1 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text11'), (12, 'text12');
+select * from t1 where id not in (select id from t1 where id < 8);
+id text
+8 text8
+9 text9
+10 text10
+11 text11
+12 text12
+select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null);
+id text
+8 text8
+9 text9
+10 text10
+11 text11
+12 text12
+explain extended select * from t1 where id not in (select id from t1 where id < 8);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 12 Using where
+2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 Using index; Using where
+Warnings:
+Note 1003 select test.t1.id AS `id`,test.t1.text AS `text` from test.t1 where not(<in_optimizer>(test.t1.id,<exists>(<primary_index_lookup>(<cache>(test.t1.id) in t1 on PRIMARY where (test.t1.id < 8)))))
+explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY tt ALL NULL NULL NULL NULL 12 Using where
+2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 7 Using where; Using index
+Warnings:
+Note 1276 Field or reference 'tt.id' of SELECT #2 was resolved in SELECT #1
+Note 1003 select test.tt.id AS `id`,test.tt.text AS `text` from test.t1 tt where not(exists(select test.t1.id AS `id` from test.t1 where ((test.t1.id < 8) and ((test.t1.id = test.tt.id) or isnull(test.t1.id))) having (test.t1.id is not null)))
+insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
+create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
+insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
+select * from t1 a left join t2 b on (a.id=b.id or b.id is null) join t1 c on (if(isnull(b.id), 1000, b.id)=c.id);
+id text id text id text
+1 text1 1 text1 1 text1
+2 text2 2 text2 2 text2
+3 text3 3 text3 3 text3
+4 text4 4 text4 4 text4
+5 text5 5 text5 5 text5
+6 text6 6 text6 6 text6
+7 text7 7 text7 7 text7
+8 text8 8 text8 8 text8
+9 text9 9 text9 9 text9
+10 text10 10 text10 10 text10
+11 text11 11 text1 11 text11
+12 text12 12 text2 12 text12
+1000 text1000 NULL NULL 1000 text1000
+1001 text1001 NULL NULL 1000 text1000
+explain extended select * from t1 a left join t2 b on (a.id=b.id or b.id is null) join t1 c on (if(isnull(b.id), 1000, b.id)=c.id);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE a ALL NULL NULL NULL NULL 14
+1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2
+1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 Using where
+Warnings:
+Note 1003 select test.a.id AS `id`,test.a.text AS `text`,test.b.id AS `id`,test.b.text AS `text`,test.c.id AS `id`,test.c.text AS `text` from test.t1 a left join test.t2 b on(((test.a.id = test.b.id) or isnull(test.b.id))) join test.t1 c where (if(isnull(test.b.id),1000,test.b.id) = test.c.id)
+drop table t1,t2;
+create table t1 (a int);
+insert into t1 values (1);
+explain select benchmark(1000, (select a from t1 where a=sha(rand())));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 1
+drop table t1;
+create table t1(id int);
+create table t2(id int);
+create table t3(flag int);
+select (select * from t3 where id not null) from t1, t2;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'null) from t1, t2' at line 1
+drop table t1,t2,t3;
+CREATE TABLE t1 (id INT);
+CREATE TABLE t2 (id INT);
+INSERT INTO t1 VALUES (1), (2);
+INSERT INTO t2 VALUES (1);
+SELECT t1.id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id);
+id c
+1 1
+2 0
+SELECT t1.id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id) ORDER BY t1.id;
+id c
+1 1
+2 0
+DROP TABLE t1,t2;
+CREATE TABLE t1 ( a int, b int );
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+SELECT a FROM t1 WHERE a > ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+3
+SELECT a FROM t1 WHERE a < ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+SELECT a FROM t1 WHERE a = ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+SELECT a FROM t1 WHERE a >= ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+3
+SELECT a FROM t1 WHERE a > ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+3
+SELECT a FROM t1 WHERE a < ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+SELECT a FROM t1 WHERE a = ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+SELECT a FROM t1 WHERE a >= ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+3
+ALTER TABLE t1 ADD INDEX (a);
+SELECT a FROM t1 WHERE a > ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+3
+SELECT a FROM t1 WHERE a < ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+SELECT a FROM t1 WHERE a = ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+SELECT a FROM t1 WHERE a >= ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+3
+SELECT a FROM t1 WHERE a > ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+3
+SELECT a FROM t1 WHERE a < ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+SELECT a FROM t1 WHERE a = ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+SELECT a FROM t1 WHERE a >= ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+3
+DROP TABLE t1;
+create table t1 (a int, b int);
+insert into t1 values (1,2),(3,4);
+select * from t1 up where exists (select * from t1 where t1.a=up.a);
+a b
+1 2
+3 4
+explain extended select * from t1 up where exists (select * from t1 where t1.a=up.a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY up ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
+Warnings:
+Note 1276 Field or reference 'up.a' of SELECT #2 was resolved in SELECT #1
+Note 1003 select test.up.a AS `a`,test.up.b AS `b` from test.t1 up where exists(select 1 AS `Not_used` from test.t1 where (test.t1.a = test.up.a))
+drop table t1;
+CREATE TABLE t1 (t1_a int);
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 (t2_a int, t2_b int, PRIMARY KEY (t2_a, t2_b));
+INSERT INTO t2 VALUES (1, 1), (1, 2);
+SELECT * FROM t1, t2 table2 WHERE t1_a = 1 AND table2.t2_a = 1
+HAVING table2.t2_b = (SELECT MAX(t2_b) FROM t2 WHERE t2_a = table2.t2_a);
+t1_a t2_a t2_b
+1 1 2
+DROP TABLE t1, t2;
+CREATE TABLE t1 (id int(11) default NULL,name varchar(10) default NULL);
+INSERT INTO t1 VALUES (1,'Tim'),(2,'Rebecca'),(3,NULL);
+CREATE TABLE t2 (id int(11) default NULL, pet varchar(10) default NULL);
+INSERT INTO t2 VALUES (1,'Fido'),(2,'Spot'),(3,'Felix');
+SELECT a.*, b.* FROM (SELECT * FROM t1) AS a JOIN t2 as b on a.id=b.id;
+id name id pet
+1 Tim 1 Fido
+2 Rebecca 2 Spot
+3 NULL 3 Felix
+drop table t1,t2;
+CREATE TABLE t1 ( a int, b int );
+CREATE TABLE t2 ( c int, d int );
+INSERT INTO t1 VALUES (1,2), (2,3), (3,4);
+SELECT a AS abc, b FROM t1 WHERE b = (SELECT MIN(b) FROM t1 WHERE a=abc);
+abc b
+1 2
+2 3
+3 4
+INSERT INTO t2 SELECT a AS abc, b FROM t1 WHERE b = (SELECT MIN(b) FROM t1 WHERE a=abc);
+select * from t2;
+c d
+1 2
+2 3
+3 4
+CREATE TABLE t3 SELECT a AS abc, b FROM t1 WHERE b = (SELECT MIN(b) FROM t1 WHERE a=abc);
+select * from t3;
+abc b
+1 2
+2 3
+3 4
+prepare stmt1 from "INSERT INTO t2 SELECT a AS abc, b FROM t1 WHERE b = (SELECT MIN(b) FROM t1 WHERE a=abc);";
+execute stmt1;
+deallocate prepare stmt1;
+select * from t2;
+c d
+1 2
+2 3
+3 4
+1 2
+2 3
+3 4
+drop table t3;
+prepare stmt1 from "CREATE TABLE t3 SELECT a AS abc, b FROM t1 WHERE b = (SELECT MIN(b) FROM t1 WHERE a=abc);";
+execute stmt1;
+select * from t3;
+abc b
+1 2
+2 3
+3 4
+deallocate prepare stmt1;
+DROP TABLE t1, t2, t3;
+CREATE TABLE `t1` ( `a` int(11) default NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+insert into t1 values (1);
+CREATE TABLE `t2` ( `b` int(11) default NULL, `a` int(11) default NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+insert into t2 values (1,2);
+select t000.a, count(*) `C` FROM t1 t000 GROUP BY t000.a HAVING count(*) > ALL (SELECT count(*) FROM t2 t001 WHERE t001.a=1);
+a C
+1 1
+drop table t1,t2;
+create table t1 (a int not null auto_increment primary key, b varchar(40), fulltext(b));
+insert into t1 (b) values ('ball'),('ball games'), ('games'), ('foo'), ('foobar'), ('Serg'), ('Sergei'),('Georg'), ('Patrik'),('Hakan');
+create table t2 (a int);
+insert into t2 values (1),(3),(2),(7);
+select a,b from t1 where match(b) against ('Ball') > 0;
+a b
+1 ball
+2 ball games
+select a from t2 where a in (select a from t1 where match(b) against ('Ball') > 0);
+a
+1
+2
+drop table t1,t2;
+CREATE TABLE t1(`IZAVORGANG_ID` VARCHAR(11) CHARACTER SET latin1 COLLATE latin1_bin,`KUERZEL` VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_bin,`IZAANALYSEART_ID` VARCHAR(11) CHARACTER SET latin1 COLLATE latin1_bin,`IZAPMKZ_ID` VARCHAR(11) CHARACTER SET latin1 COLLATE latin1_bin);
+CREATE INDEX AK01IZAVORGANG ON t1(izaAnalyseart_id,Kuerzel);
+INSERT INTO t1(`IZAVORGANG_ID`,`KUERZEL`,`IZAANALYSEART_ID`,`IZAPMKZ_ID`)VALUES('D0000000001','601','D0000000001','I0000000001');
+INSERT INTO t1(`IZAVORGANG_ID`,`KUERZEL`,`IZAANALYSEART_ID`,`IZAPMKZ_ID`)VALUES('D0000000002','602','D0000000001','I0000000001');
+INSERT INTO t1(`IZAVORGANG_ID`,`KUERZEL`,`IZAANALYSEART_ID`,`IZAPMKZ_ID`)VALUES('D0000000003','603','D0000000001','I0000000001');
+INSERT INTO t1(`IZAVORGANG_ID`,`KUERZEL`,`IZAANALYSEART_ID`,`IZAPMKZ_ID`)VALUES('D0000000004','101','D0000000001','I0000000001');
+SELECT `IZAVORGANG_ID` FROM t1 WHERE `KUERZEL` IN(SELECT MIN(`KUERZEL`)`Feld1` FROM t1 WHERE `KUERZEL` LIKE'601%'And`IZAANALYSEART_ID`='D0000000001');
+IZAVORGANG_ID
+D0000000001
+drop table t1;
+CREATE TABLE `t1` ( `aid` int(11) NOT NULL default '0', `bid` int(11) NOT NULL default '0', PRIMARY KEY (`aid`,`bid`));
+CREATE TABLE `t2` ( `aid` int(11) NOT NULL default '0', `bid` int(11) NOT NULL default '0', PRIMARY KEY (`aid`,`bid`));
+insert into t1 values (1,1),(1,2),(2,1),(2,2);
+insert into t2 values (1,2),(2,2);
+select * from t1 where t1.aid not in (select aid from t2 where bid=t1.bid);
+aid bid
+1 1
+2 1
+alter table t2 drop primary key;
+alter table t2 add key KEY1 (aid, bid);
+select * from t1 where t1.aid not in (select aid from t2 where bid=t1.bid);
+aid bid
+1 1
+2 1
+alter table t2 drop key KEY1;
+alter table t2 add primary key (bid, aid);
+select * from t1 where t1.aid not in (select aid from t2 where bid=t1.bid);
+aid bid
+1 1
+2 1
+drop table t1,t2;
+CREATE TABLE t1 (howmanyvalues bigint, avalue int);
+INSERT INTO t1 VALUES (1, 1),(2, 1),(2, 2),(3, 1),(3, 2),(3, 3),(4, 1),(4, 2),(4, 3),(4, 4);
+SELECT howmanyvalues, count(*) from t1 group by howmanyvalues;
+howmanyvalues count(*)
+1 1
+2 2
+3 3
+4 4
+SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues = a.howmanyvalues) as mycount from t1 a group by a.howmanyvalues;
+howmanyvalues mycount
+1 1
+2 2
+3 3
+4 4
+CREATE INDEX t1_howmanyvalues_idx ON t1 (howmanyvalues);
+SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues+1 = a.howmanyvalues+1) as mycount from t1 a group by a.howmanyvalues;
+howmanyvalues mycount
+1 1
+2 2
+3 3
+4 4
+SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues = a.howmanyvalues) as mycount from t1 a group by a.howmanyvalues;
+howmanyvalues mycount
+1 1
+2 2
+3 3
+4 4
+SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues = a.avalue) as mycount from t1 a group by a.howmanyvalues;
+howmanyvalues mycount
+1 1
+2 1
+3 1
+4 1
+drop table t1;
+create table t1 (x int);
+select (select b.x from t1 as b where b.x=a.x) from t1 as a where a.x=2 group by a.x;
+(select b.x from t1 as b where b.x=a.x)
+drop table t1;
+CREATE TABLE `t1` ( `master` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `slave` int(10) unsigned NOT NULL default '0', `access` int(10) unsigned NOT NULL default '0', UNIQUE KEY `access_u` (`master`,`map`,`slave`));
+INSERT INTO `t1` VALUES (1,0,0,700),(1,1,1,400),(1,5,5,400),(1,12,12,400),(1,12,32,400),(4,12,32,400);
+CREATE TABLE `t2` ( `id` int(10) unsigned NOT NULL default '0', `pid` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `level` tinyint(4) unsigned NOT NULL default '0', `title` varchar(255) default NULL, PRIMARY KEY (`id`,`pid`,`map`), KEY `level` (`level`), KEY `id` (`id`,`map`)) ;
+INSERT INTO `t2` VALUES (6,5,12,7,'a'),(12,0,0,7,'a'),(12,1,0,7,'a'),(12,5,5,7,'a'),(12,5,12,7,'a');
+SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
+ERROR 42S22: Unknown column 'b.sc' in 'field list'
+SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
+ac
+700
+NULL
+drop tables t1,t2;
+create table t1 (a int not null, b int not null, c int, primary key (a,b));
+insert into t1 values (1,1,1), (2,2,2), (3,3,3);
+set @b:= 0;
+explain select sum(a) from t1 where b > @b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 8 NULL 3 Using where; Using index
+set @a:= (select sum(a) from t1 where b > @b);
+explain select a from t1 where c=2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
+do @a:= (select sum(a) from t1 where b > @b);
+explain select a from t1 where c=2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
+drop table t1;
+set @got_val= (SELECT 1 FROM (SELECT 'A' as my_col) as T1 ) ;
+create table t1 (a int, b int);
+create table t2 (a int, b int);
+insert into t1 values (1,1),(1,2),(1,3),(2,4),(2,5);
+insert into t2 values (1,3),(2,1);
+select distinct a,b, (select max(b) from t2 where t1.b=t2.a) from t1 order by t1.b;
+a b (select max(b) from t2 where t1.b=t2.a)
+1 1 3
+1 2 1
+1 3 NULL
+2 4 NULL
+2 5 NULL
+drop table t1, t2;
+create table t1 (id int);
+create table t2 (id int, body text, fulltext (body));
+insert into t1 values(1),(2),(3);
+insert into t2 values (1,'test'), (2,'mysql'), (3,'test'), (4,'test');
+select count(distinct id) from t1 where id in (select id from t2 where match(body) against ('mysql' in boolean mode));
+count(distinct id)
+1
+drop table t2,t1;
+create table t1 (s1 int,s2 int);
+insert into t1 values (20,15);
+select * from t1 where (('a',null) <=> (select 'a',s2 from t1 where s1 = 0));
+s1 s2
+drop table t1;
+create table t1 (s1 int);
+insert into t1 values (1),(null);
+select * from t1 where s1 < all (select s1 from t1);
+s1
+select s1, s1 < all (select s1 from t1) from t1;
+s1 s1 < all (select s1 from t1)
+1 0
+NULL NULL
+drop table t1;
+CREATE TABLE t1 (
+Code char(3) NOT NULL default '',
+Name char(52) NOT NULL default '',
+Continent enum('Asia','Europe','North America','Africa','Oceania','Antarctica','South America') NOT NULL default 'Asia',
+Region char(26) NOT NULL default '',
+SurfaceArea float(10,2) NOT NULL default '0.00',
+IndepYear smallint(6) default NULL,
+Population int(11) NOT NULL default '0',
+LifeExpectancy float(3,1) default NULL,
+GNP float(10,2) default NULL,
+GNPOld float(10,2) default NULL,
+LocalName char(45) NOT NULL default '',
+GovernmentForm char(45) NOT NULL default '',
+HeadOfState char(60) default NULL,
+Capital int(11) default NULL,
+Code2 char(2) NOT NULL default ''
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('XXX','Xxxxx','Oceania','Xxxxxx',26.00,0,0,0,0,0,'Xxxxx','Xxxxx','Xxxxx',NULL,'XX');
+INSERT INTO t1 VALUES ('ASM','American Samoa','Oceania','Polynesia',199.00,0,68000,75.1,334.00,NULL,'Amerika Samoa','US Territory','George W. Bush',54,'AS');
+INSERT INTO t1 VALUES ('ATF','French Southern territories','Antarctica','Antarctica',7780.00,0,0,NULL,0.00,NULL,'Terres australes françaises','Nonmetropolitan Territory of France','Jacques Chirac',NULL,'TF');
+INSERT INTO t1 VALUES ('UMI','United States Minor Outlying Islands','Oceania','Micronesia/Caribbean',16.00,0,0,NULL,0.00,NULL,'United States Minor Outlying Islands','Dependent Territory of the US','George W. Bush',NULL,'UM');
+/*!40000 ALTER TABLE t1 ENABLE KEYS */;
+SELECT DISTINCT Continent AS c FROM t1 WHERE Code <> SOME ( SELECT Code FROM t1 WHERE Continent = c AND Population < 200);
+c
+Oceania
+drop table t1;
diff --git a/mysql-test/r/subselect2.result b/mysql-test/r/subselect2.result
new file mode 100644
index 00000000000..b04fec26c6f
--- /dev/null
+++ b/mysql-test/r/subselect2.result
@@ -0,0 +1,131 @@
+drop table if exists t1, t2, t3, t4;
+CREATE TABLE t1
+(
+DOCID VARCHAR(32)BINARY NOT NULL
+, UUID VARCHAR(32)BINARY NOT NULL
+, MIMETYPE VARCHAR(80)BINARY
+, CONTENTDATA LONGBLOB
+, CONTENTSIZE INTEGER
+, VERSIONID INTEGER
+, REPID VARCHAR(32)BINARY
+, MODIFIED TIMESTAMP
+, MODIFIER VARCHAR(255)BINARY
+, ORIGINATOR INTEGER
+, PRIMARY KEY ( DOCID )
+) ENGINE=InnoDB
+;
+CREATE TABLE t2
+(
+DOCID VARCHAR(32)BINARY NOT NULL
+, DOCNAME VARCHAR(255)BINARY NOT NULL
+, DOCTYPEID VARCHAR(32)BINARY NOT NULL
+, FOLDERID VARCHAR(32)BINARY NOT NULL
+, AUTHOR VARCHAR(255)BINARY
+, CREATED TIMESTAMP NOT NULL
+, TITLE VARCHAR(255)BINARY
+, SUBTITLE VARCHAR(255)BINARY
+, DOCABSTRACT LONGBLOB
+, PUBLISHDATE TIMESTAMP
+, EXPIRATIONDATE TIMESTAMP
+, LOCKEDBY VARCHAR(80)BINARY
+, STATUS VARCHAR(80)BINARY
+, PARENTDOCID VARCHAR(32)BINARY
+, REPID VARCHAR(32)BINARY
+, MODIFIED TIMESTAMP NOT NULL
+, MODIFIER VARCHAR(255)BINARY NOT NULL
+, PUBLISHSTATUS INTEGER
+, ORIGINATOR INTEGER
+, PRIMARY KEY ( DOCID )
+) ENGINE=InnoDB
+;
+CREATE INDEX DDOCTYPEID_IDX ON t2 (DOCTYPEID);
+CREATE INDEX DFOLDERID_IDX ON t2 (FOLDERID);
+CREATE TABLE t3
+(
+FOLDERID VARCHAR(32)BINARY NOT NULL
+, FOLDERNAME VARCHAR(255)BINARY NOT NULL
+, CREATOR VARCHAR(255)BINARY
+, CREATED TIMESTAMP NOT NULL
+, DESCRIPTION VARCHAR(255)BINARY
+, FOLDERTYPE INTEGER NOT NULL
+, MODIFIED TIMESTAMP
+, MODIFIER VARCHAR(255)BINARY
+, FOLDERSIZE INTEGER NOT NULL
+, PARENTID VARCHAR(32)BINARY
+, REPID VARCHAR(32)BINARY
+, ORIGINATOR INTEGER
+, PRIMARY KEY ( FOLDERID )
+) ENGINE=InnoDB;
+CREATE INDEX FFOLDERID_IDX ON t3 (FOLDERID);
+CREATE INDEX CMFLDRPARNT_IDX ON t3 (PARENTID);
+CREATE TABLE t4
+(
+DOCTYPEID VARCHAR(32)BINARY NOT NULL
+, DOCTYPENAME VARCHAR(80)BINARY NOT NULL
+, DESCRIPTION VARCHAR(255)BINARY
+, EXTNDATA LONGBLOB
+, MODIFIED TIMESTAMP
+, MODIFIER VARCHAR(255)BINARY
+, ORIGINATOR INTEGER
+, PRIMARY KEY ( DOCTYPEID )
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES("c373e9f59cf15a6c3e57444553544200", "c373e9f59cf15a6c3e57444553544200", "340d243d45f111d497b00010a4ef934d", "2f6161e879db43c1a5b82c21ddc49089", NULL, "2003-06-06 07:48:42", NULL, NULL, NULL, "2003-06-06 07:48:42", "2003-06-06 07:48:42", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-06 07:48:42", "admin", "0", NULL);
+INSERT INTO t2 VALUES("c373e9f5a472f43ba45e444553544200", "c373e9f5a472f43ba45e444553544200", "340d243d45f111d497b00010a4ef934d", "2f6161e879db43c1a5b82c21ddc49089", NULL, "2003-06-07 18:50:12", NULL, NULL, NULL, "2003-06-07 18:50:12", "2003-06-07 18:50:12", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-07 18:50:12", "admin", "0", NULL);
+INSERT INTO t2 VALUES("c373e9f5a4a0f56014eb444553544200", "c373e9f5a4a0f56014eb444553544200", "340d243d45f111d497b00010a4ef934d", "2f6161e879db43c1a5b82c21ddc49089", NULL, "2003-06-07 19:39:26", NULL, NULL, NULL, "2003-06-07 19:39:26", "2003-06-07 19:39:26", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-07 19:39:26", "admin", "0", NULL);
+INSERT INTO t2 VALUES("c373e9f5a4a0f8fa4a86444553544200", "c373e9f5a4a0f8fa4a86444553544200", "340d243d45f111d497b00010a4ef934d", "2f6161e879db43c1a5b82c21ddc49089", NULL, "2003-06-07 19:43:05", NULL, NULL, NULL, "2003-06-07 19:43:05", "2003-06-07 19:43:05", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-07 19:43:05", "admin", "0", NULL);
+INSERT INTO t2 VALUES("c373e9f5ac7b537205ce444553544200", "c373e9f5ac7b537205ce444553544200", "340d243d45f111d497b00010a4ef934d", "2f6161e879db43c1a5b82c21ddc49089", NULL, "2003-06-09 08:15:24", NULL, NULL, NULL, "2003-06-09 08:15:24", "2003-06-09 08:15:24", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-09 08:15:24", "admin", "0", NULL);
+INSERT INTO t2 VALUES("c373e9f5ad0792012454444553544200", "c373e9f5ad0792012454444553544200", "340d243d45f111d497b00010a4ef934d", "2f6161e879db43c1a5b82c21ddc49089", NULL, "2003-06-09 10:51:44", NULL, NULL, NULL, "2003-06-09 10:51:44", "2003-06-09 10:51:44", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-09 10:51:44", "admin", "0", NULL);
+INSERT INTO t2 VALUES("c373e9f5ad079821ef34444553544200", "First Discussion", "c373e9f5ad079174ff17444553544200", "c373e9f5ad0796c0eca4444553544200", "Goldilocks", "2003-06-09 11:16:50", "Title: First Discussion", NULL, NULL, "2003-06-09 10:51:26", "2003-06-09 10:51:26", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-09 11:16:50", "admin", "0", NULL);
+INSERT INTO t2 VALUES("c373e9f5ad07993f3859444553544200", "Last Discussion", "c373e9f5ad079174ff17444553544200", "c373e9f5ad0796c0eca4444553544200", "Goldilocks", "2003-06-09 11:21:06", "Title: Last Discussion", NULL, "Setting new abstract and keeping doc checked out", "2003-06-09 10:51:26", "2003-06-09 10:51:26", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-09 11:21:06", "admin", "0", NULL);
+INSERT INTO t2 VALUES("c373e9f5ad079a3219c4444553544200", "testdoclayout", "340d243c45f111d497b00010a4ef934d", "c373e9f5ad0796c0eca4444553544200", "Goldilocks", "2003-06-09 11:25:31", "Title: Test doc layout", "Subtitle: test doc layout", NULL, "2003-06-09 10:51:27", "2003-06-09 10:51:27", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-09 11:25:31", "admin", "0", NULL);
+INSERT INTO t3 VALUES("0c9aab05b15048c59bc35c8461507deb", "System", "System", "2003-06-05 16:30:00", "The system content repository folder.", "3", "2003-06-05 16:30:00", "System", "0", NULL, "9c9aab05b15048c59bc35c8461507deb", "1");
+INSERT INTO t3 VALUES("2f6161e879db43c1a5b82c21ddc49089", "Default", "System", "2003-06-09 10:52:02", "The default content repository folder.", "3", "2003-06-05 16:30:00", "System", "0", NULL, "03eea05112b845949f3fd03278b5fe43", "1");
+INSERT INTO t3 VALUES("c373e9f5ad0791724315444553544200", "AddDocumentTest", "admin", "2003-06-09 10:51:25", "Movie Reviews", "0", "2003-06-09 10:51:25", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad07919e1963444553544200", "NewDestDirectory", "admin", "2003-06-09 10:51:28", "Adding new directory", "128", "2003-06-09 10:51:28", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad07919fe525444553544200", "SubDestDirectory", "admin", "2003-06-09 10:51:28", "Adding new directory", "128", "2003-06-09 10:51:28", "admin", "0", "c373e9f5ad07919e1963444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0791a0dab5444553544200", "Level1", "admin", "2003-06-09 10:51:29", NULL, "0", "2003-06-09 10:51:29", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0791a14669444553544200", "Level2", "admin", "2003-06-09 10:51:29", NULL, "0", "2003-06-09 10:51:29", "admin", "0", "c373e9f5ad0791a0dab5444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0791a23c0e444553544200", "Level3", "admin", "2003-06-09 10:51:29", NULL, "0", "2003-06-09 10:51:29", "admin", "0", "c373e9f5ad0791a14669444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0791a6b11f444553544200", "Dir1", "admin", "2003-06-09 10:51:30", NULL, "0", "2003-06-09 10:51:30", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0791a897d6444553544200", "Dir2", "admin", "2003-06-09 10:51:30", NULL, "0", "2003-06-09 10:51:30", "admin", "0", "c373e9f5ad0791a6b11f444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0791a9a063444553544200", "NewDestDirectory", "admin", "2003-06-09 10:51:31", NULL, "0", "2003-06-09 10:51:31", "admin", "0", "c373e9f5ad0791a897d6444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0791aa73e3444553544200", "LevelA", "admin", "2003-06-09 10:51:31", NULL, "0", "2003-06-09 10:51:31", "admin", "0", "c373e9f5ad0791a0dab5444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0791ab034b444553544200", "LevelB", "admin", "2003-06-09 10:51:31", NULL, "0", "2003-06-09 10:51:31", "admin", "0", "c373e9f5ad0791aa73e3444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0791ac7311444553544200", "LevelC", "admin", "2003-06-09 10:51:32", NULL, "0", "2003-06-09 10:51:32", "admin", "0", "c373e9f5ad0791ab034b444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0791ad66cf444553544200", "test2", "admin", "2003-06-09 10:51:32", NULL, "0", "2003-06-09 10:51:32", "admin", "0", "c373e9f5ad0791724315444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0791aebd87444553544200", "test3", "admin", "2003-06-09 10:51:33", NULL, "0", "2003-06-09 10:51:33", "admin", "0", "c373e9f5ad0791ad66cf444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0791dbaac4444553544200", "Special Café Folder", "admin", "2003-06-09 10:51:43", "test folder names with special chars", "0", "2003-06-09 10:51:43", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0796bf913f444553544200", "CopiedFolder", "admin", "2003-06-09 11:09:05", "Movie Reviews", "0", "2003-06-09 11:09:05", "admin", "0", "c373e9f5ad0791a23c0e444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0796c0eca4444553544200", "Movie Reviews", "admin", "2003-06-09 11:09:13", "Movie Reviews", "0", "2003-06-09 11:09:13", "admin", "33", "c373e9f5ad0796bf913f444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0796d9b895444553544200", "NewBookFolder", "admin", "2003-06-09 11:12:41", "NewBooks - folder", "0", "2003-06-09 11:12:41", "admin", "0", "c373e9f5ad0796c0eca4444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad079b4c9355444553544200", "CopiedFolder", "admin", "2003-06-09 11:26:34", "Movie Reviews", "0", "2003-06-09 11:26:34", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t4 VALUES("340d243c45f111d497b00010a4ef934d", "Document Layout", "The system Document Layouts Document Type", NULL, "2003-06-05 16:30:00", "System", "1");
+INSERT INTO t4 VALUES("340d243d45f111d497b00010a4ef934d", "Default", "The default system Document Type", NULL, "2003-06-05 16:30:00", "System", "1");
+INSERT INTO t4 VALUES("4d09dd60850711d4998a204c4f4f5020", "__SystemResourceType", "The type for all the uploaded resources", NULL, "2003-06-05 16:30:00", "System", "1");
+INSERT INTO t4 VALUES("91d4d595478211d497b40010a4ef934d", "__PmcSystemDefaultType", "The type for all the default available fields", NULL, "2003-06-05 16:30:00", "System", "1");
+INSERT INTO t4 VALUES("c373e9f59cf15a59b08a444553544200", "NoFieldDocType", "plain doc type", NULL, "2003-06-06 07:48:40", "admin", NULL);
+INSERT INTO t4 VALUES("c373e9f59cf15a5c6a99444553544200", "Movie Review", "This doc type is for movie reviews", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<props autocheckin=\"false\" autopublish=\"false\" binary=\"choice\" categories=\"none\" cleanup=\"false\" folder=\"none\"><![CDATA[Doc type for cm tests]]></props>\r\n", "2003-06-06 07:48:40", "admin", NULL);
+INSERT INTO t4 VALUES("c373e9f59cf15a6116a5444553544200", "Special DocÃu20A4u20A4u0113ééøÉu016BType", "test special chars xxxé in doc type", NULL, "2003-06-06 07:48:41", "admin", NULL);
+INSERT INTO t4 VALUES("c373e9f59cf15a695d47444553544200", "Movie", NULL, NULL, "2003-06-06 07:48:41", "admin", NULL);
+INSERT INTO t4 VALUES("c373e9f5ad079174ff17444553544200", "Discussion", NULL, NULL, "2003-06-09 10:51:25", "admin", NULL);
+INSERT INTO t4 VALUES("c373e9f5ad0791da7e2b444553544200", "Books", "list of recommended books", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<props autocheckin=\"false\" autopublish=\"false\" binary=\"choice\" categories=\"none\" cleanup=\"false\" folder=\"none\"><![CDATA[Doc type for cm tests]]><![CDATA[Doc type for book tests]]></props>\r\n", "2003-06-09 10:51:40", "admin", NULL);
+ALTER TABLE t2 ADD FOREIGN KEY FK_DCMNTS_DCTYPES ( DOCTYPEID)
+REFERENCES t4 (DOCTYPEID );
+ALTER TABLE t2 ADD FOREIGN KEY FK_DCMNTS_FLDRS ( FOLDERID)
+REFERENCES t3 (FOLDERID );
+ALTER TABLE t3 ADD FOREIGN KEY FK_FLDRS_PRNTID ( PARENTID)
+REFERENCES t3 (FOLDERID );
+SELECT t2.*, t4.DOCTYPENAME, t1.CONTENTSIZE,t1.MIMETYPE FROM t2 INNER JOIN t4 ON t2.DOCTYPEID = t4.DOCTYPEID LEFT OUTER JOIN t1 ON t2.DOCID = t1.DOCID WHERE t2.FOLDERID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t3.FOLDERNAME = 'Level1') AND t3.FOLDERNAME = 'Level2') AND t3.FOLDERNAME = 'Level3') AND t3.FOLDERNAME = 'CopiedFolder') AND t3.FOLDERNAME = 'Movie Reviews') AND t2.DOCNAME = 'Last Discussion';
+DOCID DOCNAME DOCTYPEID FOLDERID AUTHOR CREATED TITLE SUBTITLE DOCABSTRACT PUBLISHDATE EXPIRATIONDATE LOCKEDBY STATUS PARENTDOCID REPID MODIFIED MODIFIER PUBLISHSTATUS ORIGINATOR DOCTYPENAME CONTENTSIZE MIMETYPE
+c373e9f5ad07993f3859444553544200 Last Discussion c373e9f5ad079174ff17444553544200 c373e9f5ad0796c0eca4444553544200 Goldilocks 2003-06-09 11:21:06 Title: Last Discussion NULL Setting new abstract and keeping doc checked out 2003-06-09 10:51:26 2003-06-09 10:51:26 NULL NULL NULL 03eea05112b845949f3fd03278b5fe43 2003-06-09 11:21:06 admin 0 NULL Discussion NULL NULL
+EXPLAIN SELECT t2.*, t4.DOCTYPENAME, t1.CONTENTSIZE,t1.MIMETYPE FROM t2 INNER JOIN t4 ON t2.DOCTYPEID = t4.DOCTYPEID LEFT OUTER JOIN t1 ON t2.DOCID = t1.DOCID WHERE t2.FOLDERID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t3.FOLDERNAME = 'Level1') AND t3.FOLDERNAME = 'Level2') AND t3.FOLDERNAME = 'Level3') AND t3.FOLDERNAME = 'CopiedFolder') AND t3.FOLDERNAME = 'Movie Reviews') AND t2.DOCNAME = 'Last Discussion';
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system PRIMARY NULL NULL NULL 0 const row not found
+1 PRIMARY t2 ALL DDOCTYPEID_IDX NULL NULL NULL 9 Using where
+1 PRIMARY t4 eq_ref PRIMARY PRIMARY 32 test.t2.DOCTYPEID 1
+2 DEPENDENT SUBQUERY t3 unique_subquery PRIMARY,FFOLDERID_IDX PRIMARY 32 func 1 Using index; Using where
+3 DEPENDENT SUBQUERY t3 unique_subquery PRIMARY,FFOLDERID_IDX PRIMARY 32 func 1 Using index; Using where
+4 DEPENDENT SUBQUERY t3 unique_subquery PRIMARY,FFOLDERID_IDX PRIMARY 32 func 1 Using index; Using where
+5 DEPENDENT SUBQUERY t3 unique_subquery PRIMARY,FFOLDERID_IDX PRIMARY 32 func 1 Using index; Using where
+6 DEPENDENT SUBQUERY t3 unique_subquery PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 32 func 1 Using index; Using where
+drop table t1, t2, t3, t4;
diff --git a/mysql-test/r/subselect_gis.result b/mysql-test/r/subselect_gis.result
new file mode 100644
index 00000000000..34ab7748656
--- /dev/null
+++ b/mysql-test/r/subselect_gis.result
@@ -0,0 +1,8 @@
+drop table if exists t1;
+create table t1(City VARCHAR(30),Location geometry);
+insert into t1 values("Paris",GeomFromText('POINT(2.33 48.87)'));
+select City from t1 where (select
+intersects(GeomFromText(AsText(Location)),GeomFromText('Polygon((2 50, 2.5
+50, 2.5 47, 2 47, 2 50))'))=0);
+City
+drop table t1;
diff --git a/mysql-test/r/subselect_innodb.result b/mysql-test/r/subselect_innodb.result
new file mode 100644
index 00000000000..0b813a07a1d
--- /dev/null
+++ b/mysql-test/r/subselect_innodb.result
@@ -0,0 +1,142 @@
+drop table if exists t1,t2,t3;
+CREATE TABLE t1
+(
+FOLDERID VARCHAR(32)BINARY NOT NULL
+, FOLDERNAME VARCHAR(255)BINARY NOT NULL
+, CREATOR VARCHAR(255)BINARY
+, CREATED TIMESTAMP NOT NULL
+, DESCRIPTION VARCHAR(255)BINARY
+, FOLDERTYPE INTEGER NOT NULL
+, MODIFIED TIMESTAMP
+, MODIFIER VARCHAR(255)BINARY
+, FOLDERSIZE INTEGER NOT NULL
+, PARENTID VARCHAR(32)BINARY
+, REPID VARCHAR(32)BINARY
+, ORIGINATOR INTEGER
+, PRIMARY KEY ( FOLDERID )
+) ENGINE=InnoDB;
+CREATE INDEX FFOLDERID_IDX ON t1 (FOLDERID);
+CREATE INDEX CMFLDRPARNT_IDX ON t1 (PARENTID);
+INSERT INTO t1 VALUES("0c9aab05b15048c59bc35c8461507deb", "System", "System", "2003-06-05 16:30:00", "The system content repository folder.", "3", "2003-06-05 16:30:00", "System", "0", NULL, "9c9aab05b15048c59bc35c8461507deb", "1");
+INSERT INTO t1 VALUES("2f6161e879db43c1a5b82c21ddc49089", "Default", "System", "2003-06-09 10:52:02", "The default content repository folder.", "3", "2003-06-05 16:30:00", "System", "0", NULL, "03eea05112b845949f3fd03278b5fe43", "1");
+INSERT INTO t1 VALUES("c373e9f5ad0791724315444553544200", "AddDocumentTest", "admin", "2003-06-09 10:51:25", "Movie Reviews", "0", "2003-06-09 10:51:25", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL);
+SELECT 'c373e9f5ad0791a0dab5444553544200' IN(SELECT t1.FOLDERID FROM t1 WHERE t1.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t1.FOLDERNAME = 'Level1');
+'c373e9f5ad0791a0dab5444553544200' IN(SELECT t1.FOLDERID FROM t1 WHERE t1.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t1.FOLDERNAME = 'Level1')
+0
+drop table t1;
+create table t1 (a int) engine=innodb;
+create table t2 (a int) engine=innodb;
+create table t3 (a int) engine=innodb;
+insert into t1 values (1),(2),(3),(4);
+insert into t2 values (10),(20),(30),(40);
+insert into t3 values (1),(2),(10),(50);
+select a from t3 where t3.a in (select a from t1 where a <= 3 union select * from t2 where a <= 30);
+a
+1
+2
+10
+drop table t1,t2,t3;
+CREATE TABLE t1 (
+processor_id INTEGER NOT NULL,
+PRIMARY KEY (processor_id)
+) ENGINE=InnoDB;
+CREATE TABLE t3 (
+yod_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL,
+login_processor INTEGER UNSIGNED ,
+PRIMARY KEY (yod_id)
+) ENGINE=InnoDB;
+CREATE TABLE t2 (
+processor_id INTEGER NOT NULL,
+yod_id BIGINT UNSIGNED NOT NULL,
+PRIMARY KEY (processor_id, yod_id),
+INDEX (processor_id),
+INDEX (yod_id),
+FOREIGN KEY (processor_id) REFERENCES t1(processor_id),
+FOREIGN KEY (yod_id) REFERENCES t3(yod_id)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2),(3);
+INSERT INTO t3 VALUES (1,1),(2,2),(3,3);
+INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
+SELECT distinct p1.processor_id, (SELECT y.yod_id FROM t1 p2, t2 y WHERE p2.processor_id = p1.processor_id and p2.processor_id = y.processor_id) FROM t1 p1;
+processor_id (SELECT y.yod_id FROM t1 p2, t2 y WHERE p2.processor_id = p1.processor_id and p2.processor_id = y.processor_id)
+1 1
+2 2
+3 3
+drop table t2,t1,t3;
+CREATE TABLE t1 (
+id int(11) NOT NULL default '0',
+b int(11) default NULL,
+c char(3) default NULL,
+PRIMARY KEY (id),
+KEY t2i1 (b)
+) ENGINE=innodb DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES (0,0,'GPL'),(1,0,'GPL'),(2,1,'GPL'),(3,2,'GPL');
+CREATE TABLE t2 (
+id int(11) NOT NULL default '0',
+b int(11) default NULL,
+c char(3) default NULL,
+PRIMARY KEY (id),
+KEY t2i (b)
+) ENGINE=innodb DEFAULT CHARSET=latin1;
+INSERT INTO t2 VALUES (0,0,'GPL'),(1,0,'GPL'),(2,1,'GPL'),(3,2,'GPL');
+select (select max(id) from t2 where b=1 group by b) as x,b from t1 where b=1;
+x b
+2 1
+drop table t1,t2;
+create table t1 (id int not null, value char(255), primary key(id)) engine=innodb;
+create table t2 (id int not null, value char(255)) engine=innodb;
+insert into t1 values (1,'a'),(2,'b');
+insert into t2 values (1,'z'),(2,'x');
+select t2.id,t2.value,(select t1.value from t1 where t1.id=t2.id) from t2;
+id value (select t1.value from t1 where t1.id=t2.id)
+1 z a
+2 x b
+select t2.id,t2.value,(select t1.value from t1 where t1.id=t2.id) from t2;
+id value (select t1.value from t1 where t1.id=t2.id)
+1 z a
+2 x b
+drop table t1,t2;
+create table t1 (a int, b int) engine=innodb;
+insert into t1 values (1,2), (1,3), (2,3), (2,4), (2,5), (3,4), (4,5), (4,100);
+create table t2 (a int) engine=innodb;
+insert into t2 values (1),(2),(3),(4);
+select a, sum(b) as b from t1 group by a having b > (select max(a) from t2);
+a b
+1 5
+2 12
+4 105
+drop table t1, t2;
+CREATE TABLE `t1` ( `unit` varchar(50) NOT NULL default '', `ingredient` varchar(50) NOT NULL default '') ENGINE=InnoDB DEFAULT CHARSET=latin1;
+CREATE TABLE `t2` ( `ingredient` varchar(50) NOT NULL default '', `unit` varchar(50) NOT NULL default '', PRIMARY KEY (ingredient, unit)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO `t1` VALUES ('xx','yy');
+INSERT INTO `t2` VALUES ('yy','xx');
+SELECT R.unit, R.ingredient FROM t1 R WHERE R.ingredient IN (SELECT N.ingredient FROM t2 N WHERE N.unit = R.unit);
+unit ingredient
+xx yy
+drop table t1, t2;
+CREATE TABLE t1 (
+id INT NOT NULL auto_increment,
+date1 DATE, coworkerid INT,
+description VARCHAR(255),
+sum_used DOUBLE,
+sum_remaining DOUBLE,
+comments VARCHAR(255),
+PRIMARY KEY(id)
+) engine=innodb;
+insert into t1 values (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1998-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1998-01-01', 1,'test', 22, 33, 'comment'), (NULL, '2004-01-01', 1,'test', 22, 33, 'comment'), (NULL, '2004-01-01', 1,'test', 22, 33, 'comment');
+SELECT DISTINCT
+(SELECT sum(sum_used) FROM t1 WHERE sum_used > 0 AND year(date1) <= '2004') as somallontvangsten,
+(SELECT sum(sum_used) FROM t1 WHERE sum_used < 0 AND year(date1) <= '2004') as somalluitgaven
+FROM t1;
+somallontvangsten somalluitgaven
+154 NULL
+select * from t1;
+id date1 coworkerid description sum_used sum_remaining comments
+1 1999-01-01 1 test 22 33 comment
+2 1999-01-01 1 test 22 33 comment
+3 1999-01-01 1 test 22 33 comment
+4 1998-01-01 1 test 22 33 comment
+5 1998-01-01 1 test 22 33 comment
+6 2004-01-01 1 test 22 33 comment
+7 2004-01-01 1 test 22 33 comment
+drop table t1;
diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result
index d07a8613883..08d75d8b562 100644
--- a/mysql-test/r/symlink.result
+++ b/mysql-test/r/symlink.result
@@ -40,7 +40,7 @@ t9 CREATE TABLE `t9` (
`b` char(16) NOT NULL default '',
`c` int(11) NOT NULL default '0',
PRIMARY KEY (`a`)
-) TYPE=MyISAM DATA DIRECTORY='TEST_DIR/var/tmp/' INDEX DIRECTORY='TEST_DIR/var/run/'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='TEST_DIR/var/tmp/' INDEX DIRECTORY='TEST_DIR/var/run/'
alter table t9 rename t8, add column d int not null;
alter table t8 rename t7;
rename table t7 to t9;
@@ -62,25 +62,25 @@ t9 CREATE TABLE `t9` (
`c` int(11) NOT NULL default '0',
`d` int(11) NOT NULL default '0',
PRIMARY KEY (`a`)
-) TYPE=MyISAM DATA DIRECTORY='TEST_DIR/var/tmp/' INDEX DIRECTORY='TEST_DIR/var/run/'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='TEST_DIR/var/tmp/' INDEX DIRECTORY='TEST_DIR/var/run/'
drop database mysqltest;
-create table t1 (a int not null) type=myisam;
+create table t1 (a int not null) engine=myisam;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0'
-) TYPE=MyISAM
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 add b int;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`b` int(11) default NULL
-) TYPE=MyISAM
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`b` int(11) default NULL
-) TYPE=MyISAM
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
diff --git a/mysql-test/r/synchronization.result b/mysql-test/r/synchronization.result
new file mode 100644
index 00000000000..ad9443c86da
--- /dev/null
+++ b/mysql-test/r/synchronization.result
@@ -0,0 +1,162 @@
+CREATE TABLE t1 (x1 int);
+ ALTER TABLE t1 CHANGE x1 x2 int;
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `xx` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+ ALTER TABLE t1 CHANGE x2 x1 int;
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `xx` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+ ALTER TABLE t1 CHANGE x1 x2 int;
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `xx` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+ ALTER TABLE t1 CHANGE x2 x1 int;
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `xx` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+ ALTER TABLE t1 CHANGE x1 x2 int;
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `xx` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+ ALTER TABLE t1 CHANGE x2 x1 int;
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `xx` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+ ALTER TABLE t1 CHANGE x1 x2 int;
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `xx` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+ ALTER TABLE t1 CHANGE x2 x1 int;
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `xx` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+ ALTER TABLE t1 CHANGE x1 x2 int;
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `xx` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+ ALTER TABLE t1 CHANGE x2 x1 int;
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `xx` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+ ALTER TABLE t1 CHANGE x1 x2 int;
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `xx` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+ ALTER TABLE t1 CHANGE x2 x1 int;
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `xx` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+ ALTER TABLE t1 CHANGE x1 x2 int;
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `xx` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+ ALTER TABLE t1 CHANGE x2 x1 int;
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `xx` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+ ALTER TABLE t1 CHANGE x1 x2 int;
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `xx` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+ ALTER TABLE t1 CHANGE x2 x1 int;
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `xx` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+ ALTER TABLE t1 CHANGE x1 x2 int;
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `xx` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+ ALTER TABLE t1 CHANGE x2 x1 int;
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `xx` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+ ALTER TABLE t1 CHANGE x1 x2 int;
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `xx` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+ ALTER TABLE t1 CHANGE x2 x1 int;
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `xx` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result
index 59cb6c38a59..ebb24159373 100644
--- a/mysql-test/r/system_mysql_db.result
+++ b/mysql-test/r/system_mysql_db.result
@@ -3,77 +3,86 @@ Tables_in_db
columns_priv
db
func
+help_category
+help_keyword
+help_relation
+help_topic
host
tables_priv
+time_zone
+time_zone_leap_second
+time_zone_name
+time_zone_transition
+time_zone_transition_type
user
show create table db;
Table Create Table
db CREATE TABLE `db` (
- `Host` char(60) binary NOT NULL default '',
- `Db` char(64) binary NOT NULL default '',
- `User` char(16) binary NOT NULL default '',
- `Select_priv` enum('N','Y') NOT NULL default 'N',
- `Insert_priv` enum('N','Y') NOT NULL default 'N',
- `Update_priv` enum('N','Y') NOT NULL default 'N',
- `Delete_priv` enum('N','Y') NOT NULL default 'N',
- `Create_priv` enum('N','Y') NOT NULL default 'N',
- `Drop_priv` enum('N','Y') NOT NULL default 'N',
- `Grant_priv` enum('N','Y') NOT NULL default 'N',
- `References_priv` enum('N','Y') NOT NULL default 'N',
- `Index_priv` enum('N','Y') NOT NULL default 'N',
- `Alter_priv` enum('N','Y') NOT NULL default 'N',
- `Create_tmp_table_priv` enum('N','Y') NOT NULL default 'N',
- `Lock_tables_priv` enum('N','Y') NOT NULL default 'N',
+ `Host` char(60) collate utf8_bin NOT NULL default '',
+ `Db` char(64) collate utf8_bin NOT NULL default '',
+ `User` char(16) collate utf8_bin NOT NULL default '',
+ `Select_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Insert_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Update_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Delete_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Create_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Drop_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Grant_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `References_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Index_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Alter_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Create_tmp_table_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Lock_tables_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
PRIMARY KEY (`Host`,`Db`,`User`),
KEY `User` (`User`)
-) TYPE=MyISAM COMMENT='Database privileges'
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Database privileges'
show create table host;
Table Create Table
host CREATE TABLE `host` (
- `Host` char(60) binary NOT NULL default '',
- `Db` char(64) binary NOT NULL default '',
- `Select_priv` enum('N','Y') NOT NULL default 'N',
- `Insert_priv` enum('N','Y') NOT NULL default 'N',
- `Update_priv` enum('N','Y') NOT NULL default 'N',
- `Delete_priv` enum('N','Y') NOT NULL default 'N',
- `Create_priv` enum('N','Y') NOT NULL default 'N',
- `Drop_priv` enum('N','Y') NOT NULL default 'N',
- `Grant_priv` enum('N','Y') NOT NULL default 'N',
- `References_priv` enum('N','Y') NOT NULL default 'N',
- `Index_priv` enum('N','Y') NOT NULL default 'N',
- `Alter_priv` enum('N','Y') NOT NULL default 'N',
- `Create_tmp_table_priv` enum('N','Y') NOT NULL default 'N',
- `Lock_tables_priv` enum('N','Y') NOT NULL default 'N',
+ `Host` char(60) collate utf8_bin NOT NULL default '',
+ `Db` char(64) collate utf8_bin NOT NULL default '',
+ `Select_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Insert_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Update_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Delete_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Create_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Drop_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Grant_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `References_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Index_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Alter_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Create_tmp_table_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Lock_tables_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
PRIMARY KEY (`Host`,`Db`)
-) TYPE=MyISAM COMMENT='Host privileges; Merged with database privileges'
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Host privileges; Merged with database privileges'
show create table user;
Table Create Table
user CREATE TABLE `user` (
- `Host` varchar(60) binary NOT NULL default '',
- `User` varchar(16) binary NOT NULL default '',
- `Password` varchar(16) binary NOT NULL default '',
- `Select_priv` enum('N','Y') NOT NULL default 'N',
- `Insert_priv` enum('N','Y') NOT NULL default 'N',
- `Update_priv` enum('N','Y') NOT NULL default 'N',
- `Delete_priv` enum('N','Y') NOT NULL default 'N',
- `Create_priv` enum('N','Y') NOT NULL default 'N',
- `Drop_priv` enum('N','Y') NOT NULL default 'N',
- `Reload_priv` enum('N','Y') NOT NULL default 'N',
- `Shutdown_priv` enum('N','Y') NOT NULL default 'N',
- `Process_priv` enum('N','Y') NOT NULL default 'N',
- `File_priv` enum('N','Y') NOT NULL default 'N',
- `Grant_priv` enum('N','Y') NOT NULL default 'N',
- `References_priv` enum('N','Y') NOT NULL default 'N',
- `Index_priv` enum('N','Y') NOT NULL default 'N',
- `Alter_priv` enum('N','Y') NOT NULL default 'N',
- `Show_db_priv` enum('N','Y') NOT NULL default 'N',
- `Super_priv` enum('N','Y') NOT NULL default 'N',
- `Create_tmp_table_priv` enum('N','Y') NOT NULL default 'N',
- `Lock_tables_priv` enum('N','Y') NOT NULL default 'N',
- `Execute_priv` enum('N','Y') NOT NULL default 'N',
- `Repl_slave_priv` enum('N','Y') NOT NULL default 'N',
- `Repl_client_priv` enum('N','Y') NOT NULL default 'N',
- `ssl_type` enum('','ANY','X509','SPECIFIED') NOT NULL default '',
+ `Host` varchar(60) collate utf8_bin NOT NULL default '',
+ `User` varchar(16) collate utf8_bin NOT NULL default '',
+ `Password` varchar(41) collate utf8_bin NOT NULL default '',
+ `Select_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Insert_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Update_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Delete_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Create_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Drop_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Reload_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Shutdown_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Process_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `File_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Grant_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `References_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Index_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Alter_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Show_db_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Super_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Create_tmp_table_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Lock_tables_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Execute_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Repl_slave_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Repl_client_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `ssl_type` enum('','ANY','X509','SPECIFIED') collate utf8_bin NOT NULL default '',
`ssl_cipher` blob NOT NULL,
`x509_issuer` blob NOT NULL,
`x509_subject` blob NOT NULL,
@@ -81,39 +90,41 @@ user CREATE TABLE `user` (
`max_updates` int(11) unsigned NOT NULL default '0',
`max_connections` int(11) unsigned NOT NULL default '0',
PRIMARY KEY (`Host`,`User`)
-) TYPE=MyISAM COMMENT='Users and global privileges'
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges'
show create table func;
Table Create Table
func CREATE TABLE `func` (
- `name` char(64) binary NOT NULL default '',
+ `name` char(64) collate utf8_bin NOT NULL default '',
`ret` tinyint(1) NOT NULL default '0',
- `dl` char(128) NOT NULL default '',
- `type` enum('function','aggregate') NOT NULL default 'function',
+ `dl` char(128) collate utf8_bin NOT NULL default '',
+ `type` enum('function','aggregate') collate utf8_bin NOT NULL default 'function',
PRIMARY KEY (`name`)
-) TYPE=MyISAM COMMENT='User defined functions'
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User defined functions'
show create table tables_priv;
Table Create Table
tables_priv CREATE TABLE `tables_priv` (
- `Host` char(60) binary NOT NULL default '',
- `Db` char(64) binary NOT NULL default '',
- `User` char(16) binary NOT NULL default '',
- `Table_name` char(64) binary NOT NULL default '',
- `Grantor` char(77) NOT NULL default '',
- `Timestamp` timestamp(14) NOT NULL,
- `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') NOT NULL default '',
- `Column_priv` set('Select','Insert','Update','References') NOT NULL default '',
+ `Host` char(60) collate utf8_bin NOT NULL default '',
+ `Db` char(64) collate utf8_bin NOT NULL default '',
+ `User` char(16) collate utf8_bin NOT NULL default '',
+ `Table_name` char(64) collate utf8_bin NOT NULL default '',
+ `Grantor` char(77) collate utf8_bin NOT NULL default '',
+ `Timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
+ `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') collate utf8_bin NOT NULL default '',
+ `Column_priv` set('Select','Insert','Update','References') collate utf8_bin NOT NULL default '',
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`),
KEY `Grantor` (`Grantor`)
-) TYPE=MyISAM COMMENT='Table privileges'
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Table privileges'
show create table columns_priv;
Table Create Table
columns_priv CREATE TABLE `columns_priv` (
- `Host` char(60) binary NOT NULL default '',
- `Db` char(64) binary NOT NULL default '',
- `User` char(16) binary NOT NULL default '',
- `Table_name` char(64) binary NOT NULL default '',
- `Column_name` char(64) binary NOT NULL default '',
- `Timestamp` timestamp(14) NOT NULL,
- `Column_priv` set('Select','Insert','Update','References') NOT NULL default '',
+ `Host` char(60) collate utf8_bin NOT NULL default '',
+ `Db` char(64) collate utf8_bin NOT NULL default '',
+ `User` char(16) collate utf8_bin NOT NULL default '',
+ `Table_name` char(64) collate utf8_bin NOT NULL default '',
+ `Column_name` char(64) collate utf8_bin NOT NULL default '',
+ `Timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
+ `Column_priv` set('Select','Insert','Update','References') collate utf8_bin NOT NULL default '',
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`)
-) TYPE=MyISAM COMMENT='Column privileges'
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges'
+show tables;
+Tables_in_test
diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result
index 7c8d10cf0a6..10c0a2e3652 100644
--- a/mysql-test/r/temp_table.result
+++ b/mysql-test/r/temp_table.result
@@ -21,12 +21,12 @@ a b
4 e
5 f
6 g
-create TEMPORARY TABLE t2 type=heap select * from t1;
-create TEMPORARY TABLE IF NOT EXISTS t2 (a int) type=heap;
+create TEMPORARY TABLE t2 engine=heap select * from t1;
+create TEMPORARY TABLE IF NOT EXISTS t2 (a int) engine=heap;
CREATE TEMPORARY TABLE t1 (a int not null, b char (10) not null);
-Table 't1' already exists
+ERROR 42S01: Table 't1' already exists
ALTER TABLE t1 RENAME t2;
-Table 't2' already exists
+ERROR 42S01: Table 't2' already exists
select * from t2;
a b
4 e
@@ -48,7 +48,6 @@ c d e
3 b 2
drop table t1;
drop table t1;
-drop table if exists t1;
CREATE TABLE t1 (pkCrash INTEGER PRIMARY KEY,strCrash VARCHAR(255));
INSERT INTO t1 ( pkCrash, strCrash ) VALUES ( 1, '1');
SELECT CONCAT_WS(pkCrash, strCrash) FROM t1;
@@ -75,12 +74,11 @@ drop table t1,t2;
create temporary table t1 (a int not null);
insert into t1 values (1),(1);
alter table t1 add primary key (a);
-Duplicate entry '1' for key 1
+ERROR 23000: Duplicate entry '1' for key 1
drop table t1;
-drop table if exists t1;
CREATE TABLE t1 (
d datetime default NULL
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('2002-10-24 14:50:32'),('2002-10-24 14:50:33'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40');
flush status;
select * from t1 group by d;
diff --git a/mysql-test/r/timezone.result b/mysql-test/r/timezone.result
index 15f0d4121c7..10944c3706e 100644
--- a/mysql-test/r/timezone.result
+++ b/mysql-test/r/timezone.result
@@ -1,7 +1,7 @@
DROP TABLE IF EXISTS t1;
-show variables like "timezone";
+show variables like "system_time_zone";
Variable_name Value
-timezone MET
+system_time_zone MET
select @a:=FROM_UNIXTIME(1);
@a:=FROM_UNIXTIME(1)
1970-01-01 01:00:01
@@ -32,6 +32,13 @@ ts from_unixtime(ts)
1048989599 2003-03-30 03:59:59
1048989601 2003-03-30 04:00:01
DROP TABLE t1;
+CREATE TABLE t1 (ts timestamp);
+INSERT INTO t1 (ts) VALUES ('2003-03-30 01:59:59'),
+('2003-03-30 02:59:59'),
+('2003-03-30 03:00:00');
+Warnings:
+Warning 1299 Invalid TIMESTAMP value in column 'ts' at row 2
+DROP TABLE t1;
select unix_timestamp('1970-01-01 01:00:00'),
unix_timestamp('1970-01-01 01:00:01'),
unix_timestamp('2038-01-01 00:59:59'),
diff --git a/mysql-test/r/timezone2.result b/mysql-test/r/timezone2.result
new file mode 100644
index 00000000000..1c98fd18a08
--- /dev/null
+++ b/mysql-test/r/timezone2.result
@@ -0,0 +1,305 @@
+drop table if exists t1, t2;
+create table t1 (ts timestamp);
+set time_zone='+00:00';
+select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp());
+unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp())
+0
+insert into t1 (ts) values ('2003-03-30 02:30:00');
+set time_zone='+10:30';
+select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp());
+unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp())
+-37800
+insert into t1 (ts) values ('2003-03-30 02:30:00');
+set time_zone='-10:00';
+select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp());
+unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp())
+36000
+insert into t1 (ts) values ('2003-03-30 02:30:00');
+select * from t1;
+ts
+2003-03-29 16:30:00
+2003-03-29 06:00:00
+2003-03-30 02:30:00
+drop table t1;
+select Name from mysql.time_zone_name where Name in
+('UTC','Universal','MET','Europe/Moscow','leap/Europe/Moscow');
+Name
+Europe/Moscow
+leap/Europe/Moscow
+MET
+Universal
+UTC
+create table t1 (i int, ts timestamp);
+set time_zone='MET';
+insert into t1 (i, ts) values
+(unix_timestamp('2003-03-01 00:00:00'),'2003-03-01 00:00:00');
+insert into t1 (i, ts) values
+(unix_timestamp('2003-03-30 01:59:59'),'2003-03-30 01:59:59'),
+(unix_timestamp('2003-03-30 02:30:00'),'2003-03-30 02:30:00'),
+(unix_timestamp('2003-03-30 03:00:00'),'2003-03-30 03:00:00');
+Warnings:
+Warning 1299 Invalid TIMESTAMP value in column 'ts' at row 2
+insert into t1 (i, ts) values
+(unix_timestamp('2003-05-01 00:00:00'),'2003-05-01 00:00:00');
+insert into t1 (i, ts) values
+(unix_timestamp('2003-10-26 01:00:00'),'2003-10-26 01:00:00'),
+(unix_timestamp('2003-10-26 02:00:00'),'2003-10-26 02:00:00'),
+(unix_timestamp('2003-10-26 02:59:59'),'2003-10-26 02:59:59'),
+(unix_timestamp('2003-10-26 04:00:00'),'2003-10-26 04:00:00'),
+(unix_timestamp('2003-10-26 02:59:59'),'2003-10-26 02:59:59');
+set time_zone='UTC';
+select * from t1;
+i ts
+1046473200 2003-02-28 23:00:00
+1048985999 2003-03-30 00:59:59
+1048986000 2003-03-30 01:00:00
+1048986000 2003-03-30 01:00:00
+1051740000 2003-04-30 22:00:00
+1067122800 2003-10-25 23:00:00
+1067126400 2003-10-26 00:00:00
+1067129999 2003-10-26 00:59:59
+1067137200 2003-10-26 03:00:00
+1067129999 2003-10-26 00:59:59
+delete from t1;
+set time_zone='Europe/Moscow';
+insert into t1 (i, ts) values
+(unix_timestamp('2004-01-01 00:00:00'),'2004-01-01 00:00:00'),
+(unix_timestamp('2004-03-28 02:30:00'),'2004-03-28 02:30:00'),
+(unix_timestamp('2004-08-01 00:00:00'),'2003-08-01 00:00:00'),
+(unix_timestamp('2004-10-31 02:30:00'),'2004-10-31 02:30:00');
+Warnings:
+Warning 1299 Invalid TIMESTAMP value in column 'ts' at row 2
+select * from t1;
+i ts
+1072904400 2004-01-01 00:00:00
+1080428400 2004-03-28 03:00:00
+1091304000 2003-08-01 00:00:00
+1099175400 2004-10-31 02:30:00
+delete from t1;
+set time_zone='leap/Europe/Moscow';
+insert into t1 (i, ts) values
+(unix_timestamp('2004-01-01 00:00:00'),'2004-01-01 00:00:00'),
+(unix_timestamp('2004-03-28 02:30:00'),'2004-03-28 02:30:00'),
+(unix_timestamp('2004-08-01 00:00:00'),'2003-08-01 00:00:00'),
+(unix_timestamp('2004-10-31 02:30:00'),'2004-10-31 02:30:00');
+Warnings:
+Warning 1299 Invalid TIMESTAMP value in column 'ts' at row 2
+select * from t1;
+i ts
+1072904422 2004-01-01 00:00:00
+1080428422 2004-03-28 03:00:00
+1091304022 2003-08-01 00:00:00
+1099175422 2004-10-31 02:30:00
+delete from t1;
+insert into t1 (i, ts) values
+(unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
+(unix_timestamp('1981-07-01 04:00:00'),'1981-07-01 04:00:00');
+select * from t1;
+i ts
+362793608 1981-07-01 03:59:59
+362793610 1981-07-01 04:00:00
+select from_unixtime(362793609);
+from_unixtime(362793609)
+1981-07-01 03:59:60
+drop table t1;
+create table t1 (ts timestamp);
+set time_zone='UTC';
+insert into t1 values ('0000-00-00 00:00:00'),('1969-12-31 23:59:59'),
+('1970-01-01 00:00:00'),('1970-01-01 00:00:01'),
+('2037-12-31 23:59:59'),('2038-01-01 00:00:00');
+Warnings:
+Warning 1264 Data truncated; out of range for column 'ts' at row 2
+Warning 1264 Data truncated; out of range for column 'ts' at row 3
+Warning 1264 Data truncated; out of range for column 'ts' at row 6
+select * from t1;
+ts
+0000-00-00 00:00:00
+0000-00-00 00:00:00
+0000-00-00 00:00:00
+1970-01-01 00:00:01
+2037-12-31 23:59:59
+0000-00-00 00:00:00
+delete from t1;
+set time_zone='MET';
+insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 00:30:00'),
+('1970-01-01 01:00:00'),('1970-01-01 01:00:01'),
+('2038-01-01 00:59:59'),('2038-01-01 01:00:00');
+Warnings:
+Warning 1264 Data truncated; out of range for column 'ts' at row 2
+Warning 1264 Data truncated; out of range for column 'ts' at row 3
+Warning 1264 Data truncated; out of range for column 'ts' at row 6
+select * from t1;
+ts
+0000-00-00 00:00:00
+0000-00-00 00:00:00
+0000-00-00 00:00:00
+1970-01-01 01:00:01
+2038-01-01 00:59:59
+0000-00-00 00:00:00
+delete from t1;
+set time_zone='+01:30';
+insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 01:00:00'),
+('1970-01-01 01:30:00'),('1970-01-01 01:30:01'),
+('2038-01-01 01:29:59'),('2038-01-01 01:30:00');
+Warnings:
+Warning 1264 Data truncated; out of range for column 'ts' at row 2
+Warning 1264 Data truncated; out of range for column 'ts' at row 3
+Warning 1264 Data truncated; out of range for column 'ts' at row 6
+select * from t1;
+ts
+0000-00-00 00:00:00
+0000-00-00 00:00:00
+0000-00-00 00:00:00
+1970-01-01 01:30:01
+2038-01-01 01:29:59
+0000-00-00 00:00:00
+drop table t1;
+show variables like 'time_zone';
+Variable_name Value
+time_zone +01:30
+set time_zone = default;
+show variables like 'time_zone';
+Variable_name Value
+time_zone SYSTEM
+set time_zone= '0';
+ERROR HY000: Unknown or incorrect time zone: '0'
+set time_zone= '0:0';
+ERROR HY000: Unknown or incorrect time zone: '0:0'
+set time_zone= '-20:00';
+ERROR HY000: Unknown or incorrect time zone: '-20:00'
+set time_zone= '+20:00';
+ERROR HY000: Unknown or incorrect time zone: '+20:00'
+set time_zone= 'Some/Unknown/Time/Zone';
+ERROR HY000: Unknown or incorrect time zone: 'Some/Unknown/Time/Zone'
+select convert_tz(now(),'UTC', 'Universal') = now();
+convert_tz(now(),'UTC', 'Universal') = now()
+1
+select convert_tz(now(),'utc', 'UTC') = now();
+convert_tz(now(),'utc', 'UTC') = now()
+1
+select convert_tz('1917-11-07 12:00:00', 'MET', 'UTC');
+convert_tz('1917-11-07 12:00:00', 'MET', 'UTC')
+1917-11-07 12:00:00
+select convert_tz('1970-01-01 01:00:00', 'MET', 'UTC');
+convert_tz('1970-01-01 01:00:00', 'MET', 'UTC')
+1970-01-01 01:00:00
+select convert_tz('1970-01-01 01:00:01', 'MET', 'UTC');
+convert_tz('1970-01-01 01:00:01', 'MET', 'UTC')
+1970-01-01 00:00:01
+select convert_tz('2003-03-01 00:00:00', 'MET', 'UTC');
+convert_tz('2003-03-01 00:00:00', 'MET', 'UTC')
+2003-02-28 23:00:00
+select convert_tz('2003-03-30 01:59:59', 'MET', 'UTC');
+convert_tz('2003-03-30 01:59:59', 'MET', 'UTC')
+2003-03-30 00:59:59
+select convert_tz('2003-03-30 02:30:00', 'MET', 'UTC');
+convert_tz('2003-03-30 02:30:00', 'MET', 'UTC')
+2003-03-30 01:00:00
+select convert_tz('2003-03-30 03:00:00', 'MET', 'UTC');
+convert_tz('2003-03-30 03:00:00', 'MET', 'UTC')
+2003-03-30 01:00:00
+select convert_tz('2003-05-01 00:00:00', 'MET', 'UTC');
+convert_tz('2003-05-01 00:00:00', 'MET', 'UTC')
+2003-04-30 22:00:00
+select convert_tz('2003-10-26 01:00:00', 'MET', 'UTC');
+convert_tz('2003-10-26 01:00:00', 'MET', 'UTC')
+2003-10-25 23:00:00
+select convert_tz('2003-10-26 02:00:00', 'MET', 'UTC');
+convert_tz('2003-10-26 02:00:00', 'MET', 'UTC')
+2003-10-26 00:00:00
+select convert_tz('2003-10-26 02:59:59', 'MET', 'UTC');
+convert_tz('2003-10-26 02:59:59', 'MET', 'UTC')
+2003-10-26 00:59:59
+select convert_tz('2003-10-26 04:00:00', 'MET', 'UTC');
+convert_tz('2003-10-26 04:00:00', 'MET', 'UTC')
+2003-10-26 03:00:00
+select convert_tz('2038-01-01 00:59:59', 'MET', 'UTC');
+convert_tz('2038-01-01 00:59:59', 'MET', 'UTC')
+2037-12-31 23:59:59
+select convert_tz('2038-01-01 01:00:00', 'MET', 'UTC');
+convert_tz('2038-01-01 01:00:00', 'MET', 'UTC')
+2038-01-01 01:00:00
+select convert_tz('2103-01-01 04:00:00', 'MET', 'UTC');
+convert_tz('2103-01-01 04:00:00', 'MET', 'UTC')
+2103-01-01 04:00:00
+create table t1 (tz varchar(3));
+insert into t1 (tz) values ('MET'), ('UTC');
+select tz, convert_tz('2003-12-31 00:00:00',tz,'UTC'), convert_tz('2003-12-31 00:00:00','UTC',tz) from t1 order by tz;
+tz convert_tz('2003-12-31 00:00:00',tz,'UTC') convert_tz('2003-12-31 00:00:00','UTC',tz)
+MET 2003-12-30 23:00:00 2003-12-31 01:00:00
+UTC 2003-12-31 00:00:00 2003-12-31 00:00:00
+drop table t1;
+select convert_tz('2003-12-31 04:00:00', NULL, 'UTC');
+convert_tz('2003-12-31 04:00:00', NULL, 'UTC')
+NULL
+select convert_tz('2003-12-31 04:00:00', 'SomeNotExistingTimeZone', 'UTC');
+convert_tz('2003-12-31 04:00:00', 'SomeNotExistingTimeZone', 'UTC')
+NULL
+select convert_tz('2003-12-31 04:00:00', 'MET', 'SomeNotExistingTimeZone');
+convert_tz('2003-12-31 04:00:00', 'MET', 'SomeNotExistingTimeZone')
+NULL
+select convert_tz('2003-12-31 04:00:00', 'MET', NULL);
+convert_tz('2003-12-31 04:00:00', 'MET', NULL)
+NULL
+select convert_tz( NULL, 'MET', 'UTC');
+convert_tz( NULL, 'MET', 'UTC')
+NULL
+create table t1 (ts timestamp);
+set timestamp=1000000000;
+insert into t1 (ts) values (now());
+select convert_tz(ts, @@time_zone, 'Japan') from t1;
+convert_tz(ts, @@time_zone, 'Japan')
+2001-09-09 10:46:40
+drop table t1;
+delete from mysql.user where user like 'mysqltest\_%';
+delete from mysql.db where user like 'mysqltest\_%';
+delete from mysql.tables_priv where user like 'mysqltest\_%';
+delete from mysql.columns_priv where user like 'mysqltest\_%';
+flush privileges;
+create table t1 (a int, b datetime);
+create table t2 (c int, d datetime);
+grant all privileges on test.* to mysqltest_1@localhost;
+show grants for current_user();
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT ALL PRIVILEGES ON `test`.* TO 'mysqltest_1'@'localhost'
+set time_zone= '+00:00';
+set time_zone= 'Europe/Moscow';
+select convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC');
+convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC')
+2004-10-21 15:00:00
+select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
+convert_tz(b, 'Europe/Moscow', 'UTC')
+update t1, t2 set t1.b = convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC')
+where t1.a = t2.c and t2.d = (select max(d) from t2);
+select * from mysql.time_zone_name;
+ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysql'
+select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name;
+ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysql'
+delete from mysql.db where user like 'mysqltest\_%';
+flush privileges;
+grant all privileges on test.t1 to mysqltest_1@localhost;
+grant all privileges on test.t2 to mysqltest_1@localhost;
+show grants for current_user();
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT ALL PRIVILEGES ON `test`.`t2` TO 'mysqltest_1'@'localhost'
+GRANT ALL PRIVILEGES ON `test`.`t1` TO 'mysqltest_1'@'localhost'
+set time_zone= '+00:00';
+set time_zone= 'Europe/Moscow';
+select convert_tz('2004-11-31 12:00:00', 'Europe/Moscow', 'UTC');
+convert_tz('2004-11-31 12:00:00', 'Europe/Moscow', 'UTC')
+2004-12-01 09:00:00
+select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
+convert_tz(b, 'Europe/Moscow', 'UTC')
+update t1, t2 set t1.b = convert_tz('2004-11-30 12:00:00', 'Europe/Moscow', 'UTC')
+where t1.a = t2.c and t2.d = (select max(d) from t2);
+select * from mysql.time_zone_name;
+ERROR 42000: select command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
+select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name;
+ERROR 42000: select command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
+delete from mysql.user where user like 'mysqltest\_%';
+delete from mysql.db where user like 'mysqltest\_%';
+delete from mysql.tables_priv where user like 'mysqltest\_%';
+flush privileges;
+drop table t1, t2;
diff --git a/mysql-test/r/timezone3.result b/mysql-test/r/timezone3.result
index 2135dd33511..ec0b6045f93 100644
--- a/mysql-test/r/timezone3.result
+++ b/mysql-test/r/timezone3.result
@@ -36,6 +36,6 @@ create table t1 (ts timestamp);
insert into t1 values (19730101235900), (20040101235900);
select * from t1;
ts
-19730101235900
-20040101235900
+1973-01-01 23:59:00
+2004-01-01 23:59:00
drop table t1;
diff --git a/mysql-test/r/truncate.result b/mysql-test/r/truncate.result
index fef15533738..74a6cb72cc6 100644
--- a/mysql-test/r/truncate.result
+++ b/mysql-test/r/truncate.result
@@ -14,7 +14,7 @@ select * from t1;
a b c1
drop table t1;
select count(*) from t1;
-Table 'test.t1' doesn't exist
+ERROR 42S02: Table 'test.t1' doesn't exist
create temporary table t1 (n int);
insert into t1 values (1),(2),(3);
truncate table t1;
@@ -22,7 +22,7 @@ select * from t1;
n
drop table t1;
truncate non_existing_table;
-Table 'test.non_existing_table' doesn't exist
+ERROR 42S02: Table 'test.non_existing_table' doesn't exist
create table t1 (a integer auto_increment primary key);
insert into t1 (a) values (NULL),(NULL);
truncate table t1;
diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
index 685301f3639..8a0c74b3ae5 100644
--- a/mysql-test/r/type_blob.result
+++ b/mysql-test/r/type_blob.result
@@ -1,4 +1,36 @@
drop table if exists t1,t2,t3,t4,t5,t6,t7;
+CREATE TABLE t1 (a blob, b text, c blob(250), d text(70000), e text(70000000));
+show columns from t1;
+Field Type Null Key Default Extra
+a blob YES NULL
+b text YES NULL
+c blob YES NULL
+d mediumtext YES NULL
+e longtext YES NULL
+CREATE TABLE t2 (a char(257), b varbinary(70000), c varchar(70000000));
+Warnings:
+Warning 1246 Converting column 'a' from CHAR to TEXT
+Warning 1246 Converting column 'b' from CHAR to BLOB
+Warning 1246 Converting column 'c' from CHAR to TEXT
+show columns from t2;
+Field Type Null Key Default Extra
+a text YES NULL
+b mediumblob YES NULL
+c longtext YES NULL
+create table t3 (a long, b long byte);
+show create TABLE t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `a` mediumtext,
+ `b` mediumblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1,t2,t3
+#;
+CREATE TABLE t1 (a char(257) default "hello");
+ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB instead
+CREATE TABLE t2 (a blob default "hello");
+ERROR 42000: BLOB/TEXT column 'a' can't have a default value
+drop table if exists t1,t2;
create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr));
insert into t1 values (null,"a","A");
insert into t1 values (null,"bbb","BBB");
@@ -25,7 +57,7 @@ select * from t1;
a
Where
drop table t1;
-create table t1 (t text,c char(10),b blob, d char(10) binary);
+create table t1 (t text,c char(10),b blob, d binary(10));
insert into t1 values (NULL,NULL,NULL,NULL);
insert into t1 values ("","","","");
insert into t1 values ("hello","hello","hello","hello");
@@ -37,18 +69,18 @@ insert into t1 values (NULL,NULL,NULL,NULL);
update t1 set c="",b=null where c="1";
lock tables t1 READ;
show full fields from t1;
-Field Type Null Key Default Extra Privileges
-t text YES NULL select,insert,update,references
-c varchar(10) YES NULL select,insert,update,references
-b blob YES NULL select,insert,update,references
-d varchar(10) binary YES NULL select,insert,update,references
+Field Type Collation Null Key Default Extra Privileges Comment
+t text latin1_swedish_ci YES NULL select,insert,update,references
+c varchar(10) latin1_swedish_ci YES NULL select,insert,update,references
+b blob NULL YES NULL select,insert,update,references
+d varbinary(10) NULL YES NULL select,insert,update,references
lock tables t1 WRITE;
show full fields from t1;
-Field Type Null Key Default Extra Privileges
-t text YES NULL select,insert,update,references
-c varchar(10) YES NULL select,insert,update,references
-b blob YES NULL select,insert,update,references
-d varchar(10) binary YES NULL select,insert,update,references
+Field Type Collation Null Key Default Extra Privileges Comment
+t text latin1_swedish_ci YES NULL select,insert,update,references
+c varchar(10) latin1_swedish_ci YES NULL select,insert,update,references
+b blob NULL YES NULL select,insert,update,references
+d varbinary(10) NULL YES NULL select,insert,update,references
unlock tables;
select t from t1 where t like "hello";
t
@@ -98,6 +130,10 @@ select d from t1 having d like "%HELLO%";
d
HELLO
HELLO MY
+select d from t1 having d like "%HE%LLO%";
+d
+HELLO
+HELLO MY
select t from t1 order by t;
t
NULL
@@ -310,9 +346,17 @@ HELLO MY 1
a 1
hello 1
drop table t1;
-create table t1 (a text, key (a(300)));
-Incorrect sub part key. The used key part isn't a string, the used length is longer than the key part or the table handler doesn't support unique sub keys
-create table t1 (a text, key (a(255)));
+create table t1 (a text, unique (a(2100)));
+ERROR 42000: Specified key was too long; max key length is 1000 bytes
+create table t1 (a text, key (a(2100)));
+Warnings:
+Warning 1071 Specified key was too long; max key length is 1000 bytes
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` text,
+ KEY `a` (`a`(1000))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 (
t1_id bigint(21) NOT NULL auto_increment,
@@ -450,11 +494,30 @@ fish 10
drop table t1;
create table t1 (id integer auto_increment unique,imagem LONGBLOB not null);
insert into t1 (id) values (1);
+select
+charset(load_file('../../std_data/words.dat')),
+collation(load_file('../../std_data/words.dat')),
+coercibility(load_file('../../std_data/words.dat'));
+charset(load_file('../../std_data/words.dat')) collation(load_file('../../std_data/words.dat')) coercibility(load_file('../../std_data/words.dat'))
+binary binary 3
+explain extended select
+charset(load_file('../../std_data/words.dat')),
+collation(load_file('../../std_data/words.dat')),
+coercibility(load_file('../../std_data/words.dat'));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select sql_no_cache charset(load_file(_latin1'../../std_data/words.dat')) AS `charset(load_file('../../std_data/words.dat'))`,collation(load_file(_latin1'../../std_data/words.dat')) AS `collation(load_file('../../std_data/words.dat'))`,coercibility(load_file(_latin1'../../std_data/words.dat')) AS `coercibility(load_file('../../std_data/words.dat'))`
update t1 set imagem=load_file('../../std_data/words.dat') where id=1;
select if(imagem is null, "ERROR", "OK"),length(imagem) from t1 where id = 1;
if(imagem is null, "ERROR", "OK") length(imagem)
OK 581
drop table t1;
+create table t1 select load_file('../../std_data/words.dat');
+show full fields from t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+load_file('../../std_data/words.dat') longblob NULL YES NULL select,insert,update,references
+drop table t1;
create table t1 (id integer primary key auto_increment, txt text not null, unique index txt_index (txt (20)));
insert into t1 (txt) values ('Chevy'), ('Chevy ');
select * from t1 where txt='Chevy';
@@ -533,6 +596,9 @@ id txt
3 NULL
1 Chevy
2 Chevy
+explain select * from t1 where txt='Chevy' or txt is NULL;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range txt_index txt_index 23 NULL 2 Using where
select * from t1 where txt='Chevy ';
id txt
1 Chevy
@@ -600,9 +666,24 @@ id txt
1 Chevy
2 Chevy
4 Ford
+alter table t1 modify column txt blob;
+explain select * from t1 where txt='Chevy' or txt is NULL;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref_or_null txt_index txt_index 23 const 2 Using where
+select * from t1 where txt='Chevy' or txt is NULL;
+id txt
+1 Chevy
+3 NULL
+explain select * from t1 where txt='Chevy' or txt is NULL order by txt;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref_or_null txt_index txt_index 23 const 2 Using where; Using filesort
+select * from t1 where txt='Chevy' or txt is NULL order by txt;
+id txt
+3 NULL
+1 Chevy
drop table t1;
-CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, PRIMARY KEY (i), KEY (c(1),c(1)));
-INSERT t1 VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
+CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, d varchar(1) NOT NULL DEFAULT ' ', PRIMARY KEY (i), KEY (c(1),d));
+INSERT t1 (i, c) VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
select max(i) from t1 where c = '';
max(i)
4
diff --git a/mysql-test/r/type_blob.result.es b/mysql-test/r/type_blob.result.es
new file mode 100644
index 00000000000..a510eee8f38
--- /dev/null
+++ b/mysql-test/r/type_blob.result.es
@@ -0,0 +1,692 @@
+drop table if exists t1,t2,t3,t4,t5,t6,t7;
+CREATE TABLE t1 (a blob, b text, c blob(250), d text(70000), e text(70000000));
+show columns from t1;
+Field Type Null Key Default Extra
+a blob YES NULL
+b text YES NULL
+c blob YES NULL
+d mediumtext YES NULL
+e longtext YES NULL
+CREATE TABLE t2 (a char(257), b varbinary(70000), c varchar(70000000));
+Warnings:
+Warning 1246 Converting column 'a' from CHAR to TEXT
+Warning 1246 Converting column 'b' from CHAR to BLOB
+Warning 1246 Converting column 'c' from CHAR to TEXT
+show columns from t2;
+Field Type Null Key Default Extra
+a text YES NULL
+b mediumblob YES NULL
+c longtext YES NULL
+create table t3 (a long, b long byte);
+show create TABLE t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `a` mediumtext,
+ `b` mediumblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1,t2,t3
+#;
+CREATE TABLE t1 (a char(257) default "hello");
+ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB instead
+CREATE TABLE t2 (a blob default "hello");
+ERROR 42000: BLOB/TEXT column 'a' can't have a default value
+drop table if exists t1,t2;
+create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr));
+insert into t1 values (null,"a","A");
+insert into t1 values (null,"bbb","BBB");
+insert into t1 values (null,"ccc","CCC");
+select last_insert_id();
+last_insert_id()
+3
+select * from t1,t1 as t2;
+nr b str nr b str
+1 a A 1 a A
+2 bbb BBB 1 a A
+3 ccc CCC 1 a A
+1 a A 2 bbb BBB
+2 bbb BBB 2 bbb BBB
+3 ccc CCC 2 bbb BBB
+1 a A 3 ccc CCC
+2 bbb BBB 3 ccc CCC
+3 ccc CCC 3 ccc CCC
+drop table t1;
+create table t1 (a text);
+insert into t1 values ('where');
+update t1 set a='Where';
+select * from t1;
+a
+Where
+drop table t1;
+create table t1 (t text,c char(10),b blob, d binary(10));
+insert into t1 values (NULL,NULL,NULL,NULL);
+insert into t1 values ("","","","");
+insert into t1 values ("hello","hello","hello","hello");
+insert into t1 values ("HELLO","HELLO","HELLO","HELLO");
+insert into t1 values ("HELLO MY","HELLO MY","HELLO MY","HELLO MY");
+insert into t1 values ("a","a","a","a");
+insert into t1 values (1,1,1,1);
+insert into t1 values (NULL,NULL,NULL,NULL);
+update t1 set c="",b=null where c="1";
+lock tables t1 READ;
+show full fields from t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+t text latin1_swedish_ci YES NULL
+c varchar(10) latin1_swedish_ci YES NULL
+b blob NULL YES NULL
+d varbinary(10) NULL YES NULL
+lock tables t1 WRITE;
+show full fields from t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+t text latin1_swedish_ci YES NULL
+c varchar(10) latin1_swedish_ci YES NULL
+b blob NULL YES NULL
+d varbinary(10) NULL YES NULL
+unlock tables;
+select t from t1 where t like "hello";
+t
+hello
+HELLO
+select c from t1 where c like "hello";
+c
+hello
+HELLO
+select b from t1 where b like "hello";
+b
+hello
+select d from t1 where d like "hello";
+d
+hello
+select c from t1 having c like "hello";
+c
+hello
+HELLO
+select d from t1 having d like "hello";
+d
+hello
+select t from t1 where t like "%HELLO%";
+t
+hello
+HELLO
+HELLO MY
+select c from t1 where c like "%HELLO%";
+c
+hello
+HELLO
+HELLO MY
+select b from t1 where b like "%HELLO%";
+b
+HELLO
+HELLO MY
+select d from t1 where d like "%HELLO%";
+d
+HELLO
+HELLO MY
+select c from t1 having c like "%HELLO%";
+c
+hello
+HELLO
+HELLO MY
+select d from t1 having d like "%HELLO%";
+d
+HELLO
+HELLO MY
+select d from t1 having d like "%HE%LLO%";
+d
+HELLO
+HELLO MY
+select t from t1 order by t;
+t
+NULL
+NULL
+
+1
+a
+hello
+HELLO
+HELLO MY
+select c from t1 order by c;
+c
+NULL
+NULL
+
+
+a
+hello
+HELLO
+HELLO MY
+select b from t1 order by b;
+b
+NULL
+NULL
+NULL
+
+HELLO
+HELLO MY
+a
+hello
+select d from t1 order by d;
+d
+NULL
+NULL
+
+1
+HELLO
+HELLO MY
+a
+hello
+select distinct t from t1;
+t
+NULL
+
+hello
+HELLO MY
+a
+1
+select distinct b from t1;
+b
+NULL
+
+hello
+HELLO
+HELLO MY
+a
+select distinct t from t1 order by t;
+t
+NULL
+
+1
+a
+hello
+HELLO MY
+select distinct b from t1 order by b;
+b
+NULL
+
+HELLO
+HELLO MY
+a
+hello
+select t from t1 group by t;
+t
+NULL
+
+1
+a
+hello
+HELLO MY
+select b from t1 group by b;
+b
+NULL
+
+HELLO
+HELLO MY
+a
+hello
+set option sql_big_tables=1;
+select distinct t from t1;
+t
+NULL
+
+hello
+HELLO MY
+a
+1
+select distinct b from t1;
+b
+NULL
+
+hello
+HELLO
+HELLO MY
+a
+select distinct t from t1 order by t;
+t
+NULL
+
+1
+a
+hello
+HELLO MY
+select distinct b from t1 order by b;
+b
+NULL
+
+HELLO
+HELLO MY
+a
+hello
+select distinct c from t1;
+c
+NULL
+
+hello
+HELLO MY
+a
+select distinct d from t1;
+d
+NULL
+
+hello
+HELLO
+HELLO MY
+a
+1
+select distinct c from t1 order by c;
+c
+NULL
+
+a
+hello
+HELLO MY
+select distinct d from t1 order by d;
+d
+NULL
+
+1
+HELLO
+HELLO MY
+a
+hello
+select c from t1 group by c;
+c
+NULL
+
+a
+hello
+HELLO MY
+select d from t1 group by d;
+d
+NULL
+
+1
+HELLO
+HELLO MY
+a
+hello
+set option sql_big_tables=0;
+select distinct * from t1;
+t c b d
+NULL NULL NULL NULL
+
+hello hello hello hello
+HELLO HELLO HELLO HELLO
+HELLO MY HELLO MY HELLO MY HELLO MY
+a a a a
+1 NULL 1
+select t,count(*) from t1 group by t;
+t count(*)
+NULL 2
+ 1
+1 1
+a 1
+hello 2
+HELLO MY 1
+select b,count(*) from t1 group by b;
+b count(*)
+NULL 3
+ 1
+HELLO 1
+HELLO MY 1
+a 1
+hello 1
+select c,count(*) from t1 group by c;
+c count(*)
+NULL 2
+ 2
+a 1
+hello 2
+HELLO MY 1
+select d,count(*) from t1 group by d;
+d count(*)
+NULL 2
+ 1
+1 1
+HELLO 1
+HELLO MY 1
+a 1
+hello 1
+drop table t1;
+create table t1 (a text, unique (a(2100)));
+ERROR 42000: Specified key was too long; max key length is 1000 bytes
+create table t1 (a text, key (a(2100)));
+Warnings:
+Warning 1071 Specified key was too long; max key length is 1000 bytes
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` text,
+ KEY `a` (`a`(1000))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+CREATE TABLE t1 (
+t1_id bigint(21) NOT NULL auto_increment,
+_field_72 varchar(128) DEFAULT '' NOT NULL,
+_field_95 varchar(32),
+_field_115 tinyint(4) DEFAULT '0' NOT NULL,
+_field_122 tinyint(4) DEFAULT '0' NOT NULL,
+_field_126 tinyint(4),
+_field_134 tinyint(4),
+PRIMARY KEY (t1_id),
+UNIQUE _field_72 (_field_72),
+KEY _field_115 (_field_115),
+KEY _field_122 (_field_122)
+);
+INSERT INTO t1 VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3',0,1,NULL,NULL);
+INSERT INTO t1 VALUES (2,'hroberts','7415275a8c95952901e42b13a6b78566',0,1,NULL,NULL);
+INSERT INTO t1 VALUES (3,'guest','d41d8cd98f00b204e9800998ecf8427e',1,0,NULL,NULL);
+CREATE TABLE t2 (
+seq_0_id bigint(21) DEFAULT '0' NOT NULL,
+seq_1_id bigint(21) DEFAULT '0' NOT NULL,
+PRIMARY KEY (seq_0_id,seq_1_id)
+);
+INSERT INTO t2 VALUES (1,1);
+INSERT INTO t2 VALUES (2,1);
+INSERT INTO t2 VALUES (2,2);
+CREATE TABLE t3 (
+t3_id bigint(21) NOT NULL auto_increment,
+_field_131 varchar(128),
+_field_133 tinyint(4) DEFAULT '0' NOT NULL,
+_field_135 datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
+_field_137 tinyint(4),
+_field_139 datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
+_field_140 blob,
+_field_142 tinyint(4) DEFAULT '0' NOT NULL,
+_field_145 tinyint(4) DEFAULT '0' NOT NULL,
+_field_148 tinyint(4) DEFAULT '0' NOT NULL,
+PRIMARY KEY (t3_id),
+KEY _field_133 (_field_133),
+KEY _field_135 (_field_135),
+KEY _field_139 (_field_139),
+KEY _field_142 (_field_142),
+KEY _field_145 (_field_145),
+KEY _field_148 (_field_148)
+);
+INSERT INTO t3 VALUES (1,'test job 1',0,'0000-00-00 00:00:00',0,'1999-02-25 22:43:32','test\r\njob\r\n1',0,0,0);
+INSERT INTO t3 VALUES (2,'test job 2',0,'0000-00-00 00:00:00',0,'1999-02-26 21:08:04','',0,0,0);
+CREATE TABLE t4 (
+seq_0_id bigint(21) DEFAULT '0' NOT NULL,
+seq_1_id bigint(21) DEFAULT '0' NOT NULL,
+PRIMARY KEY (seq_0_id,seq_1_id)
+);
+INSERT INTO t4 VALUES (1,1);
+INSERT INTO t4 VALUES (2,1);
+CREATE TABLE t5 (
+t5_id bigint(21) NOT NULL auto_increment,
+_field_149 tinyint(4),
+_field_156 varchar(128) DEFAULT '' NOT NULL,
+_field_157 varchar(128) DEFAULT '' NOT NULL,
+_field_158 varchar(128) DEFAULT '' NOT NULL,
+_field_159 varchar(128) DEFAULT '' NOT NULL,
+_field_160 varchar(128) DEFAULT '' NOT NULL,
+_field_161 varchar(128) DEFAULT '' NOT NULL,
+PRIMARY KEY (t5_id),
+KEY _field_156 (_field_156),
+KEY _field_157 (_field_157),
+KEY _field_158 (_field_158),
+KEY _field_159 (_field_159),
+KEY _field_160 (_field_160),
+KEY _field_161 (_field_161)
+);
+INSERT INTO t5 VALUES (1,0,'tomato','','','','','');
+INSERT INTO t5 VALUES (2,0,'cilantro','','','','','');
+CREATE TABLE t6 (
+seq_0_id bigint(21) DEFAULT '0' NOT NULL,
+seq_1_id bigint(21) DEFAULT '0' NOT NULL,
+PRIMARY KEY (seq_0_id,seq_1_id)
+);
+INSERT INTO t6 VALUES (1,1);
+INSERT INTO t6 VALUES (1,2);
+INSERT INTO t6 VALUES (2,2);
+CREATE TABLE t7 (
+t7_id bigint(21) NOT NULL auto_increment,
+_field_143 tinyint(4),
+_field_165 varchar(32),
+_field_166 smallint(6) DEFAULT '0' NOT NULL,
+PRIMARY KEY (t7_id),
+KEY _field_166 (_field_166)
+);
+INSERT INTO t7 VALUES (1,0,'High',1);
+INSERT INTO t7 VALUES (2,0,'Medium',2);
+INSERT INTO t7 VALUES (3,0,'Low',3);
+select replace(t3._field_140, "\r","^M"),t3_id,min(t3._field_131), min(t3._field_135), min(t3._field_139), min(t3._field_137), min(link_alias_142._field_165), min(link_alias_133._field_72), min(t3._field_145), min(link_alias_148._field_156), replace(min(t3._field_140), "\r","^M"),t3.t3_id from t3 left join t4 on t4.seq_0_id = t3.t3_id left join t7 link_alias_142 on t4.seq_1_id = link_alias_142.t7_id left join t6 on t6.seq_0_id = t3.t3_id left join t1 link_alias_133 on t6.seq_1_id = link_alias_133.t1_id left join t2 on t2.seq_0_id = t3.t3_id left join t5 link_alias_148 on t2.seq_1_id = link_alias_148.t5_id where t3.t3_id in (1) group by t3.t3_id order by link_alias_142._field_166, _field_139, link_alias_133._field_72, _field_135, link_alias_148._field_156;
+replace(t3._field_140, "\r","^M") t3_id min(t3._field_131) min(t3._field_135) min(t3._field_139) min(t3._field_137) min(link_alias_142._field_165) min(link_alias_133._field_72) min(t3._field_145) min(link_alias_148._field_156) replace(min(t3._field_140), "\r","^M") t3_id
+test^M
+job^M
+1 1 test job 1 0000-00-00 00:00:00 1999-02-25 22:43:32 0 High admin 0 tomato test^M
+job^M
+1 1
+drop table t1,t2,t3,t4,t5,t6,t7;
+create table t1 (a blob);
+insert into t1 values ("empty"),("");
+select a,reverse(a) from t1;
+a reverse(a)
+empty ytpme
+
+drop table t1;
+create table t1 (a blob, key (a(10)));
+insert into t1 values ("bye"),("hello"),("hello"),("hello word");
+select * from t1 where a like "hello%";
+a
+hello
+hello
+hello word
+drop table t1;
+CREATE TABLE t1 (
+f1 int(11) DEFAULT '0' NOT NULL,
+f2 varchar(16) DEFAULT '' NOT NULL,
+f5 text,
+KEY index_name (f1,f2,f5(16))
+);
+INSERT INTO t1 VALUES (0,'traktor','1111111111111');
+INSERT INTO t1 VALUES (1,'traktor','1111111111111111111111111');
+select count(*) from t1 where f2='traktor';
+count(*)
+2
+drop table t1;
+create table t1 (foobar tinyblob not null, boggle smallint not null, key (foobar(32), boggle));
+insert into t1 values ('fish', 10),('bear', 20);
+select foobar, boggle from t1 where foobar = 'fish';
+foobar boggle
+fish 10
+select foobar, boggle from t1 where foobar = 'fish' and boggle = 10;
+foobar boggle
+fish 10
+drop table t1;
+create table t1 (id integer auto_increment unique,imagem LONGBLOB not null);
+insert into t1 (id) values (1);
+select
+charset(load_file('../../std_data/words.dat')),
+collation(load_file('../../std_data/words.dat')),
+coercibility(load_file('../../std_data/words.dat'));
+charset(load_file('../../std_data/words.dat')) collation(load_file('../../std_data/words.dat')) coercibility(load_file('../../std_data/words.dat'))
+NULL NULL 3
+explain extended select
+charset(load_file('../../std_data/words.dat')),
+collation(load_file('../../std_data/words.dat')),
+coercibility(load_file('../../std_data/words.dat'));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select sql_no_cache charset(load_file(_latin1'../../std_data/words.dat')) AS `charset(load_file('../../std_data/words.dat'))`,collation(load_file(_latin1'../../std_data/words.dat')) AS `collation(load_file('../../std_data/words.dat'))`,coercibility(load_file(_latin1'../../std_data/words.dat')) AS `coercibility(load_file('../../std_data/words.dat'))`
+update t1 set imagem=load_file('../../std_data/words.dat') where id=1;
+Warnings:
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'imagem' at row 1
+select if(imagem is null, "ERROR", "OK"),length(imagem) from t1 where id = 1;
+if(imagem is null, "ERROR", "OK") length(imagem)
+OK 0
+drop table t1;
+create table t1 select load_file('../../std_data/words.dat');
+show full fields from t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+load_file('../../std_data/words.dat') longblob NULL YES NULL
+drop table t1;
+create table t1 (id integer primary key auto_increment, txt text not null, unique index txt_index (txt (20)));
+insert into t1 (txt) values ('Chevy'), ('Chevy ');
+select * from t1 where txt='Chevy';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt='Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt='Chevy ' or txt='Chevy';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt='Chevy' or txt='Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where id='1' or id='2';
+id txt
+1 Chevy
+2 Chevy
+insert into t1 (txt) values('Ford');
+select * from t1 where txt='Chevy' or txt='Chevy ' or txt='Ford';
+id txt
+1 Chevy
+2 Chevy
+3 Ford
+select * from t1 where txt='Chevy' or txt='Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt='Chevy' or txt='Chevy ' or txt=' Chevy';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt in ('Chevy ','Chevy');
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt in ('Chevy');
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt between 'Chevy' and 'Chevy';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt between 'Chevy' and 'Chevy' or txt='Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt between 'Chevy' and 'Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt < 'Chevy ';
+id txt
+select * from t1 where txt <= 'Chevy';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt > 'Chevy';
+id txt
+3 Ford
+select * from t1 where txt >= 'Chevy';
+id txt
+1 Chevy
+2 Chevy
+3 Ford
+drop table t1;
+create table t1 (id integer primary key auto_increment, txt text, unique index txt_index (txt (20)));
+insert into t1 (txt) values ('Chevy'), ('Chevy '), (NULL);
+select * from t1 where txt='Chevy' or txt is NULL;
+id txt
+3 NULL
+1 Chevy
+2 Chevy
+explain select * from t1 where txt='Chevy' or txt is NULL;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range txt_index txt_index 23 NULL 2 Using where
+select * from t1 where txt='Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt='Chevy ' or txt='Chevy';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt='Chevy' or txt='Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where id='1' or id='2';
+id txt
+1 Chevy
+2 Chevy
+insert into t1 (txt) values('Ford');
+select * from t1 where txt='Chevy' or txt='Chevy ' or txt='Ford';
+id txt
+1 Chevy
+2 Chevy
+4 Ford
+select * from t1 where txt='Chevy' or txt='Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt='Chevy' or txt='Chevy ' or txt=' Chevy';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt in ('Chevy ','Chevy');
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt in ('Chevy');
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt between 'Chevy' and 'Chevy';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt between 'Chevy' and 'Chevy' or txt='Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt between 'Chevy' and 'Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt < 'Chevy ';
+id txt
+select * from t1 where txt < 'Chevy ' or txt is NULL;
+id txt
+3 NULL
+select * from t1 where txt <= 'Chevy';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt > 'Chevy';
+id txt
+4 Ford
+select * from t1 where txt >= 'Chevy';
+id txt
+1 Chevy
+2 Chevy
+4 Ford
+alter table t1 modify column txt blob;
+explain select * from t1 where txt='Chevy' or txt is NULL;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref_or_null txt_index txt_index 23 const 2 Using where
+select * from t1 where txt='Chevy' or txt is NULL;
+id txt
+1 Chevy
+3 NULL
+explain select * from t1 where txt='Chevy' or txt is NULL order by txt;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref_or_null txt_index txt_index 23 const 2 Using where; Using filesort
+select * from t1 where txt='Chevy' or txt is NULL order by txt;
+id txt
+3 NULL
+1 Chevy
+drop table t1;
+CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, d varchar(1) NOT NULL DEFAULT ' ', PRIMARY KEY (i), KEY (c(1),d));
+INSERT t1 (i, c) VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
+select max(i) from t1 where c = '';
+max(i)
+4
+drop table t1;
diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result
index 5ec2c9e0434..71d1b9ad381 100644
--- a/mysql-test/r/type_date.result
+++ b/mysql-test/r/type_date.result
@@ -1,3 +1,4 @@
+drop table if exists t1,t2;
create table t1 (a char(16), b date, c datetime);
insert into t1 SET a='test 2000-01-01', b='2000-01-01', c='2000-01-01';
select * from t1 where c = '2000-01-01';
@@ -7,7 +8,6 @@ select * from t1 where b = '2000-01-01';
a b c
test 2000-01-01 2000-01-01 2000-01-01 00:00:00
drop table t1;
-drop table if exists t1,t2;
CREATE TABLE t1 (name char(6),cdate date);
INSERT INTO t1 VALUES ('name1','1998-01-01');
INSERT INTO t1 VALUES ('name2','1998-01-01');
@@ -73,7 +73,7 @@ SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.
DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT))
Wed, 06 March 2002 10:11:12 GMT-0800 Wed, 06 March 2002 10:11:12 GMT-0800
drop table t1,t2;
-CREATE TABLE t1 (f1 time default NULL, f2 time default NULL) TYPE=MyISAM;
+CREATE TABLE t1 (f1 time default NULL, f2 time default NULL);
INSERT INTO t1 (f1, f2) VALUES ('09:00', '12:00');
SELECT DATE_FORMAT(f1, "%l.%i %p") , DATE_FORMAT(f2, "%l.%i %p") FROM t1;
DATE_FORMAT(f1, "%l.%i %p") DATE_FORMAT(f2, "%l.%i %p")
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
index 756deab80e0..127a54e087b 100644
--- a/mysql-test/r/type_datetime.result
+++ b/mysql-test/r/type_datetime.result
@@ -1,6 +1,6 @@
drop table if exists t1;
create table t1 (t datetime);
-insert into t1 values(101),(691231),(700101),(991231),(10000101),(99991231),(101000000),(691231000000),(700101000000),(991231235959),(10000101000000),(99991231235959),(20030102030460),(20030102036301),(20030102240401),(20030132030401),(20031302030460);
+insert into t1 values (101),(691231),(700101),(991231),(10000101),(99991231),(101000000),(691231000000),(700101000000),(991231235959),(10000101000000),(99991231235959),(20030100000000),(20030000000000);
select * from t1;
t
2000-01-01 00:00:00
@@ -15,11 +15,8 @@ t
1999-12-31 23:59:59
1000-01-01 00:00:00
9999-12-31 23:59:59
-0000-00-00 00:00:00
-0000-00-00 00:00:00
-0000-00-00 00:00:00
-0000-00-00 00:00:00
-0000-00-00 00:00:00
+2003-01-00 00:00:00
+2003-00-00 00:00:00
delete from t1 where t > 0;
optimize table t1;
Table Op Msg_type Msg_text
@@ -28,7 +25,7 @@ check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
delete from t1;
-insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959"),("20030102030460"),("20030102036301"),("20030102240401"),("20030132030401"),("20031302030460");
+insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959"),("20030100000000"),("20030000000000");
select * from t1;
t
2000-01-01 00:00:00
@@ -44,16 +41,13 @@ t
1999-12-31 23:59:59
1000-01-01 00:00:00
9999-12-31 23:59:59
-0000-00-00 00:00:00
-0000-00-00 00:00:00
-0000-00-00 00:00:00
-0000-00-00 00:00:00
-0000-00-00 00:00:00
+2003-01-00 00:00:00
+2003-00-00 00:00:00
drop table t1;
CREATE TABLE t1 (a timestamp, b date, c time, d datetime);
insert into t1 (b,c,d) values(now(),curtime(),now());
-select date_format(a,"%Y-%m-%d")=b,right(a,6)=c+0,a=d+0 from t1;
-date_format(a,"%Y-%m-%d")=b right(a,6)=c+0 a=d+0
+select date_format(a,"%Y-%m-%d")=b,right(a+0,6)=c+0,a=d+0 from t1;
+date_format(a,"%Y-%m-%d")=b right(a+0,6)=c+0 a=d+0
1 1 1
drop table t1;
CREATE TABLE t1 (a datetime not null);
@@ -82,7 +76,7 @@ CREATE TABLE `t1` (
PRIMARY KEY (`numfacture`),
KEY `date` (`date`),
KEY `expedition` (`expedition`)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 (expedition) VALUES ('0001-00-00 00:00:00');
SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00';
date numfacture expedition
@@ -93,8 +87,8 @@ date numfacture expedition
0000-00-00 00:00:00 0 0001-00-00 00:00:00
0000-00-00 00:00:00 1212 0001-00-00 00:00:00
EXPLAIN SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00';
-table type possible_keys key key_len ref rows Extra
-t1 ref expedition expedition 8 const 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref expedition expedition 8 const 1 Using where
drop table t1;
create table t1 (a datetime not null, b datetime not null);
insert into t1 values (now(), now());
@@ -102,3 +96,50 @@ insert into t1 values (now(), now());
select * from t1 where a is null or b is null;
a b
drop table t1;
+create table t1 (t datetime);
+insert into t1 values (20030102030460),(20030102036301),(20030102240401),
+(20030132030401),(20031302030401),(100001202030401);
+Warnings:
+Warning 1265 Data truncated for column 't' at row 1
+Warning 1265 Data truncated for column 't' at row 2
+Warning 1265 Data truncated for column 't' at row 3
+Warning 1265 Data truncated for column 't' at row 4
+Warning 1265 Data truncated for column 't' at row 5
+Warning 1265 Data truncated for column 't' at row 6
+select * from t1;
+t
+0000-00-00 00:00:00
+0000-00-00 00:00:00
+0000-00-00 00:00:00
+0000-00-00 00:00:00
+0000-00-00 00:00:00
+0000-00-00 00:00:00
+delete from t1;
+insert into t1 values
+("2003-01-02 03:04:60"),("2003-01-02 03:63:01"),("2003-01-02 24:04:01"),
+("2003-01-32 03:04:01"),("2003-13-02 03:04:01"), ("10000-12-02 03:04:00");
+Warnings:
+Warning 1264 Data truncated; out of range for column 't' at row 1
+Warning 1264 Data truncated; out of range for column 't' at row 2
+Warning 1264 Data truncated; out of range for column 't' at row 3
+Warning 1264 Data truncated; out of range for column 't' at row 4
+Warning 1264 Data truncated; out of range for column 't' at row 5
+Warning 1264 Data truncated; out of range for column 't' at row 6
+select * from t1;
+t
+0000-00-00 00:00:00
+0000-00-00 00:00:00
+0000-00-00 00:00:00
+0000-00-00 00:00:00
+0000-00-00 00:00:00
+0000-00-00 00:00:00
+delete from t1;
+insert into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00 some trailer");
+Warnings:
+Warning 1264 Data truncated; out of range for column 't' at row 1
+Warning 1264 Data truncated; out of range for column 't' at row 2
+select * from t1;
+t
+0000-00-00 00:00:00
+2003-01-01 00:00:00
+drop table t1;
diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result
index 600d8639ad5..a9dcabd121e 100644
--- a/mysql-test/r/type_decimal.result
+++ b/mysql-test/r/type_decimal.result
@@ -1,4 +1,5 @@
DROP TABLE IF EXISTS t1;
+SET SQL_WARNINGS=1;
CREATE TABLE t1 (
id int(11) NOT NULL auto_increment,
datatype_id int(11) DEFAULT '0' NOT NULL,
@@ -156,8 +157,18 @@ insert into t1 values ("-.1"),("+.1"),(".1");
insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001");
insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
+Warnings:
+Warning 1264 Data truncated; out of range for column 'a' at row 1
+Warning 1264 Data truncated; out of range for column 'a' at row 2
+Warning 1264 Data truncated; out of range for column 'a' at row 3
insert into t1 values ("1e+1000"),("1e-1000"),("-1e+1000");
+Warnings:
+Warning 1264 Data truncated; out of range for column 'a' at row 1
+Warning 1265 Data truncated for column 'a' at row 2
+Warning 1264 Data truncated; out of range for column 'a' at row 3
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 3
select * from t1;
a
0.00
@@ -189,12 +200,33 @@ a
drop table t1;
create table t1 (a decimal(10,2) unsigned);
insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
+Warnings:
+Warning 1264 Data truncated; out of range for column 'a' at row 2
+Warning 1264 Data truncated; out of range for column 'a' at row 6
insert into t1 values ("-.1"),("+.1"),(".1");
+Warnings:
+Warning 1264 Data truncated; out of range for column 'a' at row 1
insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001");
+Warnings:
+Warning 1264 Data truncated; out of range for column 'a' at row 3
insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
+Warnings:
+Warning 1264 Data truncated; out of range for column 'a' at row 1
+Warning 1264 Data truncated; out of range for column 'a' at row 2
+Warning 1264 Data truncated; out of range for column 'a' at row 3
insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
+Warnings:
+Warning 1264 Data truncated; out of range for column 'a' at row 1
+Warning 1264 Data truncated; out of range for column 'a' at row 2
+Warning 1264 Data truncated; out of range for column 'a' at row 3
insert into t1 values ("1e+1000"),("1e-1000"),("-1e+1000");
+Warnings:
+Warning 1264 Data truncated; out of range for column 'a' at row 1
+Warning 1265 Data truncated for column 'a' at row 2
+Warning 1264 Data truncated; out of range for column 'a' at row 3
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 3
select * from t1;
a
0.00
@@ -226,12 +258,33 @@ a
drop table t1;
create table t1 (a decimal(10,2) zerofill);
insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
+Warnings:
+Warning 1264 Data truncated; out of range for column 'a' at row 2
+Warning 1264 Data truncated; out of range for column 'a' at row 6
insert into t1 values ("-.1"),("+.1"),(".1");
+Warnings:
+Warning 1264 Data truncated; out of range for column 'a' at row 1
insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001");
+Warnings:
+Warning 1264 Data truncated; out of range for column 'a' at row 3
insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
+Warnings:
+Warning 1264 Data truncated; out of range for column 'a' at row 1
+Warning 1264 Data truncated; out of range for column 'a' at row 2
+Warning 1264 Data truncated; out of range for column 'a' at row 3
insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
+Warnings:
+Warning 1264 Data truncated; out of range for column 'a' at row 1
+Warning 1264 Data truncated; out of range for column 'a' at row 2
+Warning 1264 Data truncated; out of range for column 'a' at row 3
insert into t1 values ("1e+1000"),("1e-1000"),("-1e+1000");
+Warnings:
+Warning 1264 Data truncated; out of range for column 'a' at row 1
+Warning 1265 Data truncated for column 'a' at row 2
+Warning 1264 Data truncated; out of range for column 'a' at row 3
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 3
select * from t1;
a
00000000.00
@@ -267,7 +320,14 @@ insert into t1 values (-.1),(+.1),(.1);
insert into t1 values (00000000000001),(+0000000000001),(-0000000000001);
insert into t1 values (+111111111.11),(111111111.11),(-11111111.11);
insert into t1 values (-111111111.11),(+1111111111.11),(1111111111.11);
+Warnings:
+Warning 1264 Data truncated; out of range for column 'a' at row 1
+Warning 1264 Data truncated; out of range for column 'a' at row 2
+Warning 1264 Data truncated; out of range for column 'a' at row 3
insert into t1 values (1e+100),(1e-100),(-1e+100);
+Warnings:
+Warning 1264 Data truncated; out of range for column 'a' at row 1
+Warning 1264 Data truncated; out of range for column 'a' at row 3
insert into t1 values (123.4e0),(123.4e+2),(123.4e-2),(123e1),(123e+0);
select * from t1;
a
@@ -300,6 +360,9 @@ a
drop table t1;
create table t1 (a decimal);
insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+12345678901'),(99999999999999);
+Warnings:
+Warning 1264 Data truncated; out of range for column 'a' at row 1
+Warning 1264 Data truncated; out of range for column 'a' at row 7
select * from t1;
a
-9999999999
@@ -312,6 +375,10 @@ a
drop table t1;
create table t1 (a decimal unsigned);
insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
+Warnings:
+Warning 1264 Data truncated; out of range for column 'a' at row 1
+Warning 1264 Data truncated; out of range for column 'a' at row 2
+Warning 1264 Data truncated; out of range for column 'a' at row 7
select * from t1;
a
0
@@ -324,6 +391,10 @@ a
drop table t1;
create table t1 (a decimal zerofill);
insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
+Warnings:
+Warning 1264 Data truncated; out of range for column 'a' at row 1
+Warning 1264 Data truncated; out of range for column 'a' at row 2
+Warning 1264 Data truncated; out of range for column 'a' at row 7
select * from t1;
a
0000000000
@@ -336,6 +407,10 @@ a
drop table t1;
create table t1 (a decimal unsigned zerofill);
insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
+Warnings:
+Warning 1264 Data truncated; out of range for column 'a' at row 1
+Warning 1264 Data truncated; out of range for column 'a' at row 2
+Warning 1264 Data truncated; out of range for column 'a' at row 7
select * from t1;
a
0000000000
@@ -348,27 +423,33 @@ a
drop table t1;
create table t1(a decimal(10,0));
insert into t1 values ("1e4294967295");
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+Warning 1264 Data truncated; out of range for column 'a' at row 1
select * from t1;
a
99999999999
delete from t1;
insert into t1 values("1e4294967297");
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+Warning 1264 Data truncated; out of range for column 'a' at row 1
select * from t1;
a
99999999999
drop table t1;
CREATE TABLE t1 (a_dec DECIMAL(-1,0));
-Too big column length for column 'a_dec' (max = 255). Use BLOB instead
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1,0))' at line 1
CREATE TABLE t1 (a_dec DECIMAL(-2,1));
-Too big column length for column 'a_dec' (max = 255). Use BLOB instead
+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 '-2,1))' at line 1
CREATE TABLE t1 (a_dec DECIMAL(-1,1));
-Too big column length for column 'a_dec' (max = 255). Use BLOB instead
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1,1))' at line 1
CREATE TABLE t1 (a_dec DECIMAL(0,11));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a_dec` decimal(12,11) default NULL
-) TYPE=MyISAM
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
create table t1(a decimal(7,3));
insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000000001'),('10'),('+10'),('-10'),('0000000010'),('+0000000010'),('-0000000010'),('100'),('+100'),('-100'),('0000000100'),('+0000000100'),('-0000000100'),('1000'),('+1000'),('-1000'),('0000001000'),('+0000001000'),('-0000001000'),('10000'),('+10000'),('-10000'),('0000010000'),('+0000010000'),('-0000010000'),('100000'),('+100000'),('-100000'),('0000100000'),('+0000100000'),('-0000100000'),('1000000'),('+1000000'),('-1000000'),('0001000000'),('+0001000000'),('-0001000000'),('10000000'),('+10000000'),('-10000000'),('0010000000'),('+0010000000'),('-0010000000'),('100000000'),('+100000000'),('-100000000'),('0100000000'),('+0100000000'),('-0100000000'),('1000000000'),('+1000000000'),('-1000000000'),('1000000000'),('+1000000000'),('-1000000000');
diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result
index 03cfdc3c286..14d3443bda9 100644
--- a/mysql-test/r/type_enum.result
+++ b/mysql-test/r/type_enum.result
@@ -1627,22 +1627,121 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` enum('','a','b') NOT NULL default ''
-) TYPE=MyISAM
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a enum (' ','a','b ') not null default 'b ');
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` enum('','a','b') NOT NULL default 'b'
-) TYPE=MyISAM
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a enum ('0','1'));
insert into t1 set a='foobar';
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
select * from t1;
a
update t1 set a = replace(a,'x','y');
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
select * from t1;
a
drop table t1;
+set names latin1;
+create table t1 (a enum(0xE4, '1', '2') not null default 0xE4);
+show columns from t1;
+Field Type Null Key Default Extra
+a enum('ä','1','2') ä
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` enum('ä','1','2') NOT NULL default 'ä'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+set names latin1;
+CREATE TABLE t1 (
+a INT default 1,
+b ENUM('value','öäü_value','ÊÃÕ') character set latin1 NOT NULL
+);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) default '1',
+ `b` enum('value','öäü_value','ÊÃÕ') NOT NULL default 'value'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+show columns from t1;
+Field Type Null Key Default Extra
+a int(11) YES 1
+b enum('value','öäü_value','ÊÃÕ') value
+drop table t1;
+CREATE TABLE t1 (c enum('a', 'A') BINARY);
+INSERT INTO t1 VALUES ('a'),('A');
+SELECT * FROM t1;
+c
+a
+A
+DROP TABLE t1;
+CREATE TABLE t1 (c enum('ae','oe','ue','ss') collate latin1_german2_ci);
+INSERT INTO t1 VALUES ('ä'),('ö'),('ü'),('ß');
+SELECT * FROM t1;
+c
+ae
+oe
+ue
+ss
+DROP TABLE t1;
+CREATE TABLE t1 (
+a ENUM('ä','ö','ü') character set utf8 default 'ü'
+);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` enum('ä','ö','ü') character set utf8 default 'ü'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values ('ä'), ('ö'), ('ü');
+select a from t1 order by a;
+a
+drop table t1;
+set names utf8;
+CREATE TABLE t1 (
+a ENUM('À','ö','Ì') character set latin1 default 'Ì'
+);
+insert into t1 values ('À'),('ö'),('Ì');
+set names latin1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` enum('ä','ö','ü') default 'ü'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select a from t1 order by a;
+a
+drop table t1;
+create table t1 (a enum ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin);
+insert into t1 values ('Y');
+alter table t1 add b set ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin;
+alter table t1 add c enum ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin;
+select * from t1;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t1 t1 a a 254 1 1 Y 384 0 8
+def test t1 t1 b b 254 3 0 Y 2176 0 8
+def test t1 t1 c c 254 1 0 Y 384 0 8
+a b c
+Y NULL NULL
+drop table t1;
+create table t1 (a enum('x','y') default 'x');
+alter table t1 alter a set default 'z';
+ERROR 42000: Invalid default value for 'a'
+drop table t1;
+create table t1 (a set('x','y') default 'x');
+alter table t1 alter a set default 'z';
+ERROR 42000: Invalid default value for 'a'
+drop table t1;
diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result
index f4c5df353a3..2f996382586 100644
--- a/mysql-test/r/type_float.result
+++ b/mysql-test/r/type_float.result
@@ -1,3 +1,4 @@
+drop table if exists t1;
SELECT 10,10.0,10.,.1e+2,100.0e-1;
10 10.0 10. .1e+2 100.0e-1
10 10.0 10 10 10
@@ -7,26 +8,28 @@ SELECT 6e-05, -6e-05, --6e-05, -6e-05+1.000000;
SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1;
1e1 1.e1 1.0e1 1e+1 1.e+1 1.0e+1 1e-1 1.e-1 1.0e-1
10 10 10 10 10 10 0.1 0.1 0.1
-drop table if exists t1;
create table t1 (f1 float(24),f2 float(52));
show full columns from t1;
-Field Type Null Key Default Extra Privileges
-f1 float YES NULL select,insert,update,references
-f2 double YES NULL select,insert,update,references
+Field Type Collation Null Key Default Extra Privileges Comment
+f1 float NULL YES NULL select,insert,update,references
+f2 double NULL YES NULL select,insert,update,references
insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150);
+Warnings:
+Warning 1264 Data truncated; out of range for column 'f1' at row 7
+Warning 1264 Data truncated; out of range for column 'f1' at row 8
insert into t1 values(-10,-10),(1e-5,1e-5),(1e-10,1e-10),(1e-15,1e-15),(1e-20,1e-20),(1e-50,1e-50),(1e-150,1e-150);
select * from t1;
f1 f2
10 10
100000 100000
-1.23457e+09 1234567890
+1.23457e+9 1234567890
1e+10 10000000000
1e+15 1e+15
1e+20 1e+20
3.40282e+38 1e+50
3.40282e+38 1e+150
-10 -10
-1e-05 1e-05
+1e-5 1e-5
1e-10 1e-10
1e-15 1e-15
1e-20 1e-20
@@ -83,23 +86,29 @@ t2 CREATE TABLE `t2` (
`col2` double(22,5) default NULL,
`col3` double default NULL,
`col4` double default NULL
-) TYPE=MyISAM
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1,t2;
+create table t1 (a float);
+insert into t1 values (1);
+select max(a),min(a),avg(a) from t1;
+max(a) min(a) avg(a)
+1 1 1
+drop table t1;
create table t1 (f float, f2 float(24), f3 float(6,2), d double, d2 float(53), d3 double(10,3), de decimal, de2 decimal(6), de3 decimal(5,2), n numeric, n2 numeric(8), n3 numeric(5,6));
show full columns from t1;
-Field Type Null Key Default Extra Privileges
-f float YES NULL select,insert,update,references
-f2 float YES NULL select,insert,update,references
-f3 float(6,2) YES NULL select,insert,update,references
-d double YES NULL select,insert,update,references
-d2 double YES NULL select,insert,update,references
-d3 double(10,3) YES NULL select,insert,update,references
-de decimal(10,0) YES NULL select,insert,update,references
-de2 decimal(6,0) YES NULL select,insert,update,references
-de3 decimal(5,2) YES NULL select,insert,update,references
-n decimal(10,0) YES NULL select,insert,update,references
-n2 decimal(8,0) YES NULL select,insert,update,references
-n3 decimal(7,6) YES NULL select,insert,update,references
+Field Type Collation Null Key Default Extra Privileges Comment
+f float NULL YES NULL select,insert,update,references
+f2 float NULL YES NULL select,insert,update,references
+f3 float(6,2) NULL YES NULL select,insert,update,references
+d double NULL YES NULL select,insert,update,references
+d2 double NULL YES NULL select,insert,update,references
+d3 double(10,3) NULL YES NULL select,insert,update,references
+de decimal(10,0) NULL YES NULL select,insert,update,references
+de2 decimal(6,0) NULL YES NULL select,insert,update,references
+de3 decimal(5,2) NULL YES NULL select,insert,update,references
+n decimal(10,0) NULL YES NULL select,insert,update,references
+n2 decimal(8,0) NULL YES NULL select,insert,update,references
+n3 decimal(7,6) NULL YES NULL select,insert,update,references
drop table t1;
create table t1 (a decimal(7,3) not null, key (a));
insert into t1 values ("0"),("-0.00"),("-0.01"),("-0.002"),("1");
@@ -114,9 +123,23 @@ select min(a) from t1;
min(a)
-0.010
drop table t1;
+create table t1 (a float(200,100), b double(200,100));
+insert t1 values (1.0, 2.0);
+select * from t1;
+a b
+1.000000000000000000000000000000 2.000000000000000000000000000000
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` float(200,30) default NULL,
+ `b` double(200,30) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
create table t1 (c20 char);
-insert into t1 (c20) values (5000.0);
+insert into t1 values (5000.0);
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
drop table t1;
create table t1 (f float(54));
-Incorrect column specifier for column 'f'
+ERROR 42000: Incorrect column specifier for column 'f'
drop table if exists t1;
diff --git a/mysql-test/r/type_float.result.es b/mysql-test/r/type_float.result.es
new file mode 100644
index 00000000000..4bfe644d7fb
--- /dev/null
+++ b/mysql-test/r/type_float.result.es
@@ -0,0 +1,145 @@
+drop table if exists t1;
+SELECT 10,10.0,10.,.1e+2,100.0e-1;
+10 10.0 10. .1e+2 100.0e-1
+10 10.0 10 10 10
+SELECT 6e-05, -6e-05, --6e-05, -6e-05+1.000000;
+6e-05 -6e-05 --6e-05 -6e-05+1.000000
+6e-05 -6e-05 6e-05 0.99994
+SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1;
+1e1 1.e1 1.0e1 1e+1 1.e+1 1.0e+1 1e-1 1.e-1 1.0e-1
+10 10 10 10 10 10 0.1 0.1 0.1
+create table t1 (f1 float(24),f2 float(52));
+show full columns from t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+f1 float NULL YES NULL
+f2 double NULL YES NULL
+insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150);
+Warnings:
+Warning 1264 Data truncated; out of range for column 'f1' at row 7
+Warning 1264 Data truncated; out of range for column 'f1' at row 8
+insert into t1 values(-10,-10),(1e-5,1e-5),(1e-10,1e-10),(1e-15,1e-15),(1e-20,1e-20),(1e-50,1e-50),(1e-150,1e-150);
+select * from t1;
+f1 f2
+10 10
+100000 100000
+1.23457e+9 1234567890
+1e+10 10000000000
+1e+15 1e+15
+1e+20 1e+20
+3.40282e+38 1e+50
+3.40282e+38 1e+150
+-10 -10
+1e-5 1e-5
+1e-10 1e-10
+1e-15 1e-15
+1e-20 1e-20
+0 1e-50
+0 1e-150
+drop table t1;
+create table t1 (datum double);
+insert into t1 values (0.5),(1.0),(1.5),(2.0),(2.5);
+select * from t1;
+datum
+0.5
+1
+1.5
+2
+2.5
+select * from t1 where datum < 1.5;
+datum
+0.5
+1
+select * from t1 where datum > 1.5;
+datum
+2
+2.5
+select * from t1 where datum = 1.5;
+datum
+1.5
+drop table t1;
+create table t1 (a decimal(7,3) not null, key (a));
+insert into t1 values ("0"),("-0.00"),("-0.01"),("-0.002"),("1");
+select a from t1 order by a;
+a
+-0.010
+-0.002
+-0.000
+0.000
+1.000
+select min(a) from t1;
+min(a)
+-0.010
+drop table t1;
+create table t1 (c1 double, c2 varchar(20));
+insert t1 values (121,"16");
+select c1 + c1 * (c2 / 100) as col from t1;
+col
+140.36
+create table t2 select c1 + c1 * (c2 / 100) as col1, round(c1, 5) as col2, round(c1, 35) as col3, sqrt(c1*1e-15) col4 from t1;
+select * from t2;
+col1 col2 col3 col4
+140.36 121.00000 121 3.47850542618522e-07
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `col1` double default NULL,
+ `col2` double(22,5) default NULL,
+ `col3` double default NULL,
+ `col4` double default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1,t2;
+create table t1 (a float);
+insert into t1 values (1);
+select max(a),min(a),avg(a) from t1;
+max(a) min(a) avg(a)
+1 1 1
+drop table t1;
+create table t1 (f float, f2 float(24), f3 float(6,2), d double, d2 float(53), d3 double(10,3), de decimal, de2 decimal(6), de3 decimal(5,2), n numeric, n2 numeric(8), n3 numeric(5,6));
+show full columns from t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+f float NULL YES NULL
+f2 float NULL YES NULL
+f3 float(6,2) NULL YES NULL
+d double NULL YES NULL
+d2 double NULL YES NULL
+d3 double(10,3) NULL YES NULL
+de decimal(10,0) NULL YES NULL
+de2 decimal(6,0) NULL YES NULL
+de3 decimal(5,2) NULL YES NULL
+n decimal(10,0) NULL YES NULL
+n2 decimal(8,0) NULL YES NULL
+n3 decimal(7,6) NULL YES NULL
+drop table t1;
+create table t1 (a decimal(7,3) not null, key (a));
+insert into t1 values ("0"),("-0.00"),("-0.01"),("-0.002"),("1");
+select a from t1 order by a;
+a
+-0.010
+-0.002
+-0.000
+0.000
+1.000
+select min(a) from t1;
+min(a)
+-0.010
+drop table t1;
+create table t1 (a float(200,100), b double(200,100));
+insert t1 values (1.0, 2.0);
+select * from t1;
+a b
+1.000000000000000000000000000000 2.000000000000000000000000000000
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` float(200,30) default NULL,
+ `b` double(200,30) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (c20 char);
+insert into t1 values (5000.0);
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+drop table t1;
+create table t1 (f float(54));
+ERROR 42000: Incorrect column specifier for column 'f'
+drop table if exists t1;
diff --git a/mysql-test/r/type_nchar.result b/mysql-test/r/type_nchar.result
new file mode 100644
index 00000000000..f844b3b0241
--- /dev/null
+++ b/mysql-test/r/type_nchar.result
@@ -0,0 +1,50 @@
+drop table if exists t1;
+create table t1 (c nchar(10));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` char(10) character set utf8 default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (c national char(10));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` char(10) character set utf8 default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (c national varchar(10));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` varchar(10) character set utf8 default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (c nvarchar(10));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` varchar(10) character set utf8 default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (c nchar varchar(10));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` varchar(10) character set utf8 default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (c national character varying(10));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` varchar(10) character set utf8 default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (c nchar varying(10));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` varchar(10) character set utf8 default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result
index 4f4b4eb43eb..5a65c90c5c7 100644
--- a/mysql-test/r/type_ranges.result
+++ b/mysql-test/r/type_ranges.result
@@ -1,4 +1,5 @@
drop table if exists t1,t2,t3;
+SET SQL_WARNINGS=1;
CREATE TABLE t1 (
auto int(5) unsigned NOT NULL auto_increment,
string char(10) default "hello",
@@ -38,31 +39,31 @@ KEY (ulonglong,ulong),
KEY (options,flags)
);
show full fields from t1;
-Field Type Null Key Default Extra Privileges
-auto int(5) unsigned PRI NULL auto_increment select,insert,update,references
-string varchar(10) YES hello select,insert,update,references
-tiny tinyint(4) MUL 0 select,insert,update,references
-short smallint(6) MUL 1 select,insert,update,references
-medium mediumint(8) MUL 0 select,insert,update,references
-long_int int(11) 0 select,insert,update,references
-longlong bigint(13) MUL 0 select,insert,update,references
-real_float float(13,1) MUL 0.0 select,insert,update,references
-real_double double(16,4) YES NULL select,insert,update,references
-utiny tinyint(3) unsigned MUL 0 select,insert,update,references
-ushort smallint(5) unsigned zerofill MUL 00000 select,insert,update,references
-umedium mediumint(8) unsigned MUL 0 select,insert,update,references
-ulong int(11) unsigned MUL 0 select,insert,update,references
-ulonglong bigint(13) unsigned MUL 0 select,insert,update,references
-time_stamp timestamp(14) YES NULL select,insert,update,references
-date_field date YES NULL select,insert,update,references
-time_field time YES NULL select,insert,update,references
-date_time datetime YES NULL select,insert,update,references
-blob_col blob YES NULL select,insert,update,references
-tinyblob_col tinyblob YES NULL select,insert,update,references
-mediumblob_col mediumblob select,insert,update,references
-longblob_col longblob select,insert,update,references
-options enum('one','two','tree') MUL one select,insert,update,references
-flags set('one','two','tree') select,insert,update,references
+Field Type Collation Null Key Default Extra Privileges Comment
+auto int(5) unsigned NULL PRI NULL auto_increment select,insert,update,references
+string varchar(10) latin1_swedish_ci YES hello select,insert,update,references
+tiny tinyint(4) NULL MUL 0 select,insert,update,references
+short smallint(6) NULL MUL 1 select,insert,update,references
+medium mediumint(8) NULL MUL 0 select,insert,update,references
+long_int int(11) NULL 0 select,insert,update,references
+longlong bigint(13) NULL MUL 0 select,insert,update,references
+real_float float(13,1) NULL MUL 0.0 select,insert,update,references
+real_double double(16,4) NULL YES NULL select,insert,update,references
+utiny tinyint(3) unsigned NULL MUL 0 select,insert,update,references
+ushort smallint(5) unsigned zerofill NULL MUL 00000 select,insert,update,references
+umedium mediumint(8) unsigned NULL MUL 0 select,insert,update,references
+ulong int(11) unsigned NULL MUL 0 select,insert,update,references
+ulonglong bigint(13) unsigned NULL MUL 0 select,insert,update,references
+time_stamp timestamp NULL YES CURRENT_TIMESTAMP select,insert,update,references
+date_field date NULL YES NULL select,insert,update,references
+time_field time NULL YES NULL select,insert,update,references
+date_time datetime NULL YES NULL select,insert,update,references
+blob_col blob NULL YES NULL select,insert,update,references
+tinyblob_col tinyblob NULL YES NULL select,insert,update,references
+mediumblob_col mediumblob NULL select,insert,update,references
+longblob_col longblob NULL select,insert,update,references
+options enum('one','two','tree') latin1_swedish_ci MUL one select,insert,update,references
+flags set('one','two','tree') latin1_swedish_ci select,insert,update,references
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 0 PRIMARY 1 auto A 0 NULL NULL BTREE
@@ -85,10 +86,37 @@ CREATE INDEX test3 on t1 ( medium ) ;
DROP INDEX test ON t1;
insert into t1 values (10, 1,1,1,1,1,1,1,1,1,1,1,1,1,NULL,0,0,0,1,1,1,1,'one','one');
insert into t1 values (NULL,2,2,2,2,2,2,2,2,2,2,2,2,2,NULL,NULL,NULL,NULL,NULL,NULL,2,2,'two','two,one');
-insert into t1 values (0,1/3,3,3,3,3,3,3,3,3,3,3,3,3,NULL,'19970303','10:10:10','19970303 101010','','','','3',3,3);
+insert into t1 values (0,1/3,3,3,3,3,3,3,3,3,3,3,3,3,NULL,'19970303','10:10:10','19970303101010','','','','3',3,3);
insert into t1 values (0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,NULL,19970807,080706,19970403090807,-1,-1,-1,'-1',-1,-1);
+Warnings:
+Warning 1264 Data truncated; out of range for column 'utiny' at row 1
+Warning 1264 Data truncated; out of range for column 'ushort' at row 1
+Warning 1264 Data truncated; out of range for column 'umedium' at row 1
+Warning 1264 Data truncated; out of range for column 'ulong' at row 1
+Warning 1265 Data truncated for column 'options' at row 1
+Warning 1265 Data truncated for column 'flags' at row 1
insert into t1 values (0,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,NULL,0,0,0,-4294967295,-4294967295,-4294967295,'-4294967295',0,"one,two,tree");
+Warnings:
+Warning 1265 Data truncated for column 'string' at row 1
+Warning 1264 Data truncated; out of range for column 'tiny' at row 1
+Warning 1264 Data truncated; out of range for column 'short' at row 1
+Warning 1264 Data truncated; out of range for column 'medium' at row 1
+Warning 1264 Data truncated; out of range for column 'long_int' at row 1
+Warning 1264 Data truncated; out of range for column 'utiny' at row 1
+Warning 1264 Data truncated; out of range for column 'ushort' at row 1
+Warning 1264 Data truncated; out of range for column 'umedium' at row 1
+Warning 1264 Data truncated; out of range for column 'ulong' at row 1
+Warning 1265 Data truncated for column 'options' at row 1
insert into t1 values (0,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,NULL,0,0,0,4294967295,4294967295,4294967295,'4294967295',0,0);
+Warnings:
+Warning 1264 Data truncated; out of range for column 'tiny' at row 1
+Warning 1264 Data truncated; out of range for column 'short' at row 1
+Warning 1264 Data truncated; out of range for column 'medium' at row 1
+Warning 1264 Data truncated; out of range for column 'long_int' at row 1
+Warning 1264 Data truncated; out of range for column 'utiny' at row 1
+Warning 1264 Data truncated; out of range for column 'ushort' at row 1
+Warning 1264 Data truncated; out of range for column 'umedium' at row 1
+Warning 1265 Data truncated for column 'options' at row 1
insert into t1 (tiny) values (1);
select auto,string,tiny,short,medium,long_int,longlong,real_float,real_double,utiny,ushort,umedium,ulong,ulonglong,mod(floor(time_stamp/1000000),1000000)-mod(curdate(),1000000),date_field,time_field,date_time,blob_col,tinyblob_col,mediumblob_col,longblob_col from t1;
auto string tiny short medium long_int longlong real_float real_double utiny ushort umedium ulong ulonglong mod(floor(time_stamp/1000000),1000000)-mod(curdate(),1000000) date_field time_field date_time blob_col tinyblob_col mediumblob_col longblob_col
@@ -136,6 +164,13 @@ new_field char(2),
PRIMARY KEY (auto)
);
INSERT INTO t2 (string,mediumblob_col,new_field) SELECT string,mediumblob_col,new_field from t1 where auto > 10;
+Warnings:
+Warning 1265 Data truncated for column 'new_field' at row 2
+Warning 1265 Data truncated for column 'new_field' at row 3
+Warning 1265 Data truncated for column 'new_field' at row 4
+Warning 1265 Data truncated for column 'new_field' at row 5
+Warning 1265 Data truncated for column 'new_field' at row 6
+Warning 1265 Data truncated for column 'new_field' at row 7
select * from t2;
auto string mediumblob_col new_field
1 2 2 ne
@@ -166,59 +201,63 @@ 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 Null Key Default Extra Privileges
-auto int(5) unsigned MUL NULL auto_increment select,insert,update,references
-string varchar(10) YES new defaul select,insert,update,references
-tiny tinyint(4) MUL 0 select,insert,update,references
-short smallint(6) MUL 0 select,insert,update,references
-medium mediumint(8) MUL 0 select,insert,update,references
-long_int int(11) 0 select,insert,update,references
-longlong bigint(13) MUL 0 select,insert,update,references
-real_float float(13,1) MUL 0.0 select,insert,update,references
-real_double double(16,4) YES NULL select,insert,update,references
-utiny tinyint(3) unsigned 0 select,insert,update,references
-ushort smallint(5) unsigned zerofill 00000 select,insert,update,references
-umedium mediumint(8) unsigned MUL 0 select,insert,update,references
-ulong int(11) unsigned MUL 0 select,insert,update,references
-ulonglong bigint(13) unsigned MUL 0 select,insert,update,references
-time_stamp timestamp(14) YES NULL select,insert,update,references
-date_field varchar(10) YES NULL select,insert,update,references
-time_field time YES NULL select,insert,update,references
-date_time datetime YES NULL select,insert,update,references
-new_blob_col varchar(20) YES NULL select,insert,update,references
-tinyblob_col tinyblob YES NULL select,insert,update,references
-mediumblob_col mediumblob select,insert,update,references
-options enum('one','two','tree') MUL one select,insert,update,references
-flags set('one','two','tree') select,insert,update,references
-new_field varchar(10) new select,insert,update,references
+Field Type Collation Null Key Default Extra Privileges Comment
+auto int(5) unsigned NULL MUL NULL auto_increment select,insert,update,references
+string varchar(10) latin1_swedish_ci YES new defaul select,insert,update,references
+tiny tinyint(4) NULL MUL 0 select,insert,update,references
+short smallint(6) NULL MUL 0 select,insert,update,references
+medium mediumint(8) NULL MUL 0 select,insert,update,references
+long_int int(11) NULL 0 select,insert,update,references
+longlong bigint(13) NULL MUL 0 select,insert,update,references
+real_float float(13,1) NULL MUL 0.0 select,insert,update,references
+real_double double(16,4) NULL YES NULL select,insert,update,references
+utiny tinyint(3) unsigned NULL 0 select,insert,update,references
+ushort smallint(5) unsigned zerofill NULL 00000 select,insert,update,references
+umedium mediumint(8) unsigned NULL MUL 0 select,insert,update,references
+ulong int(11) unsigned NULL MUL 0 select,insert,update,references
+ulonglong bigint(13) unsigned NULL MUL 0 select,insert,update,references
+time_stamp timestamp NULL YES CURRENT_TIMESTAMP select,insert,update,references
+date_field varchar(10) latin1_swedish_ci YES NULL select,insert,update,references
+time_field time NULL YES NULL select,insert,update,references
+date_time datetime NULL YES NULL select,insert,update,references
+new_blob_col varchar(20) latin1_swedish_ci YES NULL select,insert,update,references
+tinyblob_col tinyblob NULL YES NULL select,insert,update,references
+mediumblob_col mediumblob NULL select,insert,update,references
+options enum('one','two','tree') latin1_swedish_ci MUL one select,insert,update,references
+flags set('one','two','tree') latin1_swedish_ci select,insert,update,references
+new_field varchar(10) latin1_swedish_ci new select,insert,update,references
show full columns from t2;
-Field Type Null Key Default Extra Privileges
-auto int(5) unsigned 0 select,insert,update,references
-string varchar(10) YES new defaul select,insert,update,references
-tiny tinyint(4) 0 select,insert,update,references
-short smallint(6) 0 select,insert,update,references
-medium mediumint(8) 0 select,insert,update,references
-long_int int(11) 0 select,insert,update,references
-longlong bigint(13) 0 select,insert,update,references
-real_float float(13,1) 0.0 select,insert,update,references
-real_double double(16,4) YES NULL select,insert,update,references
-utiny tinyint(3) unsigned 0 select,insert,update,references
-ushort smallint(5) unsigned zerofill 00000 select,insert,update,references
-umedium mediumint(8) unsigned 0 select,insert,update,references
-ulong int(11) unsigned 0 select,insert,update,references
-ulonglong bigint(13) unsigned 0 select,insert,update,references
-time_stamp timestamp(14) YES NULL select,insert,update,references
-date_field varchar(10) YES NULL select,insert,update,references
-time_field time YES NULL select,insert,update,references
-date_time datetime YES NULL select,insert,update,references
-new_blob_col varchar(20) YES NULL select,insert,update,references
-tinyblob_col tinyblob YES NULL select,insert,update,references
-mediumblob_col mediumblob select,insert,update,references
-options enum('one','two','tree') one select,insert,update,references
-flags set('one','two','tree') select,insert,update,references
-new_field varchar(10) new select,insert,update,references
+Field Type Collation Null Key Default Extra Privileges Comment
+auto int(5) unsigned NULL 0 select,insert,update,references
+string varchar(10) latin1_swedish_ci YES new defaul select,insert,update,references
+tiny tinyint(4) NULL 0 select,insert,update,references
+short smallint(6) NULL 0 select,insert,update,references
+medium mediumint(8) NULL 0 select,insert,update,references
+long_int int(11) NULL 0 select,insert,update,references
+longlong bigint(13) NULL 0 select,insert,update,references
+real_float float(13,1) NULL 0.0 select,insert,update,references
+real_double double(16,4) NULL YES NULL select,insert,update,references
+utiny tinyint(3) unsigned NULL 0 select,insert,update,references
+ushort smallint(5) unsigned zerofill NULL 00000 select,insert,update,references
+umedium mediumint(8) unsigned NULL 0 select,insert,update,references
+ulong int(11) unsigned NULL 0 select,insert,update,references
+ulonglong bigint(13) unsigned NULL 0 select,insert,update,references
+time_stamp timestamp NULL YES 0000-00-00 00:00:00 select,insert,update,references
+date_field varchar(10) latin1_swedish_ci YES NULL select,insert,update,references
+time_field time NULL YES NULL select,insert,update,references
+date_time datetime NULL YES NULL select,insert,update,references
+new_blob_col varchar(20) latin1_swedish_ci YES NULL select,insert,update,references
+tinyblob_col tinyblob NULL YES NULL select,insert,update,references
+mediumblob_col mediumblob NULL select,insert,update,references
+options enum('one','two','tree') latin1_swedish_ci one select,insert,update,references
+flags set('one','two','tree') latin1_swedish_ci select,insert,update,references
+new_field varchar(10) latin1_swedish_ci new select,insert,update,references
select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and ((t1.string<>t2.string and (t1.string is not null or t2.string is not null)) or (t1.tiny<>t2.tiny and (t1.tiny is not null or t2.tiny is not null)) or (t1.short<>t2.short and (t1.short is not null or t2.short is not null)) or (t1.medium<>t2.medium and (t1.medium is not null or t2.medium is not null)) or (t1.long_int<>t2.long_int and (t1.long_int is not null or t2.long_int is not null)) or (t1.longlong<>t2.longlong and (t1.longlong is not null or t2.longlong is not null)) or (t1.real_float<>t2.real_float and (t1.real_float is not null or t2.real_float is not null)) or (t1.real_double<>t2.real_double and (t1.real_double is not null or t2.real_double is not null)) or (t1.utiny<>t2.utiny and (t1.utiny is not null or t2.utiny is not null)) or (t1.ushort<>t2.ushort and (t1.ushort is not null or t2.ushort is not null)) or (t1.umedium<>t2.umedium and (t1.umedium is not null or t2.umedium is not null)) or (t1.ulong<>t2.ulong and (t1.ulong is not null or t2.ulong is not null)) or (t1.ulonglong<>t2.ulonglong and (t1.ulonglong is not null or t2.ulonglong is not null)) or (t1.time_stamp<>t2.time_stamp and (t1.time_stamp is not null or t2.time_stamp is not null)) or (t1.date_field<>t2.date_field and (t1.date_field is not null or t2.date_field is not null)) or (t1.time_field<>t2.time_field and (t1.time_field is not null or t2.time_field is not null)) or (t1.date_time<>t2.date_time and (t1.date_time is not null or t2.date_time is not null)) or (t1.new_blob_col<>t2.new_blob_col and (t1.new_blob_col is not null or t2.new_blob_col is not null)) or (t1.tinyblob_col<>t2.tinyblob_col and (t1.tinyblob_col is not null or t2.tinyblob_col is not null)) or (t1.mediumblob_col<>t2.mediumblob_col and (t1.mediumblob_col is not null or t2.mediumblob_col is not null)) or (t1.options<>t2.options and (t1.options is not null or t2.options is not null)) or (t1.flags<>t2.flags and (t1.flags is not null or t2.flags is not null)) or (t1.new_field<>t2.new_field and (t1.new_field is not null or t2.new_field is not null)));
auto auto
16 16
@@ -228,12 +267,12 @@ auto auto
drop table t2;
create table t2 (primary key (auto)) select auto+1 as auto,1 as t1, "a" as t2, repeat("a",256) as t3, binary repeat("b",256) as t4 from t1;
show full columns from t2;
-Field Type Null Key Default Extra Privileges
-auto bigint(17) unsigned PRI 0 select,insert,update,references
-t1 bigint(1) 0 select,insert,update,references
-t2 char(1) select,insert,update,references
-t3 mediumtext select,insert,update,references
-t4 mediumblob select,insert,update,references
+Field Type Collation Null Key Default Extra Privileges Comment
+auto bigint(17) unsigned NULL PRI 0 select,insert,update,references
+t1 bigint(1) NULL 0 select,insert,update,references
+t2 char(1) latin1_swedish_ci select,insert,update,references
+t3 longtext latin1_swedish_ci select,insert,update,references
+t4 longblob NULL select,insert,update,references
select * from t2;
auto t1 t2 t3 t4
11 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
@@ -248,13 +287,13 @@ create table t1 (c int);
insert into t1 values(1),(2);
create table t2 select * from t1;
create table t3 select * from t1, t2;
-Duplicate column name 'c'
+ERROR 42S21: Duplicate column name 'c'
create table t3 select t1.c AS c1, t2.c AS c2,1 as "const" from t1, t2;
show full columns from t3;
-Field Type Null Key Default Extra Privileges
-c1 int(11) YES NULL select,insert,update,references
-c2 int(11) YES NULL select,insert,update,references
-const bigint(1) 0 select,insert,update,references
+Field Type Collation Null Key Default Extra Privileges Comment
+c1 int(11) NULL YES NULL select,insert,update,references
+c2 int(11) NULL YES NULL select,insert,update,references
+const bigint(1) NULL 0 select,insert,update,references
drop table t1,t2,t3;
create table t1 ( myfield INT NOT NULL, UNIQUE INDEX (myfield), unique (myfield), index(myfield));
drop table t1;
diff --git a/mysql-test/r/type_ranges.result.es b/mysql-test/r/type_ranges.result.es
new file mode 100644
index 00000000000..548b00750ea
--- /dev/null
+++ b/mysql-test/r/type_ranges.result.es
@@ -0,0 +1,320 @@
+drop table if exists t1,t2,t3;
+SET SQL_WARNINGS=1;
+CREATE TABLE t1 (
+auto int(5) unsigned NOT NULL auto_increment,
+string char(10) default "hello",
+tiny tinyint(4) DEFAULT '0' NOT NULL ,
+short smallint(6) DEFAULT '1' NOT NULL ,
+medium mediumint(8) DEFAULT '0' NOT NULL,
+long_int int(11) DEFAULT '0' NOT NULL,
+longlong bigint(13) DEFAULT '0' NOT NULL,
+real_float float(13,1) DEFAULT 0.0 NOT NULL,
+real_double double(16,4),
+utiny tinyint(3) unsigned DEFAULT '0' NOT NULL,
+ushort smallint(5) unsigned zerofill DEFAULT '00000' NOT NULL,
+umedium mediumint(8) unsigned DEFAULT '0' NOT NULL,
+ulong int(11) unsigned DEFAULT '0' NOT NULL,
+ulonglong bigint(13) unsigned DEFAULT '0' NOT NULL,
+time_stamp timestamp,
+date_field date,
+time_field time,
+date_time datetime,
+blob_col blob,
+tinyblob_col tinyblob,
+mediumblob_col mediumblob not null,
+longblob_col longblob not null,
+options enum('one','two','tree') not null,
+flags set('one','two','tree') not null,
+PRIMARY KEY (auto),
+KEY (utiny),
+KEY (tiny),
+KEY (short),
+KEY any_name (medium),
+KEY (longlong),
+KEY (real_float),
+KEY (ushort),
+KEY (umedium),
+KEY (ulong),
+KEY (ulonglong,ulong),
+KEY (options,flags)
+);
+show full fields from t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+auto int(5) unsigned NULL PRI NULL auto_increment
+string varchar(10) latin1_swedish_ci YES hello
+tiny tinyint(4) NULL MUL 0
+short smallint(6) NULL MUL 1
+medium mediumint(8) NULL MUL 0
+long_int int(11) NULL 0
+longlong bigint(13) NULL MUL 0
+real_float float(13,1) NULL MUL 0.0
+real_double double(16,4) NULL YES NULL
+utiny tinyint(3) unsigned NULL MUL 0
+ushort smallint(5) unsigned zerofill NULL MUL 00000
+umedium mediumint(8) unsigned NULL MUL 0
+ulong int(11) unsigned NULL MUL 0
+ulonglong bigint(13) unsigned NULL MUL 0
+time_stamp timestamp NULL YES CURRENT_TIMESTAMP
+date_field date NULL YES NULL
+time_field time NULL YES NULL
+date_time datetime NULL YES NULL
+blob_col blob NULL YES NULL
+tinyblob_col tinyblob NULL YES NULL
+mediumblob_col mediumblob NULL
+longblob_col longblob NULL
+options enum('one','two','tree') latin1_swedish_ci MUL one
+flags set('one','two','tree') latin1_swedish_ci
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 auto A 0 NULL NULL BTREE
+t1 1 utiny 1 utiny A NULL NULL NULL BTREE
+t1 1 tiny 1 tiny A NULL NULL NULL BTREE
+t1 1 short 1 short A NULL NULL NULL BTREE
+t1 1 any_name 1 medium A NULL NULL NULL BTREE
+t1 1 longlong 1 longlong A NULL NULL NULL BTREE
+t1 1 real_float 1 real_float A NULL NULL NULL BTREE
+t1 1 ushort 1 ushort A NULL NULL NULL BTREE
+t1 1 umedium 1 umedium A NULL NULL NULL BTREE
+t1 1 ulong 1 ulong A NULL NULL NULL BTREE
+t1 1 ulonglong 1 ulonglong A NULL NULL NULL BTREE
+t1 1 ulonglong 2 ulong A NULL NULL NULL BTREE
+t1 1 options 1 options A NULL NULL NULL BTREE
+t1 1 options 2 flags A NULL NULL NULL BTREE
+CREATE UNIQUE INDEX test on t1 ( auto ) ;
+CREATE INDEX test2 on t1 ( ulonglong,ulong) ;
+CREATE INDEX test3 on t1 ( medium ) ;
+DROP INDEX test ON t1;
+insert into t1 values (10, 1,1,1,1,1,1,1,1,1,1,1,1,1,NULL,0,0,0,1,1,1,1,'one','one');
+insert into t1 values (NULL,2,2,2,2,2,2,2,2,2,2,2,2,2,NULL,NULL,NULL,NULL,NULL,NULL,2,2,'two','two,one');
+insert into t1 values (0,1/3,3,3,3,3,3,3,3,3,3,3,3,3,NULL,'19970303','10:10:10','19970303101010','','','','3',3,3);
+insert into t1 values (0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,NULL,19970807,080706,19970403090807,-1,-1,-1,'-1',-1,-1);
+Warnings:
+Warning 1264 Data truncated; out of range for column 'utiny' at row 1
+Warning 1264 Data truncated; out of range for column 'ushort' at row 1
+Warning 1264 Data truncated; out of range for column 'umedium' at row 1
+Warning 1264 Data truncated; out of range for column 'ulong' at row 1
+Warning 1265 Data truncated for column 'options' at row 1
+Warning 1265 Data truncated for column 'flags' at row 1
+insert into t1 values (0,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,NULL,0,0,0,-4294967295,-4294967295,-4294967295,'-4294967295',0,"one,two,tree");
+Warnings:
+Warning 1265 Data truncated for column 'string' at row 1
+Warning 1264 Data truncated; out of range for column 'tiny' at row 1
+Warning 1264 Data truncated; out of range for column 'short' at row 1
+Warning 1264 Data truncated; out of range for column 'medium' at row 1
+Warning 1264 Data truncated; out of range for column 'long_int' at row 1
+Warning 1264 Data truncated; out of range for column 'utiny' at row 1
+Warning 1264 Data truncated; out of range for column 'ushort' at row 1
+Warning 1264 Data truncated; out of range for column 'umedium' at row 1
+Warning 1264 Data truncated; out of range for column 'ulong' at row 1
+Warning 1265 Data truncated for column 'options' at row 1
+insert into t1 values (0,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,NULL,0,0,0,4294967295,4294967295,4294967295,'4294967295',0,0);
+Warnings:
+Warning 1264 Data truncated; out of range for column 'tiny' at row 1
+Warning 1264 Data truncated; out of range for column 'short' at row 1
+Warning 1264 Data truncated; out of range for column 'medium' at row 1
+Warning 1264 Data truncated; out of range for column 'long_int' at row 1
+Warning 1264 Data truncated; out of range for column 'utiny' at row 1
+Warning 1264 Data truncated; out of range for column 'ushort' at row 1
+Warning 1264 Data truncated; out of range for column 'umedium' at row 1
+Warning 1265 Data truncated for column 'options' at row 1
+insert into t1 (tiny) values (1);
+select auto,string,tiny,short,medium,long_int,longlong,real_float,real_double,utiny,ushort,umedium,ulong,ulonglong,mod(floor(time_stamp/1000000),1000000)-mod(curdate(),1000000),date_field,time_field,date_time,blob_col,tinyblob_col,mediumblob_col,longblob_col from t1;
+auto string tiny short medium long_int longlong real_float real_double utiny ushort umedium ulong ulonglong mod(floor(time_stamp/1000000),1000000)-mod(curdate(),1000000) date_field time_field date_time blob_col tinyblob_col mediumblob_col longblob_col
+10 1 1 1 1 1 1 1.0 1.0000 1 00001 1 1 1 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1 1 1
+11 2 2 2 2 2 2 2.0 2.0000 2 00002 2 2 2 0 NULL NULL NULL NULL NULL 2 2
+12 0.33 3 3 3 3 3 3.0 3.0000 3 00003 3 3 3 0 1997-03-03 10:10:10 1997-03-03 10:10:10 3
+13 -1 -1 -1 -1 -1 -1 -1.0 -1.0000 0 00000 0 0 18446744073709551615 0 1997-08-07 08:07:06 1997-04-03 09:08:07 -1 -1 -1 -1
+14 -429496729 -128 -32768 -8388608 -2147483648 -4294967295 -4294967296.0 -4294967295.0000 0 00000 0 0 18446744069414584321 0 0000-00-00 00:00:00 0000-00-00 00:00:00 -4294967295 -4294967295 -4294967295 -4294967295
+15 4294967295 127 32767 8388607 2147483647 4294967295 4294967296.0 4294967295.0000 255 65535 16777215 4294967295 4294967295 0 0000-00-00 00:00:00 0000-00-00 00:00:00 4294967295 4294967295 4294967295 4294967295
+16 hello 1 1 0 0 0 0.0 NULL 0 00000 0 0 0 0 NULL NULL NULL NULL NULL
+ALTER TABLE t1
+add new_field char(10) default "new" not null,
+change blob_col new_blob_col varchar(20),
+change date_field date_field char(10),
+alter column string set default "new default",
+alter short drop default,
+DROP INDEX utiny,
+DROP INDEX ushort,
+DROP PRIMARY KEY,
+DROP FOREIGN KEY any_name,
+ADD INDEX (auto);
+LOCK TABLES t1 WRITE;
+ALTER TABLE t1
+RENAME as t2,
+DROP longblob_col;
+UNLOCK TABLES;
+ALTER TABLE t2 rename as t3;
+LOCK TABLES t3 WRITE ;
+ALTER TABLE t3 rename as t1;
+UNLOCK TABLES;
+select auto,new_field,new_blob_col,date_field from t1 ;
+auto new_field new_blob_col date_field
+10 new 1 0000-00-00
+11 new NULL NULL
+12 new 1997-03-03
+13 new -1 1997-08-07
+14 new -4294967295 0000-00-00
+15 new 4294967295 0000-00-00
+16 new NULL NULL
+CREATE TABLE t2 (
+auto int(5) unsigned NOT NULL auto_increment,
+string char(20),
+mediumblob_col mediumblob not null,
+new_field char(2),
+PRIMARY KEY (auto)
+);
+INSERT INTO t2 (string,mediumblob_col,new_field) SELECT string,mediumblob_col,new_field from t1 where auto > 10;
+Warnings:
+Warning 1265 Data truncated for column 'new_field' at row 2
+Warning 1265 Data truncated for column 'new_field' at row 3
+Warning 1265 Data truncated for column 'new_field' at row 4
+Warning 1265 Data truncated for column 'new_field' at row 5
+Warning 1265 Data truncated for column 'new_field' at row 6
+Warning 1265 Data truncated for column 'new_field' at row 7
+select * from t2;
+auto string mediumblob_col new_field
+1 2 2 ne
+2 0.33 ne
+3 -1 -1 ne
+4 -429496729 -4294967295 ne
+5 4294967295 4294967295 ne
+6 hello ne
+select distinct flags from t1;
+flags
+
+one,two,tree
+one
+one,two
+select flags from t1 where find_in_set("two",flags)>0;
+flags
+one,two,tree
+one,two,tree
+one,two
+one,two
+select flags from t1 where find_in_set("unknown",flags)>0;
+flags
+select options,flags from t1 where options="ONE" and flags="ONE";
+options flags
+one one
+select options,flags from t1 where options="one" and flags="one";
+options flags
+one one
+drop table t2;
+create table t2 select * from t1;
+Warnings:
+Warning 1265 Data truncated for column 'options' at row 4
+Warning 1265 Data truncated for column 'options' at row 5
+Warning 1265 Data truncated for column 'options' at row 6
+update t2 set string="changed" where auto=16;
+show full columns from t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+auto int(5) unsigned NULL MUL NULL auto_increment
+string varchar(10) latin1_swedish_ci YES new defaul
+tiny tinyint(4) NULL MUL 0
+short smallint(6) NULL MUL 0
+medium mediumint(8) NULL MUL 0
+long_int int(11) NULL 0
+longlong bigint(13) NULL MUL 0
+real_float float(13,1) NULL MUL 0.0
+real_double double(16,4) NULL YES NULL
+utiny tinyint(3) unsigned NULL 0
+ushort smallint(5) unsigned zerofill NULL 00000
+umedium mediumint(8) unsigned NULL MUL 0
+ulong int(11) unsigned NULL MUL 0
+ulonglong bigint(13) unsigned NULL MUL 0
+time_stamp timestamp NULL YES CURRENT_TIMESTAMP
+date_field varchar(10) latin1_swedish_ci YES NULL
+time_field time NULL YES NULL
+date_time datetime NULL YES NULL
+new_blob_col varchar(20) latin1_swedish_ci YES NULL
+tinyblob_col tinyblob NULL YES NULL
+mediumblob_col mediumblob NULL
+options enum('one','two','tree') latin1_swedish_ci MUL one
+flags set('one','two','tree') latin1_swedish_ci
+new_field varchar(10) latin1_swedish_ci new
+show full columns from t2;
+Field Type Collation Null Key Default Extra Privileges Comment
+auto int(5) unsigned NULL 0
+string varchar(10) latin1_swedish_ci YES new defaul
+tiny tinyint(4) NULL 0
+short smallint(6) NULL 0
+medium mediumint(8) NULL 0
+long_int int(11) NULL 0
+longlong bigint(13) NULL 0
+real_float float(13,1) NULL 0.0
+real_double double(16,4) NULL YES NULL
+utiny tinyint(3) unsigned NULL 0
+ushort smallint(5) unsigned zerofill NULL 00000
+umedium mediumint(8) unsigned NULL 0
+ulong int(11) unsigned NULL 0
+ulonglong bigint(13) unsigned NULL 0
+time_stamp timestamp NULL YES 0000-00-00 00:00:00
+date_field varchar(10) latin1_swedish_ci YES NULL
+time_field time NULL YES NULL
+date_time datetime NULL YES NULL
+new_blob_col varchar(20) latin1_swedish_ci YES NULL
+tinyblob_col tinyblob NULL YES NULL
+mediumblob_col mediumblob NULL
+options enum('one','two','tree') latin1_swedish_ci one
+flags set('one','two','tree') latin1_swedish_ci
+new_field varchar(10) latin1_swedish_ci new
+select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and ((t1.string<>t2.string and (t1.string is not null or t2.string is not null)) or (t1.tiny<>t2.tiny and (t1.tiny is not null or t2.tiny is not null)) or (t1.short<>t2.short and (t1.short is not null or t2.short is not null)) or (t1.medium<>t2.medium and (t1.medium is not null or t2.medium is not null)) or (t1.long_int<>t2.long_int and (t1.long_int is not null or t2.long_int is not null)) or (t1.longlong<>t2.longlong and (t1.longlong is not null or t2.longlong is not null)) or (t1.real_float<>t2.real_float and (t1.real_float is not null or t2.real_float is not null)) or (t1.real_double<>t2.real_double and (t1.real_double is not null or t2.real_double is not null)) or (t1.utiny<>t2.utiny and (t1.utiny is not null or t2.utiny is not null)) or (t1.ushort<>t2.ushort and (t1.ushort is not null or t2.ushort is not null)) or (t1.umedium<>t2.umedium and (t1.umedium is not null or t2.umedium is not null)) or (t1.ulong<>t2.ulong and (t1.ulong is not null or t2.ulong is not null)) or (t1.ulonglong<>t2.ulonglong and (t1.ulonglong is not null or t2.ulonglong is not null)) or (t1.time_stamp<>t2.time_stamp and (t1.time_stamp is not null or t2.time_stamp is not null)) or (t1.date_field<>t2.date_field and (t1.date_field is not null or t2.date_field is not null)) or (t1.time_field<>t2.time_field and (t1.time_field is not null or t2.time_field is not null)) or (t1.date_time<>t2.date_time and (t1.date_time is not null or t2.date_time is not null)) or (t1.new_blob_col<>t2.new_blob_col and (t1.new_blob_col is not null or t2.new_blob_col is not null)) or (t1.tinyblob_col<>t2.tinyblob_col and (t1.tinyblob_col is not null or t2.tinyblob_col is not null)) or (t1.mediumblob_col<>t2.mediumblob_col and (t1.mediumblob_col is not null or t2.mediumblob_col is not null)) or (t1.options<>t2.options and (t1.options is not null or t2.options is not null)) or (t1.flags<>t2.flags and (t1.flags is not null or t2.flags is not null)) or (t1.new_field<>t2.new_field and (t1.new_field is not null or t2.new_field is not null)));
+auto auto
+16 16
+select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and not (t1.string<=>t2.string and t1.tiny<=>t2.tiny and t1.short<=>t2.short and t1.medium<=>t2.medium and t1.long_int<=>t2.long_int and t1.longlong<=>t2.longlong and t1.real_float<=>t2.real_float and t1.real_double<=>t2.real_double and t1.utiny<=>t2.utiny and t1.ushort<=>t2.ushort and t1.umedium<=>t2.umedium and t1.ulong<=>t2.ulong and t1.ulonglong<=>t2.ulonglong and t1.time_stamp<=>t2.time_stamp and t1.date_field<=>t2.date_field and t1.time_field<=>t2.time_field and t1.date_time<=>t2.date_time and t1.new_blob_col<=>t2.new_blob_col and t1.tinyblob_col<=>t2.tinyblob_col and t1.mediumblob_col<=>t2.mediumblob_col and t1.options<=>t2.options and t1.flags<=>t2.flags and t1.new_field<=>t2.new_field);
+auto auto
+16 16
+drop table t2;
+create table t2 (primary key (auto)) select auto+1 as auto,1 as t1, "a" as t2, repeat("a",256) as t3, binary repeat("b",256) as t4 from t1;
+show full columns from t2;
+Field Type Collation Null Key Default Extra Privileges Comment
+auto bigint(17) unsigned NULL PRI 0
+t1 bigint(1) NULL 0
+t2 char(1) latin1_swedish_ci
+t3 longtext latin1_swedish_ci
+t4 longblob NULL
+select * from t2;
+auto t1 t2 t3 t4
+11 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+12 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+13 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+14 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+15 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+16 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+17 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+drop table t1,t2;
+create table t1 (c int);
+insert into t1 values(1),(2);
+create table t2 select * from t1;
+create table t3 select * from t1, t2;
+ERROR 42S21: Duplicate column name 'c'
+create table t3 select t1.c AS c1, t2.c AS c2,1 as "const" from t1, t2;
+show full columns from t3;
+Field Type Collation Null Key Default Extra Privileges Comment
+c1 int(11) NULL YES NULL
+c2 int(11) NULL YES NULL
+const bigint(1) NULL 0
+drop table t1,t2,t3;
+create table t1 ( myfield INT NOT NULL, UNIQUE INDEX (myfield), unique (myfield), index(myfield));
+drop table t1;
+create table t1 ( id integer unsigned not null primary key );
+create table t2 ( id integer unsigned not null primary key );
+insert into t1 values (1), (2);
+insert into t2 values (1);
+select t1.id as id_A, t2.id as id_B from t1 left join t2 using ( id );
+id_A id_B
+1 1
+2 NULL
+create table t3 (id_A integer unsigned not null, id_B integer unsigned null );
+insert into t3 select t1.id as id_A, t2.id as id_B from t1 left join t2 using ( id );
+select * from t3;
+id_A id_B
+1 1
+2 NULL
+drop table t3;
+create table t3 select t1.id as id_A, t2.id as id_B from t1 left join t2 using ( id );
+select * from t3;
+id_A id_B
+1 1
+2 NULL
+drop table t1,t2,t3;
diff --git a/mysql-test/r/type_set.result b/mysql-test/r/type_set.result
index 59f8744e2ec..9c82f59fc69 100644
--- a/mysql-test/r/type_set.result
+++ b/mysql-test/r/type_set.result
@@ -4,12 +4,47 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` set('','a','b') NOT NULL default ''
-) TYPE=MyISAM
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a set (' ','a','b ') not null default 'b ');
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` set('','a','b') NOT NULL default 'b'
-) TYPE=MyISAM
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+CREATE TABLE t1 ( user varchar(64) NOT NULL default '', path varchar(255) NOT NULL default '', privilege set('select','RESERVED30','RESERVED29','RESERVED28','RESERVED27','RESERVED26', 'RESERVED25','RESERVED24','data.delete','RESERVED22','RESERVED21', 'RESERVED20','data.insert.none','data.insert.approve', 'data.insert.delete','data.insert.move','data.insert.propose', 'data.insert.reject','RESERVED13','RESERVED12','RESERVED11','RESERVED10', 'RESERVED09','data.update','RESERVED07','RESERVED06','RESERVED05', 'RESERVED04','metadata.delete','metadata.put','RESERVED01','RESERVED00') NOT NULL default '', KEY user (user) ) ENGINE=MyISAM CHARSET=utf8;
+DROP TABLE t1;
+set names latin1;
+create table t1 (s set ('a','A') character set latin1 collate latin1_bin);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `s` set('a','A') character set latin1 collate latin1_bin default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values ('a'),('a,A'),('A,a'),('A');
+select s from t1 order by s;
+s
+a
+A
+a,A
+a,A
+drop table t1;
+CREATE TABLE t1 (c set('ae','oe','ue','ss') collate latin1_german2_ci);
+INSERT INTO t1 VALUES ('ä'),('ö'),('ü'),('ß');
+INSERT INTO t1 VALUES ('ae'),('oe'),('ue'),('ss');
+INSERT INTO t1 VALUES ('ä,ö,ü,ß');
+INSERT INTO t1 VALUES ('ae,oe,ue,ss');
+SELECT c FROM t1 ORDER BY c;
+c
+ae
+ae
+oe
+oe
+ue
+ue
+ss
+ss
+ae,oe,ue,ss
+ae,oe,ue,ss
+DROP TABLE t1;
diff --git a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result
index bacc3ec0176..025cf2a57f1 100644
--- a/mysql-test/r/type_time.result
+++ b/mysql-test/r/type_time.result
@@ -24,6 +24,12 @@ t
12:30:35
36:30:31
insert into t1 values("10.22.22"),(1234567),(123456789),(123456789.10),("10 22:22"),("12.45a");
+Warnings:
+Warning 1265 Data truncated for column 't' at row 1
+Warning 1264 Data truncated; out of range for column 't' at row 2
+Warning 1264 Data truncated; out of range for column 't' at row 3
+Warning 1264 Data truncated; out of range for column 't' at row 4
+Warning 1265 Data truncated for column 't' at row 6
select * from t1;
t
10:22:33
diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result
index 6253fa96ba8..42fdc7e50c6 100644
--- a/mysql-test/r/type_timestamp.result
+++ b/mysql-test/r/type_timestamp.result
@@ -15,26 +15,26 @@ SET TIMESTAMP=1238;
insert into t1 (a) select a+1 from t2 where a=8;
select * from t1;
a t
-1 19700101032034
-2 20020303000000
-3 19700101032035
-4 19700101032036
-5 20020304000000
-6 19700101032037
-7 20020305000000
-8 00000000000000
-9 19700101032038
+1 1970-01-01 03:20:34
+2 2002-03-03 00:00:00
+3 1970-01-01 03:20:35
+4 1970-01-01 03:20:36
+5 2002-03-04 00:00:00
+6 1970-01-01 03:20:37
+7 2002-03-05 00:00:00
+8 0000-00-00 00:00:00
+9 1970-01-01 03:20:38
drop table t1,t2;
SET TIMESTAMP=1234;
CREATE TABLE t1 (value TEXT NOT NULL, id VARCHAR(32) NOT NULL, stamp timestamp, PRIMARY KEY (id));
INSERT INTO t1 VALUES ("my value", "myKey","1999-04-02 00:00:00");
SELECT stamp FROM t1 WHERE id="myKey";
stamp
-19990402000000
+1999-04-02 00:00:00
UPDATE t1 SET value="my value" WHERE id="myKey";
SELECT stamp FROM t1 WHERE id="myKey";
stamp
-19990402000000
+1999-04-02 00:00:00
drop table t1;
create table t1 (a timestamp);
insert into t1 values (now());
@@ -43,9 +43,9 @@ date_format(a,"%Y %y") year(a) year(now())
1970 70 1970 1970
drop table t1;
create table t1 (ix timestamp);
-insert into t1 values (19991101000000),(19990102030405),(19990630232922),(19990601000000),(19990930232922),(19990531232922),(19990501000000),(19991101000000),(19990501000000),(20030101010160),(20030101016001),(20030101240101),(20030132010101),(20031301010101);
-select * from t1;
-ix
+insert into t1 values (19991101000000),(19990102030405),(19990630232922),(19990601000000),(19990930232922),(19990531232922),(19990501000000),(19991101000000),(19990501000000);
+select ix+0 from t1;
+ix+0
19991101000000
19990102030405
19990630232922
@@ -55,24 +55,14 @@ ix
19990501000000
19991101000000
19990501000000
-00000000000000
-00000000000000
-00000000000000
-00000000000000
-00000000000000
delete from t1;
-insert into t1 values ("19991101000000"),("19990102030405"),("19990630232922"),("19990601000000"),("20030101010160"),("20030101016001"),("20030101240101"),("20030132010101"),("20031301010101");
-select * from t1;
-ix
+insert into t1 values ("19991101000000"),("19990102030405"),("19990630232922"),("19990601000000");
+select ix+0 from t1;
+ix+0
19991101000000
19990102030405
19990630232922
19990601000000
-00000000000000
-00000000000000
-00000000000000
-00000000000000
-00000000000000
drop table t1;
CREATE TABLE t1 (date date, date_time datetime, time_stamp timestamp);
INSERT INTO t1 VALUES ("1998-12-31","1998-12-31 23:59:59",19981231235959);
@@ -89,22 +79,19 @@ INSERT INTO t1 VALUES ("2005-01-01","2005-01-01 00:00:00",20050101000000);
INSERT INTO t1 VALUES ("2030-01-01","2030-01-01 00:00:00",20300101000000);
SELECT * FROM t1;
date date_time time_stamp
-1998-12-31 1998-12-31 23:59:59 19981231235959
-1999-01-01 1999-01-01 00:00:00 19990101000000
-1999-09-09 1999-09-09 23:59:59 19990909235959
-2000-01-01 2000-01-01 00:00:00 20000101000000
-2000-02-28 2000-02-28 00:00:00 20000228000000
-2000-02-29 2000-02-29 00:00:00 20000229000000
-2000-03-01 2000-03-01 00:00:00 20000301000000
-2000-12-31 2000-12-31 23:59:59 20001231235959
-2001-01-01 2001-01-01 00:00:00 20010101000000
-2004-12-31 2004-12-31 23:59:59 20041231235959
-2005-01-01 2005-01-01 00:00:00 20050101000000
-2030-01-01 2030-01-01 00:00:00 20300101000000
-drop table t1;
-show variables like 'new';
-Variable_name Value
-new OFF
+1998-12-31 1998-12-31 23:59:59 1998-12-31 23:59:59
+1999-01-01 1999-01-01 00:00:00 1999-01-01 00:00:00
+1999-09-09 1999-09-09 23:59:59 1999-09-09 23:59:59
+2000-01-01 2000-01-01 00:00:00 2000-01-01 00:00:00
+2000-02-28 2000-02-28 00:00:00 2000-02-28 00:00:00
+2000-02-29 2000-02-29 00:00:00 2000-02-29 00:00:00
+2000-03-01 2000-03-01 00:00:00 2000-03-01 00:00:00
+2000-12-31 2000-12-31 23:59:59 2000-12-31 23:59:59
+2001-01-01 2001-01-01 00:00:00 2001-01-01 00:00:00
+2004-12-31 2004-12-31 23:59:59 2004-12-31 23:59:59
+2005-01-01 2005-01-01 00:00:00 2005-01-01 00:00:00
+2030-01-01 2030-01-01 00:00:00 2030-01-01 00:00:00
+drop table t1;
create table t1 (t2 timestamp(2), t4 timestamp(4), t6 timestamp(6),
t8 timestamp(8), t10 timestamp(10), t12 timestamp(12),
t14 timestamp(14));
@@ -114,110 +101,324 @@ insert t1 values (0,0,0,0,0,0,0),
"1997-12-31 23:47:59");
select * from t1;
t2 t4 t6 t8 t10 t12 t14
-00 0000 000000 00000000 0000000000 000000000000 00000000000000
-97 9712 971231 19971231 9712312347 971231234759 19971231234759
-set new=1;
+0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00
+1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59
select * from t1;
t2 t4 t6 t8 t10 t12 t14
0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00
1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59
drop table t1;
-set new=0;
-create table t1 (t1 timestamp default '2003-01-01 00:00:00',
-t2 timestamp default '2003-01-01 00:00:00');
-set TIMESTAMP=1000000000;
-insert into t1 values();
+create table t1 (ix timestamp);
+insert into t1 values (0),(20030101010160),(20030101016001),(20030101240101),(20030132010101),(20031301010101),(20031200000000),(20030000000000);
+Warnings:
+Warning 1265 Data truncated for column 'ix' at row 2
+Warning 1265 Data truncated for column 'ix' at row 3
+Warning 1265 Data truncated for column 'ix' at row 4
+Warning 1265 Data truncated for column 'ix' at row 5
+Warning 1265 Data truncated for column 'ix' at row 6
+Warning 1265 Data truncated for column 'ix' at row 7
+Warning 1265 Data truncated for column 'ix' at row 8
+select ix+0 from t1;
+ix+0
+0
+0
+0
+0
+0
+0
+0
+0
+delete from t1;
+insert into t1 values ("00000000000000"),("20030101010160"),("20030101016001"),("20030101240101"),("20030132010101"),("20031301010101"),("20031200000000"),("20030000000000");
+Warnings:
+Warning 1265 Data truncated for column 'ix' at row 2
+Warning 1265 Data truncated for column 'ix' at row 3
+Warning 1265 Data truncated for column 'ix' at row 4
+Warning 1265 Data truncated for column 'ix' at row 5
+Warning 1265 Data truncated for column 'ix' at row 6
+Warning 1265 Data truncated for column 'ix' at row 7
+Warning 1265 Data truncated for column 'ix' at row 8
+select ix+0 from t1;
+ix+0
+0
+0
+0
+0
+0
+0
+0
+0
+delete from t1;
+insert into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00 some trailer");
+Warnings:
+Warning 1265 Data truncated for column 'ix' at row 1
+Warning 1265 Data truncated for column 'ix' at row 2
+select ix+0 from t1;
+ix+0
+0
+20030101000000
+drop table t1;
+create table t1 (t1 timestamp, t2 timestamp default now());
+ERROR HY000: Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
+create table t1 (t1 timestamp, t2 timestamp on update now());
+ERROR HY000: Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
+create table t1 (t1 timestamp, t2 timestamp default now() on update now());
+ERROR HY000: Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
+create table t1 (t1 timestamp default now(), t2 timestamp on update now());
+ERROR HY000: Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
+create table t1 (t1 timestamp on update now(), t2 timestamp default now() on update now());
+ERROR HY000: Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
+create table t1 (t1 timestamp default '2003-01-01 00:00:00', t2 datetime, t3 timestamp);
+SET TIMESTAMP=1000000000;
+insert into t1 values ();
+SET TIMESTAMP=1000000001;
+update t1 set t2=now();
+SET TIMESTAMP=1000000002;
+insert into t1 (t1,t3) values (default, default);
select * from t1;
-t1 t2
-20010909044640 20030101000000
+t1 t2 t3
+2003-01-01 00:00:00 2001-09-09 04:46:41 0000-00-00 00:00:00
+2003-01-01 00:00:00 NULL 0000-00-00 00:00:00
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `t1` timestamp(14) NOT NULL,
- `t2` timestamp(14) NOT NULL default '20030101000000'
-) TYPE=MyISAM
+ `t1` timestamp NOT NULL default '2003-01-01 00:00:00',
+ `t2` datetime default NULL,
+ `t3` timestamp NOT NULL default '0000-00-00 00:00:00'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1;
Field Type Null Key Default Extra
-t1 timestamp(14) YES NULL
-t2 timestamp(14) YES 20030101000000
-show columns from t1 like 't2';
-Field Type Null Key Default Extra
-t2 timestamp(14) YES 20030101000000
-create table t2 (select * from t1);
-show create table t2;
+t1 timestamp YES 2003-01-01 00:00:00
+t2 datetime YES NULL
+t3 timestamp YES 0000-00-00 00:00:00
+drop table t1;
+create table t1 (t1 timestamp default now(), t2 datetime, t3 timestamp);
+SET TIMESTAMP=1000000002;
+insert into t1 values ();
+SET TIMESTAMP=1000000003;
+update t1 set t2=now();
+SET TIMESTAMP=1000000003;
+insert into t1 (t1,t3) values (default, default);
+select * from t1;
+t1 t2 t3
+2001-09-09 04:46:42 2001-09-09 04:46:43 0000-00-00 00:00:00
+2001-09-09 04:46:43 NULL 0000-00-00 00:00:00
+show create table t1;
Table Create Table
-t2 CREATE TABLE `t2` (
- `t1` timestamp(14) NOT NULL,
- `t2` timestamp(14) NOT NULL default '20030101000000'
-) TYPE=MyISAM
-alter table t1 add column t0 timestamp first;
+t1 CREATE TABLE `t1` (
+ `t1` timestamp NOT NULL default CURRENT_TIMESTAMP,
+ `t2` datetime default NULL,
+ `t3` timestamp NOT NULL default '0000-00-00 00:00:00'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+show columns from t1;
+Field Type Null Key Default Extra
+t1 timestamp YES CURRENT_TIMESTAMP
+t2 datetime YES NULL
+t3 timestamp YES 0000-00-00 00:00:00
+drop table t1;
+create table t1 (t1 timestamp default '2003-01-01 00:00:00' on update now(), t2 datetime);
+SET TIMESTAMP=1000000004;
+insert into t1 values ();
+select * from t1;
+t1 t2
+2003-01-01 00:00:00 NULL
+SET TIMESTAMP=1000000005;
+update t1 set t2=now();
+SET TIMESTAMP=1000000005;
+insert into t1 (t1) values (default);
+select * from t1;
+t1 t2
+2001-09-09 04:46:45 2001-09-09 04:46:45
+2003-01-01 00:00:00 NULL
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `t0` timestamp(14) NOT NULL,
- `t1` timestamp(14) NOT NULL default '20030101000000',
- `t2` timestamp(14) NOT NULL default '20030101000000'
-) TYPE=MyISAM
-drop table t1,t2;
-create table t1 (ts1 timestamp, ts2 timestamp);
-set TIMESTAMP=1000000000;
+ `t1` timestamp NOT NULL default '2003-01-01 00:00:00' on update CURRENT_TIMESTAMP,
+ `t2` datetime default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+show columns from t1;
+Field Type Null Key Default Extra
+t1 timestamp YES 2003-01-01 00:00:00
+t2 datetime YES NULL
+drop table t1;
+create table t1 (t1 timestamp default now() on update now(), t2 datetime);
+SET TIMESTAMP=1000000006;
insert into t1 values ();
-insert into t1 values (DEFAULT, DEFAULT);
select * from t1;
-ts1 ts2
-20010909044640 00000000000000
-20010909044640 00000000000000
+t1 t2
+2001-09-09 04:46:46 NULL
+SET TIMESTAMP=1000000007;
+update t1 set t2=now();
+SET TIMESTAMP=1000000007;
+insert into t1 (t1) values (default);
+select * from t1;
+t1 t2
+2001-09-09 04:46:47 2001-09-09 04:46:47
+2001-09-09 04:46:47 NULL
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `t1` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
+ `t2` datetime default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+show columns from t1;
+Field Type Null Key Default Extra
+t1 timestamp YES CURRENT_TIMESTAMP
+t2 datetime YES NULL
drop table t1;
-create table t1 (ts timestamp(19));
+create table t1 (t1 timestamp, t2 datetime, t3 timestamp);
+SET TIMESTAMP=1000000007;
+insert into t1 values ();
+select * from t1;
+t1 t2 t3
+2001-09-09 04:46:47 NULL 0000-00-00 00:00:00
+SET TIMESTAMP=1000000008;
+update t1 set t2=now();
+SET TIMESTAMP=1000000008;
+insert into t1 (t1,t3) values (default, default);
+select * from t1;
+t1 t2 t3
+2001-09-09 04:46:48 2001-09-09 04:46:48 0000-00-00 00:00:00
+2001-09-09 04:46:48 NULL 0000-00-00 00:00:00
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `ts` timestamp(19) NOT NULL
-) TYPE=MyISAM
-set TIMESTAMP=1000000000;
+ `t1` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
+ `t2` datetime default NULL,
+ `t3` timestamp NOT NULL default '0000-00-00 00:00:00'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+show columns from t1;
+Field Type Null Key Default Extra
+t1 timestamp YES CURRENT_TIMESTAMP
+t2 datetime YES NULL
+t3 timestamp YES 0000-00-00 00:00:00
+drop table t1;
+create table t1 (t1 timestamp default current_timestamp on update current_timestamp, t2 datetime);
+SET TIMESTAMP=1000000009;
insert into t1 values ();
select * from t1;
-ts
-2001-09-09 04:46:40
+t1 t2
+2001-09-09 04:46:49 NULL
+SET TIMESTAMP=1000000010;
+update t1 set t2=now();
+SET TIMESTAMP=1000000011;
+insert into t1 (t1) values (default);
+select * from t1;
+t1 t2
+2001-09-09 04:46:50 2001-09-09 04:46:50
+2001-09-09 04:46:51 NULL
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `t1` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
+ `t2` datetime default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+show columns from t1;
+Field Type Null Key Default Extra
+t1 timestamp YES CURRENT_TIMESTAMP
+t2 datetime YES NULL
+delete from t1;
+insert into t1 values ('2004-04-01 00:00:00', '2004-04-01 00:00:00');
+SET TIMESTAMP=1000000012;
+update t1 set t1= '2004-04-02 00:00:00';
+select * from t1;
+t1 t2
+2004-04-02 00:00:00 2004-04-01 00:00:00
+update t1 as ta, t1 as tb set tb.t1= '2004-04-03 00:00:00';
+select * from t1;
+t1 t2
+2004-04-03 00:00:00 2004-04-01 00:00:00
drop table t1;
-set new=1;
-create table t1 (a char(2), t timestamp);
-insert into t1 values ('a', '2004-01-01 00:00:00'), ('a', '2004-01-01 01:00:00'),
-('b', '2004-02-01 00:00:00');
-select max(t) from t1 group by a;
-max(t)
-2004-01-01 01:00:00
-2004-02-01 00:00:00
+create table t1 (pk int primary key, t1 timestamp default current_timestamp on update current_timestamp, bulk int);
+insert into t1 values (1, '2004-04-01 00:00:00', 10);
+SET TIMESTAMP=1000000013;
+replace into t1 set pk = 1, bulk= 20;
+select * from t1;
+pk t1 bulk
+1 2001-09-09 04:46:53 20
+drop table t1;
+create table t1 (pk int primary key, t1 timestamp default '2003-01-01 00:00:00' on update current_timestamp, bulk int);
+insert into t1 values (1, '2004-04-01 00:00:00', 10);
+SET TIMESTAMP=1000000014;
+replace into t1 set pk = 1, bulk= 20;
+select * from t1;
+pk t1 bulk
+1 2003-01-01 00:00:00 20
drop table t1;
-create table t1 (ts1 timestamp);
+create table t1 (pk int primary key, t1 timestamp default current_timestamp, bulk int);
+insert into t1 values (1, '2004-04-01 00:00:00', 10);
+SET TIMESTAMP=1000000015;
+replace into t1 set pk = 1, bulk= 20;
+select * from t1;
+pk t1 bulk
+1 2001-09-09 04:46:55 20
+drop table t1;
+create table t1 (t1 timestamp default current_timestamp on update current_timestamp);
+insert into t1 values ('2004-04-01 00:00:00');
+SET TIMESTAMP=1000000016;
+alter table t1 add i int default 10;
+select * from t1;
+t1 i
+2004-04-01 00:00:00 10
+drop table t1;
+create table t1 (a timestamp null, b timestamp null);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `ts1` timestamp(19) NOT NULL
-) TYPE=MyISAM
-alter table t1 add ts2 timestamp;
-set new=0;
+ `a` timestamp NULL default NULL,
+ `b` timestamp NULL default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values (NULL, NULL);
+SET TIMESTAMP=1000000017;
+insert into t1 values ();
+select * from t1;
+a b
+NULL NULL
+NULL NULL
+drop table t1;
+create table t1 (a timestamp null default current_timestamp on update current_timestamp, b timestamp null);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `ts1` timestamp(19) NOT NULL,
- `ts2` timestamp(19) NOT NULL default '0000-00-00 00:00:00'
-) TYPE=MyISAM
+ `a` timestamp NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
+ `b` timestamp NULL default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values (NULL, NULL);
+SET TIMESTAMP=1000000018;
+insert into t1 values ();
+select * from t1;
+a b
+NULL NULL
+2001-09-09 04:46:58 NULL
drop table t1;
-create table t1 (ts1 timestamp);
-insert into t1 values ('2004-01-01 00:00:00'), ('2004-01-01 01:00:00');
+create table t1 (a timestamp null default null, b timestamp null default '2003-01-01 00:00:00');
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` timestamp NULL default NULL,
+ `b` timestamp NULL default '2003-01-01 00:00:00'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values (NULL, NULL);
+insert into t1 values (DEFAULT, DEFAULT);
select * from t1;
-ts1
-20040101000000
-20040101010000
-set new=1;
+a b
+NULL NULL
+NULL 2003-01-01 00:00:00
+drop table t1;
+create table t1 (a bigint, b bigint);
+insert into t1 values (NULL, NULL), (20030101000000, 20030102000000);
+set timestamp=1000000019;
+alter table t1 modify a timestamp, modify b timestamp;
select * from t1;
-ts1
-2004-01-01 00:00:00
+a b
+2001-09-09 04:46:59 2001-09-09 04:46:59
+2003-01-01 00:00:00 2003-01-02 00:00:00
+drop table t1;
+create table t1 (a char(2), t timestamp);
+insert into t1 values ('a', '2004-01-01 00:00:00'), ('a', '2004-01-01 01:00:00'),
+('b', '2004-02-01 00:00:00');
+select max(t) from t1 group by a;
+max(t)
2004-01-01 01:00:00
-set new=0;
-select * from t1;
-ts1
-20040101000000
-20040101010000
+2004-02-01 00:00:00
drop table t1;
diff --git a/mysql-test/r/type_uint.result b/mysql-test/r/type_uint.result
index 0b7452b566b..d8edf9085b7 100644
--- a/mysql-test/r/type_uint.result
+++ b/mysql-test/r/type_uint.result
@@ -1,8 +1,13 @@
drop table if exists t1;
+SET SQL_WARNINGS=1;
create table t1 (this int unsigned);
insert into t1 values (1);
insert into t1 values (-1);
+Warnings:
+Warning 1264 Data truncated; out of range for column 'this' at row 1
insert into t1 values ('5000000000');
+Warnings:
+Warning 1265 Data truncated for column 'this' at row 1
select * from t1;
this
1
diff --git a/mysql-test/r/type_year.result b/mysql-test/r/type_year.result
index 5ef3c1bba81..84b688429db 100644
--- a/mysql-test/r/type_year.result
+++ b/mysql-test/r/type_year.result
@@ -28,6 +28,8 @@ y y2
drop table t1;
create table t1 (y year);
insert into t1 values (now());
+Warnings:
+Warning 1265 Data truncated for column 'y' at row 1
select if(y = now(), 1, 0) from t1;
if(y = now(), 1, 0)
1
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index 0db18b090bc..49a2907f571 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -36,8 +36,6 @@ a b
1 a
2 b
3 c
-3 c
-3 c
4 d
5 f
6 e
@@ -48,12 +46,10 @@ select 0,'#' union select a,b from t1 union all select a,b from t2 union select
1 a
2 b
3 c
-3 c
-3 c
4 d
5 f
6 e
-7 g
+7 gg
select a,b from t1 union select a,b from t1;
a b
1 a
@@ -84,10 +80,15 @@ a b
3 c
2 b
1 a
-explain (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 4
-t2 ALL NULL NULL NULL NULL 4 Using filesort
+(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by t1.b;
+ERROR 42000: Table 't1' from one of the SELECTs cannot be used in global ORDER clause
+explain extended (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 4
+2 UNION t2 ALL NULL NULL NULL NULL 4 Using filesort
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL Using filesort
+Warnings:
+Note 1003 (select test.t1.a AS `a`,test.t1.b AS `b` from test.t1 limit 2) union all (select test.t2.a AS `a`,test.t2.b AS `b` from test.t2 order by test.t2.a limit 1) order by b desc
(select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2;
a b
1 a
@@ -103,51 +104,62 @@ select found_rows();
found_rows()
8
explain select a,b from t1 union all select a,b from t2;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 4
-t2 ALL NULL NULL NULL NULL 4
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 4
+2 UNION t2 ALL NULL NULL NULL NULL 4
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
explain select xx from t1 union select 1;
-Unknown column 'xx' in 'field list'
+ERROR 42S22: Unknown column 'xx' in 'field list'
explain select a,b from t1 union select 1;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 4
- 0 0 No tables used
+ERROR 21000: The used SELECT statements have a different number of columns
explain select 1 union select a,b from t1 union select 1;
-table type possible_keys key key_len ref rows Extra
- 0 0 No tables used
-t1 ALL NULL NULL NULL NULL 4
- 0 0 No tables used
+ERROR 21000: The used SELECT statements have a different number of columns
explain select a,b from t1 union select 1 limit 0;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 4
- 0 0 Impossible WHERE
+ERROR 21000: The used SELECT statements have a different number of columns
select a,b from t1 into outfile 'skr' union select a,b from t2;
-Wrong usage of UNION and INTO
+ERROR HY000: Incorrect usage of UNION and INTO
select a,b from t1 order by a union select a,b from t2;
-Wrong usage of UNION and ORDER BY
+ERROR HY000: Incorrect usage of UNION and ORDER BY
insert into t3 select a from t1 order by a union select a from t2;
-Wrong usage of UNION and ORDER BY
+ERROR HY000: Incorrect usage of UNION and ORDER BY
create table t3 select a,b from t1 union select a from t2;
-The used SELECT statements have a different number of columns
+ERROR 21000: The used SELECT statements have a different number of columns
select a,b from t1 union select a from t2;
-The used SELECT statements have a different number of columns
+ERROR 21000: The used SELECT statements have a different number of columns
select * from t1 union select a from t2;
-The used SELECT statements have a different number of columns
+ERROR 21000: The used SELECT statements have a different number of columns
select a from t1 union select * from t2;
-The used SELECT statements have a different number of columns
+ERROR 21000: The used SELECT statements have a different number of columns
select * from t1 union select SQL_BUFFER_RESULT * from t2;
-Wrong usage/placement of 'SQL_BUFFER_RESULT'
+ERROR 42000: Incorrect usage/placement of 'SQL_BUFFER_RESULT'
create table t3 select a,b from t1 union all select a,b from t2;
insert into t3 select a,b from t1 union all select a,b from t2;
replace into t3 select a,b as c from t1 union all select a,b from t2;
drop table t1,t2,t3;
+select * union select 1;
+ERROR HY000: No tables used
+select 1 as a,(select a union select a);
+a (select a union select a)
+1 1
+(select 1) union (select 2) order by 0;
+ERROR 42S22: Unknown column '0' in 'order clause'
+SELECT @a:=1 UNION SELECT @a:=@a+1;
+@a:=1
+1
+2
+(SELECT 1) UNION (SELECT 2) ORDER BY (SELECT a);
+ERROR 42S22: Unknown column 'a' in 'field list'
+(SELECT 1,3) UNION (SELECT 2,1) ORDER BY (SELECT 2);
+1 3
+1 3
+2 1
CREATE TABLE t1 (
`pseudo` char(35) NOT NULL default '',
`pseudo1` char(35) NOT NULL default '',
`same` tinyint(1) unsigned NOT NULL default '1',
PRIMARY KEY (`pseudo1`),
KEY `pseudo` (`pseudo`)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 (pseudo,pseudo1,same) VALUES ('joce', 'testtt', 1),('joce', 'tsestset', 1),('dekad', 'joce', 1);
SELECT pseudo FROM t1 WHERE pseudo1='joce' UNION SELECT pseudo FROM t1 WHERE pseudo='joce';
pseudo
@@ -179,7 +191,6 @@ testtt
tsestset
1
drop table t1;
-drop table if exists t1,t2;
create table t1 (a int);
create table t2 (a int);
insert into t1 values (1),(2),(3),(4),(5);
@@ -330,11 +341,7 @@ select found_rows();
found_rows()
4
(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION SELECT * FROM t2 LIMIT 1;
-a
-1
-select found_rows();
-found_rows()
-4
+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
SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION all SELECT * FROM t2 LIMIT 2;
a
1
@@ -417,13 +424,13 @@ a
3
3
(SELECT * FROM t1) UNION all (SELECT SQL_CALC_FOUND_ROWS * FROM t2) LIMIT 1;
-Wrong usage/placement of 'SQL_CALC_FOUND_ROWS'
+ERROR 42000: Incorrect usage/placement of 'SQL_CALC_FOUND_ROWS'
create temporary table t1 select a from t1 union select a from t2;
-drop table t1;
+drop temporary table t1;
create table t1 select a from t1 union select a from t2;
-INSERT TABLE 't1' isn't allowed in FROM table list
+ERROR HY000: You can't specify target table 't1' for update in FROM clause
select a from t1 union select a from t2 order by t2.a;
-Unknown column 't2.a' in 'ORDER BY'
+ERROR 42S02: Unknown table 't2' in order clause
drop table t1,t2;
select length(version()) > 1 as `*` UNION select 2;
*
@@ -432,7 +439,685 @@ select length(version()) > 1 as `*` UNION select 2;
create table t1 (a int);
insert into t1 values (0), (3), (1), (2);
explain (select * from t1) union (select * from t1) order by a;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 4
-t1 ALL NULL NULL NULL NULL 4
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 4
+2 UNION t1 ALL NULL NULL NULL NULL 4
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL Using filesort
+drop table t1;
+CREATE TABLE t1 ( id int(3) unsigned default '0') ENGINE=MyISAM;
+INSERT INTO t1 (id) VALUES("1");
+CREATE TABLE t2 ( id int(3) unsigned default '0', id_master int(5) default '0', text1 varchar(5) default NULL, text2 varchar(5) default NULL) ENGINE=MyISAM;
+INSERT INTO t2 (id, id_master, text1, text2) VALUES("1", "1",
+"foo1", "bar1");
+INSERT INTO t2 (id, id_master, text1, text2) VALUES("2", "1",
+"foo2", "bar2");
+INSERT INTO t2 (id, id_master, text1, text2) VALUES("3", "1", NULL,
+"bar3");
+INSERT INTO t2 (id, id_master, text1, text2) VALUES("4", "1",
+"foo4", "bar4");
+SELECT 1 AS id_master, 1 AS id, NULL AS text1, 'ABCDE' AS text2 UNION SELECT id_master, t2.id, text1, text2 FROM t1 LEFT JOIN t2 ON t1.id = t2.id_master;
+id_master id text1 text2
+1 1 NULL ABCDE
+1 1 foo1 bar1
+1 2 foo2 bar2
+1 3 NULL bar3
+1 4 foo4 bar4
+SELECT 1 AS id_master, 1 AS id, 'ABCDE' AS text1, 'ABCDE' AS text2 UNION SELECT id_master, t2.id, text1, text2 FROM t1 LEFT JOIN t2 ON t1.id = t2.id_master;
+id_master id text1 text2
+1 1 ABCDE ABCDE
+1 1 foo1 bar1
+1 2 foo2 bar2
+1 3 NULL bar3
+1 4 foo4 bar4
+drop table if exists t1,t2;
+create table t1 (a int not null primary key auto_increment, b int, key(b));
+create table t2 (a int not null primary key auto_increment, b int);
+insert into t1 (b) values (1),(2),(2),(3);
+insert into t2 (b) values (10),(11),(12),(13);
+explain extended (select * from t1 where a=1) union (select * from t2 where a=1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1
+2 UNION t2 const PRIMARY PRIMARY 4 const 1
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 (select test.t1.a AS `a`,test.t1.b AS `b` from test.t1 where (test.t1.a = 1)) union (select test.t2.a AS `a`,test.t2.b AS `b` from test.t2 where (test.t2.a = 1))
+(select * from t1 where a=5) union (select * from t2 where a=1);
+a b
+1 10
+(select * from t1 where a=5 and a=6) union (select * from t2 where a=1);
+a b
+1 10
+(select t1.a,t1.b from t1,t2 where t1.a=5) union (select * from t2 where a=1);
+a b
+1 10
+(select * from t1 where a=1) union (select t1.a,t2.a from t1,t2 where t1.a=t2.a);
+a b
+1 1
+2 2
+3 3
+4 4
+explain (select * from t1 where a=1 and b=10) union (select straight_join t1.a,t2.a from t1,t2 where t1.a=t2.a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+2 UNION t1 index PRIMARY PRIMARY 4 NULL 4 Using index
+2 UNION t2 index PRIMARY PRIMARY 4 NULL 3 Using where; Using index
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
+explain (select * from t1 where a=1) union (select * from t1 where b=1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1
+2 UNION t1 ref b b 5 const 1 Using where
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
+drop table t1,t2;
+create table t1 ( id int not null auto_increment, primary key (id) ,user_name text );
+create table t2 ( id int not null auto_increment, primary key (id) ,group_name text );
+create table t3 ( id int not null auto_increment, primary key (id) ,user_id int ,index user_idx (user_id) ,foreign key (user_id) references users(id) ,group_id int ,index group_idx (group_id) ,foreign key (group_id) references groups(id) );
+insert into t1 (user_name) values ('Tester');
+insert into t2 (group_name) values ('Group A');
+insert into t2 (group_name) values ('Group B');
+insert into t3 (user_id, group_id) values (1,1);
+select 1 'is_in_group', a.user_name, c.group_name, b.id from t1 a, t3 b, t2 c where a.id = b.user_id and b.group_id = c.id UNION select 0 'is_in_group', a.user_name, c.group_name, null from t1 a, t2 c;
+is_in_group user_name group_name id
+1 Tester Group A 1
+0 Tester Group A NULL
+0 Tester Group B NULL
+drop table t1, t2, t3;
+create table t1 (mat_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, matintnum CHAR(6) NOT NULL, test MEDIUMINT UNSIGNED NULL);
+create table t2 (mat_id MEDIUMINT UNSIGNED NOT NULL, pla_id MEDIUMINT UNSIGNED NOT NULL);
+insert into t1 values (NULL, 'a', 1), (NULL, 'b', 2), (NULL, 'c', 3), (NULL, 'd', 4), (NULL, 'e', 5), (NULL, 'f', 6), (NULL, 'g', 7), (NULL, 'h', 8), (NULL, 'i', 9);
+insert into t2 values (1, 100), (1, 101), (1, 102), (2, 100), (2, 103), (2, 104), (3, 101), (3, 102), (3, 105);
+SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id union SELECT 0, 0;
+pla_id matintnum
+100 a
+101 a
+102 a
+103 b
+104 b
+105 c
+0 0
+drop table t1, t2;
+create table t1 SELECT "a" as a UNION select "aa" as a;
+select * from t1;
+a
+a
+aa
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(2) NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 SELECT 12 as a UNION select "aa" as a;
+select * from t1;
+a
+12
+aa
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(20) NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 SELECT 12 as a UNION select 12.2 as a;
+select * from t1;
+a
+12.0
+12.2
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` double(53,1) NOT NULL default '0.0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t2 (it1 tinyint, it2 tinyint not null, i int not null, ib bigint, f float, d double, y year, da date, dt datetime, sc char(10), sv varchar(10), b blob, tx text);
+insert into t2 values (NULL, 1, 3, 4, 1.5, 2.5, 1972, '1972-10-22', '1972-10-22 11:50', 'testc', 'testv', 'tetetetetest', 'teeeeeeeeeeeest');
+create table t1 SELECT it2 from t2 UNION select it1 from t2;
+select * from t1;
+it2
+1
+NULL
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `it2` tinyint(4) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 SELECT it2 from t2 UNION select i from t2;
+select * from t1;
+it2
+1
+3
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `it2` int(11) NOT NULL default '0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 SELECT i from t2 UNION select f from t2;
+select * from t1;
+i
+3
+1.5
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` double default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 SELECT f from t2 UNION select d from t2;
+select * from t1;
+f
+1.5
+2.5
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f` double default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 SELECT ib from t2 UNION select f from t2;
+select * from t1;
+ib
+4
+1.5
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `ib` double default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 SELECT ib from t2 UNION select d from t2;
+select * from t1;
+ib
+4
+2.5
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `ib` double default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 SELECT f from t2 UNION select y from t2;
+select * from t1;
+f
+1.5
+1972
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f` float default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 SELECT f from t2 UNION select da from t2;
+select * from t1;
+f
+1.5
+1972-10-22
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f` binary(24) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 SELECT y from t2 UNION select da from t2;
+select * from t1;
+y
+1972
+1972-10-22
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `y` binary(10) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 SELECT y from t2 UNION select dt from t2;
+select * from t1;
+y
+1972
+1972-10-22 11:50:00
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `y` binary(19) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 SELECT da from t2 UNION select dt from t2;
+select * from t1;
+da
+1972-10-22 00:00:00
+1972-10-22 11:50:00
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `da` datetime default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 SELECT dt from t2 UNION select sc from t2;
+select * from t1;
+dt
+1972-10-22 11:50:00
+testc
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `dt` binary(19) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 SELECT dt from t2 UNION select sv from t2;
+select * from t1;
+dt
+1972-10-22 11:50:00
+testv
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `dt` binary(19) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 SELECT sc from t2 UNION select sv from t2;
+select * from t1;
+sc
+testc
+testv
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `sc` varchar(10) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 SELECT dt from t2 UNION select b from t2;
+select * from t1;
+dt
+1972-10-22 11:50:00
+tetetetetest
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `dt` blob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 SELECT sv from t2 UNION select b from t2;
+select * from t1;
+sv
+testv
+tetetetetest
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `sv` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 SELECT i from t2 UNION select d from t2 UNION select b from t2;
+select * from t1;
+i
+3
+2.5
+tetetetetest
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` blob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 SELECT sv from t2 UNION select tx from t2;
+select * from t1;
+sv
+testv
+teeeeeeeeeeeest
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `sv` text
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 SELECT b from t2 UNION select tx from t2;
+select * from t1;
+b
+tetetetetest
+teeeeeeeeeeeest
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `b` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1,t2;
+create table t1 (d decimal(10,1));
+create table t2 (d decimal(10,9));
+insert into t1 values ("100000000.0");
+insert into t2 values ("1.23456780");
+create table t3 select * from t2 union select * from t1;
+select * from t3;
+d
+1.234567800
+100000000.0
+show create table t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `d` decimal(10,9) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1,t2,t3;
+create table t1 select 1 union select -1;
+select * from t1;
+1
+1
+-1
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `1` bigint(20) NOT NULL default '0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 select _latin1"test" union select _latin2"testt" ;
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'UNION'
+create table t1 select _latin2"test" union select _latin2"testt" ;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `test` char(5) character set latin2 NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (s char(200));
+insert into t1 values (repeat("1",200));
+create table t2 select * from t1;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+set local tmp_table_size=1024;
+select count(*) from (select * from t1 union all select * from t2 order by 1) b;
+count(*)
+21
+select count(*) from t1;
+count(*)
+8
+select count(*) from t2;
+count(*)
+13
+drop table t1,t2;
+set local tmp_table_size=default;
+create table t1 (a int, index (a), b int);
+insert t1 values (1,1),(2,2),(3,3),(4,4),(5,5);
+insert t1 select a+1, a+b from t1;
+insert t1 select a+1, a+b from t1;
+insert t1 select a+1, a+b from t1;
+insert t1 select a+1, a+b from t1;
+insert t1 select a+1, a+b from t1;
+FLUSH STATUS;
+show status like 'Slow_queries';
+Variable_name Value
+Slow_queries 0
+select count(*) from t1 where a=7;
+count(*)
+26
+show status like 'Slow_queries';
+Variable_name Value
+Slow_queries 0
+select count(*) from t1 where b=13;
+count(*)
+10
+show status like 'Slow_queries';
+Variable_name Value
+Slow_queries 1
+select count(*) from t1 where b=13 union select count(*) from t1 where a=7;
+count(*)
+10
+26
+show status like 'Slow_queries';
+Variable_name Value
+Slow_queries 2
+select count(*) from t1 where a=7 union select count(*) from t1 where b=13;
+count(*)
+26
+10
+show status like 'Slow_queries';
+Variable_name Value
+Slow_queries 3
+drop table t1;
+create table t1 ( RID int(11) not null default '0', IID int(11) not null default '0', nada varchar(50) not null,NAME varchar(50) not null,PHONE varchar(50) not null) engine=MyISAM;
+insert into t1 ( RID,IID,nada,NAME,PHONE) values (1, 1, 'main', 'a', '111'), (2, 1, 'main', 'b', '222'), (3, 1, 'main', 'c', '333'), (4, 1, 'main', 'd', '444'), (5, 1, 'main', 'e', '555'), (6, 2, 'main', 'c', '333'), (7, 2, 'main', 'd', '454'), (8, 2, 'main', 'e', '555'), (9, 2, 'main', 'f', '666'), (10, 2, 'main', 'g', '777');
+select A.NAME, A.PHONE, B.NAME, B.PHONE from t1 A left join t1 B on A.NAME = B.NAME and B.IID = 2 where A.IID = 1 and (A.PHONE <> B.PHONE or B.NAME is null) union select A.NAME, A.PHONE, B.NAME, B.PHONE from t1 B left join t1 A on B.NAME = A.NAME and A.IID = 1 where B.IID = 2 and (A.PHONE <> B.PHONE or A.NAME is null);
+NAME PHONE NAME PHONE
+a 111 NULL NULL
+b 222 NULL NULL
+d 444 d 454
+NULL NULL f 666
+NULL NULL g 777
+drop table t1;
+create table t1 (col1 tinyint unsigned, col2 tinyint unsigned);
+insert into t1 values (1,2),(3,4),(5,6),(7,8),(9,10);
+select col1 n from t1 union select col2 n from t1 order by n;
+n
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+alter table t1 add index myindex (col2);
+select col1 n from t1 union select col2 n from t1 order by n;
+n
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+drop table t1;
+create table t1 (i int);
+insert into t1 values (1);
+select * from t1 UNION select * from t1;
+i
+1
+select * from t1 UNION ALL select * from t1;
+i
+1
+1
+select * from t1 UNION select * from t1 UNION ALL select * from t1;
+i
+1
+1
+drop table t1;
+select 1 as a union all select 1 union all select 2 union select 1 union all select 2;
+a
+1
+2
+2
+set sql_select_limit=1;
+select 1 union select 2;
+1
+1
+(select 1) union (select 2);
+1
+1
+(select 1) union (select 2) union (select 3) limit 2;
+1
+1
+2
+set sql_select_limit=default;
+create table t1 (a int);
+insert into t1 values (100), (1);
+create table t2 (a int);
+insert into t2 values (100);
+select a from t1 union select a from t2 order by a;
+a
+1
+100
+SET SQL_SELECT_LIMIT=1;
+select a from t1 union select a from t2 order by a;
+a
+1
+drop table t1, t2;
+set sql_select_limit=default;
+CREATE TABLE t1 (i int(11) default NULL,c char(1) default NULL,KEY i (i));
+CREATE TABLE t2 (i int(11) default NULL,c char(1) default NULL,KEY i (i));
+explain (select * from t1) union (select * from t2) order by not_existing_column;
+ERROR 42S22: Unknown column 'not_existing_column' in 'order clause'
+drop table t1, t2;
+CREATE TABLE t1 (uid int(1));
+INSERT INTO t1 SELECT 150;
+SELECT 'a' UNION SELECT uid FROM t1;
+a
+a
+150
+drop table t1;
+CREATE TABLE t1 ( ID1 int(10) unsigned NOT NULL DEFAULT '0' , ID2 datetime NOT NULL DEFAULT '0000-00-00 00:00:00' , DATA1 varchar(10) , DATA2 double(5,4) , DATA3 datetime , PRIMARY KEY (ID1,ID2));
+CREATE TABLE t2 ( ID int(3) unsigned NOT NULL DEFAULT '0' , DATA1 timestamp DEFAULT '0000-00-00 00:00:00' , PRIMARY KEY (ID));
+(SELECT * FROM t1 AS PARTITIONED, t2 AS
+PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
+(SELECT * FROM t1 AS PARTITIONED, t2 AS
+PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
+(SELECT * FROM t1 AS PARTITIONED, t2 AS
+PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
+(SELECT * FROM t1 AS PARTITIONED, t2 AS
+PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
+(SELECT * FROM t1 AS PARTITIONED, t2 AS
+PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
+(SELECT * FROM t1 AS PARTITIONED, t2 AS
+PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
+(SELECT * FROM t1 AS PARTITIONED, t2 AS
+PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
+(SELECT * FROM t1 AS PARTITIONED, t2 AS
+PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
+(SELECT * FROM t1 AS PARTITIONED, t2 AS
+PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
+(SELECT * FROM t1 AS PARTITIONED, t2 AS
+PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
+(SELECT * FROM t1 AS PARTITIONED, t2 AS
+PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
+(SELECT * FROM t1 AS PARTITIONED, t2 AS
+PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1);
+ID1 ID2 DATA1 DATA2 DATA3 ID DATA1
+drop table t1,t2;
+create table t1 (a ENUM('Yes', 'No') NOT NULL);
+create table t2 (a ENUM('aaa', 'bbb') NOT NULL);
+insert into t1 values ('No');
+insert into t2 values ('bbb');
+create table t3 (a SET('Yes', 'No') NOT NULL);
+create table t4 (a SET('aaa', 'bbb') NOT NULL);
+insert into t3 values (1);
+insert into t4 values (3);
+select "1" as a union select a from t1;
+a
+1
+No
+select a as a from t1 union select "1";
+a
+No
+1
+select a as a from t2 union select a from t1;
+a
+bbb
+No
+select "1" as a union select a from t3;
+a
+1
+Yes
+select a as a from t3 union select "1";
+a
+Yes
+1
+select a as a from t4 union select a from t3;
+a
+aaa,bbb
+Yes
+select a as a from t1 union select a from t4;
+a
+No
+aaa,bbb
+drop table t1,t2,t3,t4;
+create table t1 as
+(select _latin1'test') union
+(select _latin1'TEST') union
+(select _latin1'TeST');
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `test` char(4) NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select count(*) from t1;
+count(*)
+1
+drop table t1;
+create table t1 as
+(select _latin1'test' collate latin1_bin) union
+(select _latin1'TEST') union
+(select _latin1'TeST');
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `_latin1'test' collate latin1_bin` char(4) character set latin1 collate latin1_bin NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select count(*) from t1;
+count(*)
+3
+drop table t1;
+create table t1 as
+(select _latin1'test') union
+(select _latin1'TEST' collate latin1_bin) union
+(select _latin1'TeST');
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `test` char(4) character set latin1 collate latin1_bin NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select count(*) from t1;
+count(*)
+3
+drop table t1;
+create table t1 as
+(select _latin1'test') union
+(select _latin1'TEST') union
+(select _latin1'TeST' collate latin1_bin);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `test` char(4) character set latin1 collate latin1_bin NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select count(*) from t1;
+count(*)
+3
+drop table t1;
+create table t2 (
+a char character set latin1 collate latin1_swedish_ci,
+b char character set latin1 collate latin1_bin);
+create table t1 as
+(select a from t2) union
+(select b from t2);
+ERROR HY000: Illegal mix of collations for operation 'UNION'
+create table t1 as
+(select a collate latin1_german1_ci from t2) union
+(select b from t2);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a collate latin1_german1_ci` char(1) character set latin1 collate latin1_german1_ci default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as
+(select a from t2) union
+(select b collate latin1_german1_ci from t2);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(1) character set latin1 collate latin1_german1_ci default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as
+(select a from t2) union
+(select b from t2) union
+(select 'c' collate latin1_german1_ci from t2);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(1) character set latin1 collate latin1_german1_ci default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+drop table t2;
diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result
index 7810d52d156..beab6105f79 100644
--- a/mysql-test/r/update.result
+++ b/mysql-test/r/update.result
@@ -1,15 +1,15 @@
-drop table if exists t1;
+drop table if exists t1,t2;
create table t1 (a int auto_increment , primary key (a));
insert into t1 values (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
update t1 set a=a+10 where a > 34;
update t1 set a=a+100 where a > 0;
update t1 set a=a+100 where a=1 and a=2;
update t1 set a=b+100 where a=1 and a=2;
-Unknown column 'b' in 'field list'
+ERROR 42S22: Unknown column 'b' in 'field list'
update t1 set a=b+100 where c=1 and a=2;
-Unknown column 'c' in 'where clause'
+ERROR 42S22: Unknown column 'c' in 'where clause'
update t1 set d=a+100 where a=1;
-Unknown column 'd' in 'field list'
+ERROR 42S22: Unknown column 'd' in 'field list'
select * from t1;
a
101
@@ -94,7 +94,7 @@ KEY k2 (type),
KEY k3 (parent),
KEY k4 (assignment),
KEY ticket (ticket)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (773,773,'','','',980257344,20010318180652,0,'Open',10,0,0,0,1,'','','','','');
alter table t1 change lfdnr lfdnr int(10) unsigned not null auto_increment;
update t1 set status=1 where type='Open';
@@ -137,13 +137,16 @@ a b
13 2
111 100
111 100
-drop table t1;
+create table t2 (a int not null, b int not null);
+insert into t2 values (1,1),(1,2),(1,3);
+update t1 set b=(select distinct 1 from (select * from t2) a);
+drop table t1,t2;
CREATE TABLE t1 (
`id_param` smallint(3) unsigned NOT NULL default '0',
`nom_option` char(40) NOT NULL default '',
`valid` tinyint(1) NOT NULL default '0',
KEY `id_param` (`id_param`,`nom_option`)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 (id_param,nom_option,valid) VALUES (185,'600x1200',1);
UPDATE t1 SET nom_option='test' WHERE id_param=185 AND nom_option='600x1200' AND valid=1 LIMIT 1;
select * from t1;
@@ -155,7 +158,7 @@ insert into t1 (F1,F2,F3,cnt,groupid) values ('0','0','0',1,6),
('0','1','2',1,5), ('0','2','0',1,3), ('1','0','1',1,2),
('1','2','1',1,1), ('1','2','2',1,1), ('2','0','1',2,4),
('2','2','0',1,7);
-delete from t1 using t1 m1,t1 m2 where m1.groupid=m2.groupid and (m1.cnt < m2.cnt or m1.cnt=m2.cnt and m1.F3>m2.F3);
+delete from m1 using t1 m1,t1 m2 where m1.groupid=m2.groupid and (m1.cnt < m2.cnt or m1.cnt=m2.cnt and m1.F3>m2.F3);
select * from t1;
F1 F2 F3 cnt groupid
0 0 0 1 6
diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result
index 3e83438b273..4f521143d97 100644
--- a/mysql-test/r/user_var.result
+++ b/mysql-test/r/user_var.result
@@ -1,10 +1,14 @@
+drop table if exists t1,t2;
set @a := foo;
-Unknown column 'foo' in 'field list'
+ERROR 42S22: Unknown column 'foo' in 'field list'
set @a := connection_id() + 3;
select @a - connection_id();
@a - connection_id()
3
-drop table if exists t1,t2;
+set @b := 1;
+select @b;
+@b
+1
CREATE TABLE t1 ( i int not null, v int not null,index (i));
insert into t1 values (1,1),(1,3),(2,1);
create table t2 (i int not null, unique (i));
@@ -18,17 +22,17 @@ i @vv1:=if(sv1.i,1,0) @vv2:=if(sv2.i,1,0) @vv3:=if(sv3.i,1,0) @vv1+@vv2+@vv3
1 1 0 1 2
2 1 0 0 1
explain select * from t1 where i=@vv1;
-table type possible_keys key key_len ref rows Extra
-t1 ref i i 4 const 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref i i 4 const 1 Using where
explain select * from t1 where @vv1:=@vv1+1 and i=@vv1;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 3 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
explain select @vv1:=i from t1 where i=@vv1;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL i 4 NULL 3 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL i 4 NULL 3 Using where; Using index
explain select * from t1 where i=@vv1;
-table type possible_keys key key_len ref rows Extra
-t1 ref i i 4 const 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref i i 4 const 1 Using where
drop table t1,t2;
set @a=0,@b=0;
select @a:=10, @b:=1, @a > @b, @a < @b;
@@ -116,3 +120,71 @@ select @a+0, @a:=@a+0+count(*), count(*), @a+0 from t1 group by i;
1 3 2 0
3 6 3 0
drop table t1;
+set @a=_latin2'test';
+select charset(@a),collation(@a),coercibility(@a);
+charset(@a) collation(@a) coercibility(@a)
+latin2 latin2_general_ci 3
+select @a=_latin2'TEST';
+@a=_latin2'TEST'
+1
+select @a=_latin2'TEST' collate latin2_bin;
+@a=_latin2'TEST' collate latin2_bin
+0
+set @a=_latin2'test' collate latin2_general_ci;
+select charset(@a),collation(@a),coercibility(@a);
+charset(@a) collation(@a) coercibility(@a)
+latin2 latin2_general_ci 0
+select @a=_latin2'TEST';
+@a=_latin2'TEST'
+1
+select @a=_latin2'TEST' collate latin2_bin;
+ERROR HY000: Illegal mix of collations (latin2_general_ci,EXPLICIT) and (latin2_bin,EXPLICIT) for operation '='
+select charset(@a:=_latin2'test');
+charset(@a:=_latin2'test')
+latin2
+select collation(@a:=_latin2'test');
+collation(@a:=_latin2'test')
+latin2_general_ci
+select coercibility(@a:=_latin2'test');
+coercibility(@a:=_latin2'test')
+3
+select collation(@a:=_latin2'test' collate latin2_bin);
+collation(@a:=_latin2'test' collate latin2_bin)
+latin2_bin
+select coercibility(@a:=_latin2'test' collate latin2_bin);
+coercibility(@a:=_latin2'test' collate latin2_bin)
+0
+select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST';
+(@a:=_latin2'test' collate latin2_bin) = _latin2'TEST'
+0
+select charset(@a),collation(@a),coercibility(@a);
+charset(@a) collation(@a) coercibility(@a)
+latin2 latin2_bin 0
+select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST' collate latin2_general_ci;
+ERROR HY000: Illegal mix of collations (latin2_bin,EXPLICIT) and (latin2_general_ci,EXPLICIT) for operation '='
+create table t1 (a varchar(50));
+reset master;
+SET TIMESTAMP=10000;
+SET @`a b`='hello';
+INSERT INTO t1 VALUES(@`a b`);
+set @var1= "';aaa";
+insert into t1 values (@var1);
+show binlog events from 79;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 79 User var 1 79 @`a b`=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci
+master-bin.000001 120 Query 1 120 use `test`; INSERT INTO t1 VALUES(@`a b`)
+master-bin.000001 184 User var 1 184 @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci
+master-bin.000001 226 Query 1 226 use `test`; insert into t1 values (@var1)
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+SET @`a b`:=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci;
+use test;
+SET TIMESTAMP=10000;
+INSERT INTO t1 VALUES(@`a b`);
+SET @`var1`:=_latin1 0x273B616161 COLLATE latin1_swedish_ci;
+SET TIMESTAMP=10000;
+insert into t1 values (@var1);
+drop table t1;
+set @var= NULL ;
+select FIELD( @var,'1it','Hit') as my_column;
+my_column
+0
diff --git a/mysql-test/r/varbinary.result b/mysql-test/r/varbinary.result
index 4eb34ebfd63..ab5779859ae 100644
--- a/mysql-test/r/varbinary.result
+++ b/mysql-test/r/varbinary.result
@@ -1,3 +1,4 @@
+drop table if exists t1;
select 0x41,0x41+0,0x41 | 0x7fffffffffffffff | 0,0xffffffffffffffff | 0 ;
0x41 0x41+0 0x41 | 0x7fffffffffffffff | 0 0xffffffffffffffff | 0
A 65 9223372036854775807 18446744073709551615
@@ -7,18 +8,19 @@ select 0x31+1,concat(0x31)+1,-0xf;
select x'31',X'ffff'+0;
x'31' X'ffff'+0
1 65535
-drop table if exists t1;
create table t1 (ID int(8) unsigned zerofill not null auto_increment,UNIQ bigint(21) unsigned zerofill not null,primary key (ID),unique (UNIQ) );
insert into t1 set UNIQ=0x38afba1d73e6a18a;
insert into t1 set UNIQ=123;
-explain select * from t1 where UNIQ=0x38afba1d73e6a18a;
-table type possible_keys key key_len ref rows Extra
-t1 const UNIQ UNIQ 8 const 1
+explain extended select * from t1 where UNIQ=0x38afba1d73e6a18a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const UNIQ UNIQ 8 const 1
+Warnings:
+Note 1003 select test.t1.ID AS `ID`,test.t1.UNIQ AS `UNIQ` from test.t1 where (test.t1.UNIQ = 4084688022709641610)
drop table t1;
select x'hello';
-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 'x'hello'' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'x'hello'' at line 1
select 0xfg;
-Unknown column '0xfg' in 'field list'
+ERROR 42S22: Unknown column '0xfg' in 'field list'
create table t1 select 1 as x, 2 as xx;
select x,xx from t1;
x xx
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index 13d09e09783..01db98648bd 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -1,4 +1,4 @@
-drop table if exists t1;
+drop table if exists t1,t2;
set @`test`=1,@TEST=3,@select=2,@t5=1.23456;
select @test,@`select`,@TEST,@not_used;
@test @`select` @TEST @not_used
@@ -22,6 +22,11 @@ NULL NULL NULL NULL
select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3;
@t1:=(@t2:=1)+@t3:=4 @t1 @t2 @t3
5 5 1 4
+explain extended select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select sql_no_cache (@t1:=((@t2:=1) + (@t3:=4))) AS `@t1:=(@t2:=1)+@t3:=4`,(@t1) AS `@t1`,(@t2) AS `@t2`,(@t3) AS `@t3`
select @t5;
@t5
1.23456
@@ -50,7 +55,7 @@ Variable_name Value
max_join_size 100
show global variables like 'max_join_size';
Variable_name Value
-max_join_size HA_POS_ERROR
+max_join_size 10
set GLOBAL max_join_size=2000;
show global variables like 'max_join_size';
Variable_name Value
@@ -76,9 +81,19 @@ select @@VERSION=version();
select last_insert_id(345);
last_insert_id(345)
345
+explain extended select last_insert_id(345);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select sql_no_cache last_insert_id(345) AS `last_insert_id(345)`
select @@IDENTITY,last_insert_id(), @@identity;
-@@identity last_insert_id() @@identity
+@@IDENTITY last_insert_id() @@identity
345 345 345
+explain extended select @@IDENTITY,last_insert_id(), @@identity;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select sql_no_cache 345 AS `@@IDENTITY`,last_insert_id() AS `last_insert_id()`,345 AS `@@identity`
set big_tables=OFF, big_tables=ON, big_tables=0, big_tables=1, big_tables="OFF", big_tables="ON";
set global concurrent_insert=ON;
show variables like 'concurrent_insert';
@@ -100,13 +115,13 @@ set global concurrent_insert=DEFAULT;
show variables like 'concurrent_insert';
Variable_name Value
concurrent_insert ON
-set table_type=MYISAM, table_type="HEAP", global table_type="INNODB";
-show local variables like 'table_type';
+set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="INNODB";
+show local variables like 'storage_engine';
Variable_name Value
-table_type HEAP
-show global variables like 'table_type';
+storage_engine HEAP
+show global variables like 'storage_engine';
Variable_name Value
-table_type INNODB
+storage_engine InnoDB
set GLOBAL query_cache_size=100000;
set GLOBAL myisam_max_sort_file_size=2000000;
show global variables like 'myisam_max_sort_file_size';
@@ -152,18 +167,10 @@ set net_buffer_length=2000000000;
show variables like 'net_buffer_length';
Variable_name Value
net_buffer_length 1048576
-set GLOBAL character set cp1251_koi8;
-show global variables like "convert_character_set";
-Variable_name Value
-convert_character_set cp1251_koi8
set character set cp1251_koi8;
-show variables like "convert_character_set";
+show variables like "character_set_client";
Variable_name Value
-convert_character_set cp1251_koi8
-set global character set default, session character set default;
-show variables like "convert_character_set";
-Variable_name Value
-convert_character_set cp1251_koi8
+character_set_client cp1251
select @@timestamp>0;
@@timestamp>0
1
@@ -204,48 +211,50 @@ range_alloc_block_size 2048
transaction_alloc_block_size 8192
transaction_prealloc_size 4096
set big_tables=OFFF;
-Variable 'big_tables' can't be set to the value of 'OFFF'
+ERROR 42000: Variable 'big_tables' can't be set to the value of 'OFFF'
set big_tables="OFFF";
-Variable 'big_tables' can't be set to the value of 'OFFF'
+ERROR 42000: Variable 'big_tables' can't be set to the value of 'OFFF'
set unknown_variable=1;
-Unknown system variable 'unknown_variable'
+ERROR HY000: Unknown system variable 'unknown_variable'
set max_join_size="hello";
-Wrong argument type to variable 'max_join_size'
-set table_type=UNKNOWN_TABLE_TYPE;
-Variable 'table_type' can't be set to the value of 'UNKNOWN_TABLE_TYPE'
-set table_type=INNODB, big_tables=2;
-Variable 'big_tables' can't be set to the value of '2'
-show local variables like 'table_type';
-Variable_name Value
-table_type HEAP
+ERROR 42000: Incorrect argument type to variable 'max_join_size'
+set storage_engine=UNKNOWN_TABLE_TYPE;
+ERROR 42000: Unknown table engine 'UNKNOWN_TABLE_TYPE'
+set storage_engine=INNODB, big_tables=2;
+ERROR 42000: Variable 'big_tables' can't be set to the value of '2'
+show local variables like 'storage_engine';
+Variable_name Value
+storage_engine HEAP
set SESSION query_cache_size=10000;
-Variable 'query_cache_size' is a GLOBAL variable and should be set with SET GLOBAL
-set GLOBAL table_type=DEFAULT;
-Variable 'table_type' doesn't have a default value
-set convert_character_set=UNKNOWN_CHARACTER_SET;
-Unknown character set: 'UNKNOWN_CHARACTER_SET'
-set character set unknown;
-Unknown character set: 'unknown'
-set character set 0;
-Wrong argument type to variable 'convert_character_set'
+ERROR HY000: Variable 'query_cache_size' is a GLOBAL variable and should be set with SET GLOBAL
+set GLOBAL storage_engine=DEFAULT;
+ERROR 42000: Variable 'storage_engine' doesn't have a default value
+set character_set_client=UNKNOWN_CHARACTER_SET;
+ERROR 42000: Unknown character set: 'UNKNOWN_CHARACTER_SET'
+set collation_connection=UNKNOWN_COLLATION;
+ERROR HY000: Unknown collation: 'UNKNOWN_COLLATION'
+set character_set_client=NULL;
+ERROR 42000: Variable 'character_set_client' can't be set to the value of 'NULL'
+set collation_connection=NULL;
+ERROR 42000: Variable 'collation_connection' can't be set to the value of 'NULL'
set global autocommit=1;
-Variable 'autocommit' is a LOCAL variable and can't be used with SET GLOBAL
+ERROR HY000: Variable 'autocommit' is a SESSION variable and can't be used with SET GLOBAL
select @@global.timestamp;
-Variable 'timestamp' is a LOCAL variable
+ERROR HY000: Variable 'timestamp' is a SESSION variable
set @@version='';
-Unknown system variable 'version'
+ERROR HY000: Unknown system variable 'version'
set @@concurrent_insert=1;
-Variable 'concurrent_insert' is a GLOBAL variable and should be set with SET GLOBAL
+ERROR HY000: Variable 'concurrent_insert' is a GLOBAL variable and should be set with SET GLOBAL
set @@global.sql_auto_is_null=1;
-Variable 'sql_auto_is_null' is a LOCAL variable and can't be used with SET GLOBAL
+ERROR HY000: Variable 'sql_auto_is_null' is a SESSION variable and can't be used with SET GLOBAL
select @@global.sql_auto_is_null;
-Variable 'sql_auto_is_null' is a LOCAL variable
+ERROR HY000: Variable 'sql_auto_is_null' is a SESSION variable
set myisam_max_sort_file_size=100;
-Variable 'myisam_max_sort_file_size' is a GLOBAL variable and should be set with SET GLOBAL
+ERROR HY000: Variable 'myisam_max_sort_file_size' is a GLOBAL variable and should be set with SET GLOBAL
set myisam_max_extra_sort_file_size=100;
-Variable 'myisam_max_extra_sort_file_size' is a GLOBAL variable and should be set with SET GLOBAL
+ERROR HY000: Variable 'myisam_max_extra_sort_file_size' is a GLOBAL variable and should be set with SET GLOBAL
set @@SQL_WARNINGS=NULL;
-Variable 'sql_warnings' can't be set to the value of 'NULL'
+ERROR 42000: Variable 'sql_warnings' can't be set to the value of 'NULL'
set autocommit=1;
set big_tables=1;
select @@autocommit, @@big_tables;
@@ -253,8 +262,8 @@ select @@autocommit, @@big_tables;
1 1
set global binlog_cache_size=100;
set bulk_insert_buffer_size=100;
-set convert_character_set=cp1251_koi8;
-set convert_character_set=default;
+set character set cp1251_koi8;
+set character set default;
set @@global.concurrent_insert=1;
set global connect_timeout=100;
select @@delay_key_write;
@@ -343,14 +352,13 @@ set sql_select_limit=1;
set global sql_slave_skip_counter=100;
set sql_warnings=1;
set global table_cache=100;
-set table_type=myisam;
+set storage_engine=myisam;
set global thread_cache_size=100;
set timestamp=1, timestamp=default;
set tmp_table_size=100;
set tx_isolation="READ-COMMITTED";
set wait_timeout=100;
set log_warnings=1;
-DROP TABLE IF EXISTS t1,t2;
create table t1 (a int not null auto_increment, primary key(a));
create table t2 (a int not null auto_increment, primary key(a));
insert into t1 values(null),(null),(null);
@@ -369,18 +377,65 @@ check table t1,t2;
Table Op Msg_type Msg_text
test.t1 check status OK
test.t2 check status OK
+select max(a) +1, max(a) +2 into @xx,@yy from t1;
drop table t1,t2;
select @@xxxxxxxxxx;
-Unknown system variable 'xxxxxxxxxx'
+ERROR HY000: Unknown system variable 'xxxxxxxxxx'
select 1;
1
1
select @@session.key_buffer_size;
-Variable 'key_buffer_size' is a GLOBAL variable
+ERROR HY000: Variable 'key_buffer_size' is a GLOBAL variable
+set ft_boolean_syntax = @@init_connect;
+ERROR HY000: Variable 'ft_boolean_syntax' is a GLOBAL variable and should be set with SET GLOBAL
+set global ft_boolean_syntax = @@init_connect;
+ERROR 42000: Variable 'ft_boolean_syntax' can't be set to the value of ''
+set init_connect = NULL;
+ERROR HY000: Variable 'init_connect' is a GLOBAL variable and should be set with SET GLOBAL
+set global init_connect = NULL;
+set ft_boolean_syntax = @@init_connect;
+ERROR HY000: Variable 'ft_boolean_syntax' is a GLOBAL variable and should be set with SET GLOBAL
+set global ft_boolean_syntax = @@init_connect;
+ERROR 42000: Variable 'ft_boolean_syntax' can't be set to the value of ''
set global myisam_max_sort_file_size=4294967296;
show global variables like 'myisam_max_sort_file_size';
Variable_name Value
myisam_max_sort_file_size MAX_FILE_SIZE
+set global myisam_max_sort_file_size=default;
+select @@global.max_user_connections,@@local.max_join_size;
+@@global.max_user_connections @@session.max_join_size
+100 200
+set @svc=@@global.max_user_connections, @svj=@@local.max_join_size;
+select @@global.max_user_connections,@@local.max_join_size;
+@@global.max_user_connections @@session.max_join_size
+100 200
+set @@global.max_user_connections=111,@@local.max_join_size=222;
+select @@global.max_user_connections,@@local.max_join_size;
+@@global.max_user_connections @@session.max_join_size
+111 222
+set @@global.max_user_connections=@@local.max_join_size,@@local.max_join_size=@@global.max_user_connections;
+select @@global.max_user_connections,@@local.max_join_size;
+@@global.max_user_connections @@session.max_join_size
+222 111
+set @@global.max_user_connections=@svc, @@local.max_join_size=@svj;
+select @@global.max_user_connections,@@local.max_join_size;
+@@global.max_user_connections @@session.max_join_size
+100 200
+set @a=1, @b=2;
+set @a=@b, @b=@a;
+select @a, @b;
+@a @b
+2 1
+set @@global.global.key_buffer_size= 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_buffer_size= 1' at line 1
+set GLOBAL global.key_buffer_size= 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_buffer_size= 1' at line 1
+SELECT @@global.global.key_buffer_size;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_buffer_size' at line 1
+SELECT @@global.session.key_buffer_size;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_buffer_size' at line 1
+SELECT @@global.local.key_buffer_size;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_buffer_size' at line 1
set @tstlw = @@log_warnings;
show global variables like 'log_warnings';
Variable_name Value
@@ -397,3 +452,33 @@ set global log_warnings = @tstlw;
show global variables like 'log_warnings';
Variable_name Value
log_warnings 1
+create table t1 (
+c1 tinyint,
+c2 smallint,
+c3 mediumint,
+c4 int,
+c5 bigint);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` tinyint(4) default NULL,
+ `c2` smallint(6) default NULL,
+ `c3` mediumint(9) default NULL,
+ `c4` int(11) default NULL,
+ `c5` bigint(20) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+set @arg00= 8, @arg01= 8.8, @arg02= 'a string';
+create table t1 as select @arg00 as c1, @arg01 as c2, @arg02 as c3;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` bigint(20) default NULL,
+ `c2` double default NULL,
+ `c3` longtext
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+SET GLOBAL MYISAM_DATA_POINTER_SIZE= 8;
+SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE';
+Variable_name Value
+myisam_data_pointer_size 8
diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result
index e5713718db0..d883feb7ce2 100644
--- a/mysql-test/r/warnings.result
+++ b/mysql-test/r/warnings.result
@@ -1,10 +1,135 @@
-drop table if exists t1;
+drop table if exists t1, t2;
+SET SQL_WARNINGS=1;
create table t1 (a int);
insert into t1 values (1);
insert into t1 values ("hej");
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
insert into t1 values ("hej"),("då");
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'a' at row 2
set SQL_WARNINGS=1;
insert into t1 values ("hej");
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
insert into t1 values ("hej"),("då");
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'a' at row 2
drop table t1;
set SQL_WARNINGS=0;
+drop temporary table if exists not_exists;
+Warnings:
+Note 1051 Unknown table 'not_exists'
+drop table if exists not_exists_table;
+Warnings:
+Note 1051 Unknown table 'not_exists_table'
+show warnings limit 1;
+Level Code Message
+Note 1051 Unknown table 'not_exists_table'
+drop database if exists not_exists_db;
+Warnings:
+Note 1008 Can't drop database 'not_exists_db'; database doesn't exist
+show count(*) warnings;
+@@session.warning_count
+1
+create table t1(id int);
+create table if not exists t1(id int);
+select @@warning_count;
+@@warning_count
+0
+drop table t1;
+create table t1(a tinyint, b int not null, c date, d char(5));
+load data infile '../../std_data/warnings_loaddata.dat' into table t1 fields terminated by ',';
+Warnings:
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'b' at row 2
+Warning 1265 Data truncated for column 'd' at row 3
+Warning 1265 Data truncated for column 'c' at row 4
+Warning 1261 Row 5 doesn't contain data for all columns
+Warning 1265 Data truncated for column 'b' at row 6
+Warning 1262 Row 7 was truncated; it contained more data than there were input columns
+Warning 1264 Data truncated; out of range for column 'a' at row 8
+select @@warning_count;
+@@warning_count
+7
+drop table t1;
+create table t1(a tinyint NOT NULL, b tinyint unsigned, c char(5));
+insert into t1 values(NULL,100,'mysql'),(10,-1,'mysql ab'),(500,256,'open source'),(20,NULL,'test');
+Warnings:
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1
+Warning 1264 Data truncated; out of range for column 'b' at row 2
+Warning 1265 Data truncated for column 'c' at row 2
+Warning 1264 Data truncated; out of range for column 'a' at row 3
+Warning 1264 Data truncated; out of range for column 'b' at row 3
+Warning 1265 Data truncated for column 'c' at row 3
+alter table t1 modify c char(4);
+Warnings:
+Warning 1265 Data truncated for column 'c' at row 1
+Warning 1265 Data truncated for column 'c' at row 2
+alter table t1 add d char(2);
+update t1 set a=NULL where a=10;
+Warnings:
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 2
+update t1 set c='mysql ab' where c='test';
+Warnings:
+Warning 1265 Data truncated for column 'c' at row 4
+update t1 set d=c;
+Warnings:
+Warning 1265 Data truncated for column 'd' at row 1
+Warning 1265 Data truncated for column 'd' at row 2
+Warning 1265 Data truncated for column 'd' at row 3
+Warning 1265 Data truncated for column 'd' at row 4
+create table t2(a tinyint NOT NULL, b char(3));
+insert into t2 select b,c from t1;
+Warnings:
+Warning 1265 Data truncated for column 'b' at row 1
+Warning 1265 Data truncated for column 'b' at row 2
+Warning 1265 Data truncated for column 'b' at row 3
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 4
+Warning 1265 Data truncated for column 'b' at row 4
+insert into t2(b) values('mysqlab');
+Warnings:
+Warning 1265 Data truncated for column 'b' at row 1
+set sql_warnings=1;
+insert into t2(b) values('mysqlab');
+Warnings:
+Warning 1265 Data truncated for column 'b' at row 1
+set sql_warnings=0;
+drop table t1, t2;
+create table t1(a char(10));
+alter table t1 add b char;
+set max_error_count=10;
+update t1 set b=a;
+Warnings:
+Warning 1265 Data truncated for column 'b' at row 1
+Warning 1265 Data truncated for column 'b' at row 2
+Warning 1265 Data truncated for column 'b' at row 3
+Warning 1265 Data truncated for column 'b' at row 4
+Warning 1265 Data truncated for column 'b' at row 5
+Warning 1265 Data truncated for column 'b' at row 6
+Warning 1265 Data truncated for column 'b' at row 7
+Warning 1265 Data truncated for column 'b' at row 8
+Warning 1265 Data truncated for column 'b' at row 9
+Warning 1265 Data truncated for column 'b' at row 10
+select @@warning_count;
+@@warning_count
+50
+drop table t1;
+create table t1 (id int) engine=isam;
+Warnings:
+Warning 1266 Using storage engine MyISAM for table 't1'
+alter table t1 engine=isam;
+Warnings:
+Warning 1266 Using storage engine MyISAM for table 't1'
+drop table t1;
+create table t1 (id int) type=heap;
+Warnings:
+Warning 1287 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead
+alter table t1 type=myisam;
+Warnings:
+Warning 1287 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead
+drop table t1;
+set table_type=MYISAM;
+Warnings:
+Warning 1287 'table_type' is deprecated; use 'storage_engine' instead
diff --git a/mysql-test/std_data/init_file.dat b/mysql-test/std_data/init_file.dat
index 4236ada1142..6105ca2ac1b 100644
--- a/mysql-test/std_data/init_file.dat
+++ b/mysql-test/std_data/init_file.dat
@@ -1 +1 @@
-select * from mysql.user as t1, mysql.user as t2, mysql.user as t3, mysql.user as t4, mysql.user as t5, mysql.user as t6, mysql.user as t7, mysql.user as t8; \ No newline at end of file
+select * from mysql.user as t1, mysql.user as t2, mysql.user as t3;
diff --git a/mysql-test/std_data/master-bin.001 b/mysql-test/std_data/master-bin.000001
index 2ec2397acdd..2ec2397acdd 100644
--- a/mysql-test/std_data/master-bin.001
+++ b/mysql-test/std_data/master-bin.000001
Binary files differ
diff --git a/mysql-test/std_data/trunc_binlog.001 b/mysql-test/std_data/trunc_binlog.000001
index 2c2b4ec6ce4..2c2b4ec6ce4 100644
--- a/mysql-test/std_data/trunc_binlog.001
+++ b/mysql-test/std_data/trunc_binlog.000001
Binary files differ
diff --git a/mysql-test/std_data/warnings_loaddata.dat b/mysql-test/std_data/warnings_loaddata.dat
new file mode 100644
index 00000000000..e645de775ab
--- /dev/null
+++ b/mysql-test/std_data/warnings_loaddata.dat
@@ -0,0 +1,8 @@
+10,20,2003-04-21,mysql
+20,\N,2003-04-22,MySQL
+30,40,2003-04-23,MySQL is Open Source Database
+40,50,monty,30
+50,60,2003-04-24
+60,67 abc,2003-04-25,mysql
+70,80,2003-04-26,mysql,open,source
+500,90,2003-04-27,mysql
diff --git a/mysql-test/t/alias.test b/mysql-test/t/alias.test
index 982bd8b2a45..986af339456 100644
--- a/mysql-test/t/alias.test
+++ b/mysql-test/t/alias.test
@@ -1,4 +1,7 @@
+--disable_warnings
DROP TABLE IF EXISTS t1;
+--enable_warnings
+
CREATE TABLE t1 (
cont_nr int(11) NOT NULL auto_increment,
ver_nr int(11) NOT NULL default '0',
@@ -47,7 +50,7 @@ CREATE TABLE t1 (
KEY mcbs_aufnr(mcbs_aufnr),
KEY kundentyp(kundentyp),
KEY p_nr(p_nr,suffix)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (3359356,405,3359356,'Mustermann Musterfrau',52500,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1485525,2122316,'+','','N',1909160,'MobilComSuper92000D2',NULL,NULL,'MS9ND2',3,24,'MobilCom Shop Koeln',52500,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
INSERT INTO t1 VALUES (3359357,468,3359357,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1503580,2139699,'+','','P',1909171,'MobilComSuper9D1T10SFreisprech(Akquise)',NULL,NULL,'MS9NS1',327,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index 11290134a71..66a4adc90fe 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -1,9 +1,10 @@
#
# Test of alter table
#
-
+--disable_warnings
drop table if exists t1,t2;
drop database if exists mysqltest;
+--enable_warnings
create table t1 (
col1 int not null auto_increment primary key,
@@ -61,7 +62,7 @@ CREATE TABLE t1 (
user_id int(11) unsigned NOT NULL default '0',
status enum('new','old') NOT NULL default 'new',
PRIMARY KEY (id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
ALTER TABLE t1 ORDER BY t1.id, t1.status, t1.type_id, t1.user_id, t1.body;
DROP TABLE t1;
@@ -70,7 +71,7 @@ DROP TABLE t1;
# The following combination found a hang-bug in MyISAM
#
-CREATE TABLE t1 (AnamneseId int(10) unsigned NOT NULL auto_increment,B BLOB,PRIMARY KEY (AnamneseId)) type=myisam;
+CREATE TABLE t1 (AnamneseId int(10) unsigned NOT NULL auto_increment,B BLOB,PRIMARY KEY (AnamneseId)) engine=myisam;
insert into t1 values (null,"hello");
LOCK TABLES t1 WRITE;
ALTER TABLE t1 ADD Column new_col int not null;
@@ -109,20 +110,20 @@ drop database mysqltest;
#
# Rights for renaming test (Bug #3270)
#
-connect (root,localhost,root,,test,$MASTER_MYPORT,master.sock);
+connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection root;
--disable_warnings
create database mysqltest;
--enable_warnings
create table mysqltest.t1 (a int,b int,c int);
grant all on mysqltest.t1 to mysqltest_1@localhost;
-connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,master.sock);
+connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
connection user1;
-- error 1142
alter table t1 rename t2;
connection root;
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
-delete from mysql.user where user='mysqltest_1';
+delete from mysql.user where user=_binary'mysqltest_1';
drop database mysqltest;
#
@@ -183,6 +184,56 @@ ALTER TABLE t1 ENABLE KEYS;
drop table t1;
#
+# Test that data get converted when character set is changed
+# Test that data doesn't get converted when src or dst is BINARY/BLOB
+#
+set names koi8r;
+create table t1 (a char(10) character set koi8r);
+insert into t1 values ('ÔÅÓÔ');
+select a,hex(a) from t1;
+alter table t1 change a a char(10) character set cp1251;
+select a,hex(a) from t1;
+alter table t1 change a a binary(10);
+select a,hex(a) from t1;
+alter table t1 change a a char(10) character set cp1251;
+select a,hex(a) from t1;
+alter table t1 change a a char(10) character set koi8r;
+select a,hex(a) from t1;
+alter table t1 change a a varchar(10) character set cp1251;
+select a,hex(a) from t1;
+alter table t1 change a a char(10) character set koi8r;
+select a,hex(a) from t1;
+alter table t1 change a a text character set cp1251;
+select a,hex(a) from t1;
+alter table t1 change a a char(10) character set koi8r;
+select a,hex(a) from t1;
+delete from t1;
+
+#
+# Test ALTER TABLE .. CHARACTER SET ..
+#
+show create table t1;
+alter table t1 DEFAULT CHARACTER SET latin1;
+show create table t1;
+alter table t1 CONVERT TO CHARACTER SET latin1;
+show create table t1;
+alter table t1 DEFAULT CHARACTER SET cp1251;
+show create table t1;
+
+drop table t1;
+
+#
+# Bug#2821
+# Test that table CHARACTER SET does not affect blobs
+#
+create table t1 (myblob longblob,mytext longtext)
+default charset latin1 collate latin1_general_cs;
+show create table t1;
+alter table t1 character set latin2;
+show create table t1;
+drop table t1;
+
+#
# Test ALTER TABLE ENABLE/DISABLE keys when things are locked
#
@@ -190,7 +241,7 @@ CREATE TABLE t1 (
Host varchar(16) binary NOT NULL default '',
User varchar(16) binary NOT NULL default '',
PRIMARY KEY (Host,User)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
ALTER TABLE t1 DISABLE KEYS;
LOCK TABLES t1 WRITE;
@@ -210,7 +261,7 @@ CREATE TABLE t1 (
User varchar(16) binary NOT NULL default '',
PRIMARY KEY (Host,User),
KEY (Host)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
ALTER TABLE t1 DISABLE KEYS;
SHOW INDEX FROM t1;
@@ -237,7 +288,7 @@ CREATE TABLE t1 (
User varchar(16) binary NOT NULL default '',
PRIMARY KEY (Host,User),
KEY (Host)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
LOCK TABLES t1 WRITE;
ALTER TABLE t1 DISABLE KEYS;
@@ -245,6 +296,25 @@ SHOW INDEX FROM t1;
DROP TABLE t1;
#
+# Bug 2361 (Don't drop UNIQUE with DROP PRIMARY KEY)
+#
+
+CREATE TABLE t1 (a int PRIMARY KEY, b INT UNIQUE);
+ALTER TABLE t1 DROP PRIMARY KEY;
+SHOW CREATE TABLE t1;
+--error 1091
+ALTER TABLE t1 DROP PRIMARY KEY;
+DROP TABLE t1;
+
+# BUG#3899
+create table t1 (a int, b int, key(a));
+insert into t1 values (1,1), (2,2);
+--error 1091
+alter table t1 drop key no_such_key;
+alter table t1 drop key a;
+drop table t1;
+
+#
# BUG#4717 - check for valid table names
#
create table t1 (a int);
@@ -254,3 +324,15 @@ alter table t1 rename to `t1\\`;
rename table t1 to `t1\\`;
drop table t1;
+#
+# Bug #6479 ALTER TABLE ... changing charset fails for TEXT columns
+#
+# The column's character set was changed but the actual data was not
+# modified. In other words, the values were reinterpreted
+# as UTF8 instead of being converted.
+create table t1 (a text) character set koi8r;
+insert into t1 values (_koi8r'ÔÅÓÔ');
+select hex(a) from t1;
+alter table t1 convert to character set cp1251;
+select hex(a) from t1;
+drop table t1;
diff --git a/mysql-test/t/analyse.test b/mysql-test/t/analyse.test
index 9bf737c9515..47f3473584b 100644
--- a/mysql-test/t/analyse.test
+++ b/mysql-test/t/analyse.test
@@ -2,12 +2,39 @@
# Test of procedure analyse
#
+--disable_warnings
drop table if exists t1,t2;
+--enable_warnings
create table t1 (i int, j int, empty_string char(10), bool char(1), d date);
insert into t1 values (1,2,"","Y","2002-03-03"), (3,4,"","N","2002-03-04"), (5,6,"","Y","2002-03-04"), (7,8,"","N","2002-03-05");
+select count(*) from t1 procedure analyse();
select * from t1 procedure analyse();
select * from t1 procedure analyse(2);
create table t2 select * from t1 procedure analyse();
select * from t2;
drop table t1,t2;
+EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE();
+
+#
+# Test with impossible where
+#
+create table t1 (a int not null);
+create table t2 select * from t1 where 0=1 procedure analyse();
+show create table t2;
+select * from t1 where 0=1 procedure analyse();
+insert into t1 values(1);
+drop table t2;
+create table t2 select * from t1 where 0=1 procedure analyse();
+show create table t2;
+select * from t2;
+insert into t2 select * from t1 procedure analyse();
+select * from t2;
+insert into t1 values(2);
+drop table t2;
+create table t2 select * from t1 where 0=1 procedure analyse();
+show create table t2;
+select * from t2;
+insert into t2 select * from t1 procedure analyse();
+select * from t2;
+drop table t1,t2;
diff --git a/mysql-test/t/ansi-master.opt b/mysql-test/t/ansi-master.opt
deleted file mode 100644
index 6bf7a4f30e2..00000000000
--- a/mysql-test/t/ansi-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---ansi
diff --git a/mysql-test/t/ansi.test b/mysql-test/t/ansi.test
index e1ac8ffd4f9..faf20f1e57e 100644
--- a/mysql-test/t/ansi.test
+++ b/mysql-test/t/ansi.test
@@ -2,7 +2,14 @@
# Test of ansi mode
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+
+set sql_mode="MySQL40";
+select @@sql_mode;
+set @@sql_mode="ANSI";
+select @@sql_mode;
# Test some functions that works different in ansi mode
@@ -15,3 +22,5 @@ SELECT id,NULL,1,1.1,'a' FROM t1 GROUP BY id;
--error 1055
SELECT id FROM t1 GROUP BY id2;
drop table t1;
+
+SET @@SQL_MODE="";
diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test
new file mode 100644
index 00000000000..f55aea6e104
--- /dev/null
+++ b/mysql-test/t/archive.test
@@ -0,0 +1,1302 @@
+#
+# Simple test for archive example
+# Taken fromm the select test
+#
+-- source include/have_archive.inc
+
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
+CREATE TABLE t1 (
+ Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
+ Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
+) ENGINE=archive;
+
+INSERT INTO t1 VALUES (9410,9412);
+
+select period from t1;
+select * from t1;
+select t1.* from t1;
+
+#
+# Create test table
+#
+
+CREATE TABLE t2 (
+ auto int,
+ fld1 int(6) unsigned zerofill DEFAULT '000000' NOT NULL,
+ companynr tinyint(2) unsigned zerofill DEFAULT '00' NOT NULL,
+ fld3 char(30) DEFAULT '' NOT NULL,
+ fld4 char(35) DEFAULT '' NOT NULL,
+ fld5 char(35) DEFAULT '' NOT NULL,
+ fld6 char(4) DEFAULT '' NOT NULL
+) ENGINE=archive;
+
+#
+# Populate table
+#
+
+--disable_query_log
+INSERT INTO t2 VALUES (1,000001,00,'Omaha','teethe','neat','');
+INSERT INTO t2 VALUES (2,011401,37,'breaking','dreaded','Steinberg','W');
+INSERT INTO t2 VALUES (3,011402,37,'Romans','scholastics','jarring','');
+INSERT INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily','');
+INSERT INTO t2 VALUES (5,011501,37,'bewilderingly','wallet','balled','');
+INSERT INTO t2 VALUES (6,011701,37,'astound','parters','persist','W');
+INSERT INTO t2 VALUES (7,011702,37,'admonishing','eschew','attainments','');
+INSERT INTO t2 VALUES (8,011703,37,'sumac','quitter','fanatic','');
+INSERT INTO t2 VALUES (9,012001,37,'flanking','neat','measures','FAS');
+INSERT INTO t2 VALUES (10,012003,37,'combed','Steinberg','rightfulness','');
+INSERT INTO t2 VALUES (11,012004,37,'subjective','jarring','capably','');
+INSERT INTO t2 VALUES (12,012005,37,'scatterbrain','tinily','impulsive','');
+INSERT INTO t2 VALUES (13,012301,37,'Eulerian','balled','starlet','');
+INSERT INTO t2 VALUES (14,012302,36,'dubbed','persist','terminators','');
+INSERT INTO t2 VALUES (15,012303,37,'Kane','attainments','untying','');
+INSERT INTO t2 VALUES (16,012304,37,'overlay','fanatic','announces','FAS');
+INSERT INTO t2 VALUES (17,012305,37,'perturb','measures','featherweight','FAS');
+INSERT INTO t2 VALUES (18,012306,37,'goblins','rightfulness','pessimist','FAS');
+INSERT INTO t2 VALUES (19,012501,37,'annihilates','capably','daughter','');
+INSERT INTO t2 VALUES (20,012602,37,'Wotan','impulsive','decliner','FAS');
+INSERT INTO t2 VALUES (21,012603,37,'snatching','starlet','lawgiver','');
+INSERT INTO t2 VALUES (22,012604,37,'concludes','terminators','stated','');
+INSERT INTO t2 VALUES (23,012605,37,'laterally','untying','readable','');
+INSERT INTO t2 VALUES (24,012606,37,'yelped','announces','attrition','');
+INSERT INTO t2 VALUES (25,012701,37,'grazing','featherweight','cascade','FAS');
+INSERT INTO t2 VALUES (26,012702,37,'Baird','pessimist','motors','FAS');
+INSERT INTO t2 VALUES (27,012703,37,'celery','daughter','interrogate','');
+INSERT INTO t2 VALUES (28,012704,37,'misunderstander','decliner','pests','W');
+INSERT INTO t2 VALUES (29,013601,37,'handgun','lawgiver','stairway','');
+INSERT INTO t2 VALUES (30,013602,37,'foldout','stated','dopers','FAS');
+INSERT INTO t2 VALUES (31,013603,37,'mystic','readable','testicle','W');
+INSERT INTO t2 VALUES (32,013604,37,'succumbed','attrition','Parsifal','W');
+INSERT INTO t2 VALUES (33,013605,37,'Nabisco','cascade','leavings','');
+INSERT INTO t2 VALUES (34,013606,37,'fingerings','motors','postulation','W');
+INSERT INTO t2 VALUES (35,013607,37,'aging','interrogate','squeaking','');
+INSERT INTO t2 VALUES (36,013608,37,'afield','pests','contrasted','');
+INSERT INTO t2 VALUES (37,013609,37,'ammonium','stairway','leftover','');
+INSERT INTO t2 VALUES (38,013610,37,'boat','dopers','whiteners','');
+INSERT INTO t2 VALUES (39,013801,37,'intelligibility','testicle','erases','W');
+INSERT INTO t2 VALUES (40,013802,37,'Augustine','Parsifal','Punjab','W');
+INSERT INTO t2 VALUES (41,013803,37,'teethe','leavings','Merritt','');
+INSERT INTO t2 VALUES (42,013804,37,'dreaded','postulation','Quixotism','');
+INSERT INTO t2 VALUES (43,013901,37,'scholastics','squeaking','sweetish','FAS');
+INSERT INTO t2 VALUES (44,016001,37,'audiology','contrasted','dogging','FAS');
+INSERT INTO t2 VALUES (45,016201,37,'wallet','leftover','scornfully','FAS');
+INSERT INTO t2 VALUES (46,016202,37,'parters','whiteners','bellow','');
+INSERT INTO t2 VALUES (47,016301,37,'eschew','erases','bills','');
+INSERT INTO t2 VALUES (48,016302,37,'quitter','Punjab','cupboard','FAS');
+INSERT INTO t2 VALUES (49,016303,37,'neat','Merritt','sureties','FAS');
+INSERT INTO t2 VALUES (50,016304,37,'Steinberg','Quixotism','puddings','');
+INSERT INTO t2 VALUES (51,018001,37,'jarring','sweetish','tapestry','');
+INSERT INTO t2 VALUES (52,018002,37,'tinily','dogging','fetters','');
+INSERT INTO t2 VALUES (53,018003,37,'balled','scornfully','bivalves','');
+INSERT INTO t2 VALUES (54,018004,37,'persist','bellow','incurring','');
+INSERT INTO t2 VALUES (55,018005,37,'attainments','bills','Adolph','');
+INSERT INTO t2 VALUES (56,018007,37,'fanatic','cupboard','pithed','');
+INSERT INTO t2 VALUES (57,018008,37,'measures','sureties','emergency','');
+INSERT INTO t2 VALUES (58,018009,37,'rightfulness','puddings','Miles','');
+INSERT INTO t2 VALUES (59,018010,37,'capably','tapestry','trimmings','');
+INSERT INTO t2 VALUES (60,018012,37,'impulsive','fetters','tragedies','W');
+INSERT INTO t2 VALUES (61,018013,37,'starlet','bivalves','skulking','W');
+INSERT INTO t2 VALUES (62,018014,37,'terminators','incurring','flint','');
+INSERT INTO t2 VALUES (63,018015,37,'untying','Adolph','flopping','W');
+INSERT INTO t2 VALUES (64,018016,37,'announces','pithed','relaxing','FAS');
+INSERT INTO t2 VALUES (65,018017,37,'featherweight','emergency','offload','FAS');
+INSERT INTO t2 VALUES (66,018018,37,'pessimist','Miles','suites','W');
+INSERT INTO t2 VALUES (67,018019,37,'daughter','trimmings','lists','FAS');
+INSERT INTO t2 VALUES (68,018020,37,'decliner','tragedies','animized','FAS');
+INSERT INTO t2 VALUES (69,018021,37,'lawgiver','skulking','multilayer','W');
+INSERT INTO t2 VALUES (70,018022,37,'stated','flint','standardizes','FAS');
+INSERT INTO t2 VALUES (71,018023,37,'readable','flopping','Judas','');
+INSERT INTO t2 VALUES (72,018024,37,'attrition','relaxing','vacuuming','W');
+INSERT INTO t2 VALUES (73,018025,37,'cascade','offload','dentally','W');
+INSERT INTO t2 VALUES (74,018026,37,'motors','suites','humanness','W');
+INSERT INTO t2 VALUES (75,018027,37,'interrogate','lists','inch','W');
+INSERT INTO t2 VALUES (76,018028,37,'pests','animized','Weissmuller','W');
+INSERT INTO t2 VALUES (77,018029,37,'stairway','multilayer','irresponsibly','W');
+INSERT INTO t2 VALUES (78,018030,37,'dopers','standardizes','luckily','FAS');
+INSERT INTO t2 VALUES (79,018032,37,'testicle','Judas','culled','W');
+INSERT INTO t2 VALUES (80,018033,37,'Parsifal','vacuuming','medical','FAS');
+INSERT INTO t2 VALUES (81,018034,37,'leavings','dentally','bloodbath','FAS');
+INSERT INTO t2 VALUES (82,018035,37,'postulation','humanness','subschema','W');
+INSERT INTO t2 VALUES (83,018036,37,'squeaking','inch','animals','W');
+INSERT INTO t2 VALUES (84,018037,37,'contrasted','Weissmuller','Micronesia','');
+INSERT INTO t2 VALUES (85,018038,37,'leftover','irresponsibly','repetitions','');
+INSERT INTO t2 VALUES (86,018039,37,'whiteners','luckily','Antares','');
+INSERT INTO t2 VALUES (87,018040,37,'erases','culled','ventilate','W');
+INSERT INTO t2 VALUES (88,018041,37,'Punjab','medical','pityingly','');
+INSERT INTO t2 VALUES (89,018042,37,'Merritt','bloodbath','interdependent','');
+INSERT INTO t2 VALUES (90,018043,37,'Quixotism','subschema','Graves','FAS');
+INSERT INTO t2 VALUES (91,018044,37,'sweetish','animals','neonatal','');
+INSERT INTO t2 VALUES (92,018045,37,'dogging','Micronesia','scribbled','FAS');
+INSERT INTO t2 VALUES (93,018046,37,'scornfully','repetitions','chafe','W');
+INSERT INTO t2 VALUES (94,018048,37,'bellow','Antares','honoring','');
+INSERT INTO t2 VALUES (95,018049,37,'bills','ventilate','realtor','');
+INSERT INTO t2 VALUES (96,018050,37,'cupboard','pityingly','elite','');
+INSERT INTO t2 VALUES (97,018051,37,'sureties','interdependent','funereal','');
+INSERT INTO t2 VALUES (98,018052,37,'puddings','Graves','abrogating','');
+INSERT INTO t2 VALUES (99,018053,50,'tapestry','neonatal','sorters','');
+INSERT INTO t2 VALUES (100,018054,37,'fetters','scribbled','Conley','');
+INSERT INTO t2 VALUES (101,018055,37,'bivalves','chafe','lectured','');
+INSERT INTO t2 VALUES (102,018056,37,'incurring','honoring','Abraham','');
+INSERT INTO t2 VALUES (103,018057,37,'Adolph','realtor','Hawaii','W');
+INSERT INTO t2 VALUES (104,018058,37,'pithed','elite','cage','');
+INSERT INTO t2 VALUES (105,018059,36,'emergency','funereal','hushes','');
+INSERT INTO t2 VALUES (106,018060,37,'Miles','abrogating','Simla','');
+INSERT INTO t2 VALUES (107,018061,37,'trimmings','sorters','reporters','');
+INSERT INTO t2 VALUES (108,018101,37,'tragedies','Conley','Dutchman','FAS');
+INSERT INTO t2 VALUES (109,018102,37,'skulking','lectured','descendants','FAS');
+INSERT INTO t2 VALUES (110,018103,37,'flint','Abraham','groupings','FAS');
+INSERT INTO t2 VALUES (111,018104,37,'flopping','Hawaii','dissociate','');
+INSERT INTO t2 VALUES (112,018201,37,'relaxing','cage','coexist','W');
+INSERT INTO t2 VALUES (113,018202,37,'offload','hushes','Beebe','');
+INSERT INTO t2 VALUES (114,018402,37,'suites','Simla','Taoism','');
+INSERT INTO t2 VALUES (115,018403,37,'lists','reporters','Connally','');
+INSERT INTO t2 VALUES (116,018404,37,'animized','Dutchman','fetched','FAS');
+INSERT INTO t2 VALUES (117,018405,37,'multilayer','descendants','checkpoints','FAS');
+INSERT INTO t2 VALUES (118,018406,37,'standardizes','groupings','rusting','');
+INSERT INTO t2 VALUES (119,018409,37,'Judas','dissociate','galling','');
+INSERT INTO t2 VALUES (120,018601,37,'vacuuming','coexist','obliterates','');
+INSERT INTO t2 VALUES (121,018602,37,'dentally','Beebe','traitor','');
+INSERT INTO t2 VALUES (122,018603,37,'humanness','Taoism','resumes','FAS');
+INSERT INTO t2 VALUES (123,018801,37,'inch','Connally','analyzable','FAS');
+INSERT INTO t2 VALUES (124,018802,37,'Weissmuller','fetched','terminator','FAS');
+INSERT INTO t2 VALUES (125,018803,37,'irresponsibly','checkpoints','gritty','FAS');
+INSERT INTO t2 VALUES (126,018804,37,'luckily','rusting','firearm','W');
+INSERT INTO t2 VALUES (127,018805,37,'culled','galling','minima','');
+INSERT INTO t2 VALUES (128,018806,37,'medical','obliterates','Selfridge','');
+INSERT INTO t2 VALUES (129,018807,37,'bloodbath','traitor','disable','');
+INSERT INTO t2 VALUES (130,018808,37,'subschema','resumes','witchcraft','W');
+INSERT INTO t2 VALUES (131,018809,37,'animals','analyzable','betroth','W');
+INSERT INTO t2 VALUES (132,018810,37,'Micronesia','terminator','Manhattanize','');
+INSERT INTO t2 VALUES (133,018811,37,'repetitions','gritty','imprint','');
+INSERT INTO t2 VALUES (134,018812,37,'Antares','firearm','peeked','');
+INSERT INTO t2 VALUES (135,019101,37,'ventilate','minima','swelling','');
+INSERT INTO t2 VALUES (136,019102,37,'pityingly','Selfridge','interrelationships','W');
+INSERT INTO t2 VALUES (137,019103,37,'interdependent','disable','riser','');
+INSERT INTO t2 VALUES (138,019201,37,'Graves','witchcraft','Gandhian','W');
+INSERT INTO t2 VALUES (139,030501,37,'neonatal','betroth','peacock','A');
+INSERT INTO t2 VALUES (140,030502,50,'scribbled','Manhattanize','bee','A');
+INSERT INTO t2 VALUES (141,030503,37,'chafe','imprint','kanji','');
+INSERT INTO t2 VALUES (142,030504,37,'honoring','peeked','dental','');
+INSERT INTO t2 VALUES (143,031901,37,'realtor','swelling','scarf','FAS');
+INSERT INTO t2 VALUES (144,036001,37,'elite','interrelationships','chasm','A');
+INSERT INTO t2 VALUES (145,036002,37,'funereal','riser','insolence','A');
+INSERT INTO t2 VALUES (146,036004,37,'abrogating','Gandhian','syndicate','');
+INSERT INTO t2 VALUES (147,036005,37,'sorters','peacock','alike','');
+INSERT INTO t2 VALUES (148,038001,37,'Conley','bee','imperial','A');
+INSERT INTO t2 VALUES (149,038002,37,'lectured','kanji','convulsion','A');
+INSERT INTO t2 VALUES (150,038003,37,'Abraham','dental','railway','A');
+INSERT INTO t2 VALUES (151,038004,37,'Hawaii','scarf','validate','A');
+INSERT INTO t2 VALUES (152,038005,37,'cage','chasm','normalizes','A');
+INSERT INTO t2 VALUES (153,038006,37,'hushes','insolence','comprehensive','');
+INSERT INTO t2 VALUES (154,038007,37,'Simla','syndicate','chewing','');
+INSERT INTO t2 VALUES (155,038008,37,'reporters','alike','denizen','');
+INSERT INTO t2 VALUES (156,038009,37,'Dutchman','imperial','schemer','');
+INSERT INTO t2 VALUES (157,038010,37,'descendants','convulsion','chronicle','');
+INSERT INTO t2 VALUES (158,038011,37,'groupings','railway','Kline','');
+INSERT INTO t2 VALUES (159,038012,37,'dissociate','validate','Anatole','');
+INSERT INTO t2 VALUES (160,038013,37,'coexist','normalizes','partridges','');
+INSERT INTO t2 VALUES (161,038014,37,'Beebe','comprehensive','brunch','');
+INSERT INTO t2 VALUES (162,038015,37,'Taoism','chewing','recruited','');
+INSERT INTO t2 VALUES (163,038016,37,'Connally','denizen','dimensions','W');
+INSERT INTO t2 VALUES (164,038017,37,'fetched','schemer','Chicana','W');
+INSERT INTO t2 VALUES (165,038018,37,'checkpoints','chronicle','announced','');
+INSERT INTO t2 VALUES (166,038101,37,'rusting','Kline','praised','FAS');
+INSERT INTO t2 VALUES (167,038102,37,'galling','Anatole','employing','');
+INSERT INTO t2 VALUES (168,038103,37,'obliterates','partridges','linear','');
+INSERT INTO t2 VALUES (169,038104,37,'traitor','brunch','quagmire','');
+INSERT INTO t2 VALUES (170,038201,37,'resumes','recruited','western','A');
+INSERT INTO t2 VALUES (171,038202,37,'analyzable','dimensions','relishing','');
+INSERT INTO t2 VALUES (172,038203,37,'terminator','Chicana','serving','A');
+INSERT INTO t2 VALUES (173,038204,37,'gritty','announced','scheduling','');
+INSERT INTO t2 VALUES (174,038205,37,'firearm','praised','lore','');
+INSERT INTO t2 VALUES (175,038206,37,'minima','employing','eventful','');
+INSERT INTO t2 VALUES (176,038208,37,'Selfridge','linear','arteriole','A');
+INSERT INTO t2 VALUES (177,042801,37,'disable','quagmire','disentangle','');
+INSERT INTO t2 VALUES (178,042802,37,'witchcraft','western','cured','A');
+INSERT INTO t2 VALUES (179,046101,37,'betroth','relishing','Fenton','W');
+INSERT INTO t2 VALUES (180,048001,37,'Manhattanize','serving','avoidable','A');
+INSERT INTO t2 VALUES (181,048002,37,'imprint','scheduling','drains','A');
+INSERT INTO t2 VALUES (182,048003,37,'peeked','lore','detectably','FAS');
+INSERT INTO t2 VALUES (183,048004,37,'swelling','eventful','husky','');
+INSERT INTO t2 VALUES (184,048005,37,'interrelationships','arteriole','impelling','');
+INSERT INTO t2 VALUES (185,048006,37,'riser','disentangle','undoes','');
+INSERT INTO t2 VALUES (186,048007,37,'Gandhian','cured','evened','');
+INSERT INTO t2 VALUES (187,048008,37,'peacock','Fenton','squeezes','');
+INSERT INTO t2 VALUES (188,048101,37,'bee','avoidable','destroyer','FAS');
+INSERT INTO t2 VALUES (189,048102,37,'kanji','drains','rudeness','');
+INSERT INTO t2 VALUES (190,048201,37,'dental','detectably','beaner','FAS');
+INSERT INTO t2 VALUES (191,048202,37,'scarf','husky','boorish','');
+INSERT INTO t2 VALUES (192,048203,37,'chasm','impelling','Everhart','');
+INSERT INTO t2 VALUES (193,048204,37,'insolence','undoes','encompass','A');
+INSERT INTO t2 VALUES (194,048205,37,'syndicate','evened','mushrooms','');
+INSERT INTO t2 VALUES (195,048301,37,'alike','squeezes','Alison','A');
+INSERT INTO t2 VALUES (196,048302,37,'imperial','destroyer','externally','FAS');
+INSERT INTO t2 VALUES (197,048303,37,'convulsion','rudeness','pellagra','');
+INSERT INTO t2 VALUES (198,048304,37,'railway','beaner','cult','');
+INSERT INTO t2 VALUES (199,048305,37,'validate','boorish','creek','A');
+INSERT INTO t2 VALUES (200,048401,37,'normalizes','Everhart','Huffman','');
+INSERT INTO t2 VALUES (201,048402,37,'comprehensive','encompass','Majorca','FAS');
+INSERT INTO t2 VALUES (202,048403,37,'chewing','mushrooms','governing','A');
+INSERT INTO t2 VALUES (203,048404,37,'denizen','Alison','gadfly','FAS');
+INSERT INTO t2 VALUES (204,048405,37,'schemer','externally','reassigned','FAS');
+INSERT INTO t2 VALUES (205,048406,37,'chronicle','pellagra','intentness','W');
+INSERT INTO t2 VALUES (206,048407,37,'Kline','cult','craziness','');
+INSERT INTO t2 VALUES (207,048408,37,'Anatole','creek','psychic','');
+INSERT INTO t2 VALUES (208,048409,37,'partridges','Huffman','squabbled','');
+INSERT INTO t2 VALUES (209,048410,37,'brunch','Majorca','burlesque','');
+INSERT INTO t2 VALUES (210,048411,37,'recruited','governing','capped','');
+INSERT INTO t2 VALUES (211,048412,37,'dimensions','gadfly','extracted','A');
+INSERT INTO t2 VALUES (212,048413,37,'Chicana','reassigned','DiMaggio','');
+INSERT INTO t2 VALUES (213,048601,37,'announced','intentness','exclamation','FAS');
+INSERT INTO t2 VALUES (214,048602,37,'praised','craziness','subdirectory','');
+INSERT INTO t2 VALUES (215,048603,37,'employing','psychic','fangs','');
+INSERT INTO t2 VALUES (216,048604,37,'linear','squabbled','buyer','A');
+INSERT INTO t2 VALUES (217,048801,37,'quagmire','burlesque','pithing','A');
+INSERT INTO t2 VALUES (218,050901,37,'western','capped','transistorizing','A');
+INSERT INTO t2 VALUES (219,051201,37,'relishing','extracted','nonbiodegradable','');
+INSERT INTO t2 VALUES (220,056002,37,'serving','DiMaggio','dislocate','');
+INSERT INTO t2 VALUES (221,056003,37,'scheduling','exclamation','monochromatic','FAS');
+INSERT INTO t2 VALUES (222,056004,37,'lore','subdirectory','batting','');
+INSERT INTO t2 VALUES (223,056102,37,'eventful','fangs','postcondition','A');
+INSERT INTO t2 VALUES (224,056203,37,'arteriole','buyer','catalog','FAS');
+INSERT INTO t2 VALUES (225,056204,37,'disentangle','pithing','Remus','');
+INSERT INTO t2 VALUES (226,058003,37,'cured','transistorizing','devices','A');
+INSERT INTO t2 VALUES (227,058004,37,'Fenton','nonbiodegradable','bike','A');
+INSERT INTO t2 VALUES (228,058005,37,'avoidable','dislocate','qualify','');
+INSERT INTO t2 VALUES (229,058006,37,'drains','monochromatic','detained','');
+INSERT INTO t2 VALUES (230,058007,37,'detectably','batting','commended','');
+INSERT INTO t2 VALUES (231,058101,37,'husky','postcondition','civilize','');
+INSERT INTO t2 VALUES (232,058102,37,'impelling','catalog','Elmhurst','');
+INSERT INTO t2 VALUES (233,058103,37,'undoes','Remus','anesthetizing','');
+INSERT INTO t2 VALUES (234,058105,37,'evened','devices','deaf','');
+INSERT INTO t2 VALUES (235,058111,37,'squeezes','bike','Brigham','');
+INSERT INTO t2 VALUES (236,058112,37,'destroyer','qualify','title','');
+INSERT INTO t2 VALUES (237,058113,37,'rudeness','detained','coarse','');
+INSERT INTO t2 VALUES (238,058114,37,'beaner','commended','combinations','');
+INSERT INTO t2 VALUES (239,058115,37,'boorish','civilize','grayness','');
+INSERT INTO t2 VALUES (240,058116,37,'Everhart','Elmhurst','innumerable','FAS');
+INSERT INTO t2 VALUES (241,058117,37,'encompass','anesthetizing','Caroline','A');
+INSERT INTO t2 VALUES (242,058118,37,'mushrooms','deaf','fatty','FAS');
+INSERT INTO t2 VALUES (243,058119,37,'Alison','Brigham','eastbound','');
+INSERT INTO t2 VALUES (244,058120,37,'externally','title','inexperienced','');
+INSERT INTO t2 VALUES (245,058121,37,'pellagra','coarse','hoarder','A');
+INSERT INTO t2 VALUES (246,058122,37,'cult','combinations','scotch','W');
+INSERT INTO t2 VALUES (247,058123,37,'creek','grayness','passport','A');
+INSERT INTO t2 VALUES (248,058124,37,'Huffman','innumerable','strategic','FAS');
+INSERT INTO t2 VALUES (249,058125,37,'Majorca','Caroline','gated','');
+INSERT INTO t2 VALUES (250,058126,37,'governing','fatty','flog','');
+INSERT INTO t2 VALUES (251,058127,37,'gadfly','eastbound','Pipestone','');
+INSERT INTO t2 VALUES (252,058128,37,'reassigned','inexperienced','Dar','');
+INSERT INTO t2 VALUES (253,058201,37,'intentness','hoarder','Corcoran','');
+INSERT INTO t2 VALUES (254,058202,37,'craziness','scotch','flyers','A');
+INSERT INTO t2 VALUES (255,058303,37,'psychic','passport','competitions','W');
+INSERT INTO t2 VALUES (256,058304,37,'squabbled','strategic','suppliers','FAS');
+INSERT INTO t2 VALUES (257,058602,37,'burlesque','gated','skips','');
+INSERT INTO t2 VALUES (258,058603,37,'capped','flog','institutes','');
+INSERT INTO t2 VALUES (259,058604,37,'extracted','Pipestone','troop','A');
+INSERT INTO t2 VALUES (260,058605,37,'DiMaggio','Dar','connective','W');
+INSERT INTO t2 VALUES (261,058606,37,'exclamation','Corcoran','denies','');
+INSERT INTO t2 VALUES (262,058607,37,'subdirectory','flyers','polka','');
+INSERT INTO t2 VALUES (263,060401,36,'fangs','competitions','observations','FAS');
+INSERT INTO t2 VALUES (264,061701,36,'buyer','suppliers','askers','');
+INSERT INTO t2 VALUES (265,066201,36,'pithing','skips','homeless','FAS');
+INSERT INTO t2 VALUES (266,066501,36,'transistorizing','institutes','Anna','');
+INSERT INTO t2 VALUES (267,068001,36,'nonbiodegradable','troop','subdirectories','W');
+INSERT INTO t2 VALUES (268,068002,36,'dislocate','connective','decaying','FAS');
+INSERT INTO t2 VALUES (269,068005,36,'monochromatic','denies','outwitting','W');
+INSERT INTO t2 VALUES (270,068006,36,'batting','polka','Harpy','W');
+INSERT INTO t2 VALUES (271,068007,36,'postcondition','observations','crazed','');
+INSERT INTO t2 VALUES (272,068008,36,'catalog','askers','suffocate','');
+INSERT INTO t2 VALUES (273,068009,36,'Remus','homeless','provers','FAS');
+INSERT INTO t2 VALUES (274,068010,36,'devices','Anna','technically','');
+INSERT INTO t2 VALUES (275,068011,36,'bike','subdirectories','Franklinizations','');
+INSERT INTO t2 VALUES (276,068202,36,'qualify','decaying','considered','');
+INSERT INTO t2 VALUES (277,068302,36,'detained','outwitting','tinnily','');
+INSERT INTO t2 VALUES (278,068303,36,'commended','Harpy','uninterruptedly','');
+INSERT INTO t2 VALUES (279,068401,36,'civilize','crazed','whistled','A');
+INSERT INTO t2 VALUES (280,068501,36,'Elmhurst','suffocate','automate','');
+INSERT INTO t2 VALUES (281,068502,36,'anesthetizing','provers','gutting','W');
+INSERT INTO t2 VALUES (282,068503,36,'deaf','technically','surreptitious','');
+INSERT INTO t2 VALUES (283,068602,36,'Brigham','Franklinizations','Choctaw','');
+INSERT INTO t2 VALUES (284,068603,36,'title','considered','cooks','');
+INSERT INTO t2 VALUES (285,068701,36,'coarse','tinnily','millivolt','FAS');
+INSERT INTO t2 VALUES (286,068702,36,'combinations','uninterruptedly','counterpoise','');
+INSERT INTO t2 VALUES (287,068703,36,'grayness','whistled','Gothicism','');
+INSERT INTO t2 VALUES (288,076001,36,'innumerable','automate','feminine','');
+INSERT INTO t2 VALUES (289,076002,36,'Caroline','gutting','metaphysically','W');
+INSERT INTO t2 VALUES (290,076101,36,'fatty','surreptitious','sanding','A');
+INSERT INTO t2 VALUES (291,076102,36,'eastbound','Choctaw','contributorily','');
+INSERT INTO t2 VALUES (292,076103,36,'inexperienced','cooks','receivers','FAS');
+INSERT INTO t2 VALUES (293,076302,36,'hoarder','millivolt','adjourn','');
+INSERT INTO t2 VALUES (294,076303,36,'scotch','counterpoise','straggled','A');
+INSERT INTO t2 VALUES (295,076304,36,'passport','Gothicism','druggists','');
+INSERT INTO t2 VALUES (296,076305,36,'strategic','feminine','thanking','FAS');
+INSERT INTO t2 VALUES (297,076306,36,'gated','metaphysically','ostrich','');
+INSERT INTO t2 VALUES (298,076307,36,'flog','sanding','hopelessness','FAS');
+INSERT INTO t2 VALUES (299,076402,36,'Pipestone','contributorily','Eurydice','');
+INSERT INTO t2 VALUES (300,076501,36,'Dar','receivers','excitation','W');
+INSERT INTO t2 VALUES (301,076502,36,'Corcoran','adjourn','presumes','FAS');
+INSERT INTO t2 VALUES (302,076701,36,'flyers','straggled','imaginable','FAS');
+INSERT INTO t2 VALUES (303,078001,36,'competitions','druggists','concoct','W');
+INSERT INTO t2 VALUES (304,078002,36,'suppliers','thanking','peering','W');
+INSERT INTO t2 VALUES (305,078003,36,'skips','ostrich','Phelps','FAS');
+INSERT INTO t2 VALUES (306,078004,36,'institutes','hopelessness','ferociousness','FAS');
+INSERT INTO t2 VALUES (307,078005,36,'troop','Eurydice','sentences','');
+INSERT INTO t2 VALUES (308,078006,36,'connective','excitation','unlocks','');
+INSERT INTO t2 VALUES (309,078007,36,'denies','presumes','engrossing','W');
+INSERT INTO t2 VALUES (310,078008,36,'polka','imaginable','Ruth','');
+INSERT INTO t2 VALUES (311,078101,36,'observations','concoct','tying','');
+INSERT INTO t2 VALUES (312,078103,36,'askers','peering','exclaimers','');
+INSERT INTO t2 VALUES (313,078104,36,'homeless','Phelps','synergy','');
+INSERT INTO t2 VALUES (314,078105,36,'Anna','ferociousness','Huey','W');
+INSERT INTO t2 VALUES (315,082101,36,'subdirectories','sentences','merging','');
+INSERT INTO t2 VALUES (316,083401,36,'decaying','unlocks','judges','A');
+INSERT INTO t2 VALUES (317,084001,36,'outwitting','engrossing','Shylock','W');
+INSERT INTO t2 VALUES (318,084002,36,'Harpy','Ruth','Miltonism','');
+INSERT INTO t2 VALUES (319,086001,36,'crazed','tying','hen','W');
+INSERT INTO t2 VALUES (320,086102,36,'suffocate','exclaimers','honeybee','FAS');
+INSERT INTO t2 VALUES (321,086201,36,'provers','synergy','towers','');
+INSERT INTO t2 VALUES (322,088001,36,'technically','Huey','dilutes','W');
+INSERT INTO t2 VALUES (323,088002,36,'Franklinizations','merging','numerals','FAS');
+INSERT INTO t2 VALUES (324,088003,36,'considered','judges','democracy','FAS');
+INSERT INTO t2 VALUES (325,088004,36,'tinnily','Shylock','Ibero-','');
+INSERT INTO t2 VALUES (326,088101,36,'uninterruptedly','Miltonism','invalids','');
+INSERT INTO t2 VALUES (327,088102,36,'whistled','hen','behavior','');
+INSERT INTO t2 VALUES (328,088103,36,'automate','honeybee','accruing','');
+INSERT INTO t2 VALUES (329,088104,36,'gutting','towers','relics','A');
+INSERT INTO t2 VALUES (330,088105,36,'surreptitious','dilutes','rackets','');
+INSERT INTO t2 VALUES (331,088106,36,'Choctaw','numerals','Fischbein','W');
+INSERT INTO t2 VALUES (332,088201,36,'cooks','democracy','phony','W');
+INSERT INTO t2 VALUES (333,088203,36,'millivolt','Ibero-','cross','FAS');
+INSERT INTO t2 VALUES (334,088204,36,'counterpoise','invalids','cleanup','');
+INSERT INTO t2 VALUES (335,088302,37,'Gothicism','behavior','conspirator','');
+INSERT INTO t2 VALUES (336,088303,37,'feminine','accruing','label','FAS');
+INSERT INTO t2 VALUES (337,088305,37,'metaphysically','relics','university','');
+INSERT INTO t2 VALUES (338,088402,37,'sanding','rackets','cleansed','FAS');
+INSERT INTO t2 VALUES (339,088501,36,'contributorily','Fischbein','ballgown','');
+INSERT INTO t2 VALUES (340,088502,36,'receivers','phony','starlet','');
+INSERT INTO t2 VALUES (341,088503,36,'adjourn','cross','aqueous','');
+INSERT INTO t2 VALUES (342,098001,58,'straggled','cleanup','portrayal','A');
+INSERT INTO t2 VALUES (343,098002,58,'druggists','conspirator','despising','W');
+INSERT INTO t2 VALUES (344,098003,58,'thanking','label','distort','W');
+INSERT INTO t2 VALUES (345,098004,58,'ostrich','university','palmed','');
+INSERT INTO t2 VALUES (346,098005,58,'hopelessness','cleansed','faced','');
+INSERT INTO t2 VALUES (347,098006,58,'Eurydice','ballgown','silverware','');
+INSERT INTO t2 VALUES (348,141903,29,'excitation','starlet','assessor','');
+INSERT INTO t2 VALUES (349,098008,58,'presumes','aqueous','spiders','');
+INSERT INTO t2 VALUES (350,098009,58,'imaginable','portrayal','artificially','');
+INSERT INTO t2 VALUES (351,098010,58,'concoct','despising','reminiscence','');
+INSERT INTO t2 VALUES (352,098011,58,'peering','distort','Mexican','');
+INSERT INTO t2 VALUES (353,098012,58,'Phelps','palmed','obnoxious','');
+INSERT INTO t2 VALUES (354,098013,58,'ferociousness','faced','fragile','');
+INSERT INTO t2 VALUES (355,098014,58,'sentences','silverware','apprehensible','');
+INSERT INTO t2 VALUES (356,098015,58,'unlocks','assessor','births','');
+INSERT INTO t2 VALUES (357,098016,58,'engrossing','spiders','garages','');
+INSERT INTO t2 VALUES (358,098017,58,'Ruth','artificially','panty','');
+INSERT INTO t2 VALUES (359,098018,58,'tying','reminiscence','anteater','');
+INSERT INTO t2 VALUES (360,098019,58,'exclaimers','Mexican','displacement','A');
+INSERT INTO t2 VALUES (361,098020,58,'synergy','obnoxious','drovers','A');
+INSERT INTO t2 VALUES (362,098021,58,'Huey','fragile','patenting','A');
+INSERT INTO t2 VALUES (363,098022,58,'merging','apprehensible','far','A');
+INSERT INTO t2 VALUES (364,098023,58,'judges','births','shrieks','');
+INSERT INTO t2 VALUES (365,098024,58,'Shylock','garages','aligning','W');
+INSERT INTO t2 VALUES (366,098025,37,'Miltonism','panty','pragmatism','');
+INSERT INTO t2 VALUES (367,106001,36,'hen','anteater','fevers','W');
+INSERT INTO t2 VALUES (368,108001,36,'honeybee','displacement','reexamines','A');
+INSERT INTO t2 VALUES (369,108002,36,'towers','drovers','occupancies','');
+INSERT INTO t2 VALUES (370,108003,36,'dilutes','patenting','sweats','FAS');
+INSERT INTO t2 VALUES (371,108004,36,'numerals','far','modulators','');
+INSERT INTO t2 VALUES (372,108005,36,'democracy','shrieks','demand','W');
+INSERT INTO t2 VALUES (373,108007,36,'Ibero-','aligning','Madeira','');
+INSERT INTO t2 VALUES (374,108008,36,'invalids','pragmatism','Viennese','W');
+INSERT INTO t2 VALUES (375,108009,36,'behavior','fevers','chillier','W');
+INSERT INTO t2 VALUES (376,108010,36,'accruing','reexamines','wildcats','FAS');
+INSERT INTO t2 VALUES (377,108011,36,'relics','occupancies','gentle','');
+INSERT INTO t2 VALUES (378,108012,36,'rackets','sweats','Angles','W');
+INSERT INTO t2 VALUES (379,108101,36,'Fischbein','modulators','accuracies','');
+INSERT INTO t2 VALUES (380,108102,36,'phony','demand','toggle','');
+INSERT INTO t2 VALUES (381,108103,36,'cross','Madeira','Mendelssohn','W');
+INSERT INTO t2 VALUES (382,108111,50,'cleanup','Viennese','behaviorally','');
+INSERT INTO t2 VALUES (383,108105,36,'conspirator','chillier','Rochford','');
+INSERT INTO t2 VALUES (384,108106,36,'label','wildcats','mirror','W');
+INSERT INTO t2 VALUES (385,108107,36,'university','gentle','Modula','');
+INSERT INTO t2 VALUES (386,108108,50,'cleansed','Angles','clobbering','');
+INSERT INTO t2 VALUES (387,108109,36,'ballgown','accuracies','chronography','');
+INSERT INTO t2 VALUES (388,108110,36,'starlet','toggle','Eskimoizeds','');
+INSERT INTO t2 VALUES (389,108201,36,'aqueous','Mendelssohn','British','W');
+INSERT INTO t2 VALUES (390,108202,36,'portrayal','behaviorally','pitfalls','');
+INSERT INTO t2 VALUES (391,108203,36,'despising','Rochford','verify','W');
+INSERT INTO t2 VALUES (392,108204,36,'distort','mirror','scatter','FAS');
+INSERT INTO t2 VALUES (393,108205,36,'palmed','Modula','Aztecan','');
+INSERT INTO t2 VALUES (394,108301,36,'faced','clobbering','acuity','W');
+INSERT INTO t2 VALUES (395,108302,36,'silverware','chronography','sinking','W');
+INSERT INTO t2 VALUES (396,112101,36,'assessor','Eskimoizeds','beasts','FAS');
+INSERT INTO t2 VALUES (397,112102,36,'spiders','British','Witt','W');
+INSERT INTO t2 VALUES (398,113701,36,'artificially','pitfalls','physicists','FAS');
+INSERT INTO t2 VALUES (399,116001,36,'reminiscence','verify','folksong','A');
+INSERT INTO t2 VALUES (400,116201,36,'Mexican','scatter','strokes','FAS');
+INSERT INTO t2 VALUES (401,116301,36,'obnoxious','Aztecan','crowder','');
+INSERT INTO t2 VALUES (402,116302,36,'fragile','acuity','merry','');
+INSERT INTO t2 VALUES (403,116601,36,'apprehensible','sinking','cadenced','');
+INSERT INTO t2 VALUES (404,116602,36,'births','beasts','alimony','A');
+INSERT INTO t2 VALUES (405,116603,36,'garages','Witt','principled','A');
+INSERT INTO t2 VALUES (406,116701,36,'panty','physicists','golfing','');
+INSERT INTO t2 VALUES (407,116702,36,'anteater','folksong','undiscovered','');
+INSERT INTO t2 VALUES (408,118001,36,'displacement','strokes','irritates','');
+INSERT INTO t2 VALUES (409,118002,36,'drovers','crowder','patriots','A');
+INSERT INTO t2 VALUES (410,118003,36,'patenting','merry','rooms','FAS');
+INSERT INTO t2 VALUES (411,118004,36,'far','cadenced','towering','W');
+INSERT INTO t2 VALUES (412,118005,36,'shrieks','alimony','displease','');
+INSERT INTO t2 VALUES (413,118006,36,'aligning','principled','photosensitive','');
+INSERT INTO t2 VALUES (414,118007,36,'pragmatism','golfing','inking','');
+INSERT INTO t2 VALUES (415,118008,36,'fevers','undiscovered','gainers','');
+INSERT INTO t2 VALUES (416,118101,36,'reexamines','irritates','leaning','A');
+INSERT INTO t2 VALUES (417,118102,36,'occupancies','patriots','hydrant','A');
+INSERT INTO t2 VALUES (418,118103,36,'sweats','rooms','preserve','');
+INSERT INTO t2 VALUES (419,118202,36,'modulators','towering','blinded','A');
+INSERT INTO t2 VALUES (420,118203,36,'demand','displease','interactions','A');
+INSERT INTO t2 VALUES (421,118204,36,'Madeira','photosensitive','Barry','');
+INSERT INTO t2 VALUES (422,118302,36,'Viennese','inking','whiteness','A');
+INSERT INTO t2 VALUES (423,118304,36,'chillier','gainers','pastimes','W');
+INSERT INTO t2 VALUES (424,118305,36,'wildcats','leaning','Edenization','');
+INSERT INTO t2 VALUES (425,118306,36,'gentle','hydrant','Muscat','');
+INSERT INTO t2 VALUES (426,118307,36,'Angles','preserve','assassinated','');
+INSERT INTO t2 VALUES (427,123101,36,'accuracies','blinded','labeled','');
+INSERT INTO t2 VALUES (428,123102,36,'toggle','interactions','glacial','A');
+INSERT INTO t2 VALUES (429,123301,36,'Mendelssohn','Barry','implied','W');
+INSERT INTO t2 VALUES (430,126001,36,'behaviorally','whiteness','bibliographies','W');
+INSERT INTO t2 VALUES (431,126002,36,'Rochford','pastimes','Buchanan','');
+INSERT INTO t2 VALUES (432,126003,36,'mirror','Edenization','forgivably','FAS');
+INSERT INTO t2 VALUES (433,126101,36,'Modula','Muscat','innuendo','A');
+INSERT INTO t2 VALUES (434,126301,36,'clobbering','assassinated','den','FAS');
+INSERT INTO t2 VALUES (435,126302,36,'chronography','labeled','submarines','W');
+INSERT INTO t2 VALUES (436,126402,36,'Eskimoizeds','glacial','mouthful','A');
+INSERT INTO t2 VALUES (437,126601,36,'British','implied','expiring','');
+INSERT INTO t2 VALUES (438,126602,36,'pitfalls','bibliographies','unfulfilled','FAS');
+INSERT INTO t2 VALUES (439,126702,36,'verify','Buchanan','precession','');
+INSERT INTO t2 VALUES (440,128001,36,'scatter','forgivably','nullified','');
+INSERT INTO t2 VALUES (441,128002,36,'Aztecan','innuendo','affects','');
+INSERT INTO t2 VALUES (442,128003,36,'acuity','den','Cynthia','');
+INSERT INTO t2 VALUES (443,128004,36,'sinking','submarines','Chablis','A');
+INSERT INTO t2 VALUES (444,128005,36,'beasts','mouthful','betterments','FAS');
+INSERT INTO t2 VALUES (445,128007,36,'Witt','expiring','advertising','');
+INSERT INTO t2 VALUES (446,128008,36,'physicists','unfulfilled','rubies','A');
+INSERT INTO t2 VALUES (447,128009,36,'folksong','precession','southwest','FAS');
+INSERT INTO t2 VALUES (448,128010,36,'strokes','nullified','superstitious','A');
+INSERT INTO t2 VALUES (449,128011,36,'crowder','affects','tabernacle','W');
+INSERT INTO t2 VALUES (450,128012,36,'merry','Cynthia','silk','A');
+INSERT INTO t2 VALUES (451,128013,36,'cadenced','Chablis','handsomest','A');
+INSERT INTO t2 VALUES (452,128014,36,'alimony','betterments','Persian','A');
+INSERT INTO t2 VALUES (453,128015,36,'principled','advertising','analog','W');
+INSERT INTO t2 VALUES (454,128016,36,'golfing','rubies','complex','W');
+INSERT INTO t2 VALUES (455,128017,36,'undiscovered','southwest','Taoist','');
+INSERT INTO t2 VALUES (456,128018,36,'irritates','superstitious','suspend','');
+INSERT INTO t2 VALUES (457,128019,36,'patriots','tabernacle','relegated','');
+INSERT INTO t2 VALUES (458,128020,36,'rooms','silk','awesome','W');
+INSERT INTO t2 VALUES (459,128021,36,'towering','handsomest','Bruxelles','');
+INSERT INTO t2 VALUES (460,128022,36,'displease','Persian','imprecisely','A');
+INSERT INTO t2 VALUES (461,128023,36,'photosensitive','analog','televise','');
+INSERT INTO t2 VALUES (462,128101,36,'inking','complex','braking','');
+INSERT INTO t2 VALUES (463,128102,36,'gainers','Taoist','true','FAS');
+INSERT INTO t2 VALUES (464,128103,36,'leaning','suspend','disappointing','FAS');
+INSERT INTO t2 VALUES (465,128104,36,'hydrant','relegated','navally','W');
+INSERT INTO t2 VALUES (466,128106,36,'preserve','awesome','circus','');
+INSERT INTO t2 VALUES (467,128107,36,'blinded','Bruxelles','beetles','');
+INSERT INTO t2 VALUES (468,128108,36,'interactions','imprecisely','trumps','');
+INSERT INTO t2 VALUES (469,128202,36,'Barry','televise','fourscore','W');
+INSERT INTO t2 VALUES (470,128203,36,'whiteness','braking','Blackfoots','');
+INSERT INTO t2 VALUES (471,128301,36,'pastimes','true','Grady','');
+INSERT INTO t2 VALUES (472,128302,36,'Edenization','disappointing','quiets','FAS');
+INSERT INTO t2 VALUES (473,128303,36,'Muscat','navally','floundered','FAS');
+INSERT INTO t2 VALUES (474,128304,36,'assassinated','circus','profundity','W');
+INSERT INTO t2 VALUES (475,128305,36,'labeled','beetles','Garrisonian','W');
+INSERT INTO t2 VALUES (476,128307,36,'glacial','trumps','Strauss','');
+INSERT INTO t2 VALUES (477,128401,36,'implied','fourscore','cemented','FAS');
+INSERT INTO t2 VALUES (478,128502,36,'bibliographies','Blackfoots','contrition','A');
+INSERT INTO t2 VALUES (479,128503,36,'Buchanan','Grady','mutations','');
+INSERT INTO t2 VALUES (480,128504,36,'forgivably','quiets','exhibits','W');
+INSERT INTO t2 VALUES (481,128505,36,'innuendo','floundered','tits','');
+INSERT INTO t2 VALUES (482,128601,36,'den','profundity','mate','A');
+INSERT INTO t2 VALUES (483,128603,36,'submarines','Garrisonian','arches','');
+INSERT INTO t2 VALUES (484,128604,36,'mouthful','Strauss','Moll','');
+INSERT INTO t2 VALUES (485,128702,36,'expiring','cemented','ropers','');
+INSERT INTO t2 VALUES (486,128703,36,'unfulfilled','contrition','bombast','');
+INSERT INTO t2 VALUES (487,128704,36,'precession','mutations','difficultly','A');
+INSERT INTO t2 VALUES (488,138001,36,'nullified','exhibits','adsorption','');
+INSERT INTO t2 VALUES (489,138002,36,'affects','tits','definiteness','FAS');
+INSERT INTO t2 VALUES (490,138003,36,'Cynthia','mate','cultivation','A');
+INSERT INTO t2 VALUES (491,138004,36,'Chablis','arches','heals','A');
+INSERT INTO t2 VALUES (492,138005,36,'betterments','Moll','Heusen','W');
+INSERT INTO t2 VALUES (493,138006,36,'advertising','ropers','target','FAS');
+INSERT INTO t2 VALUES (494,138007,36,'rubies','bombast','cited','A');
+INSERT INTO t2 VALUES (495,138008,36,'southwest','difficultly','congresswoman','W');
+INSERT INTO t2 VALUES (496,138009,36,'superstitious','adsorption','Katherine','');
+INSERT INTO t2 VALUES (497,138102,36,'tabernacle','definiteness','titter','A');
+INSERT INTO t2 VALUES (498,138103,36,'silk','cultivation','aspire','A');
+INSERT INTO t2 VALUES (499,138104,36,'handsomest','heals','Mardis','');
+INSERT INTO t2 VALUES (500,138105,36,'Persian','Heusen','Nadia','W');
+INSERT INTO t2 VALUES (501,138201,36,'analog','target','estimating','FAS');
+INSERT INTO t2 VALUES (502,138302,36,'complex','cited','stuck','A');
+INSERT INTO t2 VALUES (503,138303,36,'Taoist','congresswoman','fifteenth','A');
+INSERT INTO t2 VALUES (504,138304,36,'suspend','Katherine','Colombo','');
+INSERT INTO t2 VALUES (505,138401,29,'relegated','titter','survey','A');
+INSERT INTO t2 VALUES (506,140102,29,'awesome','aspire','staffing','');
+INSERT INTO t2 VALUES (507,140103,29,'Bruxelles','Mardis','obtain','');
+INSERT INTO t2 VALUES (508,140104,29,'imprecisely','Nadia','loaded','');
+INSERT INTO t2 VALUES (509,140105,29,'televise','estimating','slaughtered','');
+INSERT INTO t2 VALUES (510,140201,29,'braking','stuck','lights','A');
+INSERT INTO t2 VALUES (511,140701,29,'true','fifteenth','circumference','');
+INSERT INTO t2 VALUES (512,141501,29,'disappointing','Colombo','dull','A');
+INSERT INTO t2 VALUES (513,141502,29,'navally','survey','weekly','A');
+INSERT INTO t2 VALUES (514,141901,29,'circus','staffing','wetness','');
+INSERT INTO t2 VALUES (515,141902,29,'beetles','obtain','visualized','');
+INSERT INTO t2 VALUES (516,142101,29,'trumps','loaded','Tannenbaum','');
+INSERT INTO t2 VALUES (517,142102,29,'fourscore','slaughtered','moribund','');
+INSERT INTO t2 VALUES (518,142103,29,'Blackfoots','lights','demultiplex','');
+INSERT INTO t2 VALUES (519,142701,29,'Grady','circumference','lockings','');
+INSERT INTO t2 VALUES (520,143001,29,'quiets','dull','thugs','FAS');
+INSERT INTO t2 VALUES (521,143501,29,'floundered','weekly','unnerves','');
+INSERT INTO t2 VALUES (522,143502,29,'profundity','wetness','abut','');
+INSERT INTO t2 VALUES (523,148001,29,'Garrisonian','visualized','Chippewa','A');
+INSERT INTO t2 VALUES (524,148002,29,'Strauss','Tannenbaum','stratifications','A');
+INSERT INTO t2 VALUES (525,148003,29,'cemented','moribund','signaled','');
+INSERT INTO t2 VALUES (526,148004,29,'contrition','demultiplex','Italianizes','A');
+INSERT INTO t2 VALUES (527,148005,29,'mutations','lockings','algorithmic','A');
+INSERT INTO t2 VALUES (528,148006,29,'exhibits','thugs','paranoid','FAS');
+INSERT INTO t2 VALUES (529,148007,29,'tits','unnerves','camping','A');
+INSERT INTO t2 VALUES (530,148009,29,'mate','abut','signifying','A');
+INSERT INTO t2 VALUES (531,148010,29,'arches','Chippewa','Patrice','W');
+INSERT INTO t2 VALUES (532,148011,29,'Moll','stratifications','search','A');
+INSERT INTO t2 VALUES (533,148012,29,'ropers','signaled','Angeles','A');
+INSERT INTO t2 VALUES (534,148013,29,'bombast','Italianizes','semblance','');
+INSERT INTO t2 VALUES (535,148023,36,'difficultly','algorithmic','taxed','');
+INSERT INTO t2 VALUES (536,148015,29,'adsorption','paranoid','Beatrice','');
+INSERT INTO t2 VALUES (537,148016,29,'definiteness','camping','retrace','');
+INSERT INTO t2 VALUES (538,148017,29,'cultivation','signifying','lockout','');
+INSERT INTO t2 VALUES (539,148018,29,'heals','Patrice','grammatic','');
+INSERT INTO t2 VALUES (540,148019,29,'Heusen','search','helmsman','');
+INSERT INTO t2 VALUES (541,148020,29,'target','Angeles','uniform','W');
+INSERT INTO t2 VALUES (542,148021,29,'cited','semblance','hamming','');
+INSERT INTO t2 VALUES (543,148022,29,'congresswoman','taxed','disobedience','');
+INSERT INTO t2 VALUES (544,148101,29,'Katherine','Beatrice','captivated','A');
+INSERT INTO t2 VALUES (545,148102,29,'titter','retrace','transferals','A');
+INSERT INTO t2 VALUES (546,148201,29,'aspire','lockout','cartographer','A');
+INSERT INTO t2 VALUES (547,148401,29,'Mardis','grammatic','aims','FAS');
+INSERT INTO t2 VALUES (548,148402,29,'Nadia','helmsman','Pakistani','');
+INSERT INTO t2 VALUES (549,148501,29,'estimating','uniform','burglarized','FAS');
+INSERT INTO t2 VALUES (550,148502,29,'stuck','hamming','saucepans','A');
+INSERT INTO t2 VALUES (551,148503,29,'fifteenth','disobedience','lacerating','A');
+INSERT INTO t2 VALUES (552,148504,29,'Colombo','captivated','corny','');
+INSERT INTO t2 VALUES (553,148601,29,'survey','transferals','megabytes','FAS');
+INSERT INTO t2 VALUES (554,148602,29,'staffing','cartographer','chancellor','');
+INSERT INTO t2 VALUES (555,150701,29,'obtain','aims','bulk','A');
+INSERT INTO t2 VALUES (556,152101,29,'loaded','Pakistani','commits','A');
+INSERT INTO t2 VALUES (557,152102,29,'slaughtered','burglarized','meson','W');
+INSERT INTO t2 VALUES (558,155202,36,'lights','saucepans','deputies','');
+INSERT INTO t2 VALUES (559,155203,29,'circumference','lacerating','northeaster','A');
+INSERT INTO t2 VALUES (560,155204,29,'dull','corny','dipole','');
+INSERT INTO t2 VALUES (561,155205,29,'weekly','megabytes','machining','0');
+INSERT INTO t2 VALUES (562,156001,29,'wetness','chancellor','therefore','');
+INSERT INTO t2 VALUES (563,156002,29,'visualized','bulk','Telefunken','');
+INSERT INTO t2 VALUES (564,156102,29,'Tannenbaum','commits','salvaging','');
+INSERT INTO t2 VALUES (565,156301,29,'moribund','meson','Corinthianizes','A');
+INSERT INTO t2 VALUES (566,156302,29,'demultiplex','deputies','restlessly','A');
+INSERT INTO t2 VALUES (567,156303,29,'lockings','northeaster','bromides','');
+INSERT INTO t2 VALUES (568,156304,29,'thugs','dipole','generalized','A');
+INSERT INTO t2 VALUES (569,156305,29,'unnerves','machining','mishaps','');
+INSERT INTO t2 VALUES (570,156306,29,'abut','therefore','quelling','');
+INSERT INTO t2 VALUES (571,156501,29,'Chippewa','Telefunken','spiritual','A');
+INSERT INTO t2 VALUES (572,158001,29,'stratifications','salvaging','beguiles','FAS');
+INSERT INTO t2 VALUES (573,158002,29,'signaled','Corinthianizes','Trobriand','FAS');
+INSERT INTO t2 VALUES (574,158101,29,'Italianizes','restlessly','fleeing','A');
+INSERT INTO t2 VALUES (575,158102,29,'algorithmic','bromides','Armour','A');
+INSERT INTO t2 VALUES (576,158103,29,'paranoid','generalized','chin','A');
+INSERT INTO t2 VALUES (577,158201,29,'camping','mishaps','provers','A');
+INSERT INTO t2 VALUES (578,158202,29,'signifying','quelling','aeronautic','A');
+INSERT INTO t2 VALUES (579,158203,29,'Patrice','spiritual','voltage','W');
+INSERT INTO t2 VALUES (580,158204,29,'search','beguiles','sash','');
+INSERT INTO t2 VALUES (581,158301,29,'Angeles','Trobriand','anaerobic','A');
+INSERT INTO t2 VALUES (582,158302,29,'semblance','fleeing','simultaneous','A');
+INSERT INTO t2 VALUES (583,158303,29,'taxed','Armour','accumulating','A');
+INSERT INTO t2 VALUES (584,158304,29,'Beatrice','chin','Medusan','A');
+INSERT INTO t2 VALUES (585,158305,29,'retrace','provers','shouted','A');
+INSERT INTO t2 VALUES (586,158306,29,'lockout','aeronautic','freakish','');
+INSERT INTO t2 VALUES (587,158501,29,'grammatic','voltage','index','FAS');
+INSERT INTO t2 VALUES (588,160301,29,'helmsman','sash','commercially','');
+INSERT INTO t2 VALUES (589,166101,50,'uniform','anaerobic','mistiness','A');
+INSERT INTO t2 VALUES (590,166102,50,'hamming','simultaneous','endpoint','');
+INSERT INTO t2 VALUES (591,168001,29,'disobedience','accumulating','straight','A');
+INSERT INTO t2 VALUES (592,168002,29,'captivated','Medusan','flurried','');
+INSERT INTO t2 VALUES (593,168003,29,'transferals','shouted','denotative','A');
+INSERT INTO t2 VALUES (594,168101,29,'cartographer','freakish','coming','FAS');
+INSERT INTO t2 VALUES (595,168102,29,'aims','index','commencements','FAS');
+INSERT INTO t2 VALUES (596,168103,29,'Pakistani','commercially','gentleman','');
+INSERT INTO t2 VALUES (597,168104,29,'burglarized','mistiness','gifted','');
+INSERT INTO t2 VALUES (598,168202,29,'saucepans','endpoint','Shanghais','');
+INSERT INTO t2 VALUES (599,168301,29,'lacerating','straight','sportswriting','A');
+INSERT INTO t2 VALUES (600,168502,29,'corny','flurried','sloping','A');
+INSERT INTO t2 VALUES (601,168503,29,'megabytes','denotative','navies','');
+INSERT INTO t2 VALUES (602,168601,29,'chancellor','coming','leaflet','A');
+INSERT INTO t2 VALUES (603,173001,40,'bulk','commencements','shooter','');
+INSERT INTO t2 VALUES (604,173701,40,'commits','gentleman','Joplin','FAS');
+INSERT INTO t2 VALUES (605,173702,40,'meson','gifted','babies','');
+INSERT INTO t2 VALUES (606,176001,40,'deputies','Shanghais','subdivision','FAS');
+INSERT INTO t2 VALUES (607,176101,40,'northeaster','sportswriting','burstiness','W');
+INSERT INTO t2 VALUES (608,176201,40,'dipole','sloping','belted','FAS');
+INSERT INTO t2 VALUES (609,176401,40,'machining','navies','assails','FAS');
+INSERT INTO t2 VALUES (610,176501,40,'therefore','leaflet','admiring','W');
+INSERT INTO t2 VALUES (611,176601,40,'Telefunken','shooter','swaying','0');
+INSERT INTO t2 VALUES (612,176602,40,'salvaging','Joplin','Goldstine','FAS');
+INSERT INTO t2 VALUES (613,176603,40,'Corinthianizes','babies','fitting','');
+INSERT INTO t2 VALUES (614,178001,40,'restlessly','subdivision','Norwalk','W');
+INSERT INTO t2 VALUES (615,178002,40,'bromides','burstiness','weakening','W');
+INSERT INTO t2 VALUES (616,178003,40,'generalized','belted','analogy','FAS');
+INSERT INTO t2 VALUES (617,178004,40,'mishaps','assails','deludes','');
+INSERT INTO t2 VALUES (618,178005,40,'quelling','admiring','cokes','');
+INSERT INTO t2 VALUES (619,178006,40,'spiritual','swaying','Clayton','');
+INSERT INTO t2 VALUES (620,178007,40,'beguiles','Goldstine','exhausts','');
+INSERT INTO t2 VALUES (621,178008,40,'Trobriand','fitting','causality','');
+INSERT INTO t2 VALUES (622,178101,40,'fleeing','Norwalk','sating','FAS');
+INSERT INTO t2 VALUES (623,178102,40,'Armour','weakening','icon','');
+INSERT INTO t2 VALUES (624,178103,40,'chin','analogy','throttles','');
+INSERT INTO t2 VALUES (625,178201,40,'provers','deludes','communicants','FAS');
+INSERT INTO t2 VALUES (626,178202,40,'aeronautic','cokes','dehydrate','FAS');
+INSERT INTO t2 VALUES (627,178301,40,'voltage','Clayton','priceless','FAS');
+INSERT INTO t2 VALUES (628,178302,40,'sash','exhausts','publicly','');
+INSERT INTO t2 VALUES (629,178401,40,'anaerobic','causality','incidentals','FAS');
+INSERT INTO t2 VALUES (630,178402,40,'simultaneous','sating','commonplace','');
+INSERT INTO t2 VALUES (631,178403,40,'accumulating','icon','mumbles','');
+INSERT INTO t2 VALUES (632,178404,40,'Medusan','throttles','furthermore','W');
+INSERT INTO t2 VALUES (633,178501,40,'shouted','communicants','cautioned','W');
+INSERT INTO t2 VALUES (634,186002,37,'freakish','dehydrate','parametrized','A');
+INSERT INTO t2 VALUES (635,186102,37,'index','priceless','registration','A');
+INSERT INTO t2 VALUES (636,186201,40,'commercially','publicly','sadly','FAS');
+INSERT INTO t2 VALUES (637,186202,40,'mistiness','incidentals','positioning','');
+INSERT INTO t2 VALUES (638,186203,40,'endpoint','commonplace','babysitting','');
+INSERT INTO t2 VALUES (639,186302,37,'straight','mumbles','eternal','A');
+INSERT INTO t2 VALUES (640,188007,37,'flurried','furthermore','hoarder','');
+INSERT INTO t2 VALUES (641,188008,37,'denotative','cautioned','congregates','');
+INSERT INTO t2 VALUES (642,188009,37,'coming','parametrized','rains','');
+INSERT INTO t2 VALUES (643,188010,37,'commencements','registration','workers','W');
+INSERT INTO t2 VALUES (644,188011,37,'gentleman','sadly','sags','A');
+INSERT INTO t2 VALUES (645,188012,37,'gifted','positioning','unplug','W');
+INSERT INTO t2 VALUES (646,188013,37,'Shanghais','babysitting','garage','A');
+INSERT INTO t2 VALUES (647,188014,37,'sportswriting','eternal','boulder','A');
+INSERT INTO t2 VALUES (648,188015,37,'sloping','hoarder','hollowly','A');
+INSERT INTO t2 VALUES (649,188016,37,'navies','congregates','specifics','');
+INSERT INTO t2 VALUES (650,188017,37,'leaflet','rains','Teresa','');
+INSERT INTO t2 VALUES (651,188102,37,'shooter','workers','Winsett','');
+INSERT INTO t2 VALUES (652,188103,37,'Joplin','sags','convenient','A');
+INSERT INTO t2 VALUES (653,188202,37,'babies','unplug','buckboards','FAS');
+INSERT INTO t2 VALUES (654,188301,40,'subdivision','garage','amenities','');
+INSERT INTO t2 VALUES (655,188302,40,'burstiness','boulder','resplendent','FAS');
+INSERT INTO t2 VALUES (656,188303,40,'belted','hollowly','priding','FAS');
+INSERT INTO t2 VALUES (657,188401,37,'assails','specifics','configurations','');
+INSERT INTO t2 VALUES (658,188402,37,'admiring','Teresa','untidiness','A');
+INSERT INTO t2 VALUES (659,188503,37,'swaying','Winsett','Brice','W');
+INSERT INTO t2 VALUES (660,188504,37,'Goldstine','convenient','sews','FAS');
+INSERT INTO t2 VALUES (661,188505,37,'fitting','buckboards','participated','');
+INSERT INTO t2 VALUES (662,190701,37,'Norwalk','amenities','Simon','FAS');
+INSERT INTO t2 VALUES (663,190703,50,'weakening','resplendent','certificates','');
+INSERT INTO t2 VALUES (664,191701,37,'analogy','priding','Fitzpatrick','');
+INSERT INTO t2 VALUES (665,191702,37,'deludes','configurations','Evanston','A');
+INSERT INTO t2 VALUES (666,191703,37,'cokes','untidiness','misted','');
+INSERT INTO t2 VALUES (667,196001,37,'Clayton','Brice','textures','A');
+INSERT INTO t2 VALUES (668,196002,37,'exhausts','sews','save','');
+INSERT INTO t2 VALUES (669,196003,37,'causality','participated','count','');
+INSERT INTO t2 VALUES (670,196101,37,'sating','Simon','rightful','A');
+INSERT INTO t2 VALUES (671,196103,37,'icon','certificates','chaperone','');
+INSERT INTO t2 VALUES (672,196104,37,'throttles','Fitzpatrick','Lizzy','A');
+INSERT INTO t2 VALUES (673,196201,37,'communicants','Evanston','clenched','A');
+INSERT INTO t2 VALUES (674,196202,37,'dehydrate','misted','effortlessly','');
+INSERT INTO t2 VALUES (675,196203,37,'priceless','textures','accessed','');
+INSERT INTO t2 VALUES (676,198001,37,'publicly','save','beaters','A');
+INSERT INTO t2 VALUES (677,198003,37,'incidentals','count','Hornblower','FAS');
+INSERT INTO t2 VALUES (678,198004,37,'commonplace','rightful','vests','A');
+INSERT INTO t2 VALUES (679,198005,37,'mumbles','chaperone','indulgences','FAS');
+INSERT INTO t2 VALUES (680,198006,37,'furthermore','Lizzy','infallibly','A');
+INSERT INTO t2 VALUES (681,198007,37,'cautioned','clenched','unwilling','FAS');
+INSERT INTO t2 VALUES (682,198008,37,'parametrized','effortlessly','excrete','FAS');
+INSERT INTO t2 VALUES (683,198009,37,'registration','accessed','spools','A');
+INSERT INTO t2 VALUES (684,198010,37,'sadly','beaters','crunches','FAS');
+INSERT INTO t2 VALUES (685,198011,37,'positioning','Hornblower','overestimating','FAS');
+INSERT INTO t2 VALUES (686,198012,37,'babysitting','vests','ineffective','');
+INSERT INTO t2 VALUES (687,198013,37,'eternal','indulgences','humiliation','A');
+INSERT INTO t2 VALUES (688,198014,37,'hoarder','infallibly','sophomore','');
+INSERT INTO t2 VALUES (689,198015,37,'congregates','unwilling','star','');
+INSERT INTO t2 VALUES (690,198017,37,'rains','excrete','rifles','');
+INSERT INTO t2 VALUES (691,198018,37,'workers','spools','dialysis','');
+INSERT INTO t2 VALUES (692,198019,37,'sags','crunches','arriving','');
+INSERT INTO t2 VALUES (693,198020,37,'unplug','overestimating','indulge','');
+INSERT INTO t2 VALUES (694,198021,37,'garage','ineffective','clockers','');
+INSERT INTO t2 VALUES (695,198022,37,'boulder','humiliation','languages','');
+INSERT INTO t2 VALUES (696,198023,50,'hollowly','sophomore','Antarctica','A');
+INSERT INTO t2 VALUES (697,198024,37,'specifics','star','percentage','');
+INSERT INTO t2 VALUES (698,198101,37,'Teresa','rifles','ceiling','A');
+INSERT INTO t2 VALUES (699,198103,37,'Winsett','dialysis','specification','');
+INSERT INTO t2 VALUES (700,198105,37,'convenient','arriving','regimented','A');
+INSERT INTO t2 VALUES (701,198106,37,'buckboards','indulge','ciphers','');
+INSERT INTO t2 VALUES (702,198201,37,'amenities','clockers','pictures','A');
+INSERT INTO t2 VALUES (703,198204,37,'resplendent','languages','serpents','A');
+INSERT INTO t2 VALUES (704,198301,53,'priding','Antarctica','allot','A');
+INSERT INTO t2 VALUES (705,198302,53,'configurations','percentage','realized','A');
+INSERT INTO t2 VALUES (706,198303,53,'untidiness','ceiling','mayoral','A');
+INSERT INTO t2 VALUES (707,198304,53,'Brice','specification','opaquely','A');
+INSERT INTO t2 VALUES (708,198401,37,'sews','regimented','hostess','FAS');
+INSERT INTO t2 VALUES (709,198402,37,'participated','ciphers','fiftieth','');
+INSERT INTO t2 VALUES (710,198403,37,'Simon','pictures','incorrectly','');
+INSERT INTO t2 VALUES (711,202101,37,'certificates','serpents','decomposition','FAS');
+INSERT INTO t2 VALUES (712,202301,37,'Fitzpatrick','allot','stranglings','');
+INSERT INTO t2 VALUES (713,202302,37,'Evanston','realized','mixture','FAS');
+INSERT INTO t2 VALUES (714,202303,37,'misted','mayoral','electroencephalography','FAS');
+INSERT INTO t2 VALUES (715,202304,37,'textures','opaquely','similarities','FAS');
+INSERT INTO t2 VALUES (716,202305,37,'save','hostess','charges','W');
+INSERT INTO t2 VALUES (717,202601,37,'count','fiftieth','freest','FAS');
+INSERT INTO t2 VALUES (718,202602,37,'rightful','incorrectly','Greenberg','FAS');
+INSERT INTO t2 VALUES (719,202605,37,'chaperone','decomposition','tinting','');
+INSERT INTO t2 VALUES (720,202606,37,'Lizzy','stranglings','expelled','W');
+INSERT INTO t2 VALUES (721,202607,37,'clenched','mixture','warm','');
+INSERT INTO t2 VALUES (722,202901,37,'effortlessly','electroencephalography','smoothed','');
+INSERT INTO t2 VALUES (723,202902,37,'accessed','similarities','deductions','FAS');
+INSERT INTO t2 VALUES (724,202903,37,'beaters','charges','Romano','W');
+INSERT INTO t2 VALUES (725,202904,37,'Hornblower','freest','bitterroot','');
+INSERT INTO t2 VALUES (726,202907,37,'vests','Greenberg','corset','');
+INSERT INTO t2 VALUES (727,202908,37,'indulgences','tinting','securing','');
+INSERT INTO t2 VALUES (728,203101,37,'infallibly','expelled','environing','FAS');
+INSERT INTO t2 VALUES (729,203103,37,'unwilling','warm','cute','');
+INSERT INTO t2 VALUES (730,203104,37,'excrete','smoothed','Crays','');
+INSERT INTO t2 VALUES (731,203105,37,'spools','deductions','heiress','FAS');
+INSERT INTO t2 VALUES (732,203401,37,'crunches','Romano','inform','FAS');
+INSERT INTO t2 VALUES (733,203402,37,'overestimating','bitterroot','avenge','');
+INSERT INTO t2 VALUES (734,203404,37,'ineffective','corset','universals','');
+INSERT INTO t2 VALUES (735,203901,37,'humiliation','securing','Kinsey','W');
+INSERT INTO t2 VALUES (736,203902,37,'sophomore','environing','ravines','FAS');
+INSERT INTO t2 VALUES (737,203903,37,'star','cute','bestseller','');
+INSERT INTO t2 VALUES (738,203906,37,'rifles','Crays','equilibrium','');
+INSERT INTO t2 VALUES (739,203907,37,'dialysis','heiress','extents','0');
+INSERT INTO t2 VALUES (740,203908,37,'arriving','inform','relatively','');
+INSERT INTO t2 VALUES (741,203909,37,'indulge','avenge','pressure','FAS');
+INSERT INTO t2 VALUES (742,206101,37,'clockers','universals','critiques','FAS');
+INSERT INTO t2 VALUES (743,206201,37,'languages','Kinsey','befouled','');
+INSERT INTO t2 VALUES (744,206202,37,'Antarctica','ravines','rightfully','FAS');
+INSERT INTO t2 VALUES (745,206203,37,'percentage','bestseller','mechanizing','FAS');
+INSERT INTO t2 VALUES (746,206206,37,'ceiling','equilibrium','Latinizes','');
+INSERT INTO t2 VALUES (747,206207,37,'specification','extents','timesharing','');
+INSERT INTO t2 VALUES (748,206208,37,'regimented','relatively','Aden','');
+INSERT INTO t2 VALUES (749,208001,37,'ciphers','pressure','embassies','');
+INSERT INTO t2 VALUES (750,208002,37,'pictures','critiques','males','FAS');
+INSERT INTO t2 VALUES (751,208003,37,'serpents','befouled','shapelessly','FAS');
+INSERT INTO t2 VALUES (752,208004,37,'allot','rightfully','genres','FAS');
+INSERT INTO t2 VALUES (753,208008,37,'realized','mechanizing','mastering','');
+INSERT INTO t2 VALUES (754,208009,37,'mayoral','Latinizes','Newtonian','');
+INSERT INTO t2 VALUES (755,208010,37,'opaquely','timesharing','finishers','FAS');
+INSERT INTO t2 VALUES (756,208011,37,'hostess','Aden','abates','');
+INSERT INTO t2 VALUES (757,208101,37,'fiftieth','embassies','teem','');
+INSERT INTO t2 VALUES (758,208102,37,'incorrectly','males','kiting','FAS');
+INSERT INTO t2 VALUES (759,208103,37,'decomposition','shapelessly','stodgy','FAS');
+INSERT INTO t2 VALUES (760,208104,37,'stranglings','genres','scalps','FAS');
+INSERT INTO t2 VALUES (761,208105,37,'mixture','mastering','feed','FAS');
+INSERT INTO t2 VALUES (762,208110,37,'electroencephalography','Newtonian','guitars','');
+INSERT INTO t2 VALUES (763,208111,37,'similarities','finishers','airships','');
+INSERT INTO t2 VALUES (764,208112,37,'charges','abates','store','');
+INSERT INTO t2 VALUES (765,208113,37,'freest','teem','denounces','');
+INSERT INTO t2 VALUES (766,208201,37,'Greenberg','kiting','Pyle','FAS');
+INSERT INTO t2 VALUES (767,208203,37,'tinting','stodgy','Saxony','');
+INSERT INTO t2 VALUES (768,208301,37,'expelled','scalps','serializations','FAS');
+INSERT INTO t2 VALUES (769,208302,37,'warm','feed','Peruvian','FAS');
+INSERT INTO t2 VALUES (770,208305,37,'smoothed','guitars','taxonomically','FAS');
+INSERT INTO t2 VALUES (771,208401,37,'deductions','airships','kingdom','A');
+INSERT INTO t2 VALUES (772,208402,37,'Romano','store','stint','A');
+INSERT INTO t2 VALUES (773,208403,37,'bitterroot','denounces','Sault','A');
+INSERT INTO t2 VALUES (774,208404,37,'corset','Pyle','faithful','');
+INSERT INTO t2 VALUES (775,208501,37,'securing','Saxony','Ganymede','FAS');
+INSERT INTO t2 VALUES (776,208502,37,'environing','serializations','tidiness','FAS');
+INSERT INTO t2 VALUES (777,208503,37,'cute','Peruvian','gainful','FAS');
+INSERT INTO t2 VALUES (778,208504,37,'Crays','taxonomically','contrary','FAS');
+INSERT INTO t2 VALUES (779,208505,37,'heiress','kingdom','Tipperary','FAS');
+INSERT INTO t2 VALUES (780,210101,37,'inform','stint','tropics','W');
+INSERT INTO t2 VALUES (781,210102,37,'avenge','Sault','theorizers','');
+INSERT INTO t2 VALUES (782,210103,37,'universals','faithful','renew','0');
+INSERT INTO t2 VALUES (783,210104,37,'Kinsey','Ganymede','already','');
+INSERT INTO t2 VALUES (784,210105,37,'ravines','tidiness','terminal','');
+INSERT INTO t2 VALUES (785,210106,37,'bestseller','gainful','Hegelian','');
+INSERT INTO t2 VALUES (786,210107,37,'equilibrium','contrary','hypothesizer','');
+INSERT INTO t2 VALUES (787,210401,37,'extents','Tipperary','warningly','FAS');
+INSERT INTO t2 VALUES (788,213201,37,'relatively','tropics','journalizing','FAS');
+INSERT INTO t2 VALUES (789,213203,37,'pressure','theorizers','nested','');
+INSERT INTO t2 VALUES (790,213204,37,'critiques','renew','Lars','');
+INSERT INTO t2 VALUES (791,213205,37,'befouled','already','saplings','');
+INSERT INTO t2 VALUES (792,213206,37,'rightfully','terminal','foothill','');
+INSERT INTO t2 VALUES (793,213207,37,'mechanizing','Hegelian','labeled','');
+INSERT INTO t2 VALUES (794,216101,37,'Latinizes','hypothesizer','imperiously','FAS');
+INSERT INTO t2 VALUES (795,216103,37,'timesharing','warningly','reporters','FAS');
+INSERT INTO t2 VALUES (796,218001,37,'Aden','journalizing','furnishings','FAS');
+INSERT INTO t2 VALUES (797,218002,37,'embassies','nested','precipitable','FAS');
+INSERT INTO t2 VALUES (798,218003,37,'males','Lars','discounts','FAS');
+INSERT INTO t2 VALUES (799,218004,37,'shapelessly','saplings','excises','FAS');
+INSERT INTO t2 VALUES (800,143503,50,'genres','foothill','Stalin','');
+INSERT INTO t2 VALUES (801,218006,37,'mastering','labeled','despot','FAS');
+INSERT INTO t2 VALUES (802,218007,37,'Newtonian','imperiously','ripeness','FAS');
+INSERT INTO t2 VALUES (803,218008,37,'finishers','reporters','Arabia','');
+INSERT INTO t2 VALUES (804,218009,37,'abates','furnishings','unruly','');
+INSERT INTO t2 VALUES (805,218010,37,'teem','precipitable','mournfulness','');
+INSERT INTO t2 VALUES (806,218011,37,'kiting','discounts','boom','FAS');
+INSERT INTO t2 VALUES (807,218020,37,'stodgy','excises','slaughter','A');
+INSERT INTO t2 VALUES (808,218021,50,'scalps','Stalin','Sabine','');
+INSERT INTO t2 VALUES (809,218022,37,'feed','despot','handy','FAS');
+INSERT INTO t2 VALUES (810,218023,37,'guitars','ripeness','rural','');
+INSERT INTO t2 VALUES (811,218024,37,'airships','Arabia','organizer','');
+INSERT INTO t2 VALUES (812,218101,37,'store','unruly','shipyard','FAS');
+INSERT INTO t2 VALUES (813,218102,37,'denounces','mournfulness','civics','FAS');
+INSERT INTO t2 VALUES (814,218103,37,'Pyle','boom','inaccuracy','FAS');
+INSERT INTO t2 VALUES (815,218201,37,'Saxony','slaughter','rules','FAS');
+INSERT INTO t2 VALUES (816,218202,37,'serializations','Sabine','juveniles','FAS');
+INSERT INTO t2 VALUES (817,218203,37,'Peruvian','handy','comprised','W');
+INSERT INTO t2 VALUES (818,218204,37,'taxonomically','rural','investigations','');
+INSERT INTO t2 VALUES (819,218205,37,'kingdom','organizer','stabilizes','A');
+INSERT INTO t2 VALUES (820,218301,37,'stint','shipyard','seminaries','FAS');
+INSERT INTO t2 VALUES (821,218302,37,'Sault','civics','Hunter','A');
+INSERT INTO t2 VALUES (822,218401,37,'faithful','inaccuracy','sporty','FAS');
+INSERT INTO t2 VALUES (823,218402,37,'Ganymede','rules','test','FAS');
+INSERT INTO t2 VALUES (824,218403,37,'tidiness','juveniles','weasels','');
+INSERT INTO t2 VALUES (825,218404,37,'gainful','comprised','CERN','');
+INSERT INTO t2 VALUES (826,218407,37,'contrary','investigations','tempering','');
+INSERT INTO t2 VALUES (827,218408,37,'Tipperary','stabilizes','afore','FAS');
+INSERT INTO t2 VALUES (828,218409,37,'tropics','seminaries','Galatean','');
+INSERT INTO t2 VALUES (829,218410,37,'theorizers','Hunter','techniques','W');
+INSERT INTO t2 VALUES (830,226001,37,'renew','sporty','error','');
+INSERT INTO t2 VALUES (831,226002,37,'already','test','veranda','');
+INSERT INTO t2 VALUES (832,226003,37,'terminal','weasels','severely','');
+INSERT INTO t2 VALUES (833,226004,37,'Hegelian','CERN','Cassites','FAS');
+INSERT INTO t2 VALUES (834,226005,37,'hypothesizer','tempering','forthcoming','');
+INSERT INTO t2 VALUES (835,226006,37,'warningly','afore','guides','');
+INSERT INTO t2 VALUES (836,226007,37,'journalizing','Galatean','vanish','FAS');
+INSERT INTO t2 VALUES (837,226008,37,'nested','techniques','lied','A');
+INSERT INTO t2 VALUES (838,226203,37,'Lars','error','sawtooth','FAS');
+INSERT INTO t2 VALUES (839,226204,37,'saplings','veranda','fated','FAS');
+INSERT INTO t2 VALUES (840,226205,37,'foothill','severely','gradually','');
+INSERT INTO t2 VALUES (841,226206,37,'labeled','Cassites','widens','');
+INSERT INTO t2 VALUES (842,226207,37,'imperiously','forthcoming','preclude','');
+INSERT INTO t2 VALUES (843,226208,37,'reporters','guides','Jobrel','');
+INSERT INTO t2 VALUES (844,226209,37,'furnishings','vanish','hooker','');
+INSERT INTO t2 VALUES (845,226210,37,'precipitable','lied','rainstorm','');
+INSERT INTO t2 VALUES (846,226211,37,'discounts','sawtooth','disconnects','');
+INSERT INTO t2 VALUES (847,228001,37,'excises','fated','cruelty','');
+INSERT INTO t2 VALUES (848,228004,37,'Stalin','gradually','exponentials','A');
+INSERT INTO t2 VALUES (849,228005,37,'despot','widens','affective','A');
+INSERT INTO t2 VALUES (850,228006,37,'ripeness','preclude','arteries','');
+INSERT INTO t2 VALUES (851,228007,37,'Arabia','Jobrel','Crosby','FAS');
+INSERT INTO t2 VALUES (852,228008,37,'unruly','hooker','acquaint','');
+INSERT INTO t2 VALUES (853,228009,37,'mournfulness','rainstorm','evenhandedly','');
+INSERT INTO t2 VALUES (854,228101,37,'boom','disconnects','percentage','');
+INSERT INTO t2 VALUES (855,228108,37,'slaughter','cruelty','disobedience','');
+INSERT INTO t2 VALUES (856,228109,37,'Sabine','exponentials','humility','');
+INSERT INTO t2 VALUES (857,228110,37,'handy','affective','gleaning','A');
+INSERT INTO t2 VALUES (858,228111,37,'rural','arteries','petted','A');
+INSERT INTO t2 VALUES (859,228112,37,'organizer','Crosby','bloater','A');
+INSERT INTO t2 VALUES (860,228113,37,'shipyard','acquaint','minion','A');
+INSERT INTO t2 VALUES (861,228114,37,'civics','evenhandedly','marginal','A');
+INSERT INTO t2 VALUES (862,228115,37,'inaccuracy','percentage','apiary','A');
+INSERT INTO t2 VALUES (863,228116,37,'rules','disobedience','measures','');
+INSERT INTO t2 VALUES (864,228117,37,'juveniles','humility','precaution','');
+INSERT INTO t2 VALUES (865,228118,37,'comprised','gleaning','repelled','');
+INSERT INTO t2 VALUES (866,228119,37,'investigations','petted','primary','FAS');
+INSERT INTO t2 VALUES (867,228120,37,'stabilizes','bloater','coverings','');
+INSERT INTO t2 VALUES (868,228121,37,'seminaries','minion','Artemia','A');
+INSERT INTO t2 VALUES (869,228122,37,'Hunter','marginal','navigate','');
+INSERT INTO t2 VALUES (870,228201,37,'sporty','apiary','spatial','');
+INSERT INTO t2 VALUES (871,228206,37,'test','measures','Gurkha','');
+INSERT INTO t2 VALUES (872,228207,37,'weasels','precaution','meanwhile','A');
+INSERT INTO t2 VALUES (873,228208,37,'CERN','repelled','Melinda','A');
+INSERT INTO t2 VALUES (874,228209,37,'tempering','primary','Butterfield','');
+INSERT INTO t2 VALUES (875,228210,37,'afore','coverings','Aldrich','A');
+INSERT INTO t2 VALUES (876,228211,37,'Galatean','Artemia','previewing','A');
+INSERT INTO t2 VALUES (877,228212,37,'techniques','navigate','glut','A');
+INSERT INTO t2 VALUES (878,228213,37,'error','spatial','unaffected','');
+INSERT INTO t2 VALUES (879,228214,37,'veranda','Gurkha','inmate','');
+INSERT INTO t2 VALUES (880,228301,37,'severely','meanwhile','mineral','');
+INSERT INTO t2 VALUES (881,228305,37,'Cassites','Melinda','impending','A');
+INSERT INTO t2 VALUES (882,228306,37,'forthcoming','Butterfield','meditation','A');
+INSERT INTO t2 VALUES (883,228307,37,'guides','Aldrich','ideas','');
+INSERT INTO t2 VALUES (884,228308,37,'vanish','previewing','miniaturizes','W');
+INSERT INTO t2 VALUES (885,228309,37,'lied','glut','lewdly','');
+INSERT INTO t2 VALUES (886,228310,37,'sawtooth','unaffected','title','');
+INSERT INTO t2 VALUES (887,228311,37,'fated','inmate','youthfulness','');
+INSERT INTO t2 VALUES (888,228312,37,'gradually','mineral','creak','FAS');
+INSERT INTO t2 VALUES (889,228313,37,'widens','impending','Chippewa','');
+INSERT INTO t2 VALUES (890,228314,37,'preclude','meditation','clamored','');
+INSERT INTO t2 VALUES (891,228401,65,'Jobrel','ideas','freezes','');
+INSERT INTO t2 VALUES (892,228402,65,'hooker','miniaturizes','forgivably','FAS');
+INSERT INTO t2 VALUES (893,228403,65,'rainstorm','lewdly','reduce','FAS');
+INSERT INTO t2 VALUES (894,228404,65,'disconnects','title','McGovern','W');
+INSERT INTO t2 VALUES (895,228405,65,'cruelty','youthfulness','Nazis','W');
+INSERT INTO t2 VALUES (896,228406,65,'exponentials','creak','epistle','W');
+INSERT INTO t2 VALUES (897,228407,65,'affective','Chippewa','socializes','W');
+INSERT INTO t2 VALUES (898,228408,65,'arteries','clamored','conceptions','');
+INSERT INTO t2 VALUES (899,228409,65,'Crosby','freezes','Kevin','');
+INSERT INTO t2 VALUES (900,228410,65,'acquaint','forgivably','uncovering','');
+INSERT INTO t2 VALUES (901,230301,37,'evenhandedly','reduce','chews','FAS');
+INSERT INTO t2 VALUES (902,230302,37,'percentage','McGovern','appendixes','FAS');
+INSERT INTO t2 VALUES (903,230303,37,'disobedience','Nazis','raining','');
+INSERT INTO t2 VALUES (904,018062,37,'humility','epistle','infest','');
+INSERT INTO t2 VALUES (905,230501,37,'gleaning','socializes','compartment','');
+INSERT INTO t2 VALUES (906,230502,37,'petted','conceptions','minting','');
+INSERT INTO t2 VALUES (907,230503,37,'bloater','Kevin','ducks','');
+INSERT INTO t2 VALUES (908,230504,37,'minion','uncovering','roped','A');
+INSERT INTO t2 VALUES (909,230505,37,'marginal','chews','waltz','');
+INSERT INTO t2 VALUES (910,230506,37,'apiary','appendixes','Lillian','');
+INSERT INTO t2 VALUES (911,230507,37,'measures','raining','repressions','A');
+INSERT INTO t2 VALUES (912,230508,37,'precaution','infest','chillingly','');
+INSERT INTO t2 VALUES (913,230509,37,'repelled','compartment','noncritical','');
+INSERT INTO t2 VALUES (914,230901,37,'primary','minting','lithograph','');
+INSERT INTO t2 VALUES (915,230902,37,'coverings','ducks','spongers','');
+INSERT INTO t2 VALUES (916,230903,37,'Artemia','roped','parenthood','');
+INSERT INTO t2 VALUES (917,230904,37,'navigate','waltz','posed','');
+INSERT INTO t2 VALUES (918,230905,37,'spatial','Lillian','instruments','');
+INSERT INTO t2 VALUES (919,230906,37,'Gurkha','repressions','filial','');
+INSERT INTO t2 VALUES (920,230907,37,'meanwhile','chillingly','fixedly','');
+INSERT INTO t2 VALUES (921,230908,37,'Melinda','noncritical','relives','');
+INSERT INTO t2 VALUES (922,230909,37,'Butterfield','lithograph','Pandora','');
+INSERT INTO t2 VALUES (923,230910,37,'Aldrich','spongers','watering','A');
+INSERT INTO t2 VALUES (924,230911,37,'previewing','parenthood','ungrateful','');
+INSERT INTO t2 VALUES (925,230912,37,'glut','posed','secures','');
+INSERT INTO t2 VALUES (926,230913,37,'unaffected','instruments','chastisers','');
+INSERT INTO t2 VALUES (927,230914,37,'inmate','filial','icon','');
+INSERT INTO t2 VALUES (928,231304,37,'mineral','fixedly','reuniting','A');
+INSERT INTO t2 VALUES (929,231305,37,'impending','relives','imagining','A');
+INSERT INTO t2 VALUES (930,231306,37,'meditation','Pandora','abiding','A');
+INSERT INTO t2 VALUES (931,231307,37,'ideas','watering','omnisciently','');
+INSERT INTO t2 VALUES (932,231308,37,'miniaturizes','ungrateful','Britannic','');
+INSERT INTO t2 VALUES (933,231309,37,'lewdly','secures','scholastics','A');
+INSERT INTO t2 VALUES (934,231310,37,'title','chastisers','mechanics','A');
+INSERT INTO t2 VALUES (935,231311,37,'youthfulness','icon','humidly','A');
+INSERT INTO t2 VALUES (936,231312,37,'creak','reuniting','masterpiece','');
+INSERT INTO t2 VALUES (937,231313,37,'Chippewa','imagining','however','');
+INSERT INTO t2 VALUES (938,231314,37,'clamored','abiding','Mendelian','');
+INSERT INTO t2 VALUES (939,231315,37,'freezes','omnisciently','jarred','');
+INSERT INTO t2 VALUES (940,232102,37,'forgivably','Britannic','scolds','');
+INSERT INTO t2 VALUES (941,232103,37,'reduce','scholastics','infatuate','');
+INSERT INTO t2 VALUES (942,232104,37,'McGovern','mechanics','willed','A');
+INSERT INTO t2 VALUES (943,232105,37,'Nazis','humidly','joyfully','');
+INSERT INTO t2 VALUES (944,232106,37,'epistle','masterpiece','Microsoft','');
+INSERT INTO t2 VALUES (945,232107,37,'socializes','however','fibrosities','');
+INSERT INTO t2 VALUES (946,232108,37,'conceptions','Mendelian','Baltimorean','');
+INSERT INTO t2 VALUES (947,232601,37,'Kevin','jarred','equestrian','');
+INSERT INTO t2 VALUES (948,232602,37,'uncovering','scolds','Goodrich','');
+INSERT INTO t2 VALUES (949,232603,37,'chews','infatuate','apish','A');
+INSERT INTO t2 VALUES (950,232605,37,'appendixes','willed','Adlerian','');
+INSERT INTO t2 VALUES (5950,1232605,37,'appendixes','willed','Adlerian','');
+INSERT INTO t2 VALUES (5951,1232606,37,'appendixes','willed','Adlerian','');
+INSERT INTO t2 VALUES (5952,1232607,37,'appendixes','willed','Adlerian','');
+INSERT INTO t2 VALUES (5953,1232608,37,'appendixes','willed','Adlerian','');
+INSERT INTO t2 VALUES (5954,1232609,37,'appendixes','willed','Adlerian','');
+INSERT INTO t2 VALUES (951,232606,37,'raining','joyfully','Tropez','');
+INSERT INTO t2 VALUES (952,232607,37,'infest','Microsoft','nouns','');
+INSERT INTO t2 VALUES (953,232608,37,'compartment','fibrosities','distracting','');
+INSERT INTO t2 VALUES (954,232609,37,'minting','Baltimorean','mutton','');
+INSERT INTO t2 VALUES (955,236104,37,'ducks','equestrian','bridgeable','A');
+INSERT INTO t2 VALUES (956,236105,37,'roped','Goodrich','stickers','A');
+INSERT INTO t2 VALUES (957,236106,37,'waltz','apish','transcontinental','A');
+INSERT INTO t2 VALUES (958,236107,37,'Lillian','Adlerian','amateurish','');
+INSERT INTO t2 VALUES (959,236108,37,'repressions','Tropez','Gandhian','');
+INSERT INTO t2 VALUES (960,236109,37,'chillingly','nouns','stratified','');
+INSERT INTO t2 VALUES (961,236110,37,'noncritical','distracting','chamberlains','');
+INSERT INTO t2 VALUES (962,236111,37,'lithograph','mutton','creditably','');
+INSERT INTO t2 VALUES (963,236112,37,'spongers','bridgeable','philosophic','');
+INSERT INTO t2 VALUES (964,236113,37,'parenthood','stickers','ores','');
+INSERT INTO t2 VALUES (965,238005,37,'posed','transcontinental','Carleton','');
+INSERT INTO t2 VALUES (966,238006,37,'instruments','amateurish','tape','A');
+INSERT INTO t2 VALUES (967,238007,37,'filial','Gandhian','afloat','A');
+INSERT INTO t2 VALUES (968,238008,37,'fixedly','stratified','goodness','A');
+INSERT INTO t2 VALUES (969,238009,37,'relives','chamberlains','welcoming','');
+INSERT INTO t2 VALUES (970,238010,37,'Pandora','creditably','Pinsky','FAS');
+INSERT INTO t2 VALUES (971,238011,37,'watering','philosophic','halting','');
+INSERT INTO t2 VALUES (972,238012,37,'ungrateful','ores','bibliography','');
+INSERT INTO t2 VALUES (973,238013,37,'secures','Carleton','decoding','');
+INSERT INTO t2 VALUES (974,240401,41,'chastisers','tape','variance','A');
+INSERT INTO t2 VALUES (975,240402,41,'icon','afloat','allowed','A');
+INSERT INTO t2 VALUES (976,240901,41,'reuniting','goodness','dire','A');
+INSERT INTO t2 VALUES (977,240902,41,'imagining','welcoming','dub','A');
+INSERT INTO t2 VALUES (978,241801,41,'abiding','Pinsky','poisoning','');
+INSERT INTO t2 VALUES (979,242101,41,'omnisciently','halting','Iraqis','A');
+INSERT INTO t2 VALUES (980,242102,41,'Britannic','bibliography','heaving','');
+INSERT INTO t2 VALUES (981,242201,41,'scholastics','decoding','population','A');
+INSERT INTO t2 VALUES (982,242202,41,'mechanics','variance','bomb','A');
+INSERT INTO t2 VALUES (983,242501,41,'humidly','allowed','Majorca','A');
+INSERT INTO t2 VALUES (984,242502,41,'masterpiece','dire','Gershwins','');
+INSERT INTO t2 VALUES (985,246201,41,'however','dub','explorers','');
+INSERT INTO t2 VALUES (986,246202,41,'Mendelian','poisoning','libretto','A');
+INSERT INTO t2 VALUES (987,246203,41,'jarred','Iraqis','occurred','');
+INSERT INTO t2 VALUES (988,246204,41,'scolds','heaving','Lagos','');
+INSERT INTO t2 VALUES (989,246205,41,'infatuate','population','rats','');
+INSERT INTO t2 VALUES (990,246301,41,'willed','bomb','bankruptcies','A');
+INSERT INTO t2 VALUES (991,246302,41,'joyfully','Majorca','crying','');
+INSERT INTO t2 VALUES (992,248001,41,'Microsoft','Gershwins','unexpected','');
+INSERT INTO t2 VALUES (993,248002,41,'fibrosities','explorers','accessed','A');
+INSERT INTO t2 VALUES (994,248003,41,'Baltimorean','libretto','colorful','A');
+INSERT INTO t2 VALUES (995,248004,41,'equestrian','occurred','versatility','A');
+INSERT INTO t2 VALUES (996,248005,41,'Goodrich','Lagos','cosy','');
+INSERT INTO t2 VALUES (997,248006,41,'apish','rats','Darius','A');
+INSERT INTO t2 VALUES (998,248007,41,'Adlerian','bankruptcies','mastering','A');
+INSERT INTO t2 VALUES (999,248008,41,'Tropez','crying','Asiaticizations','A');
+INSERT INTO t2 VALUES (1000,248009,41,'nouns','unexpected','offerers','A');
+INSERT INTO t2 VALUES (1001,248010,41,'distracting','accessed','uncles','A');
+INSERT INTO t2 VALUES (1002,248011,41,'mutton','colorful','sleepwalk','');
+INSERT INTO t2 VALUES (1003,248012,41,'bridgeable','versatility','Ernestine','');
+INSERT INTO t2 VALUES (1004,248013,41,'stickers','cosy','checksumming','');
+INSERT INTO t2 VALUES (1005,248014,41,'transcontinental','Darius','stopped','');
+INSERT INTO t2 VALUES (1006,248015,41,'amateurish','mastering','sicker','');
+INSERT INTO t2 VALUES (1007,248016,41,'Gandhian','Asiaticizations','Italianization','');
+INSERT INTO t2 VALUES (1008,248017,41,'stratified','offerers','alphabetic','');
+INSERT INTO t2 VALUES (1009,248018,41,'chamberlains','uncles','pharmaceutic','');
+INSERT INTO t2 VALUES (1010,248019,41,'creditably','sleepwalk','creator','');
+INSERT INTO t2 VALUES (1011,248020,41,'philosophic','Ernestine','chess','');
+INSERT INTO t2 VALUES (1012,248021,41,'ores','checksumming','charcoal','');
+INSERT INTO t2 VALUES (1013,248101,41,'Carleton','stopped','Epiphany','A');
+INSERT INTO t2 VALUES (1014,248102,41,'tape','sicker','bulldozes','A');
+INSERT INTO t2 VALUES (1015,248201,41,'afloat','Italianization','Pygmalion','A');
+INSERT INTO t2 VALUES (1016,248202,41,'goodness','alphabetic','caressing','A');
+INSERT INTO t2 VALUES (1017,248203,41,'welcoming','pharmaceutic','Palestine','A');
+INSERT INTO t2 VALUES (1018,248204,41,'Pinsky','creator','regimented','A');
+INSERT INTO t2 VALUES (1019,248205,41,'halting','chess','scars','A');
+INSERT INTO t2 VALUES (1020,248206,41,'bibliography','charcoal','realest','A');
+INSERT INTO t2 VALUES (1021,248207,41,'decoding','Epiphany','diffusing','A');
+INSERT INTO t2 VALUES (1022,248208,41,'variance','bulldozes','clubroom','A');
+INSERT INTO t2 VALUES (1023,248209,41,'allowed','Pygmalion','Blythe','A');
+INSERT INTO t2 VALUES (1024,248210,41,'dire','caressing','ahead','');
+INSERT INTO t2 VALUES (1025,248211,50,'dub','Palestine','reviver','');
+INSERT INTO t2 VALUES (1026,250501,34,'poisoning','regimented','retransmitting','A');
+INSERT INTO t2 VALUES (1027,250502,34,'Iraqis','scars','landslide','');
+INSERT INTO t2 VALUES (1028,250503,34,'heaving','realest','Eiffel','');
+INSERT INTO t2 VALUES (1029,250504,34,'population','diffusing','absentee','');
+INSERT INTO t2 VALUES (1030,250505,34,'bomb','clubroom','aye','');
+INSERT INTO t2 VALUES (1031,250601,34,'Majorca','Blythe','forked','A');
+INSERT INTO t2 VALUES (1032,250602,34,'Gershwins','ahead','Peruvianizes','');
+INSERT INTO t2 VALUES (1033,250603,34,'explorers','reviver','clerked','');
+INSERT INTO t2 VALUES (1034,250604,34,'libretto','retransmitting','tutor','');
+INSERT INTO t2 VALUES (1035,250605,34,'occurred','landslide','boulevard','');
+INSERT INTO t2 VALUES (1036,251001,34,'Lagos','Eiffel','shuttered','');
+INSERT INTO t2 VALUES (1037,251002,34,'rats','absentee','quotes','A');
+INSERT INTO t2 VALUES (1038,251003,34,'bankruptcies','aye','Caltech','');
+INSERT INTO t2 VALUES (1039,251004,34,'crying','forked','Mossberg','');
+INSERT INTO t2 VALUES (1040,251005,34,'unexpected','Peruvianizes','kept','');
+INSERT INTO t2 VALUES (1041,251301,34,'accessed','clerked','roundly','');
+INSERT INTO t2 VALUES (1042,251302,34,'colorful','tutor','features','A');
+INSERT INTO t2 VALUES (1043,251303,34,'versatility','boulevard','imaginable','A');
+INSERT INTO t2 VALUES (1044,251304,34,'cosy','shuttered','controller','');
+INSERT INTO t2 VALUES (1045,251305,34,'Darius','quotes','racial','');
+INSERT INTO t2 VALUES (1046,251401,34,'mastering','Caltech','uprisings','A');
+INSERT INTO t2 VALUES (1047,251402,34,'Asiaticizations','Mossberg','narrowed','A');
+INSERT INTO t2 VALUES (1048,251403,34,'offerers','kept','cannot','A');
+INSERT INTO t2 VALUES (1049,251404,34,'uncles','roundly','vest','');
+INSERT INTO t2 VALUES (1050,251405,34,'sleepwalk','features','famine','');
+INSERT INTO t2 VALUES (1051,251406,34,'Ernestine','imaginable','sugars','');
+INSERT INTO t2 VALUES (1052,251801,34,'checksumming','controller','exterminated','A');
+INSERT INTO t2 VALUES (1053,251802,34,'stopped','racial','belays','');
+INSERT INTO t2 VALUES (1054,252101,34,'sicker','uprisings','Hodges','A');
+INSERT INTO t2 VALUES (1055,252102,34,'Italianization','narrowed','translatable','');
+INSERT INTO t2 VALUES (1056,252301,34,'alphabetic','cannot','duality','A');
+INSERT INTO t2 VALUES (1057,252302,34,'pharmaceutic','vest','recording','A');
+INSERT INTO t2 VALUES (1058,252303,34,'creator','famine','rouses','A');
+INSERT INTO t2 VALUES (1059,252304,34,'chess','sugars','poison','');
+INSERT INTO t2 VALUES (1060,252305,34,'charcoal','exterminated','attitude','');
+INSERT INTO t2 VALUES (1061,252306,34,'Epiphany','belays','dusted','');
+INSERT INTO t2 VALUES (1062,252307,34,'bulldozes','Hodges','encompasses','');
+INSERT INTO t2 VALUES (1063,252308,34,'Pygmalion','translatable','presentation','');
+INSERT INTO t2 VALUES (1064,252309,34,'caressing','duality','Kantian','');
+INSERT INTO t2 VALUES (1065,256001,34,'Palestine','recording','imprecision','A');
+INSERT INTO t2 VALUES (1066,256002,34,'regimented','rouses','saving','');
+INSERT INTO t2 VALUES (1067,256003,34,'scars','poison','maternal','');
+INSERT INTO t2 VALUES (1068,256004,34,'realest','attitude','hewed','');
+INSERT INTO t2 VALUES (1069,256005,34,'diffusing','dusted','kerosene','');
+INSERT INTO t2 VALUES (1070,258001,34,'clubroom','encompasses','Cubans','');
+INSERT INTO t2 VALUES (1071,258002,34,'Blythe','presentation','photographers','');
+INSERT INTO t2 VALUES (1072,258003,34,'ahead','Kantian','nymph','A');
+INSERT INTO t2 VALUES (1073,258004,34,'reviver','imprecision','bedlam','A');
+INSERT INTO t2 VALUES (1074,258005,34,'retransmitting','saving','north','A');
+INSERT INTO t2 VALUES (1075,258006,34,'landslide','maternal','Schoenberg','A');
+INSERT INTO t2 VALUES (1076,258007,34,'Eiffel','hewed','botany','A');
+INSERT INTO t2 VALUES (1077,258008,34,'absentee','kerosene','curs','');
+INSERT INTO t2 VALUES (1078,258009,34,'aye','Cubans','solidification','');
+INSERT INTO t2 VALUES (1079,258010,34,'forked','photographers','inheritresses','');
+INSERT INTO t2 VALUES (1080,258011,34,'Peruvianizes','nymph','stiller','');
+INSERT INTO t2 VALUES (1081,258101,68,'clerked','bedlam','t1','A');
+INSERT INTO t2 VALUES (1082,258102,68,'tutor','north','suite','A');
+INSERT INTO t2 VALUES (1083,258103,34,'boulevard','Schoenberg','ransomer','');
+INSERT INTO t2 VALUES (1084,258104,68,'shuttered','botany','Willy','');
+INSERT INTO t2 VALUES (1085,258105,68,'quotes','curs','Rena','A');
+INSERT INTO t2 VALUES (1086,258106,68,'Caltech','solidification','Seattle','A');
+INSERT INTO t2 VALUES (1087,258107,68,'Mossberg','inheritresses','relaxes','A');
+INSERT INTO t2 VALUES (1088,258108,68,'kept','stiller','exclaim','');
+INSERT INTO t2 VALUES (1089,258109,68,'roundly','t1','implicated','A');
+INSERT INTO t2 VALUES (1090,258110,68,'features','suite','distinguish','');
+INSERT INTO t2 VALUES (1091,258111,68,'imaginable','ransomer','assayed','');
+INSERT INTO t2 VALUES (1092,258112,68,'controller','Willy','homeowner','');
+INSERT INTO t2 VALUES (1093,258113,68,'racial','Rena','and','');
+INSERT INTO t2 VALUES (1094,258201,34,'uprisings','Seattle','stealth','');
+INSERT INTO t2 VALUES (1095,258202,34,'narrowed','relaxes','coinciding','A');
+INSERT INTO t2 VALUES (1096,258203,34,'cannot','exclaim','founder','A');
+INSERT INTO t2 VALUES (1097,258204,34,'vest','implicated','environing','');
+INSERT INTO t2 VALUES (1098,258205,34,'famine','distinguish','jewelry','');
+INSERT INTO t2 VALUES (1099,258301,34,'sugars','assayed','lemons','A');
+INSERT INTO t2 VALUES (1100,258401,34,'exterminated','homeowner','brokenness','A');
+INSERT INTO t2 VALUES (1101,258402,34,'belays','and','bedpost','A');
+INSERT INTO t2 VALUES (1102,258403,34,'Hodges','stealth','assurers','A');
+INSERT INTO t2 VALUES (1103,258404,34,'translatable','coinciding','annoyers','');
+INSERT INTO t2 VALUES (1104,258405,34,'duality','founder','affixed','');
+INSERT INTO t2 VALUES (1105,258406,34,'recording','environing','warbling','');
+INSERT INTO t2 VALUES (1106,258407,34,'rouses','jewelry','seriously','');
+INSERT INTO t2 VALUES (1107,228123,37,'poison','lemons','boasted','');
+INSERT INTO t2 VALUES (1108,250606,34,'attitude','brokenness','Chantilly','');
+INSERT INTO t2 VALUES (1109,208405,37,'dusted','bedpost','Iranizes','');
+INSERT INTO t2 VALUES (1110,212101,37,'encompasses','assurers','violinist','');
+INSERT INTO t2 VALUES (1111,218206,37,'presentation','annoyers','extramarital','');
+INSERT INTO t2 VALUES (1112,150401,37,'Kantian','affixed','spates','');
+INSERT INTO t2 VALUES (1113,248212,41,'imprecision','warbling','cloakroom','');
+INSERT INTO t2 VALUES (1114,128026,00,'saving','seriously','gazer','');
+INSERT INTO t2 VALUES (1115,128024,00,'maternal','boasted','hand','');
+INSERT INTO t2 VALUES (1116,128027,00,'hewed','Chantilly','tucked','');
+INSERT INTO t2 VALUES (1117,128025,00,'kerosene','Iranizes','gems','');
+INSERT INTO t2 VALUES (1118,128109,00,'Cubans','violinist','clinker','');
+INSERT INTO t2 VALUES (1119,128705,00,'photographers','extramarital','refiner','');
+INSERT INTO t2 VALUES (1120,126303,00,'nymph','spates','callus','');
+INSERT INTO t2 VALUES (1121,128308,00,'bedlam','cloakroom','leopards','');
+INSERT INTO t2 VALUES (1122,128204,00,'north','gazer','comfortingly','');
+INSERT INTO t2 VALUES (1123,128205,00,'Schoenberg','hand','generically','');
+INSERT INTO t2 VALUES (1124,128206,00,'botany','tucked','getters','');
+INSERT INTO t2 VALUES (1125,128207,00,'curs','gems','sexually','');
+INSERT INTO t2 VALUES (1126,118205,00,'solidification','clinker','spear','');
+INSERT INTO t2 VALUES (1127,116801,00,'inheritresses','refiner','serums','');
+INSERT INTO t2 VALUES (1128,116803,00,'stiller','callus','Italianization','');
+INSERT INTO t2 VALUES (1129,116804,00,'t1','leopards','attendants','');
+INSERT INTO t2 VALUES (1130,116802,00,'suite','comfortingly','spies','');
+INSERT INTO t2 VALUES (1131,128605,00,'ransomer','generically','Anthony','');
+INSERT INTO t2 VALUES (1132,118308,00,'Willy','getters','planar','');
+INSERT INTO t2 VALUES (1133,113702,00,'Rena','sexually','cupped','');
+INSERT INTO t2 VALUES (1134,113703,00,'Seattle','spear','cleanser','');
+INSERT INTO t2 VALUES (1135,112103,00,'relaxes','serums','commuters','');
+INSERT INTO t2 VALUES (1136,118009,00,'exclaim','Italianization','honeysuckle','');
+INSERT INTO t2 VALUES (5136,1118009,00,'exclaim','Italianization','honeysuckle','');
+INSERT INTO t2 VALUES (1137,138011,00,'implicated','attendants','orphanage','');
+INSERT INTO t2 VALUES (1138,138010,00,'distinguish','spies','skies','');
+INSERT INTO t2 VALUES (1139,138012,00,'assayed','Anthony','crushers','');
+INSERT INTO t2 VALUES (1140,068304,00,'homeowner','planar','Puritan','');
+INSERT INTO t2 VALUES (1141,078009,00,'and','cupped','squeezer','');
+INSERT INTO t2 VALUES (1142,108013,00,'stealth','cleanser','bruises','');
+INSERT INTO t2 VALUES (1143,084004,00,'coinciding','commuters','bonfire','');
+INSERT INTO t2 VALUES (1144,083402,00,'founder','honeysuckle','Colombo','');
+INSERT INTO t2 VALUES (1145,084003,00,'environing','orphanage','nondecreasing','');
+INSERT INTO t2 VALUES (1146,088504,00,'jewelry','skies','innocents','');
+INSERT INTO t2 VALUES (1147,088005,00,'lemons','crushers','masked','');
+INSERT INTO t2 VALUES (1148,088007,00,'brokenness','Puritan','file','');
+INSERT INTO t2 VALUES (1149,088006,00,'bedpost','squeezer','brush','');
+INSERT INTO t2 VALUES (1150,148025,00,'assurers','bruises','mutilate','');
+INSERT INTO t2 VALUES (1151,148024,00,'annoyers','bonfire','mommy','');
+INSERT INTO t2 VALUES (1152,138305,00,'affixed','Colombo','bulkheads','');
+INSERT INTO t2 VALUES (1153,138306,00,'warbling','nondecreasing','undeclared','');
+INSERT INTO t2 VALUES (1154,152701,00,'seriously','innocents','displacements','');
+INSERT INTO t2 VALUES (1155,148505,00,'boasted','masked','nieces','');
+INSERT INTO t2 VALUES (1156,158003,00,'Chantilly','file','coeducation','');
+INSERT INTO t2 VALUES (1157,156201,00,'Iranizes','brush','brassy','');
+INSERT INTO t2 VALUES (1158,156202,00,'violinist','mutilate','authenticator','');
+INSERT INTO t2 VALUES (1159,158307,00,'extramarital','mommy','Washoe','');
+INSERT INTO t2 VALUES (1160,158402,00,'spates','bulkheads','penny','');
+INSERT INTO t2 VALUES (1161,158401,00,'cloakroom','undeclared','Flagler','');
+INSERT INTO t2 VALUES (1162,068013,00,'gazer','displacements','stoned','');
+INSERT INTO t2 VALUES (1163,068012,00,'hand','nieces','cranes','');
+INSERT INTO t2 VALUES (1164,068203,00,'tucked','coeducation','masterful','');
+INSERT INTO t2 VALUES (1165,088205,00,'gems','brassy','biracial','');
+INSERT INTO t2 VALUES (1166,068704,00,'clinker','authenticator','steamships','');
+INSERT INTO t2 VALUES (1167,068604,00,'refiner','Washoe','windmills','');
+INSERT INTO t2 VALUES (1168,158502,00,'callus','penny','exploit','');
+INSERT INTO t2 VALUES (1169,123103,00,'leopards','Flagler','riverfront','');
+INSERT INTO t2 VALUES (1170,148026,00,'comfortingly','stoned','sisterly','');
+INSERT INTO t2 VALUES (1171,123302,00,'generically','cranes','sharpshoot','');
+INSERT INTO t2 VALUES (1172,076503,00,'getters','masterful','mittens','');
+INSERT INTO t2 VALUES (1173,126304,00,'sexually','biracial','interdependency','');
+INSERT INTO t2 VALUES (1174,068306,00,'spear','steamships','policy','');
+INSERT INTO t2 VALUES (1175,143504,00,'serums','windmills','unleashing','');
+INSERT INTO t2 VALUES (1176,160201,00,'Italianization','exploit','pretenders','');
+INSERT INTO t2 VALUES (1177,148028,00,'attendants','riverfront','overstatements','');
+INSERT INTO t2 VALUES (1178,148027,00,'spies','sisterly','birthed','');
+INSERT INTO t2 VALUES (1179,143505,00,'Anthony','sharpshoot','opportunism','');
+INSERT INTO t2 VALUES (1180,108014,00,'planar','mittens','showroom','');
+INSERT INTO t2 VALUES (1181,076104,00,'cupped','interdependency','compromisingly','');
+INSERT INTO t2 VALUES (1182,078106,00,'cleanser','policy','Medicare','');
+INSERT INTO t2 VALUES (1183,126102,00,'commuters','unleashing','corresponds','');
+INSERT INTO t2 VALUES (1184,128029,00,'honeysuckle','pretenders','hardware','');
+INSERT INTO t2 VALUES (1185,128028,00,'orphanage','overstatements','implant','');
+INSERT INTO t2 VALUES (1186,018410,00,'skies','birthed','Alicia','');
+INSERT INTO t2 VALUES (1187,128110,00,'crushers','opportunism','requesting','');
+INSERT INTO t2 VALUES (1188,148506,00,'Puritan','showroom','produced','');
+INSERT INTO t2 VALUES (1189,123303,00,'squeezer','compromisingly','criticizes','');
+INSERT INTO t2 VALUES (1190,123304,00,'bruises','Medicare','backer','');
+INSERT INTO t2 VALUES (1191,068504,00,'bonfire','corresponds','positively','');
+INSERT INTO t2 VALUES (1192,068305,00,'Colombo','hardware','colicky','');
+INSERT INTO t2 VALUES (1193,000000,00,'nondecreasing','implant','thrillingly','');
+--enable_query_log
+
+#
+# Search with a key
+#
+
+select t2.fld3 from t2 where companynr = 58 and fld3 like "%imaginable%";
+select fld3 from t2 where fld3 like "%cultivation" ;
+
+#
+# Search with a key using sorting and limit the same time
+#
+
+select t2.fld3,companynr from t2 where companynr = 57+1 order by fld3;
+select fld3,companynr from t2 where companynr = 58 order by fld3;
+
+select fld3 from t2 order by fld3 desc limit 10;
+select fld3 from t2 order by fld3 desc limit 5;
+select fld3 from t2 order by fld3 desc limit 5,5;
+
+#
+# Search with a key having a constant with each unique key.
+# The table is read directly with read-next on fld3
+#
+
+select t2.fld3 from t2 where fld3 = 'honeysuckle';
+select t2.fld3 from t2 where fld3 LIKE 'honeysuckl_';
+select t2.fld3 from t2 where fld3 LIKE 'hon_ysuckl_';
+select t2.fld3 from t2 where fld3 LIKE 'honeysuckle%';
+select t2.fld3 from t2 where fld3 LIKE 'h%le';
+
+select t2.fld3 from t2 where fld3 LIKE 'honeysuckle_';
+select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%';
+
+#
+# Test sorting with a used key (there is no need for sorting)
+#
+
+select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
+select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3;
+
+#
+# Search with a key with LIKE constant
+# If the like starts with a certain letter key will be used.
+#
+
+select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%';
+select fld3 from t2 where fld3 like "L%" and fld3 = "ok";
+select fld3 from t2 where (fld3 like "C%" and fld3 = "Chantilly");
+select fld1,fld3 from t2 where fld1 like "25050%";
+select fld1,fld3 from t2 where fld1 like "25050_";
+
+#
+# Test for insert after select
+#
+INSERT INTO t2 VALUES (1,000001,00,'Omaha','teethe','neat','');
+INSERT INTO t2 VALUES (2,011401,37,'breaking','dreaded','Steinberg','W');
+INSERT INTO t2 VALUES (3,011402,37,'Romans','scholastics','jarring','');
+INSERT INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily','');
+SELECT * FROM t2;
+OPTIMIZE TABLE t2;
+SELECT * FROM t2;
+drop table t1, t2;
diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test
index c26983b5eec..8e11a3d68a5 100644
--- a/mysql-test/t/auto_increment.test
+++ b/mysql-test/t/auto_increment.test
@@ -1,9 +1,13 @@
#
# Test of auto_increment; The test for BDB tables is in bdb.test
#
-
+--disable_warnings
drop table if exists t1;
-create table t1 (a int not null auto_increment,b int, primary key (a)) type=myisam auto_increment=3;
+drop table if exists t2;
+--enable_warnings
+SET SQL_WARNINGS=1;
+
+create table t1 (a int not null auto_increment,b int, primary key (a)) engine=myisam auto_increment=3;
insert into t1 values (1,1),(NULL,3),(NULL,4);
delete from t1 where a=4;
insert into t1 values (NULL,5),(NULL,6);
@@ -82,10 +86,123 @@ insert into t1 values (NULL);
select * from t1;
drop table t1;
-create table t1 (a int not null auto_increment primary key) /*!40102 type=heap */;
+create table t1 (a int not null auto_increment primary key) /*!40102 engine=heap */;
insert into t1 values (NULL);
insert into t1 values (-1);
select last_insert_id();
insert into t1 values (NULL);
select * from t1;
drop table t1;
+#
+# last_insert_id() madness
+#
+create table t1 (i tinyint unsigned not null auto_increment primary key);
+insert into t1 set i = 254;
+insert into t1 set i = null;
+select last_insert_id();
+explain extended select last_insert_id();
+--error 1062
+insert into t1 set i = 254;
+select last_insert_id();
+--error 1062
+insert into t1 set i = null;
+select last_insert_id();
+drop table t1;
+
+create table t1 (i tinyint unsigned not null auto_increment, key (i));
+insert into t1 set i = 254;
+insert into t1 set i = null;
+select last_insert_id();
+insert into t1 set i = null;
+select last_insert_id();
+drop table t1;
+
+create table t1 (i tinyint unsigned not null auto_increment primary key, b int, unique (b));
+insert into t1 values (NULL, 10);
+select last_insert_id();
+insert into t1 values (NULL, 15);
+select last_insert_id();
+--error 1062
+insert into t1 values (NULL, 10);
+select last_insert_id();
+
+drop table t1;
+
+create table t1(a int auto_increment,b int null,primary key(a));
+SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
+insert into t1(a,b)values(NULL,1);
+insert into t1(a,b)values(200,2);
+insert into t1(a,b)values(0,3);
+insert into t1(b)values(4);
+insert into t1(b)values(5);
+insert into t1(b)values(6);
+insert into t1(b)values(7);
+select * from t1 order by b;
+alter table t1 modify b mediumint;
+select * from t1 order by b;
+create table t2 (a int);
+insert t2 values (1),(2);
+alter table t2 add b int auto_increment primary key;
+select * from t2;
+drop table t2;
+delete from t1 where a=0;
+update t1 set a=0 where b=5;
+select * from t1 order by b;
+delete from t1 where a=0;
+update t1 set a=NULL where b=6;
+update t1 set a=300 where b=7;
+SET SQL_MODE='';
+insert into t1(a,b)values(NULL,8);
+insert into t1(a,b)values(400,9);
+insert into t1(a,b)values(0,10);
+insert into t1(b)values(11);
+insert into t1(b)values(12);
+insert into t1(b)values(13);
+insert into t1(b)values(14);
+select * from t1 order by b;
+delete from t1 where a=0;
+update t1 set a=0 where b=12;
+select * from t1 order by b;
+delete from t1 where a=0;
+update t1 set a=NULL where b=13;
+update t1 set a=500 where b=14;
+select * from t1 order by b;
+drop table t1;
+
+#
+# Test of behavior of ALTER TABLE when coulmn containing NULL or zeroes is
+# converted to AUTO_INCREMENT column
+#
+create table t1 (a bigint);
+insert into t1 values (1), (2), (3), (NULL), (NULL);
+alter table t1 modify a bigint not null auto_increment primary key;
+select * from t1;
+drop table t1;
+
+create table t1 (a bigint);
+insert into t1 values (1), (2), (3), (0), (0);
+alter table t1 modify a bigint not null auto_increment primary key;
+select * from t1;
+drop table t1;
+
+# We still should be able to preserve zero in NO_AUTO_VALUE_ON_ZERO mode
+create table t1 (a bigint);
+insert into t1 values (0), (1), (2), (3);
+set sql_mode=NO_AUTO_VALUE_ON_ZERO;
+alter table t1 modify a bigint not null auto_increment primary key;
+set sql_mode= '';
+select * from t1;
+drop table t1;
+
+# It also sensible to preserve zeroes if we are converting auto_increment
+# column to auto_increment column (or not touching it at all, which is more
+# common case probably)
+create table t1 (a int auto_increment primary key , b int null);
+set sql_mode=NO_AUTO_VALUE_ON_ZERO;
+insert into t1 values (0,1),(1,2),(2,3);
+select * from t1;
+set sql_mode= '';
+alter table t1 modify b varchar(255);
+insert into t1 values (0,4);
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/backup.test b/mysql-test/t/backup.test
index 650b85477f5..ed24161bef5 100644
--- a/mysql-test/t/backup.test
+++ b/mysql-test/t/backup.test
@@ -6,6 +6,9 @@ connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
set SQL_LOG_BIN=0;
+--disable_warnings
+drop table if exists t1, t2, t3;
+--enable_warnings
create table t4(n int);
--replace_result "errno: 1" "errno: X" "errno: 2" "errno: X" "errno: 22" "errno: X" "errno: 23" "errno: X"
backup table t4 to '../bogus';
diff --git a/mysql-test/t/bdb-alter-table-1.test b/mysql-test/t/bdb-alter-table-1.test
index 5861c2fe0bf..18b6c70758f 100644
--- a/mysql-test/t/bdb-alter-table-1.test
+++ b/mysql-test/t/bdb-alter-table-1.test
@@ -2,8 +2,11 @@
# Test of problem when shutting down mysqld at once after ALTER TABLE
#
-- source include/have_bdb.inc
+--disable_warnings
drop table if exists t1;
-create table t1(objid BIGINT not null, tablename varchar(64), oid BIGINT not null, test BIGINT, PRIMARY KEY (objid), UNIQUE(tablename)) type=BDB;
+--enable_warnings
+
+create table t1(objid BIGINT not null, tablename varchar(64), oid BIGINT not null, test BIGINT, PRIMARY KEY (objid), UNIQUE(tablename)) engine=BDB;
insert into t1 values(1, 't1',4,9);
insert into t1 values(2, 'metatable',1,9);
insert into t1 values(3, 'metaindex',1,9 );
diff --git a/mysql-test/t/bdb-crash.test b/mysql-test/t/bdb-crash.test
index 98b542bf4c3..3cd78821000 100644
--- a/mysql-test/t/bdb-crash.test
+++ b/mysql-test/t/bdb-crash.test
@@ -2,7 +2,9 @@
# test for bug reported by Mark Steele
+--disable_warnings
drop table if exists t1;
+--enable_warnings
CREATE TABLE t1 (
ChargeID int(10) unsigned NOT NULL auto_increment,
ServiceID int(10) unsigned DEFAULT '0' NOT NULL,
@@ -18,7 +20,7 @@ DEFAULT 'New' NOT NULL,
PRIMARY KEY (ChargeID),
KEY ServiceID (ServiceID),
KEY ChargeDate (ChargeDate)
-) type=BDB;
+) engine=BDB;
BEGIN;
INSERT INTO t1
@@ -37,8 +39,7 @@ drop table t1;
#
# Test for bug #2342 "Running ANALYZE TABLE on bdb table
-# inside a transaction hangs server thread"
-#
+# inside a transaction hangs server thread"
create table t1 (a int) engine=bdb;
diff --git a/mysql-test/t/bdb-deadlock.test b/mysql-test/t/bdb-deadlock.test
index b32b50c715b..d86403fcffc 100644
--- a/mysql-test/t/bdb-deadlock.test
+++ b/mysql-test/t/bdb-deadlock.test
@@ -11,10 +11,12 @@
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
+--disable_warnings
drop table if exists t1,t2;
+--enable_warnings
connection con1;
-create table t1 (id integer, x integer) type=BDB;
-create table t2 (id integer, x integer) type=BDB;
+create table t1 (id integer, x integer) engine=BDB;
+create table t2 (id integer, x integer) engine=BDB;
insert into t1 values(0, 0);
insert into t2 values(0, 0);
set autocommit=0;
@@ -30,13 +32,19 @@ select x from t1 where id = 0;
connection con1;
# This should generate a deadlock as we are trying to access a locked row
---error 1213
+--send
select x from t2 where id = 0;
-commit;
connection con2;
+--error 1213
reap;
commit;
+
+connection con1;
+reap;
+commit;
+
+connection con2;
select * from t1;
select * from t2;
commit;
@@ -45,4 +53,5 @@ connection con1;
select * from t1;
select * from t2;
commit;
+
drop table t1,t2;
diff --git a/mysql-test/t/bdb-deadlock.tminus b/mysql-test/t/bdb-deadlock.tminus
new file mode 100644
index 00000000000..d86403fcffc
--- /dev/null
+++ b/mysql-test/t/bdb-deadlock.tminus
@@ -0,0 +1,57 @@
+# This test doesn't work with the embedded version as this code
+# assumes that one query is running while we are doing queries on
+# a second connection.
+# This would work if mysqltest run would be threaded and handle each
+# connection in a separate thread.
+#
+
+#-- source include/not_embedded.inc
+-- source include/have_bdb.inc
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+connection con1;
+create table t1 (id integer, x integer) engine=BDB;
+create table t2 (id integer, x integer) engine=BDB;
+insert into t1 values(0, 0);
+insert into t2 values(0, 0);
+set autocommit=0;
+update t1 set x = 1 where id = 0;
+
+connection con2;
+set autocommit=0;
+update t2 set x = 1 where id = 0;
+
+# The following query should hang because con1 is locking the page
+--send
+select x from t1 where id = 0;
+
+connection con1;
+# This should generate a deadlock as we are trying to access a locked row
+--send
+select x from t2 where id = 0;
+
+connection con2;
+--error 1213
+reap;
+commit;
+
+connection con1;
+reap;
+commit;
+
+connection con2;
+select * from t1;
+select * from t2;
+commit;
+
+connection con1;
+select * from t1;
+select * from t2;
+commit;
+
+drop table t1,t2;
diff --git a/mysql-test/t/bdb.test b/mysql-test/t/bdb.test
index 1e6d7035989..069ec758ba2 100644
--- a/mysql-test/t/bdb.test
+++ b/mysql-test/t/bdb.test
@@ -4,8 +4,10 @@
# Small basic test with ignore
#
+--disable_warnings
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8;
-create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=bdb;
+--enable_warnings
+create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=bdb;
insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt');
select id, code, name from t1 order by id;
@@ -28,7 +30,7 @@ CREATE TABLE t1 (
PRIMARY KEY (id),
KEY parent_id (parent_id),
KEY level (level)
-) type=bdb;
+) engine=bdb;
INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2);
update t1 set parent_id=parent_id+100;
select * from t1 where parent_id=102;
@@ -57,7 +59,7 @@ CREATE TABLE t1 (
gesuchnr int(11) DEFAULT '0' NOT NULL,
benutzer_id int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (gesuchnr,benutzer_id)
-) type=BDB;
+) engine=BDB;
replace into t1 (gesuchnr,benutzer_id) values (2,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
@@ -66,7 +68,7 @@ select * from t1;
drop table t1;
# test for bug in replace with secondary key
-create table t1 (id int not null primary key, x int not null, key (x)) type=bdb;
+create table t1 (id int not null primary key, x int not null, key (x)) engine=bdb;
insert into t1 (id, x) values (1, 1);
replace into t1 (id, x) values (1, 2);
select * from t1;
@@ -76,7 +78,7 @@ drop table t1;
# test delete using hidden_primary_key
#
-create table t1 (a int) type=bdb;
+create table t1 (a int) engine=bdb;
insert into t1 values (1), (2);
optimize table t1;
delete from t1 where a = 1;
@@ -84,7 +86,7 @@ select * from t1;
check table t1;
drop table t1;
-create table t1 (a int,b varchar(20)) type=bdb;
+create table t1 (a int,b varchar(20)) engine=bdb;
insert into t1 values (1,""), (2,"testing");
delete from t1 where a = 1;
select * from t1;
@@ -96,7 +98,7 @@ drop table t1;
# Test of reading on secondary key with may be null
-create table t1 (a int,b varchar(20),key(a)) type=bdb;
+create table t1 (a int,b varchar(20),key(a)) engine=bdb;
insert into t1 values (1,""), (2,"testing");
select * from t1 where a = 1;
drop table t1;
@@ -105,7 +107,7 @@ drop table t1;
# Test auto_increment on sub key
#
-create table t1 (a char(10) not null, b int not null auto_increment, primary key(a,b)) type=BDB;
+create table t1 (a char(10) not null, b int not null auto_increment, primary key(a,b)) engine=BDB;
insert into t1 values ("a",1),("b",2),("a",2),("c",1);
insert into t1 values ("a",NULL),("b",NULL),("c",NULL),("e",NULL);
insert into t1 (a) values ("a"),("b"),("c"),("d");
@@ -121,7 +123,7 @@ drop table t1;
# Test rollback
#
-create table t1 (n int not null primary key) type=bdb;
+create table t1 (n int not null primary key) engine=bdb;
set autocommit=0;
insert into t1 values (4);
rollback;
@@ -148,7 +150,7 @@ drop table t1;
# Testing transactions
#
-create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) type=BDB;
+create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) engine=BDB;
begin;
insert into t1 values(1,'hamdouni');
select id as afterbegin_id,nom as afterbegin_nom from t1;
@@ -166,7 +168,7 @@ drop table t1;
# Simple not autocommit test
#
-CREATE TABLE t1 (id char(8) not null primary key, val int not null) type=bdb;
+CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=bdb;
insert into t1 values ('pippo', 12);
-- error 1062
insert into t1 values ('pippo', 12); # Gives error
@@ -189,12 +191,12 @@ set autocommit=1;
# The following simple tests failed at some point
#
-CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) TYPE=BDB;
+CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) ENGINE=BDB;
INSERT INTO t1 VALUES (1, 'Jochen');
select * from t1;
drop table t1;
-CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) TYPE=BDB;
+CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) ENGINE=BDB;
set autocommit=0;
INSERT INTO t1 SET _userid='marc@anyware.co.uk';
COMMIT;
@@ -213,7 +215,7 @@ CREATE TABLE t1 (
ref_email varchar(100) DEFAULT '' NOT NULL,
detail varchar(200),
PRIMARY KEY (user_id,ref_email)
-)type=bdb;
+)engine=bdb;
INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar');
select * from t1 where user_id=10292;
@@ -238,7 +240,7 @@ drop table t1;
#
create table t1 (col1 int not null, col2 char(4) not null, primary key(col1));
-alter table t1 type=BDB;
+alter table t1 engine=BDB;
insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4');
select * from t1;
update t1 set col2='7' where col1='4';
@@ -253,8 +255,8 @@ drop table t1;
# INSERT INTO BDB tables
#
-create table t1 (a int not null , b int, primary key (a)) type = BDB;
-create table t2 (a int not null , b int, primary key (a)) type = myisam;
+create table t1 (a int not null , b int, primary key (a)) engine = BDB;
+create table t2 (a int not null , b int, primary key (a)) engine = myisam;
insert into t1 VALUES (1,3) , (2,3), (3,3);
select * from t1;
insert into t2 select * from t1;
@@ -277,7 +279,7 @@ CREATE TABLE t1 (
passwd varchar(32) binary DEFAULT '' NOT NULL,
PRIMARY KEY (id),
UNIQUE ggid (ggid)
-) TYPE=BDB;
+) ENGINE=BDB;
insert into t1 (ggid,passwd) values ('test1','xxx');
insert into t1 (ggid,passwd) values ('test2','yyy');
@@ -315,7 +317,7 @@ CREATE TABLE t1 (
approved datetime,
dummy_primary_key int(11) NOT NULL auto_increment,
PRIMARY KEY (dummy_primary_key)
-) TYPE=BDB;
+) ENGINE=BDB;
INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1);
INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2);
INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3);
@@ -335,7 +337,7 @@ CREATE TABLE t1 (
KEY (id),
KEY parent_id (parent_id),
KEY level (level)
-) type=bdb;
+) engine=bdb;
INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1);
INSERT INTO t1 values (179,5,2);
update t1 set parent_id=parent_id+100;
@@ -368,7 +370,7 @@ CREATE TABLE t1 (
sca_sch_desc varchar(16),
PRIMARY KEY (sca_code, cat_code, lan_code),
INDEX sca_pic (sca_pic)
-) type = bdb ;
+) engine = bdb ;
INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
select count(*) from t1 where sca_code = 'PD';
@@ -390,7 +392,7 @@ drop table t1;
# Test of opening table twice and timestamps
#
set @a:=now();
-CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) type=bdb;
+CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=bdb;
insert into t1 (a) values(1),(2),(3);
select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a;
update t1 set a=5 where a=1;
@@ -405,7 +407,7 @@ flush logs;
#
# Test key on blob with null values
#
-create table t1 (b blob, i int, key (b(100)), key (i), key (i, b(20))) type=bdb;
+create table t1 (b blob, i int, key (b(100)), key (i), key (i, b(20))) engine=bdb;
insert into t1 values ('this is a blob', 1), (null, -1), (null, null),("",1),("",2),("",3);
select b from t1 where b = 'this is a blob';
select * from t1 where b like 't%';
@@ -419,7 +421,7 @@ drop table t1;
#
# Test with variable length primary key
#
-create table t1 (a varchar(100) not null, primary key(a), b int not null) type=bdb;
+create table t1 (a varchar(100) not null, primary key(a), b int not null) engine=bdb;
insert into t1 values("hello",1),("world",2);
select * from t1 order by b desc;
optimize table t1;
@@ -429,7 +431,7 @@ drop table t1;
#
# Test of bug in create index with NULL columns
#
-create table t1 (i int, j int )TYPE=BDB;
+create table t1 (i int, j int )ENGINE=BDB;
insert into t1 values (1,2);
select * from t1 where i=1 and j=2;
create index ax1 on t1 (i,j);
@@ -441,7 +443,6 @@ drop table t1;
# This gave a wrong result because the row information was freed too early
#
-drop table if exists t1, t2, t3, t4, t5, t6, t7;
create table t1
(
branch_id int auto_increment primary key,
@@ -450,8 +451,7 @@ create table t1
unique branch_name(branch_name),
index branch_active(branch_active)
-) type=bdb;
-drop table if exists t2 ;
+) engine=bdb;
create table t2
(
target_id int auto_increment primary key,
@@ -460,8 +460,7 @@ create table t2
unique target_name(target_name),
index target_active(target_active)
-) type=bdb;
-drop table if exists t3 ;
+) engine=bdb;
create table t3
(
platform_id int auto_increment primary key,
@@ -470,8 +469,7 @@ create table t3
unique platform_name(platform_name),
index platform_active(platform_active)
-) type=bdb;
-drop table if exists t4 ;
+) engine=bdb;
create table t4
(
product_id int auto_increment primary key,
@@ -481,8 +479,7 @@ create table t4
unique product_name(product_name),
index product_active(product_active)
-) type=bdb;
-drop table if exists t5 ;
+) engine=bdb;
create table t5
(
product_file_id int auto_increment primary key,
@@ -495,8 +492,7 @@ create table t5
unique product_file(product_id,file_name),
index file_included(file_included)
-) type=bdb;
-drop table if exists t6 ;
+) engine=bdb;
create table t6
(
file_platform_id int auto_increment primary key,
@@ -509,8 +505,7 @@ create table t6
archive_filename varchar(255) not null,
unique file_platform(product_file_id,platform_id,branch_id)
-) type=bdb;
-drop table if exists t8 ;
+) engine=bdb;
create table t8
(
archive_id int auto_increment primary key,
@@ -522,8 +517,7 @@ create table t8
unique archive(branch_id,target_id,platform_id,product_id),
index status_id(status_id)
-) type=bdb;
-drop table if exists t7 ;
+) engine=bdb;
create table t7
(
build_id int auto_increment primary key,
@@ -537,7 +531,7 @@ create table t7
build_path text not null,
unique build(branch_id,target_id,build_number)
-) type=bdb;
+) engine=bdb;
insert into t1 (branch_name)
values ('RealMedia');
@@ -665,7 +659,7 @@ CREATE TABLE t1 (
a tinytext NOT NULL,
b tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (a(32),b)
-) TYPE=BDB;
+) ENGINE=BDB;
INSERT INTO t1 VALUES ('a',1),('a',2);
SELECT * FROM t1 WHERE a='a' AND b=2;
SELECT * FROM t1 WHERE a='a' AND b in (2);
@@ -680,7 +674,7 @@ CREATE TABLE t1 (
a int3 unsigned NOT NULL,
b int1 unsigned NOT NULL,
UNIQUE (a, b)
-) TYPE = BDB;
+) ENGINE = BDB;
INSERT INTO t1 VALUES (1, 1);
SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1;
@@ -690,7 +684,7 @@ drop table t1;
# Test problem with BDB and lock tables with duplicate write.
#
-create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=bdb;
+create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=bdb;
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
LOCK TABLES t1 WRITE;
--error 1062
@@ -700,7 +694,7 @@ select id from t1;
UNLOCK TABLES;
DROP TABLE t1;
-create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=bdb;
+create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=bdb;
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
LOCK TABLES t1 WRITE;
begin;
@@ -717,8 +711,8 @@ DROP TABLE t1;
# Test with empty tables (crashed with lock error)
#
-CREATE TABLE t1 (SYAIN_NO char(5) NOT NULL default '', KINMU_DATE char(6) NOT NULL default '', PRIMARY KEY (SYAIN_NO,KINMU_DATE)) TYPE=BerkeleyDB;
-CREATE TABLE t2 ( SYAIN_NO char(5) NOT NULL default '',STR_DATE char(8) NOT NULL default '',PRIMARY KEY (SYAIN_NO,STR_DATE) ) TYPE=BerkeleyDB;
+CREATE TABLE t1 (SYAIN_NO char(5) NOT NULL default '', KINMU_DATE char(6) NOT NULL default '', PRIMARY KEY (SYAIN_NO,KINMU_DATE)) ENGINE=BerkeleyDB;
+CREATE TABLE t2 ( SYAIN_NO char(5) NOT NULL default '',STR_DATE char(8) NOT NULL default '',PRIMARY KEY (SYAIN_NO,STR_DATE) ) ENGINE=BerkeleyDB;
select T1.KINMU_DATE from t1 T1 ,t2 T2 where T1.SYAIN_NO = '12345' and T1.KINMU_DATE = '200106' and T2.SYAIN_NO = T1.SYAIN_NO;
select T1.KINMU_DATE from t1 T1 ,t2 T2 where T1.SYAIN_NO = '12345' and T1.KINMU_DATE = '200106' and T2.SYAIN_NO = T1.SYAIN_NO;
DROP TABLE t1,t2;
@@ -727,8 +721,7 @@ DROP TABLE t1,t2;
# Test problem with joining table to itself on a multi-part unique key
#
-drop table if exists t1;
-create table t1 (a int(11) not null, b int(11) not null, unique (a,b)) type=bdb;
+create table t1 (a int(11) not null, b int(11) not null, unique (a,b)) engine=bdb;
insert into t1 values (1,1), (1,2);
select * from t1 where a = 1;
select t1.*, t2.* from t1, t1 t2 where t1.a = t2.a and t2.a = 1;
@@ -739,9 +732,9 @@ drop table t1;
# This caused a deadlock in BDB internal locks
#
-create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=bdb;
+create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=bdb;
insert into t1 values (0,0,0,'ABCDEFGHIJ');
-create table t2 (id int NOT NULL,primary key (id)) type=bdb;
+create table t2 (id int NOT NULL,primary key (id)) engine=bdb;
LOCK TABLES t1 WRITE, t2 WRITE;
insert into t2 values(1);
SELECT t1.* FROM t1 WHERE id IN (1);
@@ -753,7 +746,7 @@ drop table t1,t2;
# Test problems with NULL
#
-CREATE TABLE t1 (i varchar(48) NOT NULL default '', p varchar(255) default NULL,s varchar(48) NOT NULL default '', PRIMARY KEY (i), UNIQUE(p,s)) TYPE=BDB;
+CREATE TABLE t1 (i varchar(48) NOT NULL default '', p varchar(255) default NULL,s varchar(48) NOT NULL default '', PRIMARY KEY (i), UNIQUE(p,s)) ENGINE=BDB;
INSERT INTO t1 VALUES ('00000000-e6c4ddeaa6-003b8-83458387','programs/xxxxxxxx.wmv','00000000-e6c4ddeb32-003bc-83458387');
SELECT * FROM t1 WHERE p='programs/xxxxxxxx.wmv';
drop table t1;
@@ -762,7 +755,7 @@ drop table t1;
# Test problem which gave error 'Can't find record in 't1''
#
-CREATE TABLE t1 ( STR_DATE varchar(8) NOT NULL default '',INFO_NOTE varchar(200) default NULL,PRIMARY KEY (STR_DATE) ) TYPE=BerkeleyDB;
+CREATE TABLE t1 ( STR_DATE varchar(8) NOT NULL default '',INFO_NOTE varchar(200) default NULL,PRIMARY KEY (STR_DATE) ) ENGINE=BerkeleyDB;
select INFO_NOTE from t1 where STR_DATE = '20010610';
select INFO_NOTE from t1 where STR_DATE < '20010610';
select INFO_NOTE from t1 where STR_DATE > '20010610';
@@ -772,8 +765,8 @@ drop table t1;
# Test problem with multi table delete which quickly shows up with bdb tables.
#
-create table t1 (a int not null, b int, primary key (a)) type =bdb;
-create table t2 (a int not null, b int, primary key (a)) type =bdb;
+create table t1 (a int not null, b int, primary key (a)) engine =bdb;
+create table t2 (a int not null, b int, primary key (a)) engine =bdb;
insert into t1 values (2, 3),(1, 7),(10, 7);
insert into t2 values (2, 3),(1, 7),(10, 7);
select * from t1;
@@ -788,7 +781,7 @@ drop table t1,t2;
# The bug #971
#
-create table t1 (x int not null, index(x)) type=bdb;
+create table t1 (x int not null, index(x)) engine=bdb;
insert into t1 values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
select * from t1 where x <= 10 and x >= 7;
select * from t1 where x <= 10 and x >= 7 order by x;
@@ -801,7 +794,7 @@ drop table t1;
# Test of multi-table-updates (bug #1980).
#
-create table t1 ( c char(8) not null ) type=bdb;
+create table t1 ( c char(8) not null ) engine=bdb;
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
@@ -810,7 +803,7 @@ alter table t1 add a char(8) not null;
alter table t1 add primary key (a,b,c);
update t1 set a=c, b=c;
-create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) type=bdb;
+create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=bdb;
insert into t2 select * from t1;
delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
@@ -848,7 +841,6 @@ select substring(pk1, 1, 4), substring(pk1, 4001),
from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
drop table t1;
-
#
# bug#2688 - Wrong index_merge query results for BDB table with variable length primary key
#
@@ -866,3 +858,74 @@ insert into t1 values ('','empt',2,2), ('a','a--a',2,2),
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
drop table t1;
+
+#
+# Bug #4000: problem with active cursor.
+#
+
+set autocommit=0;
+create table t1(b varchar(30)) engine=bdb;
+insert into t1 values ('one');
+commit;
+select b FROM t1 outer_table where
+exists (select 'two' from t1 where 'two' = outer_table.b);
+drop table t1;
+set autocommit=1;
+
+#
+# Bug #4089: subselect and open cursor.
+#
+
+create table t1(a int primary key, b varchar(30)) engine=bdb;
+insert into t1 values (1,'one'), (2,'two'), (3,'three'), (4,'four');
+create table t2 like t1;
+insert t2 select * from t1;
+select a from t1 where a in (select a from t2);
+delete from t2;
+insert into t2 (a, b)
+ select a, b from t1 where (a, b) in (select a, b from t1);
+select * from t2;
+drop table t1, t2;
+
+#
+# Bug #4304: TRUNCATE <table of type BDB> , wrong result
+#
+
+create table t1 (a int, b varchar(30), primary key(a)) engine = bdb;
+insert into t1 values (1,'one');
+commit;
+truncate t1;
+select * from t1;
+drop table t1;
+
+#
+# Check that BDB works fine with a string which is
+# longer than 255 bytes for multibyte characters.
+#
+SET NAMES utf8;
+create table t1 (a varchar(255) character set utf8) engine=bdb;
+set @a:= convert(repeat(_latin1 0xFF, 255) using utf8);
+insert into t1 values (@a);
+select a, length(a), char_length(a) from t1;
+drop table t1;
+SET NAMES latin1;
+
+#
+# Bug #5832 SELECT doesn't return records in some cases
+#
+CREATE TABLE t1 (
+ id int unsigned NOT NULL auto_increment,
+ list_id smallint unsigned NOT NULL,
+ term TEXT NOT NULL,
+ PRIMARY KEY(id),
+ INDEX(list_id, term(4))
+) ENGINE=BDB CHARSET=utf8;
+INSERT INTO t1 SET list_id = 1, term = "letterc";
+INSERT INTO t1 SET list_id = 1, term = "letterb";
+INSERT INTO t1 SET list_id = 1, term = "lettera";
+INSERT INTO t1 SET list_id = 1, term = "letterd";
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterc");
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterb");
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "lettera");
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd");
+DROP TABLE t1;
diff --git a/mysql-test/t/bdb_cache.test b/mysql-test/t/bdb_cache.test
index aa5572886c5..0082c83faff 100644
--- a/mysql-test/t/bdb_cache.test
+++ b/mysql-test/t/bdb_cache.test
@@ -4,10 +4,12 @@
#
# Without auto_commit.
#
+--disable_warnings
drop table if exists t1, t2, t3;
+--enable_warnings
flush status;
set autocommit=0;
-create table t1 (a int not null) type=bdb;
+create table t1 (a int not null) engine=bdb;
insert into t1 values (1),(2),(3);
select * from t1;
show status like "Qcache_queries_in_cache";
@@ -15,15 +17,15 @@ drop table t1;
commit;
set autocommit=1;
begin;
-create table t1 (a int not null) type=bdb;
+create table t1 (a int not null) engine=bdb;
insert into t1 values (1),(2),(3);
select * from t1;
show status like "Qcache_queries_in_cache";
drop table t1;
commit;
-create table t1 (a int not null) type=bdb;
-create table t2 (a int not null) type=bdb;
-create table t3 (a int not null) type=bdb;
+create table t1 (a int not null) engine=bdb;
+create table t2 (a int not null) engine=bdb;
+create table t3 (a int not null) engine=bdb;
insert into t1 values (1),(2);
insert into t2 values (1),(2);
insert into t3 values (1),(2);
@@ -47,4 +49,5 @@ select * from t3;
show status like "Qcache_queries_in_cache";
show status like "Qcache_hits";
commit;
-show status like "Qcache_queries_in_cache"; \ No newline at end of file
+show status like "Qcache_queries_in_cache";
+drop table if exists t1, t2, t3;
diff --git a/mysql-test/t/bench_count_distinct.test b/mysql-test/t/bench_count_distinct.test
index 9059428bea4..3ffb95a69c2 100644
--- a/mysql-test/t/bench_count_distinct.test
+++ b/mysql-test/t/bench_count_distinct.test
@@ -1,4 +1,10 @@
+#
+# Test of count(distinct ..)
+#
+
+--disable_warnings
drop table if exists t1;
+--enable_warnings
create table t1(n int not null, key(n)) delay_key_write = 1;
let $1=100;
disable_query_log;
@@ -10,4 +16,5 @@ while ($1)
}
enable_query_log;
select count(distinct n) from t1;
+explain extended select count(distinct n) from t1;
drop table t1;
diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test
index 353e9fd44b1..c509a4113f4 100644
--- a/mysql-test/t/bigint.test
+++ b/mysql-test/t/bigint.test
@@ -1,4 +1,11 @@
#
+# Initialize
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
# Test of reading of bigint values
#
select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296;
@@ -6,13 +13,14 @@ select 9223372036854775807,-009223372036854775808;
select +9999999999999999999,-9999999999999999999;
select cast(9223372036854775808 as unsigned)+1;
select 9223372036854775808+1;
+select -(0-3),round(-(0-3)), round(9999999999999999999);
+
#
# In 3.23 we have to disable the test of column to bigint as
# this fails on AIX powerpc (the resolution for double is not good enough)
# This will work on 4.0 as we then have internal handling of bigint variables.
#
-drop table if exists t1;
create table t1 (a bigint unsigned not null, primary key(a));
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
select * from t1;
@@ -61,5 +69,5 @@ select * from t1;
drop table t1;
# atof() behaviour is different of different systems. to be fixed in 4.1
-#SELECT '0x8000000000000001'+0;
+SELECT '0x8000000000000001'+0;
diff --git a/mysql-test/t/binary.test b/mysql-test/t/binary.test
index a8c724bf33b..54ad8e92237 100644
--- a/mysql-test/t/binary.test
+++ b/mysql-test/t/binary.test
@@ -1,8 +1,10 @@
#
# test sort,min and max on binary fields
#
-
+--disable_warnings
drop table if exists t1,t2;
+--enable_warnings
+
create table t1 (name char(20) not null, primary key (name));
create table t2 (name char(20) binary not null, primary key (name));
insert into t1 values ("å");
@@ -28,16 +30,17 @@ drop table t1,t2;
create table t1 (a char(10) not null, b char(10) binary not null,key (a), key(b));
insert into t1 values ("hello ","hello "),("hello2 ","hello2 ");
-select * from t1 where a="hello";
-select * from t1 where a="hello ";
-select * from t1 ignore index (a) where a="hello ";
-select * from t1 where b="hello";
-select * from t1 where b="hello ";
-select * from t1 ignore index (b) where b="hello ";
+select concat("-",a,"-",b,"-") from t1 where a="hello";
+select concat("-",a,"-",b,"-") from t1 where a="hello ";
+select concat("-",a,"-",b,"-") from t1 ignore index (a) where a="hello ";
+select concat("-",a,"-",b,"-") from t1 where b="hello";
+select concat("-",a,"-",b,"-") from t1 where b="hello ";
+select concat("-",a,"-",b,"-") from t1 ignore index (b) where b="hello ";
# blob test
alter table t1 modify b tinytext not null, drop key b, add key (b(100));
-select * from t1 where b="hello ";
-select * from t1 ignore index (b) where b="hello ";
+select concat("-",a,"-",b,"-") from t1;
+select concat("-",a,"-",b,"-") from t1 where b="hello ";
+select concat("-",a,"-",b,"-") from t1 ignore index (b) where b="hello ";
drop table t1;
#
@@ -51,6 +54,21 @@ select b from t1 having binary b like '';
drop table t1;
#
+# Test of binary and upper/lower
+#
+create table t1 (a char(15) binary, b binary(15));
+insert into t1 values ('aaa','bbb'),('AAA','BBB');
+select upper(a),upper(b) from t1;
+select lower(a),lower(b) from t1;
+select * from t1 where upper(a)='AAA';
+select * from t1 where lower(a)='aaa';
+select * from t1 where upper(b)='BBB';
+select * from t1 where lower(b)='bbb';
+select charset(a), charset(b), charset(binary 'ccc') from t1 limit 1;
+select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1;
+drop table t1;
+
+#
# Bug5134: WHERE x = 'bar' AND x LIKE BINARY 'bar' returns wrong results
#
@@ -62,3 +80,10 @@ select * from t1 where firstname='john' and firstname = binary 'john';
select * from t1 where firstname='John' and firstname like binary 'john';
select * from t1 where firstname='john' and firstname like binary 'John';
drop table t1;
+
+#
+# Bug #6552 CHAR column w/o length is legal, BINARY w/o length is not
+#
+create table t1 (a binary);
+show create table t1;
+drop table t1;
diff --git a/mysql-test/t/bool.test b/mysql-test/t/bool.test
index 10f97fefb73..b263ecfded2 100644
--- a/mysql-test/t/bool.test
+++ b/mysql-test/t/bool.test
@@ -2,7 +2,9 @@
# Test of boolean operations with NULL
#
+--disable_warnings
DROP TABLE IF EXISTS t1;
+--enable_warnings
SELECT IF(NULL AND 1, 1, 2), IF(1 AND NULL, 1, 2);
SELECT NULL AND 1, 1 AND NULL, 0 AND NULL, NULL and 0;
@@ -24,7 +26,6 @@ SELECT * FROM t1 WHERE NULL AND (@a:=@a+1);
SELECT * FROM t1 WHERE NOT(a>=0 AND NULL AND (@b:=@b+1));
SELECT * FROM t1 WHERE a=2 OR (NULL AND (@a:=@a+1));
SELECT * FROM t1 WHERE NOT(a=2 OR (NULL AND (@b:=@b+1)));
-SELECT @a, @b;
DROP TABLE t1;
@@ -33,19 +34,17 @@ DROP TABLE t1;
# Read nA as !A, AB as A && B, AoB as A || B
# Result table makes ANSI happy
-drop table if exists t;
-create table t(a int, b int);
-insert into t values(null, null), (0, null), (1, null), (null, 0), (null, 1), (0, 0), (0, 1), (1, 0), (1, 1);
+create table t1 (a int, b int);
+insert into t1 values(null, null), (0, null), (1, null), (null, 0), (null, 1), (0, 0), (0, 1), (1, 0), (1, 1);
# Below test is valid untill we have True/False implemented as 1/0
# To comply to all rules it must show that: n(AB) = nAonB, n(AoB) = nAnB
-select ifnull(A, 'N') as A, ifnull(B, 'N') as B, ifnull(not A, 'N') as nA, ifnull(not B, 'N') as nB, ifnull(A and B, 'N') as AB, ifnull(not (A and B), 'N') as `n(AB)`, ifnull((not A or not B), 'N') as nAonB, ifnull(A or B, 'N') as AoB, ifnull(not(A or B), 'N') as `n(AoB)`, ifnull(not A and not B, 'N') as nAnB from t;
+select ifnull(A, 'N') as A, ifnull(B, 'N') as B, ifnull(not A, 'N') as nA, ifnull(not B, 'N') as nB, ifnull(A and B, 'N') as AB, ifnull(not (A and B), 'N') as `n(AB)`, ifnull((not A or not B), 'N') as nAonB, ifnull(A or B, 'N') as AoB, ifnull(not(A or B), 'N') as `n(AoB)`, ifnull(not A and not B, 'N') as nAnB from t1;
# This should work with any internal representation of True/False
# Result must be same as above
-select ifnull(A=1, 'N') as A, ifnull(B=1, 'N') as B, ifnull(not (A=1), 'N') as nA, ifnull(not (B=1), 'N') as nB, ifnull((A=1) and (B=1), 'N') as AB, ifnull(not ((A=1) and (B=1)), 'N') as `n(AB)`, ifnull((not (A=1) or not (B=1)), 'N') as nAonB, ifnull((A=1) or (B=1), 'N') as AoB, ifnull(not((A=1) or (B=1)), 'N') as `n(AoB)`, ifnull(not (A=1) and not (B=1), 'N') as nAnB from t;
+select ifnull(A=1, 'N') as A, ifnull(B=1, 'N') as B, ifnull(not (A=1), 'N') as nA, ifnull(not (B=1), 'N') as nB, ifnull((A=1) and (B=1), 'N') as AB, ifnull(not ((A=1) and (B=1)), 'N') as `n(AB)`, ifnull((not (A=1) or not (B=1)), 'N') as nAonB, ifnull((A=1) or (B=1), 'N') as AoB, ifnull(not((A=1) or (B=1)), 'N') as `n(AoB)`, ifnull(not (A=1) and not (B=1), 'N') as nAnB from t1;
-
-drop table t;
+drop table t1;
diff --git a/mysql-test/t/bulk_replace.test b/mysql-test/t/bulk_replace.test
index d366004c16f..755d34083f8 100644
--- a/mysql-test/t/bulk_replace.test
+++ b/mysql-test/t/bulk_replace.test
@@ -1,11 +1,10 @@
#
# this is a test of bulk-insert code
-# as used by REPLACE
-#
-# by Monty
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
CREATE TABLE t1 (a int, unique (a), b int not null, unique(b), c int not null, index(c));
replace into t1 values (1,1,1),(2,2,2),(3,1,3);
select * from t1;
diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test
index 3ba3a292c77..87e456baba7 100644
--- a/mysql-test/t/case.test
+++ b/mysql-test/t/case.test
@@ -2,7 +2,9 @@
# Testing of CASE
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
select CASE "b" when "a" then 1 when "b" then 2 END;
select CASE "c" when "a" then 1 when "b" then 2 END;
@@ -12,6 +14,7 @@ select CASE "b" when "a" then 1 when binary "B" then 2 WHEN "b" then "ok" END;
select CASE concat("a","b") when concat("ab","") then "a" when "b" then "b" end;
select CASE when 1=0 then "true" else "false" END;
select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END;
+explain extended select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END;
select CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END;
select (CASE "two" when "one" then "1" WHEN "two" then "2" END) | 0;
select (CASE "two" when "one" then 1.00 WHEN "two" then 2.00 END) +0.0;
@@ -28,6 +31,7 @@ select case when 1<0 then "TRUE" else "FALSE" END;
create table t1 (a int);
insert into t1 values(1),(2),(3),(4);
select case a when 1 then 2 when 2 then 3 else 0 end as fcase, count(*) from t1 group by fcase;
+explain extended select case a when 1 then 2 when 2 then 3 else 0 end as fcase, count(*) from t1 group by fcase;
select case a when 1 then "one" when 2 then "two" else "nothing" end as fcase, count(*) from t1 group by fcase;
drop table t1;
@@ -39,3 +43,67 @@ create table t1 (row int not null, col int not null, val varchar(255) not null);
insert into t1 values (1,1,'orange'),(1,2,'large'),(2,1,'yellow'),(2,2,'medium'),(3,1,'green'),(3,2,'small');
select max(case col when 1 then val else null end) as color from t1 group by row;
drop table t1;
+
+SET NAMES latin1;
+
+#
+# CASE and argument types/collations aggregation into result
+#
+CREATE TABLE t1 SELECT
+ CASE WHEN 1 THEN _latin1'a' COLLATE latin1_danish_ci ELSE _latin1'a' END AS c1,
+ CASE WHEN 1 THEN _latin1'a' ELSE _latin1'a' COLLATE latin1_danish_ci END AS c2,
+ CASE WHEN 1 THEN 'a' ELSE 1 END AS c3,
+ CASE WHEN 1 THEN 1 ELSE 'a' END AS c4,
+ CASE WHEN 1 THEN 'a' ELSE 1.0 END AS c5,
+ CASE WHEN 1 THEN 1.0 ELSE 'a' END AS c6,
+ CASE WHEN 1 THEN 1 ELSE 1.0 END AS c7,
+ CASE WHEN 1 THEN 1.0 ELSE 1 END AS c8,
+ CASE WHEN 1 THEN 1.0 END AS c9
+;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+--error 1267
+SELECT CASE
+ WHEN 1
+ THEN _latin1'a' COLLATE latin1_danish_ci
+ ELSE _latin1'a' COLLATE latin1_swedish_ci
+ END;
+
+--error 1270
+SELECT CASE _latin1'a' COLLATE latin1_general_ci
+ WHEN _latin1'a' COLLATE latin1_danish_ci THEN 1
+ WHEN _latin1'a' COLLATE latin1_swedish_ci THEN 2
+ END;
+
+SELECT
+CASE _latin1'a' COLLATE latin1_general_ci WHEN _latin1'A' THEN '1' ELSE 2 END,
+CASE _latin1'a' COLLATE latin1_bin WHEN _latin1'A' THEN '1' ELSE 2 END,
+CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_swedish_ci THEN '1' ELSE 2 END,
+CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_bin THEN '1' ELSE 2 END
+;
+
+#
+# COALESCE is a CASE abbrevation:
+#
+# COALESCE(v1,v2) == CASE WHEN v1 IS NOT NULL THEN v1 ELSE v2 END
+#
+# COALESCE(V1, V2, . . . ,Vn ) =
+# CASE WHEN V1 IS NOT NULL THEN V1 ELSE COALESCE (V2, . . . ,Vn) END
+#
+# Check COALESCE argument types aggregation
+
+--error 1267
+CREATE TABLE t1 SELECT COALESCE(_latin1'a',_latin2'a');
+--error 1267
+CREATE TABLE t1 SELECT COALESCE('a' COLLATE latin1_swedish_ci,'b' COLLATE latin1_bin);
+CREATE TABLE t1 SELECT
+ COALESCE(1), COALESCE(1.0),COALESCE('a'),
+ COALESCE(1,1.0), COALESCE(1,'1'),COALESCE(1.1,'1'),
+ COALESCE('a' COLLATE latin1_bin,'b');
+explain extended SELECT
+ COALESCE(1), COALESCE(1.0),COALESCE('a'),
+ COALESCE(1,1.0), COALESCE(1,'1'),COALESCE(1.1,'1'),
+ COALESCE('a' COLLATE latin1_bin,'b');
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test
index 7a120ef5005..e5681dedbac 100644
--- a/mysql-test/t/cast.test
+++ b/mysql-test/t/cast.test
@@ -8,10 +8,83 @@ select CONVERT('-1',UNSIGNED);
select cast(-5 as unsigned) | 1, cast(-5 as unsigned) & -1;
select cast(-5 as unsigned) -1, cast(-5 as unsigned) + 1;
select ~5, cast(~5 as signed);
+explain extended select ~5, cast(~5 as signed);
select cast(5 as unsigned) -6.0;
+select cast(NULL as signed), cast(1/0 as signed);
+select cast(NULL as unsigned), cast(1/0 as unsigned);
select cast("A" as binary) = "a", cast(BINARY "a" as CHAR) = "A";
select cast("2001-1-1" as DATE), cast("2001-1-1" as DATETIME);
select cast("1:2:3" as TIME);
+select CONVERT("2004-01-22 21:45:33",DATE);
+select CONVERT(DATE "2004-01-22 21:45:33" USING latin1);
+select CONVERT(DATE "2004-01-22 21:45:33",CHAR);
+select CONVERT(DATE "2004-01-22 21:45:33",CHAR(4));
+select CONVERT(DATE "2004-01-22 21:45:33",BINARY(4));
+select CAST(DATE "2004-01-22 21:45:33" AS BINARY(4));
+
+#
+# Character set convertion
+#
+set names binary;
+select cast(_latin1'test' as char character set latin2);
+select cast(_koi8r'ÔÅÓÔ' as char character set cp1251);
+create table t1 select cast(_koi8r'ÔÅÓÔ' as char character set cp1251) as t;
+show create table t1;
+drop table t1;
+
+#
+# CAST to CHAR with/without length
+#
+select
+ cast(_latin1'ab' AS char) as c1,
+ cast(_latin1'a ' AS char) as c2,
+ cast(_latin1'abc' AS char(2)) as c3,
+ cast(_latin1'a ' AS char(2)) as c4,
+ cast(_latin1'a' AS char(2)) as c5;
+
+create table t1 select
+ cast(_latin1'ab' AS char) as c1,
+ cast(_latin1'a ' AS char) as c2,
+ cast(_latin1'abc' AS char(2)) as c3,
+ cast(_latin1'a ' AS char(2)) as c4,
+ cast(_latin1'a' AS char(2)) as c5;
+select * from t1;
+show create table t1;
+drop table t1;
+
+#
+# CAST to NCHAR with/without length
+#
+select
+ cast(_koi8r'ÆÇ' AS nchar) as c1,
+ cast(_koi8r'Æ ' AS nchar) as c2,
+ cast(_koi8r'ÆÇÈ' AS nchar(2)) as c3,
+ cast(_koi8r'Æ ' AS nchar(2)) as c4,
+ cast(_koi8r'Æ' AS nchar(2)) as c5;
+
+create table t1 select
+ cast(_koi8r'ÆÇ' AS nchar) as c1,
+ cast(_koi8r'Æ ' AS nchar) as c2,
+ cast(_koi8r'ÆÇÈ' AS nchar(2)) as c3,
+ cast(_koi8r'Æ ' AS nchar(2)) as c4,
+ cast(_koi8r'Æ' AS nchar(2)) as c5;
+select * from t1;
+show create table t1;
+drop table t1;
+
+#
+# Bug 2202
+# CAST from BINARY to non-BINARY and from non-BINARY to BINARY
+#
+create table t1 (a binary(10), b char(10) character set koi8r);
+insert into t1 values (_binary'ÔÅÓÔ',_binary'ÔÅÓÔ');
+select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
+set names koi8r;
+select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
+set names cp1251;
+select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
+drop table t1;
+set names binary;
#
# The following should be fixed in 4.1
@@ -20,3 +93,18 @@ select cast("1:2:3" as TIME);
select cast("2001-1-1" as date) = "2001-01-01";
select cast("2001-1-1" as datetime) = "2001-01-01 00:00:00";
select cast("1:2:3" as TIME) = "1:02:03";
+select cast(NULL as DATE);
+select cast(NULL as BINARY);
+
+#
+# Bug #5228 ORDER BY CAST(enumcol) sorts incorrectly under certain conditions
+#
+CREATE TABLE t1 (a enum ('aac','aab','aaa') not null);
+INSERT INTO t1 VALUES ('aaa'),('aab'),('aac');
+# these two should be in enum order
+SELECT a, CAST(a AS CHAR) FROM t1 ORDER BY CAST(a AS UNSIGNED) ;
+SELECT a, CAST(a AS CHAR(3)) FROM t1 ORDER BY CAST(a AS CHAR(2)), a;
+# these two should be in alphabetic order
+SELECT a, CAST(a AS UNSIGNED) FROM t1 ORDER BY CAST(a AS CHAR) ;
+SELECT a, CAST(a AS CHAR(2)) FROM t1 ORDER BY CAST(a AS CHAR(3)), a;
+DROP TABLE t1;
diff --git a/mysql-test/t/check.test b/mysql-test/t/check.test
index 947566e725b..bc61aea2d66 100644
--- a/mysql-test/t/check.test
+++ b/mysql-test/t/check.test
@@ -1,8 +1,11 @@
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
+--disable_warnings
drop table if exists t1;
-#add a lot of keys to slow down check
+--enable_warnings
+
+# Add a lot of keys to slow down check
create table t1(n int not null, key(n), key(n), key(n), key(n));
let $1=10000;
disable_query_log;
diff --git a/mysql-test/t/client_test.test b/mysql-test/t/client_test.test
new file mode 100644
index 00000000000..66f5e69eb36
--- /dev/null
+++ b/mysql-test/t/client_test.test
@@ -0,0 +1,2 @@
+--disable_result_log
+--exec $TESTS_BINDIR/client_test --no-defaults --testcase --user=root --socket=$MASTER_MYSOCK --port=$MYSQL_TCP_PORT --silent
diff --git a/mysql-test/t/comments.test b/mysql-test/t/comments.test
index 2fc6237907c..087df60f3f5 100644
--- a/mysql-test/t/comments.test
+++ b/mysql-test/t/comments.test
@@ -5,7 +5,8 @@
select 1+2/*hello*/+3;
select 1 /* long
multi line comment */;
-!$1065 ;
+--error 1065
+ ;
select 1 /*!32301 +1 */;
select 1 /*!52301 +1 */;
select 1--1;
diff --git a/mysql-test/t/compare.test b/mysql-test/t/compare.test
index 450d9c0961c..b0cef48dd3f 100644
--- a/mysql-test/t/compare.test
+++ b/mysql-test/t/compare.test
@@ -2,7 +2,10 @@
# Bug when using comparions of strings and integers.
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+
CREATE TABLE t1 (id CHAR(12) not null, PRIMARY KEY (id));
insert into t1 values ('000000000001'),('000000000002');
explain select * from t1 where id=000000000001;
@@ -10,3 +13,20 @@ select * from t1 where id=000000000001;
delete from t1 where id=000000000002;
select * from t1;
drop table t1;
+
+#
+# Check the following:
+# "a" == "a "
+# "a\0" < "a"
+# "a\0" < "a "
+
+SELECT 'a' = 'a ';
+SELECT 'a\0' < 'a';
+SELECT 'a\0' < 'a ';
+SELECT 'a\t' < 'a';
+SELECT 'a\t' < 'a ';
+
+CREATE TABLE t1 (a char(10) not null);
+INSERT INTO t1 VALUES ('a'),('a\0'),('a\t'),('a ');
+SELECT hex(a),STRCMP(a,'a'), STRCMP(a,'a ') FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/t/connect.test b/mysql-test/t/connect.test
new file mode 100644
index 00000000000..4598ca5ea15
--- /dev/null
+++ b/mysql-test/t/connect.test
@@ -0,0 +1,75 @@
+# This test is to check various cases of connections
+# with right and wrong password, with and without database
+# Unfortunately the check is incomplete as we can't handle errors on connect
+# Also we can't connect without database
+
+#connect (con1,localhost,root,,"");
+#show tables;
+connect (con1,localhost,root,,mysql);
+show tables;
+connect (con1,localhost,root,,test);
+show tables;
+
+# Re enable this one day if error handling on connect will take place
+
+#connect (con1,localhost,root,z,test2);
+#--error 1045
+#connect (con1,localhost,root,z,);
+#--error 1045
+
+grant ALL on *.* to test@localhost identified by "gambling";
+grant ALL on *.* to test@127.0.0.1 identified by "gambling";
+
+# Now check this user with different databases
+
+#connect (con1,localhost,test,gambling,"");
+#show tables;
+connect (con1,localhost,test,gambling,mysql);
+show tables;
+connect (con1,localhost,test,gambling,test);
+show tables;
+
+# Re enable this one day if error handling on connect will take place
+
+#connect (con1,localhost,test,,test2);
+#--error 1045
+#connect (con1,localhost,test,,"");
+#--error 1045
+#connect (con1,localhost,test,zorro,test2);
+#--error 1045
+#connect (con1,localhost,test,zorro,);
+#--error 1045
+
+
+# check if old password version also works
+update mysql.user set password=old_password("gambling2") where user=_binary"test";
+flush privileges;
+
+#connect (con1,localhost,test,gambling2,"");
+#show tables;
+connect (con1,localhost,test,gambling2,mysql);
+set password="";
+--error 1105
+set password='gambling3';
+set password=old_password('gambling3');
+show tables;
+connect (con1,localhost,test,gambling3,test);
+show tables;
+
+# Re enable this one day if error handling on connect will take place
+
+#connect (con1,localhost,test,,test2);
+#--error 1045
+#connect (con1,localhost,test,,);
+#--error 1045
+#connect (con1,localhost,test,zorro,test2);
+#--error 1045
+#connect (con1,localhost,test,zorro,);
+#--error 1045
+
+
+# remove user 'test' so that other tests which may use 'test'
+# do not depend on this test.
+
+delete from mysql.user where user=_binary"test";
+flush privileges;
diff --git a/mysql-test/t/consistent_snapshot.test b/mysql-test/t/consistent_snapshot.test
new file mode 100644
index 00000000000..7afdae36325
--- /dev/null
+++ b/mysql-test/t/consistent_snapshot.test
@@ -0,0 +1,41 @@
+-- source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+
+### Test 1:
+### - While a consistent snapshot transaction is executed,
+### no external inserts should be visible to the transaction.
+
+connection con1;
+create table t1 (a int) engine=innodb;
+start transaction with consistent snapshot;
+
+connection con2;
+insert into t1 values(1);
+
+connection con1;
+select * from t1; # if consistent snapshot was set as expected, we
+# should see nothing.
+commit;
+
+### Test 2:
+### - For any non-consistent snapshot transaction, external
+### committed inserts should be visible to the transaction.
+
+delete from t1;
+start transaction; # Now we omit WITH CONSISTENT SNAPSHOT
+
+connection con2;
+insert into t1 values(1);
+
+connection con1;
+select * from t1; # if consistent snapshot was not set, as expected, we
+# should see 1.
+commit;
+
+drop table t1;
diff --git a/mysql-test/t/constraints.test b/mysql-test/t/constraints.test
index 8682cdc42a2..dbc34a0dff1 100644
--- a/mysql-test/t/constraints.test
+++ b/mysql-test/t/constraints.test
@@ -2,7 +2,9 @@
# Testing of constraints
# Currently MySQL only ignores the syntax.
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
create table t1 (a int check (a>0));
insert into t1 values (1);
@@ -19,3 +21,9 @@ drop table t1;
create table t1 (a int null);
insert into t1 values (1),(NULL);
drop table t1;
+create table t1 (a int null);
+alter table t1 add constraint constraint_1 unique (a);
+alter table t1 add constraint unique key_1(a);
+alter table t1 add constraint constraint_2 unique key_2(a);
+show create table t1;
+drop table t1;
diff --git a/mysql-test/t/convert.test b/mysql-test/t/convert.test
deleted file mode 100644
index f26ef3a8c72..00000000000
--- a/mysql-test/t/convert.test
+++ /dev/null
@@ -1,11 +0,0 @@
-# Test of character set conversions
-
-# Test that SET DEFAULT works
-
-select @@convert_character_set;
-select @@global.convert_character_set;
-show variables like "%convert_character_set%";
-SET CHARACTER SET cp1251_koi8;
-select @@convert_character_set;
-SET CHARACTER SET DEFAULT;
-select @@convert_character_set;
diff --git a/mysql-test/t/count_distinct.test b/mysql-test/t/count_distinct.test
index cb84d0211d7..1f0404876cb 100644
--- a/mysql-test/t/count_distinct.test
+++ b/mysql-test/t/count_distinct.test
@@ -2,7 +2,10 @@
# Problem with count(distinct)
#
+--disable_warnings
drop table if exists t1,t2,t3;
+--enable_warnings
+
create table t1 (libname varchar(21) not null, city text, primary key (libname));
create table t2 (isbn varchar(21) not null, author text, title text, primary key (isbn));
create table t3 (isbn varchar(21) not null, libname varchar(21) not null, quantity int ,primary key (isbn,libname));
diff --git a/mysql-test/t/count_distinct2.test b/mysql-test/t/count_distinct2.test
index d1bea7614c8..9100f622dec 100644
--- a/mysql-test/t/count_distinct2.test
+++ b/mysql-test/t/count_distinct2.test
@@ -1,4 +1,6 @@
+--disable_warnings
drop table if exists t1;
+--enable_warnings
create table t1(n1 int, n2 int, s char(20), vs varchar(20), t text);
insert into t1 values (1,11, 'one','eleven', 'eleven'),
diff --git a/mysql-test/t/count_distinct3.test b/mysql-test/t/count_distinct3.test
new file mode 100644
index 00000000000..9d2bb0d139a
--- /dev/null
+++ b/mysql-test/t/count_distinct3.test
@@ -0,0 +1,58 @@
+#
+# this is a test for error 1032 in count(distinct) + group by, introduced in
+# mysql-4.1
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+CREATE TABLE t1 (id INTEGER, grp TINYINT, id_rev INTEGER);
+
+--disable_query_log
+SET @rnd_max= 2147483647;
+let $1 = 1000;
+while ($1)
+{
+ SET @rnd= RAND();
+ SET @id = CAST(@rnd * @rnd_max AS UNSIGNED);
+ SET @id_rev= @rnd_max - @id;
+ SET @grp= CAST(128.0 * @rnd AS UNSIGNED);
+ INSERT INTO t1 (id, grp, id_rev) VALUES (@id, @grp, @id_rev);
+ dec $1;
+}
+set @@read_buffer_size=2*1024*1024;
+CREATE TABLE t2 SELECT * FROM t1;
+INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
+INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
+INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
+INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
+INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
+INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
+INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
+INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
+INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
+INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
+INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
+INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
+INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
+INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
+INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
+INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
+INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
+INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
+DROP TABLE t2;
+--enable_query_log
+
+SELECT COUNT(*) FROM t1;
+
+# As t1 contains random numbers, results are different from test to test.
+# That's okay, because we test only that select doesn't yield an
+# error. Note, that --disable_result_log doesn't suppress error output.
+
+--disable_result_log
+SELECT COUNT(DISTINCT id) FROM t1 GROUP BY grp;
+--enable_result_log
+DROP TABLE t1;
+
+set @@read_buffer_size=default;
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index c71a1e0c177..6f222eedec1 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -2,7 +2,11 @@
# Check some special create statements.
#
-drop table if exists t1,t2;
+--disable_warnings
+drop table if exists t1,t2,t3;
+drop database if exists mysqltest;
+--enable_warnings
+
create table t1 (b char(0));
insert into t1 values (""),(null);
select * from t1;
@@ -12,27 +16,28 @@ create table t1 (b char(0) not null);
create table if not exists t1 (b char(0) not null);
insert into t1 values (""),(null);
select * from t1;
-drop table if exists t1;
+drop table t1;
+
+create table t1 (a int not null auto_increment,primary key (a)) engine=heap;
+drop table t1;
#
# Test of some CREATE TABLE'S that should fail
#
--error 1146
-create table t2 type=heap select * from t1;
+create table t2 engine=heap select * from t1;
--error 1146
create table t2 select auto+1 from t1;
drop table if exists t1,t2;
--error 1167
create table t1 (b char(0) not null, index(b));
---error 1164
-create table t1 (a int not null auto_increment,primary key (a)) type=heap;
--error 1163
-create table t1 (a int not null,b text) type=heap;
+create table t1 (a int not null,b text) engine=heap;
drop table if exists t1;
---error 1164
-create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=heap;
+--error 1075
+create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) engine=heap;
-- error 1044,1
create table not_existing_database.test (a int);
@@ -44,6 +49,16 @@ create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
create table a (`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` int);
#
+# Some wrong defaults, so these creates should fail too
+#
+--error 1067
+create table test (a datetime default now());
+--error 1294
+create table test (a datetime on update now());
+--error 1067
+create table test (a int default 100 auto_increment);
+
+#
# test of dummy table names
#
@@ -53,14 +68,15 @@ select 1ea10.1a20,1e+ 1e+10 from 1ea10;
drop table 1ea10;
create table t1 (t1.index int);
drop table t1;
-drop database if exists test_$1;
-create database test_$1;
-create table test_$1.$test1 (a$1 int, $b int, c$ int);
-insert into test_$1.$test1 values (1,2,3);
-select a$1, $b, c$ from test_$1.$test1;
-create table test_$1.test2$ (a int);
-drop table test_$1.test2$;
-drop database test_$1;
+# Test that we get warning for this
+drop database if exists mysqltest;
+create database mysqltest;
+create table mysqltest.$test1 (a$1 int, $b int, c$ int);
+insert into mysqltest.$test1 values (1,2,3);
+select a$1, $b, c$ from mysqltest.$test1;
+create table mysqltest.test2$ (a int);
+drop table mysqltest.test2$;
+drop database mysqltest;
--error 1103
create table `` (a int);
@@ -68,7 +84,8 @@ create table `` (a int);
drop table if exists ``;
--error 1166
create table t1 (`` int);
-drop table if exists t1;
+--error 1280
+create table t1 (i int, index `` (i));
#
# Test of CREATE ... SELECT with indexes
@@ -98,6 +115,38 @@ describe t2;
drop table t1,t2;
#
+# Test of CREATE ... SELECT with duplicate fields
+#
+
+create table t1 (a tinyint);
+create table t2 (a int) select * from t1;
+describe t1;
+describe t2;
+drop table if exists t2;
+--error 1060
+create table t2 (a int, a float) select * from t1;
+drop table if exists t2;
+--error 1060
+create table t2 (a int) select a as b, a+1 as b from t1;
+drop table if exists t2;
+--error 1060
+create table t2 (b int) select a as b, a+1 as b from t1;
+drop table if exists t1,t2;
+
+#
+# Test CREATE ... SELECT when insert fails
+#
+
+CREATE TABLE t1 (a int not null);
+INSERT INTO t1 values (1),(2),(1);
+--error 1062
+CREATE TABLE t2 (primary key(a)) SELECT * FROM t1;
+--error 1146
+SELECT * from t2;
+DROP TABLE t1;
+DROP TABLE IF EXISTS t2;
+
+#
# Test of primary key with 32 index
#
@@ -113,17 +162,17 @@ drop table if exists t1;
#
# Test default table type
#
-SET SESSION table_type="heap";
-SELECT @@table_type;
+SET SESSION storage_engine="heap";
+SELECT @@storage_engine;
CREATE TABLE t1 (a int not null);
show create table t1;
drop table t1;
-# Test what happens when using a non existing table type
-SET SESSION table_type="gemini";
-SELECT @@table_type;
+--error 1286
+SET SESSION storage_engine="gemini";
+SELECT @@storage_engine;
CREATE TABLE t1 (a int not null);
show create table t1;
-SET SESSION table_type=default;
+SET SESSION storage_engine=default;
drop table t1;
@@ -141,7 +190,7 @@ insert into t1 values (NULL, NULL);
drop table t1;
#
-# Bug #801
+# Bug # 801
#
create table t1 select x'4132';
@@ -203,3 +252,200 @@ create table t1 (a int,);
create table t1 (a int,,b int);
--error 1064
create table t1 (,b int);
+
+#
+# Test create with foreign keys
+#
+
+create table t1 (a int, key(a));
+create table t2 (b int, foreign key(b) references t1(a), key(b));
+drop table if exists t1,t2;
+
+#
+# Test for CREATE TABLE .. LIKE ..
+#
+
+create table t1(id int not null, name char(20));
+insert into t1 values(10,'mysql'),(20,'monty- the creator');
+create table t2(id int not null);
+insert into t2 values(10),(20);
+create table t3 like t1;
+show create table t3;
+select * from t3;
+# Disable PS becasue of @@warning_count
+--disable_ps_protocol
+create table if not exists t3 like t1;
+select @@warning_count;
+--enable_ps_protocol
+create temporary table t3 like t2;
+show create table t3;
+select * from t3;
+drop table t3;
+show create table t3;
+select * from t3;
+drop table t2, t3;
+create database mysqltest;
+create table mysqltest.t3 like t1;
+create temporary table t3 like mysqltest.t3;
+show create table t3;
+create table t2 like t3;
+show create table t2;
+select * from t2;
+create table t3 like t1;
+--error 1050
+create table t3 like mysqltest.t3;
+--error 1044,1
+create table non_existing_database.t1 like t1;
+--error 1051
+create table t3 like non_existing_table;
+--error 1050
+create temporary table t3 like t1;
+--error 1103
+create table t3 like `a/a`;
+drop table t1, t2, t3;
+drop table t3;
+drop database mysqltest;
+
+#
+# Test default table type
+#
+SET SESSION storage_engine="heap";
+SELECT @@storage_engine;
+CREATE TABLE t1 (a int not null);
+show create table t1;
+drop table t1;
+--error 1286
+SET SESSION storage_engine="gemini";
+SELECT @@storage_engine;
+CREATE TABLE t1 (a int not null);
+show create table t1;
+SET SESSION storage_engine=default;
+drop table t1;
+
+#
+# Test types of data for create select with functions
+#
+
+create table t1(a int,b int,c int unsigned,d date,e char,f datetime,g time,h blob);
+insert into t1(a)values(1);
+insert into t1(a,b,c,d,e,f,g,h)
+values(2,-2,2,'1825-12-14','a','2003-1-1 3:2:1','4:3:2','binary data');
+select * from t1;
+select a,
+ ifnull(b,cast(-7 as signed)) as b,
+ ifnull(c,cast(7 as unsigned)) as c,
+ ifnull(d,cast('2000-01-01' as date)) as d,
+ ifnull(e,cast('b' as char)) as e,
+ ifnull(f,cast('2000-01-01' as datetime)) as f,
+ ifnull(g,cast('5:4:3' as time)) as g,
+ ifnull(h,cast('yet another binary data' as binary)) as h,
+ addtime(cast('1:0:0' as time),cast('1:0:0' as time)) as dd
+from t1;
+
+create table t2
+select
+ a,
+ ifnull(b,cast(-7 as signed)) as b,
+ ifnull(c,cast(7 as unsigned)) as c,
+ ifnull(d,cast('2000-01-01' as date)) as d,
+ ifnull(e,cast('b' as char)) as e,
+ ifnull(f,cast('2000-01-01' as datetime)) as f,
+ ifnull(g,cast('5:4:3' as time)) as g,
+ ifnull(h,cast('yet another binary data' as binary)) as h,
+ addtime(cast('1:0:0' as time),cast('1:0:0' as time)) as dd
+from t1;
+explain t2;
+select * from t2;
+drop table t1, t2;
+
+create table t1 (a tinyint, b smallint, c mediumint, d int, e bigint, f float(3,2), g double(4,3), h decimal(5,4), i year, j date, k timestamp, l datetime, m enum('a','b'), n set('a','b'), o char(10));
+create table t2 select ifnull(a,a), ifnull(b,b), ifnull(c,c), ifnull(d,d), ifnull(e,e), ifnull(f,f), ifnull(g,g), ifnull(h,h), ifnull(i,i), ifnull(j,j), ifnull(k,k), ifnull(l,l), ifnull(m,m), ifnull(n,n), ifnull(o,o) from t1;
+show create table t2;
+drop table t1,t2;
+
+#
+# Test of default()
+#
+create table t1(str varchar(10) default 'def',strnull varchar(10),intg int default '10',rel double default '3.14');
+insert into t1 values ('','',0,0.0);
+describe t1;
+create table t2 select default(str) as str, default(strnull) as strnull, default(intg) as intg, default(rel) as rel from t1;
+describe t2;
+drop table t1, t2;
+
+#
+# Bug #2075
+#
+
+create table t1(name varchar(10), age smallint default -1);
+describe t1;
+create table t2(name varchar(10), age smallint default - 1);
+describe t2;
+drop table t1, t2;
+
+#
+# test for bug #1427 "enum allows duplicate values in the list"
+#
+
+create table t1(cenum enum('a'), cset set('b'));
+create table t2(cenum enum('a','a'), cset set('b','b'));
+create table t3(cenum enum('a','A','a','c','c'), cset set('b','B','b','d','d'));
+drop table t1, t2, t3;
+
+#
+# Bug #1209
+#
+
+create database mysqltest;
+use mysqltest;
+select database();
+drop database mysqltest;
+select database();
+
+# Connect without a database
+connect (user4,localhost,mysqltest_1,,*NO-ONE*);
+select database();
+
+#
+# Test for Bug 856 'Naming a key "Primary" causes trouble'
+#
+
+use test;
+--error 1280
+create table t1 (a int, index `primary` (a));
+--error 1280
+create table t1 (a int, index `PRIMARY` (a));
+
+create table t1 (`primary` int, index(`primary`));
+show create table t1;
+create table t2 (`PRIMARY` int, index(`PRIMARY`));
+show create table t2;
+
+create table t3 (a int);
+--error 1280
+alter table t3 add index `primary` (a);
+--error 1280
+alter table t3 add index `PRIMARY` (a);
+
+create table t4 (`primary` int);
+alter table t4 add index(`primary`);
+show create table t4;
+create table t5 (`PRIMARY` int);
+alter table t5 add index(`PRIMARY`);
+show create table t5;
+
+drop table t1, t2, t3, t4, t5;
+
+#
+# bug #3266 TEXT in CREATE TABLE SELECT
+#
+
+CREATE TABLE t1(id varchar(10) NOT NULL PRIMARY KEY, dsc longtext);
+INSERT INTO t1 VALUES ('5000000001', NULL),('5000000003', 'Test'),('5000000004', NULL);
+CREATE TABLE t2(id varchar(15) NOT NULL, proc varchar(100) NOT NULL, runID varchar(16) NOT NULL, start datetime NOT NULL, PRIMARY KEY (id,proc,runID,start));
+
+INSERT INTO t2 VALUES ('5000000001', 'proc01', '20031029090650', '2003-10-29 13:38:40'),('5000000001', 'proc02', '20031029090650', '2003-10-29 13:38:51'),('5000000001', 'proc03', '20031029090650', '2003-10-29 13:38:11'),('5000000002', 'proc09', '20031024013310', '2003-10-24 01:33:11'),('5000000002', 'proc09', '20031024153537', '2003-10-24 15:36:04'),('5000000004', 'proc01', '20031024013641', '2003-10-24 01:37:29'),('5000000004', 'proc02', '20031024013641', '2003-10-24 01:37:39');
+
+CREATE TABLE t3 SELECT t1.dsc,COUNT(DISTINCT t2.id) AS countOfRuns FROM t1 LEFT JOIN t2 ON (t1.id=t2.id) GROUP BY t1.id;
+SELECT * FROM t3;
+drop table t1, t2, t3;
diff --git a/mysql-test/t/create_select_tmp.test b/mysql-test/t/create_select_tmp.test
index 36292abd899..d81a3799d98 100644
--- a/mysql-test/t/create_select_tmp.test
+++ b/mysql-test/t/create_select_tmp.test
@@ -6,22 +6,24 @@
# inconsistency between binlog and the internal list of temp tables.
-- source include/have_innodb.inc
+--disable_warnings
drop table if exists t1, t2;
+--enable_warnings
CREATE TABLE t1 ( a int );
INSERT INTO t1 VALUES (1),(2),(1);
--error 1062;
-CREATE TABLE t2 ( PRIMARY KEY (a) ) TYPE=INNODB SELECT a FROM t1;
+CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
--error 1146;
select * from t2;
--error 1062;
-CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) TYPE=INNODB SELECT a FROM t1;
+CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
--error 1146;
select * from t2;
--error 1062;
-CREATE TABLE t2 ( PRIMARY KEY (a) ) TYPE=MYISAM SELECT a FROM t1;
+CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
--error 1146;
select * from t2;
--error 1062;
-CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) TYPE=MYISAM SELECT a FROM t1;
+CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
--error 1146;
select * from t2;
diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test
new file mode 100644
index 00000000000..591fab3961a
--- /dev/null
+++ b/mysql-test/t/csv.test
@@ -0,0 +1,1315 @@
+#
+# Test for the CSV engine
+#
+
+-- source include/have_csv.inc
+
+#
+# Simple select test
+#
+
+--disable_warnings
+drop table if exists t1,t2,t3,t4;
+--enable_warnings
+
+CREATE TABLE t1 (
+ Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
+ Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
+) ENGINE = CSV;
+
+INSERT INTO t1 VALUES (9410,9412);
+
+select period from t1;
+select * from t1;
+select t1.* from t1;
+
+#
+# Create test table
+#
+
+CREATE TABLE t2 (
+ auto int not null,
+ fld1 int(6) unsigned zerofill DEFAULT '000000' NOT NULL,
+ companynr tinyint(2) unsigned zerofill DEFAULT '00' NOT NULL,
+ fld3 char(30) DEFAULT '' NOT NULL,
+ fld4 char(35) DEFAULT '' NOT NULL,
+ fld5 char(35) DEFAULT '' NOT NULL,
+ fld6 char(4) DEFAULT '' NOT NULL
+) ENGINE = CSV;
+
+#
+# Populate table
+#
+
+--disable_query_log
+INSERT INTO t2 VALUES (1,000001,00,'Omaha','teethe','neat','');
+INSERT INTO t2 VALUES (2,011401,37,'breaking','dreaded','Steinberg','W');
+INSERT INTO t2 VALUES (3,011402,37,'Romans','scholastics','jarring','');
+INSERT INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily','');
+INSERT INTO t2 VALUES (5,011501,37,'bewilderingly','wallet','balled','');
+INSERT INTO t2 VALUES (6,011701,37,'astound','parters','persist','W');
+INSERT INTO t2 VALUES (7,011702,37,'admonishing','eschew','attainments','');
+INSERT INTO t2 VALUES (8,011703,37,'sumac','quitter','fanatic','');
+INSERT INTO t2 VALUES (9,012001,37,'flanking','neat','measures','FAS');
+INSERT INTO t2 VALUES (10,012003,37,'combed','Steinberg','rightfulness','');
+INSERT INTO t2 VALUES (11,012004,37,'subjective','jarring','capably','');
+INSERT INTO t2 VALUES (12,012005,37,'scatterbrain','tinily','impulsive','');
+INSERT INTO t2 VALUES (13,012301,37,'Eulerian','balled','starlet','');
+INSERT INTO t2 VALUES (14,012302,36,'dubbed','persist','terminators','');
+INSERT INTO t2 VALUES (15,012303,37,'Kane','attainments','untying','');
+INSERT INTO t2 VALUES (16,012304,37,'overlay','fanatic','announces','FAS');
+INSERT INTO t2 VALUES (17,012305,37,'perturb','measures','featherweight','FAS');
+INSERT INTO t2 VALUES (18,012306,37,'goblins','rightfulness','pessimist','FAS');
+INSERT INTO t2 VALUES (19,012501,37,'annihilates','capably','daughter','');
+INSERT INTO t2 VALUES (20,012602,37,'Wotan','impulsive','decliner','FAS');
+INSERT INTO t2 VALUES (21,012603,37,'snatching','starlet','lawgiver','');
+INSERT INTO t2 VALUES (22,012604,37,'concludes','terminators','stated','');
+INSERT INTO t2 VALUES (23,012605,37,'laterally','untying','readable','');
+INSERT INTO t2 VALUES (24,012606,37,'yelped','announces','attrition','');
+INSERT INTO t2 VALUES (25,012701,37,'grazing','featherweight','cascade','FAS');
+INSERT INTO t2 VALUES (26,012702,37,'Baird','pessimist','motors','FAS');
+INSERT INTO t2 VALUES (27,012703,37,'celery','daughter','interrogate','');
+INSERT INTO t2 VALUES (28,012704,37,'misunderstander','decliner','pests','W');
+INSERT INTO t2 VALUES (29,013601,37,'handgun','lawgiver','stairway','');
+INSERT INTO t2 VALUES (30,013602,37,'foldout','stated','dopers','FAS');
+INSERT INTO t2 VALUES (31,013603,37,'mystic','readable','testicle','W');
+INSERT INTO t2 VALUES (32,013604,37,'succumbed','attrition','Parsifal','W');
+INSERT INTO t2 VALUES (33,013605,37,'Nabisco','cascade','leavings','');
+INSERT INTO t2 VALUES (34,013606,37,'fingerings','motors','postulation','W');
+INSERT INTO t2 VALUES (35,013607,37,'aging','interrogate','squeaking','');
+INSERT INTO t2 VALUES (36,013608,37,'afield','pests','contrasted','');
+INSERT INTO t2 VALUES (37,013609,37,'ammonium','stairway','leftover','');
+INSERT INTO t2 VALUES (38,013610,37,'boat','dopers','whiteners','');
+INSERT INTO t2 VALUES (39,013801,37,'intelligibility','testicle','erases','W');
+INSERT INTO t2 VALUES (40,013802,37,'Augustine','Parsifal','Punjab','W');
+INSERT INTO t2 VALUES (41,013803,37,'teethe','leavings','Merritt','');
+INSERT INTO t2 VALUES (42,013804,37,'dreaded','postulation','Quixotism','');
+INSERT INTO t2 VALUES (43,013901,37,'scholastics','squeaking','sweetish','FAS');
+INSERT INTO t2 VALUES (44,016001,37,'audiology','contrasted','dogging','FAS');
+INSERT INTO t2 VALUES (45,016201,37,'wallet','leftover','scornfully','FAS');
+INSERT INTO t2 VALUES (46,016202,37,'parters','whiteners','bellow','');
+INSERT INTO t2 VALUES (47,016301,37,'eschew','erases','bills','');
+INSERT INTO t2 VALUES (48,016302,37,'quitter','Punjab','cupboard','FAS');
+INSERT INTO t2 VALUES (49,016303,37,'neat','Merritt','sureties','FAS');
+INSERT INTO t2 VALUES (50,016304,37,'Steinberg','Quixotism','puddings','');
+INSERT INTO t2 VALUES (51,018001,37,'jarring','sweetish','tapestry','');
+INSERT INTO t2 VALUES (52,018002,37,'tinily','dogging','fetters','');
+INSERT INTO t2 VALUES (53,018003,37,'balled','scornfully','bivalves','');
+INSERT INTO t2 VALUES (54,018004,37,'persist','bellow','incurring','');
+INSERT INTO t2 VALUES (55,018005,37,'attainments','bills','Adolph','');
+INSERT INTO t2 VALUES (56,018007,37,'fanatic','cupboard','pithed','');
+INSERT INTO t2 VALUES (57,018008,37,'measures','sureties','emergency','');
+INSERT INTO t2 VALUES (58,018009,37,'rightfulness','puddings','Miles','');
+INSERT INTO t2 VALUES (59,018010,37,'capably','tapestry','trimmings','');
+INSERT INTO t2 VALUES (60,018012,37,'impulsive','fetters','tragedies','W');
+INSERT INTO t2 VALUES (61,018013,37,'starlet','bivalves','skulking','W');
+INSERT INTO t2 VALUES (62,018014,37,'terminators','incurring','flint','');
+INSERT INTO t2 VALUES (63,018015,37,'untying','Adolph','flopping','W');
+INSERT INTO t2 VALUES (64,018016,37,'announces','pithed','relaxing','FAS');
+INSERT INTO t2 VALUES (65,018017,37,'featherweight','emergency','offload','FAS');
+INSERT INTO t2 VALUES (66,018018,37,'pessimist','Miles','suites','W');
+INSERT INTO t2 VALUES (67,018019,37,'daughter','trimmings','lists','FAS');
+INSERT INTO t2 VALUES (68,018020,37,'decliner','tragedies','animized','FAS');
+INSERT INTO t2 VALUES (69,018021,37,'lawgiver','skulking','multilayer','W');
+INSERT INTO t2 VALUES (70,018022,37,'stated','flint','standardizes','FAS');
+INSERT INTO t2 VALUES (71,018023,37,'readable','flopping','Judas','');
+INSERT INTO t2 VALUES (72,018024,37,'attrition','relaxing','vacuuming','W');
+INSERT INTO t2 VALUES (73,018025,37,'cascade','offload','dentally','W');
+INSERT INTO t2 VALUES (74,018026,37,'motors','suites','humanness','W');
+INSERT INTO t2 VALUES (75,018027,37,'interrogate','lists','inch','W');
+INSERT INTO t2 VALUES (76,018028,37,'pests','animized','Weissmuller','W');
+INSERT INTO t2 VALUES (77,018029,37,'stairway','multilayer','irresponsibly','W');
+INSERT INTO t2 VALUES (78,018030,37,'dopers','standardizes','luckily','FAS');
+INSERT INTO t2 VALUES (79,018032,37,'testicle','Judas','culled','W');
+INSERT INTO t2 VALUES (80,018033,37,'Parsifal','vacuuming','medical','FAS');
+INSERT INTO t2 VALUES (81,018034,37,'leavings','dentally','bloodbath','FAS');
+INSERT INTO t2 VALUES (82,018035,37,'postulation','humanness','subschema','W');
+INSERT INTO t2 VALUES (83,018036,37,'squeaking','inch','animals','W');
+INSERT INTO t2 VALUES (84,018037,37,'contrasted','Weissmuller','Micronesia','');
+INSERT INTO t2 VALUES (85,018038,37,'leftover','irresponsibly','repetitions','');
+INSERT INTO t2 VALUES (86,018039,37,'whiteners','luckily','Antares','');
+INSERT INTO t2 VALUES (87,018040,37,'erases','culled','ventilate','W');
+INSERT INTO t2 VALUES (88,018041,37,'Punjab','medical','pityingly','');
+INSERT INTO t2 VALUES (89,018042,37,'Merritt','bloodbath','interdependent','');
+INSERT INTO t2 VALUES (90,018043,37,'Quixotism','subschema','Graves','FAS');
+INSERT INTO t2 VALUES (91,018044,37,'sweetish','animals','neonatal','');
+INSERT INTO t2 VALUES (92,018045,37,'dogging','Micronesia','scribbled','FAS');
+INSERT INTO t2 VALUES (93,018046,37,'scornfully','repetitions','chafe','W');
+INSERT INTO t2 VALUES (94,018048,37,'bellow','Antares','honoring','');
+INSERT INTO t2 VALUES (95,018049,37,'bills','ventilate','realtor','');
+INSERT INTO t2 VALUES (96,018050,37,'cupboard','pityingly','elite','');
+INSERT INTO t2 VALUES (97,018051,37,'sureties','interdependent','funereal','');
+INSERT INTO t2 VALUES (98,018052,37,'puddings','Graves','abrogating','');
+INSERT INTO t2 VALUES (99,018053,50,'tapestry','neonatal','sorters','');
+INSERT INTO t2 VALUES (100,018054,37,'fetters','scribbled','Conley','');
+INSERT INTO t2 VALUES (101,018055,37,'bivalves','chafe','lectured','');
+INSERT INTO t2 VALUES (102,018056,37,'incurring','honoring','Abraham','');
+INSERT INTO t2 VALUES (103,018057,37,'Adolph','realtor','Hawaii','W');
+INSERT INTO t2 VALUES (104,018058,37,'pithed','elite','cage','');
+INSERT INTO t2 VALUES (105,018059,36,'emergency','funereal','hushes','');
+INSERT INTO t2 VALUES (106,018060,37,'Miles','abrogating','Simla','');
+INSERT INTO t2 VALUES (107,018061,37,'trimmings','sorters','reporters','');
+INSERT INTO t2 VALUES (108,018101,37,'tragedies','Conley','Dutchman','FAS');
+INSERT INTO t2 VALUES (109,018102,37,'skulking','lectured','descendants','FAS');
+INSERT INTO t2 VALUES (110,018103,37,'flint','Abraham','groupings','FAS');
+INSERT INTO t2 VALUES (111,018104,37,'flopping','Hawaii','dissociate','');
+INSERT INTO t2 VALUES (112,018201,37,'relaxing','cage','coexist','W');
+INSERT INTO t2 VALUES (113,018202,37,'offload','hushes','Beebe','');
+INSERT INTO t2 VALUES (114,018402,37,'suites','Simla','Taoism','');
+INSERT INTO t2 VALUES (115,018403,37,'lists','reporters','Connally','');
+INSERT INTO t2 VALUES (116,018404,37,'animized','Dutchman','fetched','FAS');
+INSERT INTO t2 VALUES (117,018405,37,'multilayer','descendants','checkpoints','FAS');
+INSERT INTO t2 VALUES (118,018406,37,'standardizes','groupings','rusting','');
+INSERT INTO t2 VALUES (119,018409,37,'Judas','dissociate','galling','');
+INSERT INTO t2 VALUES (120,018601,37,'vacuuming','coexist','obliterates','');
+INSERT INTO t2 VALUES (121,018602,37,'dentally','Beebe','traitor','');
+INSERT INTO t2 VALUES (122,018603,37,'humanness','Taoism','resumes','FAS');
+INSERT INTO t2 VALUES (123,018801,37,'inch','Connally','analyzable','FAS');
+INSERT INTO t2 VALUES (124,018802,37,'Weissmuller','fetched','terminator','FAS');
+INSERT INTO t2 VALUES (125,018803,37,'irresponsibly','checkpoints','gritty','FAS');
+INSERT INTO t2 VALUES (126,018804,37,'luckily','rusting','firearm','W');
+INSERT INTO t2 VALUES (127,018805,37,'culled','galling','minima','');
+INSERT INTO t2 VALUES (128,018806,37,'medical','obliterates','Selfridge','');
+INSERT INTO t2 VALUES (129,018807,37,'bloodbath','traitor','disable','');
+INSERT INTO t2 VALUES (130,018808,37,'subschema','resumes','witchcraft','W');
+INSERT INTO t2 VALUES (131,018809,37,'animals','analyzable','betroth','W');
+INSERT INTO t2 VALUES (132,018810,37,'Micronesia','terminator','Manhattanize','');
+INSERT INTO t2 VALUES (133,018811,37,'repetitions','gritty','imprint','');
+INSERT INTO t2 VALUES (134,018812,37,'Antares','firearm','peeked','');
+INSERT INTO t2 VALUES (135,019101,37,'ventilate','minima','swelling','');
+INSERT INTO t2 VALUES (136,019102,37,'pityingly','Selfridge','interrelationships','W');
+INSERT INTO t2 VALUES (137,019103,37,'interdependent','disable','riser','');
+INSERT INTO t2 VALUES (138,019201,37,'Graves','witchcraft','Gandhian','W');
+INSERT INTO t2 VALUES (139,030501,37,'neonatal','betroth','peacock','A');
+INSERT INTO t2 VALUES (140,030502,50,'scribbled','Manhattanize','bee','A');
+INSERT INTO t2 VALUES (141,030503,37,'chafe','imprint','kanji','');
+INSERT INTO t2 VALUES (142,030504,37,'honoring','peeked','dental','');
+INSERT INTO t2 VALUES (143,031901,37,'realtor','swelling','scarf','FAS');
+INSERT INTO t2 VALUES (144,036001,37,'elite','interrelationships','chasm','A');
+INSERT INTO t2 VALUES (145,036002,37,'funereal','riser','insolence','A');
+INSERT INTO t2 VALUES (146,036004,37,'abrogating','Gandhian','syndicate','');
+INSERT INTO t2 VALUES (147,036005,37,'sorters','peacock','alike','');
+INSERT INTO t2 VALUES (148,038001,37,'Conley','bee','imperial','A');
+INSERT INTO t2 VALUES (149,038002,37,'lectured','kanji','convulsion','A');
+INSERT INTO t2 VALUES (150,038003,37,'Abraham','dental','railway','A');
+INSERT INTO t2 VALUES (151,038004,37,'Hawaii','scarf','validate','A');
+INSERT INTO t2 VALUES (152,038005,37,'cage','chasm','normalizes','A');
+INSERT INTO t2 VALUES (153,038006,37,'hushes','insolence','comprehensive','');
+INSERT INTO t2 VALUES (154,038007,37,'Simla','syndicate','chewing','');
+INSERT INTO t2 VALUES (155,038008,37,'reporters','alike','denizen','');
+INSERT INTO t2 VALUES (156,038009,37,'Dutchman','imperial','schemer','');
+INSERT INTO t2 VALUES (157,038010,37,'descendants','convulsion','chronicle','');
+INSERT INTO t2 VALUES (158,038011,37,'groupings','railway','Kline','');
+INSERT INTO t2 VALUES (159,038012,37,'dissociate','validate','Anatole','');
+INSERT INTO t2 VALUES (160,038013,37,'coexist','normalizes','partridges','');
+INSERT INTO t2 VALUES (161,038014,37,'Beebe','comprehensive','brunch','');
+INSERT INTO t2 VALUES (162,038015,37,'Taoism','chewing','recruited','');
+INSERT INTO t2 VALUES (163,038016,37,'Connally','denizen','dimensions','W');
+INSERT INTO t2 VALUES (164,038017,37,'fetched','schemer','Chicana','W');
+INSERT INTO t2 VALUES (165,038018,37,'checkpoints','chronicle','announced','');
+INSERT INTO t2 VALUES (166,038101,37,'rusting','Kline','praised','FAS');
+INSERT INTO t2 VALUES (167,038102,37,'galling','Anatole','employing','');
+INSERT INTO t2 VALUES (168,038103,37,'obliterates','partridges','linear','');
+INSERT INTO t2 VALUES (169,038104,37,'traitor','brunch','quagmire','');
+INSERT INTO t2 VALUES (170,038201,37,'resumes','recruited','western','A');
+INSERT INTO t2 VALUES (171,038202,37,'analyzable','dimensions','relishing','');
+INSERT INTO t2 VALUES (172,038203,37,'terminator','Chicana','serving','A');
+INSERT INTO t2 VALUES (173,038204,37,'gritty','announced','scheduling','');
+INSERT INTO t2 VALUES (174,038205,37,'firearm','praised','lore','');
+INSERT INTO t2 VALUES (175,038206,37,'minima','employing','eventful','');
+INSERT INTO t2 VALUES (176,038208,37,'Selfridge','linear','arteriole','A');
+INSERT INTO t2 VALUES (177,042801,37,'disable','quagmire','disentangle','');
+INSERT INTO t2 VALUES (178,042802,37,'witchcraft','western','cured','A');
+INSERT INTO t2 VALUES (179,046101,37,'betroth','relishing','Fenton','W');
+INSERT INTO t2 VALUES (180,048001,37,'Manhattanize','serving','avoidable','A');
+INSERT INTO t2 VALUES (181,048002,37,'imprint','scheduling','drains','A');
+INSERT INTO t2 VALUES (182,048003,37,'peeked','lore','detectably','FAS');
+INSERT INTO t2 VALUES (183,048004,37,'swelling','eventful','husky','');
+INSERT INTO t2 VALUES (184,048005,37,'interrelationships','arteriole','impelling','');
+INSERT INTO t2 VALUES (185,048006,37,'riser','disentangle','undoes','');
+INSERT INTO t2 VALUES (186,048007,37,'Gandhian','cured','evened','');
+INSERT INTO t2 VALUES (187,048008,37,'peacock','Fenton','squeezes','');
+INSERT INTO t2 VALUES (188,048101,37,'bee','avoidable','destroyer','FAS');
+INSERT INTO t2 VALUES (189,048102,37,'kanji','drains','rudeness','');
+INSERT INTO t2 VALUES (190,048201,37,'dental','detectably','beaner','FAS');
+INSERT INTO t2 VALUES (191,048202,37,'scarf','husky','boorish','');
+INSERT INTO t2 VALUES (192,048203,37,'chasm','impelling','Everhart','');
+INSERT INTO t2 VALUES (193,048204,37,'insolence','undoes','encompass','A');
+INSERT INTO t2 VALUES (194,048205,37,'syndicate','evened','mushrooms','');
+INSERT INTO t2 VALUES (195,048301,37,'alike','squeezes','Alison','A');
+INSERT INTO t2 VALUES (196,048302,37,'imperial','destroyer','externally','FAS');
+INSERT INTO t2 VALUES (197,048303,37,'convulsion','rudeness','pellagra','');
+INSERT INTO t2 VALUES (198,048304,37,'railway','beaner','cult','');
+INSERT INTO t2 VALUES (199,048305,37,'validate','boorish','creek','A');
+INSERT INTO t2 VALUES (200,048401,37,'normalizes','Everhart','Huffman','');
+INSERT INTO t2 VALUES (201,048402,37,'comprehensive','encompass','Majorca','FAS');
+INSERT INTO t2 VALUES (202,048403,37,'chewing','mushrooms','governing','A');
+INSERT INTO t2 VALUES (203,048404,37,'denizen','Alison','gadfly','FAS');
+INSERT INTO t2 VALUES (204,048405,37,'schemer','externally','reassigned','FAS');
+INSERT INTO t2 VALUES (205,048406,37,'chronicle','pellagra','intentness','W');
+INSERT INTO t2 VALUES (206,048407,37,'Kline','cult','craziness','');
+INSERT INTO t2 VALUES (207,048408,37,'Anatole','creek','psychic','');
+INSERT INTO t2 VALUES (208,048409,37,'partridges','Huffman','squabbled','');
+INSERT INTO t2 VALUES (209,048410,37,'brunch','Majorca','burlesque','');
+INSERT INTO t2 VALUES (210,048411,37,'recruited','governing','capped','');
+INSERT INTO t2 VALUES (211,048412,37,'dimensions','gadfly','extracted','A');
+INSERT INTO t2 VALUES (212,048413,37,'Chicana','reassigned','DiMaggio','');
+INSERT INTO t2 VALUES (213,048601,37,'announced','intentness','exclamation','FAS');
+INSERT INTO t2 VALUES (214,048602,37,'praised','craziness','subdirectory','');
+INSERT INTO t2 VALUES (215,048603,37,'employing','psychic','fangs','');
+INSERT INTO t2 VALUES (216,048604,37,'linear','squabbled','buyer','A');
+INSERT INTO t2 VALUES (217,048801,37,'quagmire','burlesque','pithing','A');
+INSERT INTO t2 VALUES (218,050901,37,'western','capped','transistorizing','A');
+INSERT INTO t2 VALUES (219,051201,37,'relishing','extracted','nonbiodegradable','');
+INSERT INTO t2 VALUES (220,056002,37,'serving','DiMaggio','dislocate','');
+INSERT INTO t2 VALUES (221,056003,37,'scheduling','exclamation','monochromatic','FAS');
+INSERT INTO t2 VALUES (222,056004,37,'lore','subdirectory','batting','');
+INSERT INTO t2 VALUES (223,056102,37,'eventful','fangs','postcondition','A');
+INSERT INTO t2 VALUES (224,056203,37,'arteriole','buyer','catalog','FAS');
+INSERT INTO t2 VALUES (225,056204,37,'disentangle','pithing','Remus','');
+INSERT INTO t2 VALUES (226,058003,37,'cured','transistorizing','devices','A');
+INSERT INTO t2 VALUES (227,058004,37,'Fenton','nonbiodegradable','bike','A');
+INSERT INTO t2 VALUES (228,058005,37,'avoidable','dislocate','qualify','');
+INSERT INTO t2 VALUES (229,058006,37,'drains','monochromatic','detained','');
+INSERT INTO t2 VALUES (230,058007,37,'detectably','batting','commended','');
+INSERT INTO t2 VALUES (231,058101,37,'husky','postcondition','civilize','');
+INSERT INTO t2 VALUES (232,058102,37,'impelling','catalog','Elmhurst','');
+INSERT INTO t2 VALUES (233,058103,37,'undoes','Remus','anesthetizing','');
+INSERT INTO t2 VALUES (234,058105,37,'evened','devices','deaf','');
+INSERT INTO t2 VALUES (235,058111,37,'squeezes','bike','Brigham','');
+INSERT INTO t2 VALUES (236,058112,37,'destroyer','qualify','title','');
+INSERT INTO t2 VALUES (237,058113,37,'rudeness','detained','coarse','');
+INSERT INTO t2 VALUES (238,058114,37,'beaner','commended','combinations','');
+INSERT INTO t2 VALUES (239,058115,37,'boorish','civilize','grayness','');
+INSERT INTO t2 VALUES (240,058116,37,'Everhart','Elmhurst','innumerable','FAS');
+INSERT INTO t2 VALUES (241,058117,37,'encompass','anesthetizing','Caroline','A');
+INSERT INTO t2 VALUES (242,058118,37,'mushrooms','deaf','fatty','FAS');
+INSERT INTO t2 VALUES (243,058119,37,'Alison','Brigham','eastbound','');
+INSERT INTO t2 VALUES (244,058120,37,'externally','title','inexperienced','');
+INSERT INTO t2 VALUES (245,058121,37,'pellagra','coarse','hoarder','A');
+INSERT INTO t2 VALUES (246,058122,37,'cult','combinations','scotch','W');
+INSERT INTO t2 VALUES (247,058123,37,'creek','grayness','passport','A');
+INSERT INTO t2 VALUES (248,058124,37,'Huffman','innumerable','strategic','FAS');
+INSERT INTO t2 VALUES (249,058125,37,'Majorca','Caroline','gated','');
+INSERT INTO t2 VALUES (250,058126,37,'governing','fatty','flog','');
+INSERT INTO t2 VALUES (251,058127,37,'gadfly','eastbound','Pipestone','');
+INSERT INTO t2 VALUES (252,058128,37,'reassigned','inexperienced','Dar','');
+INSERT INTO t2 VALUES (253,058201,37,'intentness','hoarder','Corcoran','');
+INSERT INTO t2 VALUES (254,058202,37,'craziness','scotch','flyers','A');
+INSERT INTO t2 VALUES (255,058303,37,'psychic','passport','competitions','W');
+INSERT INTO t2 VALUES (256,058304,37,'squabbled','strategic','suppliers','FAS');
+INSERT INTO t2 VALUES (257,058602,37,'burlesque','gated','skips','');
+INSERT INTO t2 VALUES (258,058603,37,'capped','flog','institutes','');
+INSERT INTO t2 VALUES (259,058604,37,'extracted','Pipestone','troop','A');
+INSERT INTO t2 VALUES (260,058605,37,'DiMaggio','Dar','connective','W');
+INSERT INTO t2 VALUES (261,058606,37,'exclamation','Corcoran','denies','');
+INSERT INTO t2 VALUES (262,058607,37,'subdirectory','flyers','polka','');
+INSERT INTO t2 VALUES (263,060401,36,'fangs','competitions','observations','FAS');
+INSERT INTO t2 VALUES (264,061701,36,'buyer','suppliers','askers','');
+INSERT INTO t2 VALUES (265,066201,36,'pithing','skips','homeless','FAS');
+INSERT INTO t2 VALUES (266,066501,36,'transistorizing','institutes','Anna','');
+INSERT INTO t2 VALUES (267,068001,36,'nonbiodegradable','troop','subdirectories','W');
+INSERT INTO t2 VALUES (268,068002,36,'dislocate','connective','decaying','FAS');
+INSERT INTO t2 VALUES (269,068005,36,'monochromatic','denies','outwitting','W');
+INSERT INTO t2 VALUES (270,068006,36,'batting','polka','Harpy','W');
+INSERT INTO t2 VALUES (271,068007,36,'postcondition','observations','crazed','');
+INSERT INTO t2 VALUES (272,068008,36,'catalog','askers','suffocate','');
+INSERT INTO t2 VALUES (273,068009,36,'Remus','homeless','provers','FAS');
+INSERT INTO t2 VALUES (274,068010,36,'devices','Anna','technically','');
+INSERT INTO t2 VALUES (275,068011,36,'bike','subdirectories','Franklinizations','');
+INSERT INTO t2 VALUES (276,068202,36,'qualify','decaying','considered','');
+INSERT INTO t2 VALUES (277,068302,36,'detained','outwitting','tinnily','');
+INSERT INTO t2 VALUES (278,068303,36,'commended','Harpy','uninterruptedly','');
+INSERT INTO t2 VALUES (279,068401,36,'civilize','crazed','whistled','A');
+INSERT INTO t2 VALUES (280,068501,36,'Elmhurst','suffocate','automate','');
+INSERT INTO t2 VALUES (281,068502,36,'anesthetizing','provers','gutting','W');
+INSERT INTO t2 VALUES (282,068503,36,'deaf','technically','surreptitious','');
+INSERT INTO t2 VALUES (283,068602,36,'Brigham','Franklinizations','Choctaw','');
+INSERT INTO t2 VALUES (284,068603,36,'title','considered','cooks','');
+INSERT INTO t2 VALUES (285,068701,36,'coarse','tinnily','millivolt','FAS');
+INSERT INTO t2 VALUES (286,068702,36,'combinations','uninterruptedly','counterpoise','');
+INSERT INTO t2 VALUES (287,068703,36,'grayness','whistled','Gothicism','');
+INSERT INTO t2 VALUES (288,076001,36,'innumerable','automate','feminine','');
+INSERT INTO t2 VALUES (289,076002,36,'Caroline','gutting','metaphysically','W');
+INSERT INTO t2 VALUES (290,076101,36,'fatty','surreptitious','sanding','A');
+INSERT INTO t2 VALUES (291,076102,36,'eastbound','Choctaw','contributorily','');
+INSERT INTO t2 VALUES (292,076103,36,'inexperienced','cooks','receivers','FAS');
+INSERT INTO t2 VALUES (293,076302,36,'hoarder','millivolt','adjourn','');
+INSERT INTO t2 VALUES (294,076303,36,'scotch','counterpoise','straggled','A');
+INSERT INTO t2 VALUES (295,076304,36,'passport','Gothicism','druggists','');
+INSERT INTO t2 VALUES (296,076305,36,'strategic','feminine','thanking','FAS');
+INSERT INTO t2 VALUES (297,076306,36,'gated','metaphysically','ostrich','');
+INSERT INTO t2 VALUES (298,076307,36,'flog','sanding','hopelessness','FAS');
+INSERT INTO t2 VALUES (299,076402,36,'Pipestone','contributorily','Eurydice','');
+INSERT INTO t2 VALUES (300,076501,36,'Dar','receivers','excitation','W');
+INSERT INTO t2 VALUES (301,076502,36,'Corcoran','adjourn','presumes','FAS');
+INSERT INTO t2 VALUES (302,076701,36,'flyers','straggled','imaginable','FAS');
+INSERT INTO t2 VALUES (303,078001,36,'competitions','druggists','concoct','W');
+INSERT INTO t2 VALUES (304,078002,36,'suppliers','thanking','peering','W');
+INSERT INTO t2 VALUES (305,078003,36,'skips','ostrich','Phelps','FAS');
+INSERT INTO t2 VALUES (306,078004,36,'institutes','hopelessness','ferociousness','FAS');
+INSERT INTO t2 VALUES (307,078005,36,'troop','Eurydice','sentences','');
+INSERT INTO t2 VALUES (308,078006,36,'connective','excitation','unlocks','');
+INSERT INTO t2 VALUES (309,078007,36,'denies','presumes','engrossing','W');
+INSERT INTO t2 VALUES (310,078008,36,'polka','imaginable','Ruth','');
+INSERT INTO t2 VALUES (311,078101,36,'observations','concoct','tying','');
+INSERT INTO t2 VALUES (312,078103,36,'askers','peering','exclaimers','');
+INSERT INTO t2 VALUES (313,078104,36,'homeless','Phelps','synergy','');
+INSERT INTO t2 VALUES (314,078105,36,'Anna','ferociousness','Huey','W');
+INSERT INTO t2 VALUES (315,082101,36,'subdirectories','sentences','merging','');
+INSERT INTO t2 VALUES (316,083401,36,'decaying','unlocks','judges','A');
+INSERT INTO t2 VALUES (317,084001,36,'outwitting','engrossing','Shylock','W');
+INSERT INTO t2 VALUES (318,084002,36,'Harpy','Ruth','Miltonism','');
+INSERT INTO t2 VALUES (319,086001,36,'crazed','tying','hen','W');
+INSERT INTO t2 VALUES (320,086102,36,'suffocate','exclaimers','honeybee','FAS');
+INSERT INTO t2 VALUES (321,086201,36,'provers','synergy','towers','');
+INSERT INTO t2 VALUES (322,088001,36,'technically','Huey','dilutes','W');
+INSERT INTO t2 VALUES (323,088002,36,'Franklinizations','merging','numerals','FAS');
+INSERT INTO t2 VALUES (324,088003,36,'considered','judges','democracy','FAS');
+INSERT INTO t2 VALUES (325,088004,36,'tinnily','Shylock','Ibero-','');
+INSERT INTO t2 VALUES (326,088101,36,'uninterruptedly','Miltonism','invalids','');
+INSERT INTO t2 VALUES (327,088102,36,'whistled','hen','behavior','');
+INSERT INTO t2 VALUES (328,088103,36,'automate','honeybee','accruing','');
+INSERT INTO t2 VALUES (329,088104,36,'gutting','towers','relics','A');
+INSERT INTO t2 VALUES (330,088105,36,'surreptitious','dilutes','rackets','');
+INSERT INTO t2 VALUES (331,088106,36,'Choctaw','numerals','Fischbein','W');
+INSERT INTO t2 VALUES (332,088201,36,'cooks','democracy','phony','W');
+INSERT INTO t2 VALUES (333,088203,36,'millivolt','Ibero-','cross','FAS');
+INSERT INTO t2 VALUES (334,088204,36,'counterpoise','invalids','cleanup','');
+INSERT INTO t2 VALUES (335,088302,37,'Gothicism','behavior','conspirator','');
+INSERT INTO t2 VALUES (336,088303,37,'feminine','accruing','label','FAS');
+INSERT INTO t2 VALUES (337,088305,37,'metaphysically','relics','university','');
+INSERT INTO t2 VALUES (338,088402,37,'sanding','rackets','cleansed','FAS');
+INSERT INTO t2 VALUES (339,088501,36,'contributorily','Fischbein','ballgown','');
+INSERT INTO t2 VALUES (340,088502,36,'receivers','phony','starlet','');
+INSERT INTO t2 VALUES (341,088503,36,'adjourn','cross','aqueous','');
+INSERT INTO t2 VALUES (342,098001,58,'straggled','cleanup','portrayal','A');
+INSERT INTO t2 VALUES (343,098002,58,'druggists','conspirator','despising','W');
+INSERT INTO t2 VALUES (344,098003,58,'thanking','label','distort','W');
+INSERT INTO t2 VALUES (345,098004,58,'ostrich','university','palmed','');
+INSERT INTO t2 VALUES (346,098005,58,'hopelessness','cleansed','faced','');
+INSERT INTO t2 VALUES (347,098006,58,'Eurydice','ballgown','silverware','');
+INSERT INTO t2 VALUES (348,141903,29,'excitation','starlet','assessor','');
+INSERT INTO t2 VALUES (349,098008,58,'presumes','aqueous','spiders','');
+INSERT INTO t2 VALUES (350,098009,58,'imaginable','portrayal','artificially','');
+INSERT INTO t2 VALUES (351,098010,58,'concoct','despising','reminiscence','');
+INSERT INTO t2 VALUES (352,098011,58,'peering','distort','Mexican','');
+INSERT INTO t2 VALUES (353,098012,58,'Phelps','palmed','obnoxious','');
+INSERT INTO t2 VALUES (354,098013,58,'ferociousness','faced','fragile','');
+INSERT INTO t2 VALUES (355,098014,58,'sentences','silverware','apprehensible','');
+INSERT INTO t2 VALUES (356,098015,58,'unlocks','assessor','births','');
+INSERT INTO t2 VALUES (357,098016,58,'engrossing','spiders','garages','');
+INSERT INTO t2 VALUES (358,098017,58,'Ruth','artificially','panty','');
+INSERT INTO t2 VALUES (359,098018,58,'tying','reminiscence','anteater','');
+INSERT INTO t2 VALUES (360,098019,58,'exclaimers','Mexican','displacement','A');
+INSERT INTO t2 VALUES (361,098020,58,'synergy','obnoxious','drovers','A');
+INSERT INTO t2 VALUES (362,098021,58,'Huey','fragile','patenting','A');
+INSERT INTO t2 VALUES (363,098022,58,'merging','apprehensible','far','A');
+INSERT INTO t2 VALUES (364,098023,58,'judges','births','shrieks','');
+INSERT INTO t2 VALUES (365,098024,58,'Shylock','garages','aligning','W');
+INSERT INTO t2 VALUES (366,098025,37,'Miltonism','panty','pragmatism','');
+INSERT INTO t2 VALUES (367,106001,36,'hen','anteater','fevers','W');
+INSERT INTO t2 VALUES (368,108001,36,'honeybee','displacement','reexamines','A');
+INSERT INTO t2 VALUES (369,108002,36,'towers','drovers','occupancies','');
+INSERT INTO t2 VALUES (370,108003,36,'dilutes','patenting','sweats','FAS');
+INSERT INTO t2 VALUES (371,108004,36,'numerals','far','modulators','');
+INSERT INTO t2 VALUES (372,108005,36,'democracy','shrieks','demand','W');
+INSERT INTO t2 VALUES (373,108007,36,'Ibero-','aligning','Madeira','');
+INSERT INTO t2 VALUES (374,108008,36,'invalids','pragmatism','Viennese','W');
+INSERT INTO t2 VALUES (375,108009,36,'behavior','fevers','chillier','W');
+INSERT INTO t2 VALUES (376,108010,36,'accruing','reexamines','wildcats','FAS');
+INSERT INTO t2 VALUES (377,108011,36,'relics','occupancies','gentle','');
+INSERT INTO t2 VALUES (378,108012,36,'rackets','sweats','Angles','W');
+INSERT INTO t2 VALUES (379,108101,36,'Fischbein','modulators','accuracies','');
+INSERT INTO t2 VALUES (380,108102,36,'phony','demand','toggle','');
+INSERT INTO t2 VALUES (381,108103,36,'cross','Madeira','Mendelssohn','W');
+INSERT INTO t2 VALUES (382,108111,50,'cleanup','Viennese','behaviorally','');
+INSERT INTO t2 VALUES (383,108105,36,'conspirator','chillier','Rochford','');
+INSERT INTO t2 VALUES (384,108106,36,'label','wildcats','mirror','W');
+INSERT INTO t2 VALUES (385,108107,36,'university','gentle','Modula','');
+INSERT INTO t2 VALUES (386,108108,50,'cleansed','Angles','clobbering','');
+INSERT INTO t2 VALUES (387,108109,36,'ballgown','accuracies','chronography','');
+INSERT INTO t2 VALUES (388,108110,36,'starlet','toggle','Eskimoizeds','');
+INSERT INTO t2 VALUES (389,108201,36,'aqueous','Mendelssohn','British','W');
+INSERT INTO t2 VALUES (390,108202,36,'portrayal','behaviorally','pitfalls','');
+INSERT INTO t2 VALUES (391,108203,36,'despising','Rochford','verify','W');
+INSERT INTO t2 VALUES (392,108204,36,'distort','mirror','scatter','FAS');
+INSERT INTO t2 VALUES (393,108205,36,'palmed','Modula','Aztecan','');
+INSERT INTO t2 VALUES (394,108301,36,'faced','clobbering','acuity','W');
+INSERT INTO t2 VALUES (395,108302,36,'silverware','chronography','sinking','W');
+INSERT INTO t2 VALUES (396,112101,36,'assessor','Eskimoizeds','beasts','FAS');
+INSERT INTO t2 VALUES (397,112102,36,'spiders','British','Witt','W');
+INSERT INTO t2 VALUES (398,113701,36,'artificially','pitfalls','physicists','FAS');
+INSERT INTO t2 VALUES (399,116001,36,'reminiscence','verify','folksong','A');
+INSERT INTO t2 VALUES (400,116201,36,'Mexican','scatter','strokes','FAS');
+INSERT INTO t2 VALUES (401,116301,36,'obnoxious','Aztecan','crowder','');
+INSERT INTO t2 VALUES (402,116302,36,'fragile','acuity','merry','');
+INSERT INTO t2 VALUES (403,116601,36,'apprehensible','sinking','cadenced','');
+INSERT INTO t2 VALUES (404,116602,36,'births','beasts','alimony','A');
+INSERT INTO t2 VALUES (405,116603,36,'garages','Witt','principled','A');
+INSERT INTO t2 VALUES (406,116701,36,'panty','physicists','golfing','');
+INSERT INTO t2 VALUES (407,116702,36,'anteater','folksong','undiscovered','');
+INSERT INTO t2 VALUES (408,118001,36,'displacement','strokes','irritates','');
+INSERT INTO t2 VALUES (409,118002,36,'drovers','crowder','patriots','A');
+INSERT INTO t2 VALUES (410,118003,36,'patenting','merry','rooms','FAS');
+INSERT INTO t2 VALUES (411,118004,36,'far','cadenced','towering','W');
+INSERT INTO t2 VALUES (412,118005,36,'shrieks','alimony','displease','');
+INSERT INTO t2 VALUES (413,118006,36,'aligning','principled','photosensitive','');
+INSERT INTO t2 VALUES (414,118007,36,'pragmatism','golfing','inking','');
+INSERT INTO t2 VALUES (415,118008,36,'fevers','undiscovered','gainers','');
+INSERT INTO t2 VALUES (416,118101,36,'reexamines','irritates','leaning','A');
+INSERT INTO t2 VALUES (417,118102,36,'occupancies','patriots','hydrant','A');
+INSERT INTO t2 VALUES (418,118103,36,'sweats','rooms','preserve','');
+INSERT INTO t2 VALUES (419,118202,36,'modulators','towering','blinded','A');
+INSERT INTO t2 VALUES (420,118203,36,'demand','displease','interactions','A');
+INSERT INTO t2 VALUES (421,118204,36,'Madeira','photosensitive','Barry','');
+INSERT INTO t2 VALUES (422,118302,36,'Viennese','inking','whiteness','A');
+INSERT INTO t2 VALUES (423,118304,36,'chillier','gainers','pastimes','W');
+INSERT INTO t2 VALUES (424,118305,36,'wildcats','leaning','Edenization','');
+INSERT INTO t2 VALUES (425,118306,36,'gentle','hydrant','Muscat','');
+INSERT INTO t2 VALUES (426,118307,36,'Angles','preserve','assassinated','');
+INSERT INTO t2 VALUES (427,123101,36,'accuracies','blinded','labeled','');
+INSERT INTO t2 VALUES (428,123102,36,'toggle','interactions','glacial','A');
+INSERT INTO t2 VALUES (429,123301,36,'Mendelssohn','Barry','implied','W');
+INSERT INTO t2 VALUES (430,126001,36,'behaviorally','whiteness','bibliographies','W');
+INSERT INTO t2 VALUES (431,126002,36,'Rochford','pastimes','Buchanan','');
+INSERT INTO t2 VALUES (432,126003,36,'mirror','Edenization','forgivably','FAS');
+INSERT INTO t2 VALUES (433,126101,36,'Modula','Muscat','innuendo','A');
+INSERT INTO t2 VALUES (434,126301,36,'clobbering','assassinated','den','FAS');
+INSERT INTO t2 VALUES (435,126302,36,'chronography','labeled','submarines','W');
+INSERT INTO t2 VALUES (436,126402,36,'Eskimoizeds','glacial','mouthful','A');
+INSERT INTO t2 VALUES (437,126601,36,'British','implied','expiring','');
+INSERT INTO t2 VALUES (438,126602,36,'pitfalls','bibliographies','unfulfilled','FAS');
+INSERT INTO t2 VALUES (439,126702,36,'verify','Buchanan','precession','');
+INSERT INTO t2 VALUES (440,128001,36,'scatter','forgivably','nullified','');
+INSERT INTO t2 VALUES (441,128002,36,'Aztecan','innuendo','affects','');
+INSERT INTO t2 VALUES (442,128003,36,'acuity','den','Cynthia','');
+INSERT INTO t2 VALUES (443,128004,36,'sinking','submarines','Chablis','A');
+INSERT INTO t2 VALUES (444,128005,36,'beasts','mouthful','betterments','FAS');
+INSERT INTO t2 VALUES (445,128007,36,'Witt','expiring','advertising','');
+INSERT INTO t2 VALUES (446,128008,36,'physicists','unfulfilled','rubies','A');
+INSERT INTO t2 VALUES (447,128009,36,'folksong','precession','southwest','FAS');
+INSERT INTO t2 VALUES (448,128010,36,'strokes','nullified','superstitious','A');
+INSERT INTO t2 VALUES (449,128011,36,'crowder','affects','tabernacle','W');
+INSERT INTO t2 VALUES (450,128012,36,'merry','Cynthia','silk','A');
+INSERT INTO t2 VALUES (451,128013,36,'cadenced','Chablis','handsomest','A');
+INSERT INTO t2 VALUES (452,128014,36,'alimony','betterments','Persian','A');
+INSERT INTO t2 VALUES (453,128015,36,'principled','advertising','analog','W');
+INSERT INTO t2 VALUES (454,128016,36,'golfing','rubies','complex','W');
+INSERT INTO t2 VALUES (455,128017,36,'undiscovered','southwest','Taoist','');
+INSERT INTO t2 VALUES (456,128018,36,'irritates','superstitious','suspend','');
+INSERT INTO t2 VALUES (457,128019,36,'patriots','tabernacle','relegated','');
+INSERT INTO t2 VALUES (458,128020,36,'rooms','silk','awesome','W');
+INSERT INTO t2 VALUES (459,128021,36,'towering','handsomest','Bruxelles','');
+INSERT INTO t2 VALUES (460,128022,36,'displease','Persian','imprecisely','A');
+INSERT INTO t2 VALUES (461,128023,36,'photosensitive','analog','televise','');
+INSERT INTO t2 VALUES (462,128101,36,'inking','complex','braking','');
+INSERT INTO t2 VALUES (463,128102,36,'gainers','Taoist','true','FAS');
+INSERT INTO t2 VALUES (464,128103,36,'leaning','suspend','disappointing','FAS');
+INSERT INTO t2 VALUES (465,128104,36,'hydrant','relegated','navally','W');
+INSERT INTO t2 VALUES (466,128106,36,'preserve','awesome','circus','');
+INSERT INTO t2 VALUES (467,128107,36,'blinded','Bruxelles','beetles','');
+INSERT INTO t2 VALUES (468,128108,36,'interactions','imprecisely','trumps','');
+INSERT INTO t2 VALUES (469,128202,36,'Barry','televise','fourscore','W');
+INSERT INTO t2 VALUES (470,128203,36,'whiteness','braking','Blackfoots','');
+INSERT INTO t2 VALUES (471,128301,36,'pastimes','true','Grady','');
+INSERT INTO t2 VALUES (472,128302,36,'Edenization','disappointing','quiets','FAS');
+INSERT INTO t2 VALUES (473,128303,36,'Muscat','navally','floundered','FAS');
+INSERT INTO t2 VALUES (474,128304,36,'assassinated','circus','profundity','W');
+INSERT INTO t2 VALUES (475,128305,36,'labeled','beetles','Garrisonian','W');
+INSERT INTO t2 VALUES (476,128307,36,'glacial','trumps','Strauss','');
+INSERT INTO t2 VALUES (477,128401,36,'implied','fourscore','cemented','FAS');
+INSERT INTO t2 VALUES (478,128502,36,'bibliographies','Blackfoots','contrition','A');
+INSERT INTO t2 VALUES (479,128503,36,'Buchanan','Grady','mutations','');
+INSERT INTO t2 VALUES (480,128504,36,'forgivably','quiets','exhibits','W');
+INSERT INTO t2 VALUES (481,128505,36,'innuendo','floundered','tits','');
+INSERT INTO t2 VALUES (482,128601,36,'den','profundity','mate','A');
+INSERT INTO t2 VALUES (483,128603,36,'submarines','Garrisonian','arches','');
+INSERT INTO t2 VALUES (484,128604,36,'mouthful','Strauss','Moll','');
+INSERT INTO t2 VALUES (485,128702,36,'expiring','cemented','ropers','');
+INSERT INTO t2 VALUES (486,128703,36,'unfulfilled','contrition','bombast','');
+INSERT INTO t2 VALUES (487,128704,36,'precession','mutations','difficultly','A');
+INSERT INTO t2 VALUES (488,138001,36,'nullified','exhibits','adsorption','');
+INSERT INTO t2 VALUES (489,138002,36,'affects','tits','definiteness','FAS');
+INSERT INTO t2 VALUES (490,138003,36,'Cynthia','mate','cultivation','A');
+INSERT INTO t2 VALUES (491,138004,36,'Chablis','arches','heals','A');
+INSERT INTO t2 VALUES (492,138005,36,'betterments','Moll','Heusen','W');
+INSERT INTO t2 VALUES (493,138006,36,'advertising','ropers','target','FAS');
+INSERT INTO t2 VALUES (494,138007,36,'rubies','bombast','cited','A');
+INSERT INTO t2 VALUES (495,138008,36,'southwest','difficultly','congresswoman','W');
+INSERT INTO t2 VALUES (496,138009,36,'superstitious','adsorption','Katherine','');
+INSERT INTO t2 VALUES (497,138102,36,'tabernacle','definiteness','titter','A');
+INSERT INTO t2 VALUES (498,138103,36,'silk','cultivation','aspire','A');
+INSERT INTO t2 VALUES (499,138104,36,'handsomest','heals','Mardis','');
+INSERT INTO t2 VALUES (500,138105,36,'Persian','Heusen','Nadia','W');
+INSERT INTO t2 VALUES (501,138201,36,'analog','target','estimating','FAS');
+INSERT INTO t2 VALUES (502,138302,36,'complex','cited','stuck','A');
+INSERT INTO t2 VALUES (503,138303,36,'Taoist','congresswoman','fifteenth','A');
+INSERT INTO t2 VALUES (504,138304,36,'suspend','Katherine','Colombo','');
+INSERT INTO t2 VALUES (505,138401,29,'relegated','titter','survey','A');
+INSERT INTO t2 VALUES (506,140102,29,'awesome','aspire','staffing','');
+INSERT INTO t2 VALUES (507,140103,29,'Bruxelles','Mardis','obtain','');
+INSERT INTO t2 VALUES (508,140104,29,'imprecisely','Nadia','loaded','');
+INSERT INTO t2 VALUES (509,140105,29,'televise','estimating','slaughtered','');
+INSERT INTO t2 VALUES (510,140201,29,'braking','stuck','lights','A');
+INSERT INTO t2 VALUES (511,140701,29,'true','fifteenth','circumference','');
+INSERT INTO t2 VALUES (512,141501,29,'disappointing','Colombo','dull','A');
+INSERT INTO t2 VALUES (513,141502,29,'navally','survey','weekly','A');
+INSERT INTO t2 VALUES (514,141901,29,'circus','staffing','wetness','');
+INSERT INTO t2 VALUES (515,141902,29,'beetles','obtain','visualized','');
+INSERT INTO t2 VALUES (516,142101,29,'trumps','loaded','Tannenbaum','');
+INSERT INTO t2 VALUES (517,142102,29,'fourscore','slaughtered','moribund','');
+INSERT INTO t2 VALUES (518,142103,29,'Blackfoots','lights','demultiplex','');
+INSERT INTO t2 VALUES (519,142701,29,'Grady','circumference','lockings','');
+INSERT INTO t2 VALUES (520,143001,29,'quiets','dull','thugs','FAS');
+INSERT INTO t2 VALUES (521,143501,29,'floundered','weekly','unnerves','');
+INSERT INTO t2 VALUES (522,143502,29,'profundity','wetness','abut','');
+INSERT INTO t2 VALUES (523,148001,29,'Garrisonian','visualized','Chippewa','A');
+INSERT INTO t2 VALUES (524,148002,29,'Strauss','Tannenbaum','stratifications','A');
+INSERT INTO t2 VALUES (525,148003,29,'cemented','moribund','signaled','');
+INSERT INTO t2 VALUES (526,148004,29,'contrition','demultiplex','Italianizes','A');
+INSERT INTO t2 VALUES (527,148005,29,'mutations','lockings','algorithmic','A');
+INSERT INTO t2 VALUES (528,148006,29,'exhibits','thugs','paranoid','FAS');
+INSERT INTO t2 VALUES (529,148007,29,'tits','unnerves','camping','A');
+INSERT INTO t2 VALUES (530,148009,29,'mate','abut','signifying','A');
+INSERT INTO t2 VALUES (531,148010,29,'arches','Chippewa','Patrice','W');
+INSERT INTO t2 VALUES (532,148011,29,'Moll','stratifications','search','A');
+INSERT INTO t2 VALUES (533,148012,29,'ropers','signaled','Angeles','A');
+INSERT INTO t2 VALUES (534,148013,29,'bombast','Italianizes','semblance','');
+INSERT INTO t2 VALUES (535,148023,36,'difficultly','algorithmic','taxed','');
+INSERT INTO t2 VALUES (536,148015,29,'adsorption','paranoid','Beatrice','');
+INSERT INTO t2 VALUES (537,148016,29,'definiteness','camping','retrace','');
+INSERT INTO t2 VALUES (538,148017,29,'cultivation','signifying','lockout','');
+INSERT INTO t2 VALUES (539,148018,29,'heals','Patrice','grammatic','');
+INSERT INTO t2 VALUES (540,148019,29,'Heusen','search','helmsman','');
+INSERT INTO t2 VALUES (541,148020,29,'target','Angeles','uniform','W');
+INSERT INTO t2 VALUES (542,148021,29,'cited','semblance','hamming','');
+INSERT INTO t2 VALUES (543,148022,29,'congresswoman','taxed','disobedience','');
+INSERT INTO t2 VALUES (544,148101,29,'Katherine','Beatrice','captivated','A');
+INSERT INTO t2 VALUES (545,148102,29,'titter','retrace','transferals','A');
+INSERT INTO t2 VALUES (546,148201,29,'aspire','lockout','cartographer','A');
+INSERT INTO t2 VALUES (547,148401,29,'Mardis','grammatic','aims','FAS');
+INSERT INTO t2 VALUES (548,148402,29,'Nadia','helmsman','Pakistani','');
+INSERT INTO t2 VALUES (549,148501,29,'estimating','uniform','burglarized','FAS');
+INSERT INTO t2 VALUES (550,148502,29,'stuck','hamming','saucepans','A');
+INSERT INTO t2 VALUES (551,148503,29,'fifteenth','disobedience','lacerating','A');
+INSERT INTO t2 VALUES (552,148504,29,'Colombo','captivated','corny','');
+INSERT INTO t2 VALUES (553,148601,29,'survey','transferals','megabytes','FAS');
+INSERT INTO t2 VALUES (554,148602,29,'staffing','cartographer','chancellor','');
+INSERT INTO t2 VALUES (555,150701,29,'obtain','aims','bulk','A');
+INSERT INTO t2 VALUES (556,152101,29,'loaded','Pakistani','commits','A');
+INSERT INTO t2 VALUES (557,152102,29,'slaughtered','burglarized','meson','W');
+INSERT INTO t2 VALUES (558,155202,36,'lights','saucepans','deputies','');
+INSERT INTO t2 VALUES (559,155203,29,'circumference','lacerating','northeaster','A');
+INSERT INTO t2 VALUES (560,155204,29,'dull','corny','dipole','');
+INSERT INTO t2 VALUES (561,155205,29,'weekly','megabytes','machining','0');
+INSERT INTO t2 VALUES (562,156001,29,'wetness','chancellor','therefore','');
+INSERT INTO t2 VALUES (563,156002,29,'visualized','bulk','Telefunken','');
+INSERT INTO t2 VALUES (564,156102,29,'Tannenbaum','commits','salvaging','');
+INSERT INTO t2 VALUES (565,156301,29,'moribund','meson','Corinthianizes','A');
+INSERT INTO t2 VALUES (566,156302,29,'demultiplex','deputies','restlessly','A');
+INSERT INTO t2 VALUES (567,156303,29,'lockings','northeaster','bromides','');
+INSERT INTO t2 VALUES (568,156304,29,'thugs','dipole','generalized','A');
+INSERT INTO t2 VALUES (569,156305,29,'unnerves','machining','mishaps','');
+INSERT INTO t2 VALUES (570,156306,29,'abut','therefore','quelling','');
+INSERT INTO t2 VALUES (571,156501,29,'Chippewa','Telefunken','spiritual','A');
+INSERT INTO t2 VALUES (572,158001,29,'stratifications','salvaging','beguiles','FAS');
+INSERT INTO t2 VALUES (573,158002,29,'signaled','Corinthianizes','Trobriand','FAS');
+INSERT INTO t2 VALUES (574,158101,29,'Italianizes','restlessly','fleeing','A');
+INSERT INTO t2 VALUES (575,158102,29,'algorithmic','bromides','Armour','A');
+INSERT INTO t2 VALUES (576,158103,29,'paranoid','generalized','chin','A');
+INSERT INTO t2 VALUES (577,158201,29,'camping','mishaps','provers','A');
+INSERT INTO t2 VALUES (578,158202,29,'signifying','quelling','aeronautic','A');
+INSERT INTO t2 VALUES (579,158203,29,'Patrice','spiritual','voltage','W');
+INSERT INTO t2 VALUES (580,158204,29,'search','beguiles','sash','');
+INSERT INTO t2 VALUES (581,158301,29,'Angeles','Trobriand','anaerobic','A');
+INSERT INTO t2 VALUES (582,158302,29,'semblance','fleeing','simultaneous','A');
+INSERT INTO t2 VALUES (583,158303,29,'taxed','Armour','accumulating','A');
+INSERT INTO t2 VALUES (584,158304,29,'Beatrice','chin','Medusan','A');
+INSERT INTO t2 VALUES (585,158305,29,'retrace','provers','shouted','A');
+INSERT INTO t2 VALUES (586,158306,29,'lockout','aeronautic','freakish','');
+INSERT INTO t2 VALUES (587,158501,29,'grammatic','voltage','index','FAS');
+INSERT INTO t2 VALUES (588,160301,29,'helmsman','sash','commercially','');
+INSERT INTO t2 VALUES (589,166101,50,'uniform','anaerobic','mistiness','A');
+INSERT INTO t2 VALUES (590,166102,50,'hamming','simultaneous','endpoint','');
+INSERT INTO t2 VALUES (591,168001,29,'disobedience','accumulating','straight','A');
+INSERT INTO t2 VALUES (592,168002,29,'captivated','Medusan','flurried','');
+INSERT INTO t2 VALUES (593,168003,29,'transferals','shouted','denotative','A');
+INSERT INTO t2 VALUES (594,168101,29,'cartographer','freakish','coming','FAS');
+INSERT INTO t2 VALUES (595,168102,29,'aims','index','commencements','FAS');
+INSERT INTO t2 VALUES (596,168103,29,'Pakistani','commercially','gentleman','');
+INSERT INTO t2 VALUES (597,168104,29,'burglarized','mistiness','gifted','');
+INSERT INTO t2 VALUES (598,168202,29,'saucepans','endpoint','Shanghais','');
+INSERT INTO t2 VALUES (599,168301,29,'lacerating','straight','sportswriting','A');
+INSERT INTO t2 VALUES (600,168502,29,'corny','flurried','sloping','A');
+INSERT INTO t2 VALUES (601,168503,29,'megabytes','denotative','navies','');
+INSERT INTO t2 VALUES (602,168601,29,'chancellor','coming','leaflet','A');
+INSERT INTO t2 VALUES (603,173001,40,'bulk','commencements','shooter','');
+INSERT INTO t2 VALUES (604,173701,40,'commits','gentleman','Joplin','FAS');
+INSERT INTO t2 VALUES (605,173702,40,'meson','gifted','babies','');
+INSERT INTO t2 VALUES (606,176001,40,'deputies','Shanghais','subdivision','FAS');
+INSERT INTO t2 VALUES (607,176101,40,'northeaster','sportswriting','burstiness','W');
+INSERT INTO t2 VALUES (608,176201,40,'dipole','sloping','belted','FAS');
+INSERT INTO t2 VALUES (609,176401,40,'machining','navies','assails','FAS');
+INSERT INTO t2 VALUES (610,176501,40,'therefore','leaflet','admiring','W');
+INSERT INTO t2 VALUES (611,176601,40,'Telefunken','shooter','swaying','0');
+INSERT INTO t2 VALUES (612,176602,40,'salvaging','Joplin','Goldstine','FAS');
+INSERT INTO t2 VALUES (613,176603,40,'Corinthianizes','babies','fitting','');
+INSERT INTO t2 VALUES (614,178001,40,'restlessly','subdivision','Norwalk','W');
+INSERT INTO t2 VALUES (615,178002,40,'bromides','burstiness','weakening','W');
+INSERT INTO t2 VALUES (616,178003,40,'generalized','belted','analogy','FAS');
+INSERT INTO t2 VALUES (617,178004,40,'mishaps','assails','deludes','');
+INSERT INTO t2 VALUES (618,178005,40,'quelling','admiring','cokes','');
+INSERT INTO t2 VALUES (619,178006,40,'spiritual','swaying','Clayton','');
+INSERT INTO t2 VALUES (620,178007,40,'beguiles','Goldstine','exhausts','');
+INSERT INTO t2 VALUES (621,178008,40,'Trobriand','fitting','causality','');
+INSERT INTO t2 VALUES (622,178101,40,'fleeing','Norwalk','sating','FAS');
+INSERT INTO t2 VALUES (623,178102,40,'Armour','weakening','icon','');
+INSERT INTO t2 VALUES (624,178103,40,'chin','analogy','throttles','');
+INSERT INTO t2 VALUES (625,178201,40,'provers','deludes','communicants','FAS');
+INSERT INTO t2 VALUES (626,178202,40,'aeronautic','cokes','dehydrate','FAS');
+INSERT INTO t2 VALUES (627,178301,40,'voltage','Clayton','priceless','FAS');
+INSERT INTO t2 VALUES (628,178302,40,'sash','exhausts','publicly','');
+INSERT INTO t2 VALUES (629,178401,40,'anaerobic','causality','incidentals','FAS');
+INSERT INTO t2 VALUES (630,178402,40,'simultaneous','sating','commonplace','');
+INSERT INTO t2 VALUES (631,178403,40,'accumulating','icon','mumbles','');
+INSERT INTO t2 VALUES (632,178404,40,'Medusan','throttles','furthermore','W');
+INSERT INTO t2 VALUES (633,178501,40,'shouted','communicants','cautioned','W');
+INSERT INTO t2 VALUES (634,186002,37,'freakish','dehydrate','parametrized','A');
+INSERT INTO t2 VALUES (635,186102,37,'index','priceless','registration','A');
+INSERT INTO t2 VALUES (636,186201,40,'commercially','publicly','sadly','FAS');
+INSERT INTO t2 VALUES (637,186202,40,'mistiness','incidentals','positioning','');
+INSERT INTO t2 VALUES (638,186203,40,'endpoint','commonplace','babysitting','');
+INSERT INTO t2 VALUES (639,186302,37,'straight','mumbles','eternal','A');
+INSERT INTO t2 VALUES (640,188007,37,'flurried','furthermore','hoarder','');
+INSERT INTO t2 VALUES (641,188008,37,'denotative','cautioned','congregates','');
+INSERT INTO t2 VALUES (642,188009,37,'coming','parametrized','rains','');
+INSERT INTO t2 VALUES (643,188010,37,'commencements','registration','workers','W');
+INSERT INTO t2 VALUES (644,188011,37,'gentleman','sadly','sags','A');
+INSERT INTO t2 VALUES (645,188012,37,'gifted','positioning','unplug','W');
+INSERT INTO t2 VALUES (646,188013,37,'Shanghais','babysitting','garage','A');
+INSERT INTO t2 VALUES (647,188014,37,'sportswriting','eternal','boulder','A');
+INSERT INTO t2 VALUES (648,188015,37,'sloping','hoarder','hollowly','A');
+INSERT INTO t2 VALUES (649,188016,37,'navies','congregates','specifics','');
+INSERT INTO t2 VALUES (650,188017,37,'leaflet','rains','Teresa','');
+INSERT INTO t2 VALUES (651,188102,37,'shooter','workers','Winsett','');
+INSERT INTO t2 VALUES (652,188103,37,'Joplin','sags','convenient','A');
+INSERT INTO t2 VALUES (653,188202,37,'babies','unplug','buckboards','FAS');
+INSERT INTO t2 VALUES (654,188301,40,'subdivision','garage','amenities','');
+INSERT INTO t2 VALUES (655,188302,40,'burstiness','boulder','resplendent','FAS');
+INSERT INTO t2 VALUES (656,188303,40,'belted','hollowly','priding','FAS');
+INSERT INTO t2 VALUES (657,188401,37,'assails','specifics','configurations','');
+INSERT INTO t2 VALUES (658,188402,37,'admiring','Teresa','untidiness','A');
+INSERT INTO t2 VALUES (659,188503,37,'swaying','Winsett','Brice','W');
+INSERT INTO t2 VALUES (660,188504,37,'Goldstine','convenient','sews','FAS');
+INSERT INTO t2 VALUES (661,188505,37,'fitting','buckboards','participated','');
+INSERT INTO t2 VALUES (662,190701,37,'Norwalk','amenities','Simon','FAS');
+INSERT INTO t2 VALUES (663,190703,50,'weakening','resplendent','certificates','');
+INSERT INTO t2 VALUES (664,191701,37,'analogy','priding','Fitzpatrick','');
+INSERT INTO t2 VALUES (665,191702,37,'deludes','configurations','Evanston','A');
+INSERT INTO t2 VALUES (666,191703,37,'cokes','untidiness','misted','');
+INSERT INTO t2 VALUES (667,196001,37,'Clayton','Brice','textures','A');
+INSERT INTO t2 VALUES (668,196002,37,'exhausts','sews','save','');
+INSERT INTO t2 VALUES (669,196003,37,'causality','participated','count','');
+INSERT INTO t2 VALUES (670,196101,37,'sating','Simon','rightful','A');
+INSERT INTO t2 VALUES (671,196103,37,'icon','certificates','chaperone','');
+INSERT INTO t2 VALUES (672,196104,37,'throttles','Fitzpatrick','Lizzy','A');
+INSERT INTO t2 VALUES (673,196201,37,'communicants','Evanston','clenched','A');
+INSERT INTO t2 VALUES (674,196202,37,'dehydrate','misted','effortlessly','');
+INSERT INTO t2 VALUES (675,196203,37,'priceless','textures','accessed','');
+INSERT INTO t2 VALUES (676,198001,37,'publicly','save','beaters','A');
+INSERT INTO t2 VALUES (677,198003,37,'incidentals','count','Hornblower','FAS');
+INSERT INTO t2 VALUES (678,198004,37,'commonplace','rightful','vests','A');
+INSERT INTO t2 VALUES (679,198005,37,'mumbles','chaperone','indulgences','FAS');
+INSERT INTO t2 VALUES (680,198006,37,'furthermore','Lizzy','infallibly','A');
+INSERT INTO t2 VALUES (681,198007,37,'cautioned','clenched','unwilling','FAS');
+INSERT INTO t2 VALUES (682,198008,37,'parametrized','effortlessly','excrete','FAS');
+INSERT INTO t2 VALUES (683,198009,37,'registration','accessed','spools','A');
+INSERT INTO t2 VALUES (684,198010,37,'sadly','beaters','crunches','FAS');
+INSERT INTO t2 VALUES (685,198011,37,'positioning','Hornblower','overestimating','FAS');
+INSERT INTO t2 VALUES (686,198012,37,'babysitting','vests','ineffective','');
+INSERT INTO t2 VALUES (687,198013,37,'eternal','indulgences','humiliation','A');
+INSERT INTO t2 VALUES (688,198014,37,'hoarder','infallibly','sophomore','');
+INSERT INTO t2 VALUES (689,198015,37,'congregates','unwilling','star','');
+INSERT INTO t2 VALUES (690,198017,37,'rains','excrete','rifles','');
+INSERT INTO t2 VALUES (691,198018,37,'workers','spools','dialysis','');
+INSERT INTO t2 VALUES (692,198019,37,'sags','crunches','arriving','');
+INSERT INTO t2 VALUES (693,198020,37,'unplug','overestimating','indulge','');
+INSERT INTO t2 VALUES (694,198021,37,'garage','ineffective','clockers','');
+INSERT INTO t2 VALUES (695,198022,37,'boulder','humiliation','languages','');
+INSERT INTO t2 VALUES (696,198023,50,'hollowly','sophomore','Antarctica','A');
+INSERT INTO t2 VALUES (697,198024,37,'specifics','star','percentage','');
+INSERT INTO t2 VALUES (698,198101,37,'Teresa','rifles','ceiling','A');
+INSERT INTO t2 VALUES (699,198103,37,'Winsett','dialysis','specification','');
+INSERT INTO t2 VALUES (700,198105,37,'convenient','arriving','regimented','A');
+INSERT INTO t2 VALUES (701,198106,37,'buckboards','indulge','ciphers','');
+INSERT INTO t2 VALUES (702,198201,37,'amenities','clockers','pictures','A');
+INSERT INTO t2 VALUES (703,198204,37,'resplendent','languages','serpents','A');
+INSERT INTO t2 VALUES (704,198301,53,'priding','Antarctica','allot','A');
+INSERT INTO t2 VALUES (705,198302,53,'configurations','percentage','realized','A');
+INSERT INTO t2 VALUES (706,198303,53,'untidiness','ceiling','mayoral','A');
+INSERT INTO t2 VALUES (707,198304,53,'Brice','specification','opaquely','A');
+INSERT INTO t2 VALUES (708,198401,37,'sews','regimented','hostess','FAS');
+INSERT INTO t2 VALUES (709,198402,37,'participated','ciphers','fiftieth','');
+INSERT INTO t2 VALUES (710,198403,37,'Simon','pictures','incorrectly','');
+INSERT INTO t2 VALUES (711,202101,37,'certificates','serpents','decomposition','FAS');
+INSERT INTO t2 VALUES (712,202301,37,'Fitzpatrick','allot','stranglings','');
+INSERT INTO t2 VALUES (713,202302,37,'Evanston','realized','mixture','FAS');
+INSERT INTO t2 VALUES (714,202303,37,'misted','mayoral','electroencephalography','FAS');
+INSERT INTO t2 VALUES (715,202304,37,'textures','opaquely','similarities','FAS');
+INSERT INTO t2 VALUES (716,202305,37,'save','hostess','charges','W');
+INSERT INTO t2 VALUES (717,202601,37,'count','fiftieth','freest','FAS');
+INSERT INTO t2 VALUES (718,202602,37,'rightful','incorrectly','Greenberg','FAS');
+INSERT INTO t2 VALUES (719,202605,37,'chaperone','decomposition','tinting','');
+INSERT INTO t2 VALUES (720,202606,37,'Lizzy','stranglings','expelled','W');
+INSERT INTO t2 VALUES (721,202607,37,'clenched','mixture','warm','');
+INSERT INTO t2 VALUES (722,202901,37,'effortlessly','electroencephalography','smoothed','');
+INSERT INTO t2 VALUES (723,202902,37,'accessed','similarities','deductions','FAS');
+INSERT INTO t2 VALUES (724,202903,37,'beaters','charges','Romano','W');
+INSERT INTO t2 VALUES (725,202904,37,'Hornblower','freest','bitterroot','');
+INSERT INTO t2 VALUES (726,202907,37,'vests','Greenberg','corset','');
+INSERT INTO t2 VALUES (727,202908,37,'indulgences','tinting','securing','');
+INSERT INTO t2 VALUES (728,203101,37,'infallibly','expelled','environing','FAS');
+INSERT INTO t2 VALUES (729,203103,37,'unwilling','warm','cute','');
+INSERT INTO t2 VALUES (730,203104,37,'excrete','smoothed','Crays','');
+INSERT INTO t2 VALUES (731,203105,37,'spools','deductions','heiress','FAS');
+INSERT INTO t2 VALUES (732,203401,37,'crunches','Romano','inform','FAS');
+INSERT INTO t2 VALUES (733,203402,37,'overestimating','bitterroot','avenge','');
+INSERT INTO t2 VALUES (734,203404,37,'ineffective','corset','universals','');
+INSERT INTO t2 VALUES (735,203901,37,'humiliation','securing','Kinsey','W');
+INSERT INTO t2 VALUES (736,203902,37,'sophomore','environing','ravines','FAS');
+INSERT INTO t2 VALUES (737,203903,37,'star','cute','bestseller','');
+INSERT INTO t2 VALUES (738,203906,37,'rifles','Crays','equilibrium','');
+INSERT INTO t2 VALUES (739,203907,37,'dialysis','heiress','extents','0');
+INSERT INTO t2 VALUES (740,203908,37,'arriving','inform','relatively','');
+INSERT INTO t2 VALUES (741,203909,37,'indulge','avenge','pressure','FAS');
+INSERT INTO t2 VALUES (742,206101,37,'clockers','universals','critiques','FAS');
+INSERT INTO t2 VALUES (743,206201,37,'languages','Kinsey','befouled','');
+INSERT INTO t2 VALUES (744,206202,37,'Antarctica','ravines','rightfully','FAS');
+INSERT INTO t2 VALUES (745,206203,37,'percentage','bestseller','mechanizing','FAS');
+INSERT INTO t2 VALUES (746,206206,37,'ceiling','equilibrium','Latinizes','');
+INSERT INTO t2 VALUES (747,206207,37,'specification','extents','timesharing','');
+INSERT INTO t2 VALUES (748,206208,37,'regimented','relatively','Aden','');
+INSERT INTO t2 VALUES (749,208001,37,'ciphers','pressure','embassies','');
+INSERT INTO t2 VALUES (750,208002,37,'pictures','critiques','males','FAS');
+INSERT INTO t2 VALUES (751,208003,37,'serpents','befouled','shapelessly','FAS');
+INSERT INTO t2 VALUES (752,208004,37,'allot','rightfully','genres','FAS');
+INSERT INTO t2 VALUES (753,208008,37,'realized','mechanizing','mastering','');
+INSERT INTO t2 VALUES (754,208009,37,'mayoral','Latinizes','Newtonian','');
+INSERT INTO t2 VALUES (755,208010,37,'opaquely','timesharing','finishers','FAS');
+INSERT INTO t2 VALUES (756,208011,37,'hostess','Aden','abates','');
+INSERT INTO t2 VALUES (757,208101,37,'fiftieth','embassies','teem','');
+INSERT INTO t2 VALUES (758,208102,37,'incorrectly','males','kiting','FAS');
+INSERT INTO t2 VALUES (759,208103,37,'decomposition','shapelessly','stodgy','FAS');
+INSERT INTO t2 VALUES (760,208104,37,'stranglings','genres','scalps','FAS');
+INSERT INTO t2 VALUES (761,208105,37,'mixture','mastering','feed','FAS');
+INSERT INTO t2 VALUES (762,208110,37,'electroencephalography','Newtonian','guitars','');
+INSERT INTO t2 VALUES (763,208111,37,'similarities','finishers','airships','');
+INSERT INTO t2 VALUES (764,208112,37,'charges','abates','store','');
+INSERT INTO t2 VALUES (765,208113,37,'freest','teem','denounces','');
+INSERT INTO t2 VALUES (766,208201,37,'Greenberg','kiting','Pyle','FAS');
+INSERT INTO t2 VALUES (767,208203,37,'tinting','stodgy','Saxony','');
+INSERT INTO t2 VALUES (768,208301,37,'expelled','scalps','serializations','FAS');
+INSERT INTO t2 VALUES (769,208302,37,'warm','feed','Peruvian','FAS');
+INSERT INTO t2 VALUES (770,208305,37,'smoothed','guitars','taxonomically','FAS');
+INSERT INTO t2 VALUES (771,208401,37,'deductions','airships','kingdom','A');
+INSERT INTO t2 VALUES (772,208402,37,'Romano','store','stint','A');
+INSERT INTO t2 VALUES (773,208403,37,'bitterroot','denounces','Sault','A');
+INSERT INTO t2 VALUES (774,208404,37,'corset','Pyle','faithful','');
+INSERT INTO t2 VALUES (775,208501,37,'securing','Saxony','Ganymede','FAS');
+INSERT INTO t2 VALUES (776,208502,37,'environing','serializations','tidiness','FAS');
+INSERT INTO t2 VALUES (777,208503,37,'cute','Peruvian','gainful','FAS');
+INSERT INTO t2 VALUES (778,208504,37,'Crays','taxonomically','contrary','FAS');
+INSERT INTO t2 VALUES (779,208505,37,'heiress','kingdom','Tipperary','FAS');
+INSERT INTO t2 VALUES (780,210101,37,'inform','stint','tropics','W');
+INSERT INTO t2 VALUES (781,210102,37,'avenge','Sault','theorizers','');
+INSERT INTO t2 VALUES (782,210103,37,'universals','faithful','renew','0');
+INSERT INTO t2 VALUES (783,210104,37,'Kinsey','Ganymede','already','');
+INSERT INTO t2 VALUES (784,210105,37,'ravines','tidiness','terminal','');
+INSERT INTO t2 VALUES (785,210106,37,'bestseller','gainful','Hegelian','');
+INSERT INTO t2 VALUES (786,210107,37,'equilibrium','contrary','hypothesizer','');
+INSERT INTO t2 VALUES (787,210401,37,'extents','Tipperary','warningly','FAS');
+INSERT INTO t2 VALUES (788,213201,37,'relatively','tropics','journalizing','FAS');
+INSERT INTO t2 VALUES (789,213203,37,'pressure','theorizers','nested','');
+INSERT INTO t2 VALUES (790,213204,37,'critiques','renew','Lars','');
+INSERT INTO t2 VALUES (791,213205,37,'befouled','already','saplings','');
+INSERT INTO t2 VALUES (792,213206,37,'rightfully','terminal','foothill','');
+INSERT INTO t2 VALUES (793,213207,37,'mechanizing','Hegelian','labeled','');
+INSERT INTO t2 VALUES (794,216101,37,'Latinizes','hypothesizer','imperiously','FAS');
+INSERT INTO t2 VALUES (795,216103,37,'timesharing','warningly','reporters','FAS');
+INSERT INTO t2 VALUES (796,218001,37,'Aden','journalizing','furnishings','FAS');
+INSERT INTO t2 VALUES (797,218002,37,'embassies','nested','precipitable','FAS');
+INSERT INTO t2 VALUES (798,218003,37,'males','Lars','discounts','FAS');
+INSERT INTO t2 VALUES (799,218004,37,'shapelessly','saplings','excises','FAS');
+INSERT INTO t2 VALUES (800,143503,50,'genres','foothill','Stalin','');
+INSERT INTO t2 VALUES (801,218006,37,'mastering','labeled','despot','FAS');
+INSERT INTO t2 VALUES (802,218007,37,'Newtonian','imperiously','ripeness','FAS');
+INSERT INTO t2 VALUES (803,218008,37,'finishers','reporters','Arabia','');
+INSERT INTO t2 VALUES (804,218009,37,'abates','furnishings','unruly','');
+INSERT INTO t2 VALUES (805,218010,37,'teem','precipitable','mournfulness','');
+INSERT INTO t2 VALUES (806,218011,37,'kiting','discounts','boom','FAS');
+INSERT INTO t2 VALUES (807,218020,37,'stodgy','excises','slaughter','A');
+INSERT INTO t2 VALUES (808,218021,50,'scalps','Stalin','Sabine','');
+INSERT INTO t2 VALUES (809,218022,37,'feed','despot','handy','FAS');
+INSERT INTO t2 VALUES (810,218023,37,'guitars','ripeness','rural','');
+INSERT INTO t2 VALUES (811,218024,37,'airships','Arabia','organizer','');
+INSERT INTO t2 VALUES (812,218101,37,'store','unruly','shipyard','FAS');
+INSERT INTO t2 VALUES (813,218102,37,'denounces','mournfulness','civics','FAS');
+INSERT INTO t2 VALUES (814,218103,37,'Pyle','boom','inaccuracy','FAS');
+INSERT INTO t2 VALUES (815,218201,37,'Saxony','slaughter','rules','FAS');
+INSERT INTO t2 VALUES (816,218202,37,'serializations','Sabine','juveniles','FAS');
+INSERT INTO t2 VALUES (817,218203,37,'Peruvian','handy','comprised','W');
+INSERT INTO t2 VALUES (818,218204,37,'taxonomically','rural','investigations','');
+INSERT INTO t2 VALUES (819,218205,37,'kingdom','organizer','stabilizes','A');
+INSERT INTO t2 VALUES (820,218301,37,'stint','shipyard','seminaries','FAS');
+INSERT INTO t2 VALUES (821,218302,37,'Sault','civics','Hunter','A');
+INSERT INTO t2 VALUES (822,218401,37,'faithful','inaccuracy','sporty','FAS');
+INSERT INTO t2 VALUES (823,218402,37,'Ganymede','rules','test','FAS');
+INSERT INTO t2 VALUES (824,218403,37,'tidiness','juveniles','weasels','');
+INSERT INTO t2 VALUES (825,218404,37,'gainful','comprised','CERN','');
+INSERT INTO t2 VALUES (826,218407,37,'contrary','investigations','tempering','');
+INSERT INTO t2 VALUES (827,218408,37,'Tipperary','stabilizes','afore','FAS');
+INSERT INTO t2 VALUES (828,218409,37,'tropics','seminaries','Galatean','');
+INSERT INTO t2 VALUES (829,218410,37,'theorizers','Hunter','techniques','W');
+INSERT INTO t2 VALUES (830,226001,37,'renew','sporty','error','');
+INSERT INTO t2 VALUES (831,226002,37,'already','test','veranda','');
+INSERT INTO t2 VALUES (832,226003,37,'terminal','weasels','severely','');
+INSERT INTO t2 VALUES (833,226004,37,'Hegelian','CERN','Cassites','FAS');
+INSERT INTO t2 VALUES (834,226005,37,'hypothesizer','tempering','forthcoming','');
+INSERT INTO t2 VALUES (835,226006,37,'warningly','afore','guides','');
+INSERT INTO t2 VALUES (836,226007,37,'journalizing','Galatean','vanish','FAS');
+INSERT INTO t2 VALUES (837,226008,37,'nested','techniques','lied','A');
+INSERT INTO t2 VALUES (838,226203,37,'Lars','error','sawtooth','FAS');
+INSERT INTO t2 VALUES (839,226204,37,'saplings','veranda','fated','FAS');
+INSERT INTO t2 VALUES (840,226205,37,'foothill','severely','gradually','');
+INSERT INTO t2 VALUES (841,226206,37,'labeled','Cassites','widens','');
+INSERT INTO t2 VALUES (842,226207,37,'imperiously','forthcoming','preclude','');
+INSERT INTO t2 VALUES (843,226208,37,'reporters','guides','Jobrel','');
+INSERT INTO t2 VALUES (844,226209,37,'furnishings','vanish','hooker','');
+INSERT INTO t2 VALUES (845,226210,37,'precipitable','lied','rainstorm','');
+INSERT INTO t2 VALUES (846,226211,37,'discounts','sawtooth','disconnects','');
+INSERT INTO t2 VALUES (847,228001,37,'excises','fated','cruelty','');
+INSERT INTO t2 VALUES (848,228004,37,'Stalin','gradually','exponentials','A');
+INSERT INTO t2 VALUES (849,228005,37,'despot','widens','affective','A');
+INSERT INTO t2 VALUES (850,228006,37,'ripeness','preclude','arteries','');
+INSERT INTO t2 VALUES (851,228007,37,'Arabia','Jobrel','Crosby','FAS');
+INSERT INTO t2 VALUES (852,228008,37,'unruly','hooker','acquaint','');
+INSERT INTO t2 VALUES (853,228009,37,'mournfulness','rainstorm','evenhandedly','');
+INSERT INTO t2 VALUES (854,228101,37,'boom','disconnects','percentage','');
+INSERT INTO t2 VALUES (855,228108,37,'slaughter','cruelty','disobedience','');
+INSERT INTO t2 VALUES (856,228109,37,'Sabine','exponentials','humility','');
+INSERT INTO t2 VALUES (857,228110,37,'handy','affective','gleaning','A');
+INSERT INTO t2 VALUES (858,228111,37,'rural','arteries','petted','A');
+INSERT INTO t2 VALUES (859,228112,37,'organizer','Crosby','bloater','A');
+INSERT INTO t2 VALUES (860,228113,37,'shipyard','acquaint','minion','A');
+INSERT INTO t2 VALUES (861,228114,37,'civics','evenhandedly','marginal','A');
+INSERT INTO t2 VALUES (862,228115,37,'inaccuracy','percentage','apiary','A');
+INSERT INTO t2 VALUES (863,228116,37,'rules','disobedience','measures','');
+INSERT INTO t2 VALUES (864,228117,37,'juveniles','humility','precaution','');
+INSERT INTO t2 VALUES (865,228118,37,'comprised','gleaning','repelled','');
+INSERT INTO t2 VALUES (866,228119,37,'investigations','petted','primary','FAS');
+INSERT INTO t2 VALUES (867,228120,37,'stabilizes','bloater','coverings','');
+INSERT INTO t2 VALUES (868,228121,37,'seminaries','minion','Artemia','A');
+INSERT INTO t2 VALUES (869,228122,37,'Hunter','marginal','navigate','');
+INSERT INTO t2 VALUES (870,228201,37,'sporty','apiary','spatial','');
+INSERT INTO t2 VALUES (871,228206,37,'test','measures','Gurkha','');
+INSERT INTO t2 VALUES (872,228207,37,'weasels','precaution','meanwhile','A');
+INSERT INTO t2 VALUES (873,228208,37,'CERN','repelled','Melinda','A');
+INSERT INTO t2 VALUES (874,228209,37,'tempering','primary','Butterfield','');
+INSERT INTO t2 VALUES (875,228210,37,'afore','coverings','Aldrich','A');
+INSERT INTO t2 VALUES (876,228211,37,'Galatean','Artemia','previewing','A');
+INSERT INTO t2 VALUES (877,228212,37,'techniques','navigate','glut','A');
+INSERT INTO t2 VALUES (878,228213,37,'error','spatial','unaffected','');
+INSERT INTO t2 VALUES (879,228214,37,'veranda','Gurkha','inmate','');
+INSERT INTO t2 VALUES (880,228301,37,'severely','meanwhile','mineral','');
+INSERT INTO t2 VALUES (881,228305,37,'Cassites','Melinda','impending','A');
+INSERT INTO t2 VALUES (882,228306,37,'forthcoming','Butterfield','meditation','A');
+INSERT INTO t2 VALUES (883,228307,37,'guides','Aldrich','ideas','');
+INSERT INTO t2 VALUES (884,228308,37,'vanish','previewing','miniaturizes','W');
+INSERT INTO t2 VALUES (885,228309,37,'lied','glut','lewdly','');
+INSERT INTO t2 VALUES (886,228310,37,'sawtooth','unaffected','title','');
+INSERT INTO t2 VALUES (887,228311,37,'fated','inmate','youthfulness','');
+INSERT INTO t2 VALUES (888,228312,37,'gradually','mineral','creak','FAS');
+INSERT INTO t2 VALUES (889,228313,37,'widens','impending','Chippewa','');
+INSERT INTO t2 VALUES (890,228314,37,'preclude','meditation','clamored','');
+INSERT INTO t2 VALUES (891,228401,65,'Jobrel','ideas','freezes','');
+INSERT INTO t2 VALUES (892,228402,65,'hooker','miniaturizes','forgivably','FAS');
+INSERT INTO t2 VALUES (893,228403,65,'rainstorm','lewdly','reduce','FAS');
+INSERT INTO t2 VALUES (894,228404,65,'disconnects','title','McGovern','W');
+INSERT INTO t2 VALUES (895,228405,65,'cruelty','youthfulness','Nazis','W');
+INSERT INTO t2 VALUES (896,228406,65,'exponentials','creak','epistle','W');
+INSERT INTO t2 VALUES (897,228407,65,'affective','Chippewa','socializes','W');
+INSERT INTO t2 VALUES (898,228408,65,'arteries','clamored','conceptions','');
+INSERT INTO t2 VALUES (899,228409,65,'Crosby','freezes','Kevin','');
+INSERT INTO t2 VALUES (900,228410,65,'acquaint','forgivably','uncovering','');
+INSERT INTO t2 VALUES (901,230301,37,'evenhandedly','reduce','chews','FAS');
+INSERT INTO t2 VALUES (902,230302,37,'percentage','McGovern','appendixes','FAS');
+INSERT INTO t2 VALUES (903,230303,37,'disobedience','Nazis','raining','');
+INSERT INTO t2 VALUES (904,018062,37,'humility','epistle','infest','');
+INSERT INTO t2 VALUES (905,230501,37,'gleaning','socializes','compartment','');
+INSERT INTO t2 VALUES (906,230502,37,'petted','conceptions','minting','');
+INSERT INTO t2 VALUES (907,230503,37,'bloater','Kevin','ducks','');
+INSERT INTO t2 VALUES (908,230504,37,'minion','uncovering','roped','A');
+INSERT INTO t2 VALUES (909,230505,37,'marginal','chews','waltz','');
+INSERT INTO t2 VALUES (910,230506,37,'apiary','appendixes','Lillian','');
+INSERT INTO t2 VALUES (911,230507,37,'measures','raining','repressions','A');
+INSERT INTO t2 VALUES (912,230508,37,'precaution','infest','chillingly','');
+INSERT INTO t2 VALUES (913,230509,37,'repelled','compartment','noncritical','');
+INSERT INTO t2 VALUES (914,230901,37,'primary','minting','lithograph','');
+INSERT INTO t2 VALUES (915,230902,37,'coverings','ducks','spongers','');
+INSERT INTO t2 VALUES (916,230903,37,'Artemia','roped','parenthood','');
+INSERT INTO t2 VALUES (917,230904,37,'navigate','waltz','posed','');
+INSERT INTO t2 VALUES (918,230905,37,'spatial','Lillian','instruments','');
+INSERT INTO t2 VALUES (919,230906,37,'Gurkha','repressions','filial','');
+INSERT INTO t2 VALUES (920,230907,37,'meanwhile','chillingly','fixedly','');
+INSERT INTO t2 VALUES (921,230908,37,'Melinda','noncritical','relives','');
+INSERT INTO t2 VALUES (922,230909,37,'Butterfield','lithograph','Pandora','');
+INSERT INTO t2 VALUES (923,230910,37,'Aldrich','spongers','watering','A');
+INSERT INTO t2 VALUES (924,230911,37,'previewing','parenthood','ungrateful','');
+INSERT INTO t2 VALUES (925,230912,37,'glut','posed','secures','');
+INSERT INTO t2 VALUES (926,230913,37,'unaffected','instruments','chastisers','');
+INSERT INTO t2 VALUES (927,230914,37,'inmate','filial','icon','');
+INSERT INTO t2 VALUES (928,231304,37,'mineral','fixedly','reuniting','A');
+INSERT INTO t2 VALUES (929,231305,37,'impending','relives','imagining','A');
+INSERT INTO t2 VALUES (930,231306,37,'meditation','Pandora','abiding','A');
+INSERT INTO t2 VALUES (931,231307,37,'ideas','watering','omnisciently','');
+INSERT INTO t2 VALUES (932,231308,37,'miniaturizes','ungrateful','Britannic','');
+INSERT INTO t2 VALUES (933,231309,37,'lewdly','secures','scholastics','A');
+INSERT INTO t2 VALUES (934,231310,37,'title','chastisers','mechanics','A');
+INSERT INTO t2 VALUES (935,231311,37,'youthfulness','icon','humidly','A');
+INSERT INTO t2 VALUES (936,231312,37,'creak','reuniting','masterpiece','');
+INSERT INTO t2 VALUES (937,231313,37,'Chippewa','imagining','however','');
+INSERT INTO t2 VALUES (938,231314,37,'clamored','abiding','Mendelian','');
+INSERT INTO t2 VALUES (939,231315,37,'freezes','omnisciently','jarred','');
+INSERT INTO t2 VALUES (940,232102,37,'forgivably','Britannic','scolds','');
+INSERT INTO t2 VALUES (941,232103,37,'reduce','scholastics','infatuate','');
+INSERT INTO t2 VALUES (942,232104,37,'McGovern','mechanics','willed','A');
+INSERT INTO t2 VALUES (943,232105,37,'Nazis','humidly','joyfully','');
+INSERT INTO t2 VALUES (944,232106,37,'epistle','masterpiece','Microsoft','');
+INSERT INTO t2 VALUES (945,232107,37,'socializes','however','fibrosities','');
+INSERT INTO t2 VALUES (946,232108,37,'conceptions','Mendelian','Baltimorean','');
+INSERT INTO t2 VALUES (947,232601,37,'Kevin','jarred','equestrian','');
+INSERT INTO t2 VALUES (948,232602,37,'uncovering','scolds','Goodrich','');
+INSERT INTO t2 VALUES (949,232603,37,'chews','infatuate','apish','A');
+INSERT INTO t2 VALUES (950,232605,37,'appendixes','willed','Adlerian','');
+INSERT INTO t2 VALUES (5950,1232605,37,'appendixes','willed','Adlerian','');
+INSERT INTO t2 VALUES (5951,1232606,37,'appendixes','willed','Adlerian','');
+INSERT INTO t2 VALUES (5952,1232607,37,'appendixes','willed','Adlerian','');
+INSERT INTO t2 VALUES (5953,1232608,37,'appendixes','willed','Adlerian','');
+INSERT INTO t2 VALUES (5954,1232609,37,'appendixes','willed','Adlerian','');
+INSERT INTO t2 VALUES (951,232606,37,'raining','joyfully','Tropez','');
+INSERT INTO t2 VALUES (952,232607,37,'infest','Microsoft','nouns','');
+INSERT INTO t2 VALUES (953,232608,37,'compartment','fibrosities','distracting','');
+INSERT INTO t2 VALUES (954,232609,37,'minting','Baltimorean','mutton','');
+INSERT INTO t2 VALUES (955,236104,37,'ducks','equestrian','bridgeable','A');
+INSERT INTO t2 VALUES (956,236105,37,'roped','Goodrich','stickers','A');
+INSERT INTO t2 VALUES (957,236106,37,'waltz','apish','transcontinental','A');
+INSERT INTO t2 VALUES (958,236107,37,'Lillian','Adlerian','amateurish','');
+INSERT INTO t2 VALUES (959,236108,37,'repressions','Tropez','Gandhian','');
+INSERT INTO t2 VALUES (960,236109,37,'chillingly','nouns','stratified','');
+INSERT INTO t2 VALUES (961,236110,37,'noncritical','distracting','chamberlains','');
+INSERT INTO t2 VALUES (962,236111,37,'lithograph','mutton','creditably','');
+INSERT INTO t2 VALUES (963,236112,37,'spongers','bridgeable','philosophic','');
+INSERT INTO t2 VALUES (964,236113,37,'parenthood','stickers','ores','');
+INSERT INTO t2 VALUES (965,238005,37,'posed','transcontinental','Carleton','');
+INSERT INTO t2 VALUES (966,238006,37,'instruments','amateurish','tape','A');
+INSERT INTO t2 VALUES (967,238007,37,'filial','Gandhian','afloat','A');
+INSERT INTO t2 VALUES (968,238008,37,'fixedly','stratified','goodness','A');
+INSERT INTO t2 VALUES (969,238009,37,'relives','chamberlains','welcoming','');
+INSERT INTO t2 VALUES (970,238010,37,'Pandora','creditably','Pinsky','FAS');
+INSERT INTO t2 VALUES (971,238011,37,'watering','philosophic','halting','');
+INSERT INTO t2 VALUES (972,238012,37,'ungrateful','ores','bibliography','');
+INSERT INTO t2 VALUES (973,238013,37,'secures','Carleton','decoding','');
+INSERT INTO t2 VALUES (974,240401,41,'chastisers','tape','variance','A');
+INSERT INTO t2 VALUES (975,240402,41,'icon','afloat','allowed','A');
+INSERT INTO t2 VALUES (976,240901,41,'reuniting','goodness','dire','A');
+INSERT INTO t2 VALUES (977,240902,41,'imagining','welcoming','dub','A');
+INSERT INTO t2 VALUES (978,241801,41,'abiding','Pinsky','poisoning','');
+INSERT INTO t2 VALUES (979,242101,41,'omnisciently','halting','Iraqis','A');
+INSERT INTO t2 VALUES (980,242102,41,'Britannic','bibliography','heaving','');
+INSERT INTO t2 VALUES (981,242201,41,'scholastics','decoding','population','A');
+INSERT INTO t2 VALUES (982,242202,41,'mechanics','variance','bomb','A');
+INSERT INTO t2 VALUES (983,242501,41,'humidly','allowed','Majorca','A');
+INSERT INTO t2 VALUES (984,242502,41,'masterpiece','dire','Gershwins','');
+INSERT INTO t2 VALUES (985,246201,41,'however','dub','explorers','');
+INSERT INTO t2 VALUES (986,246202,41,'Mendelian','poisoning','libretto','A');
+INSERT INTO t2 VALUES (987,246203,41,'jarred','Iraqis','occurred','');
+INSERT INTO t2 VALUES (988,246204,41,'scolds','heaving','Lagos','');
+INSERT INTO t2 VALUES (989,246205,41,'infatuate','population','rats','');
+INSERT INTO t2 VALUES (990,246301,41,'willed','bomb','bankruptcies','A');
+INSERT INTO t2 VALUES (991,246302,41,'joyfully','Majorca','crying','');
+INSERT INTO t2 VALUES (992,248001,41,'Microsoft','Gershwins','unexpected','');
+INSERT INTO t2 VALUES (993,248002,41,'fibrosities','explorers','accessed','A');
+INSERT INTO t2 VALUES (994,248003,41,'Baltimorean','libretto','colorful','A');
+INSERT INTO t2 VALUES (995,248004,41,'equestrian','occurred','versatility','A');
+INSERT INTO t2 VALUES (996,248005,41,'Goodrich','Lagos','cosy','');
+INSERT INTO t2 VALUES (997,248006,41,'apish','rats','Darius','A');
+INSERT INTO t2 VALUES (998,248007,41,'Adlerian','bankruptcies','mastering','A');
+INSERT INTO t2 VALUES (999,248008,41,'Tropez','crying','Asiaticizations','A');
+INSERT INTO t2 VALUES (1000,248009,41,'nouns','unexpected','offerers','A');
+INSERT INTO t2 VALUES (1001,248010,41,'distracting','accessed','uncles','A');
+INSERT INTO t2 VALUES (1002,248011,41,'mutton','colorful','sleepwalk','');
+INSERT INTO t2 VALUES (1003,248012,41,'bridgeable','versatility','Ernestine','');
+INSERT INTO t2 VALUES (1004,248013,41,'stickers','cosy','checksumming','');
+INSERT INTO t2 VALUES (1005,248014,41,'transcontinental','Darius','stopped','');
+INSERT INTO t2 VALUES (1006,248015,41,'amateurish','mastering','sicker','');
+INSERT INTO t2 VALUES (1007,248016,41,'Gandhian','Asiaticizations','Italianization','');
+INSERT INTO t2 VALUES (1008,248017,41,'stratified','offerers','alphabetic','');
+INSERT INTO t2 VALUES (1009,248018,41,'chamberlains','uncles','pharmaceutic','');
+INSERT INTO t2 VALUES (1010,248019,41,'creditably','sleepwalk','creator','');
+INSERT INTO t2 VALUES (1011,248020,41,'philosophic','Ernestine','chess','');
+INSERT INTO t2 VALUES (1012,248021,41,'ores','checksumming','charcoal','');
+INSERT INTO t2 VALUES (1013,248101,41,'Carleton','stopped','Epiphany','A');
+INSERT INTO t2 VALUES (1014,248102,41,'tape','sicker','bulldozes','A');
+INSERT INTO t2 VALUES (1015,248201,41,'afloat','Italianization','Pygmalion','A');
+INSERT INTO t2 VALUES (1016,248202,41,'goodness','alphabetic','caressing','A');
+INSERT INTO t2 VALUES (1017,248203,41,'welcoming','pharmaceutic','Palestine','A');
+INSERT INTO t2 VALUES (1018,248204,41,'Pinsky','creator','regimented','A');
+INSERT INTO t2 VALUES (1019,248205,41,'halting','chess','scars','A');
+INSERT INTO t2 VALUES (1020,248206,41,'bibliography','charcoal','realest','A');
+INSERT INTO t2 VALUES (1021,248207,41,'decoding','Epiphany','diffusing','A');
+INSERT INTO t2 VALUES (1022,248208,41,'variance','bulldozes','clubroom','A');
+INSERT INTO t2 VALUES (1023,248209,41,'allowed','Pygmalion','Blythe','A');
+INSERT INTO t2 VALUES (1024,248210,41,'dire','caressing','ahead','');
+INSERT INTO t2 VALUES (1025,248211,50,'dub','Palestine','reviver','');
+INSERT INTO t2 VALUES (1026,250501,34,'poisoning','regimented','retransmitting','A');
+INSERT INTO t2 VALUES (1027,250502,34,'Iraqis','scars','landslide','');
+INSERT INTO t2 VALUES (1028,250503,34,'heaving','realest','Eiffel','');
+INSERT INTO t2 VALUES (1029,250504,34,'population','diffusing','absentee','');
+INSERT INTO t2 VALUES (1030,250505,34,'bomb','clubroom','aye','');
+INSERT INTO t2 VALUES (1031,250601,34,'Majorca','Blythe','forked','A');
+INSERT INTO t2 VALUES (1032,250602,34,'Gershwins','ahead','Peruvianizes','');
+INSERT INTO t2 VALUES (1033,250603,34,'explorers','reviver','clerked','');
+INSERT INTO t2 VALUES (1034,250604,34,'libretto','retransmitting','tutor','');
+INSERT INTO t2 VALUES (1035,250605,34,'occurred','landslide','boulevard','');
+INSERT INTO t2 VALUES (1036,251001,34,'Lagos','Eiffel','shuttered','');
+INSERT INTO t2 VALUES (1037,251002,34,'rats','absentee','quotes','A');
+INSERT INTO t2 VALUES (1038,251003,34,'bankruptcies','aye','Caltech','');
+INSERT INTO t2 VALUES (1039,251004,34,'crying','forked','Mossberg','');
+INSERT INTO t2 VALUES (1040,251005,34,'unexpected','Peruvianizes','kept','');
+INSERT INTO t2 VALUES (1041,251301,34,'accessed','clerked','roundly','');
+INSERT INTO t2 VALUES (1042,251302,34,'colorful','tutor','features','A');
+INSERT INTO t2 VALUES (1043,251303,34,'versatility','boulevard','imaginable','A');
+INSERT INTO t2 VALUES (1044,251304,34,'cosy','shuttered','controller','');
+INSERT INTO t2 VALUES (1045,251305,34,'Darius','quotes','racial','');
+INSERT INTO t2 VALUES (1046,251401,34,'mastering','Caltech','uprisings','A');
+INSERT INTO t2 VALUES (1047,251402,34,'Asiaticizations','Mossberg','narrowed','A');
+INSERT INTO t2 VALUES (1048,251403,34,'offerers','kept','cannot','A');
+INSERT INTO t2 VALUES (1049,251404,34,'uncles','roundly','vest','');
+INSERT INTO t2 VALUES (1050,251405,34,'sleepwalk','features','famine','');
+INSERT INTO t2 VALUES (1051,251406,34,'Ernestine','imaginable','sugars','');
+INSERT INTO t2 VALUES (1052,251801,34,'checksumming','controller','exterminated','A');
+INSERT INTO t2 VALUES (1053,251802,34,'stopped','racial','belays','');
+INSERT INTO t2 VALUES (1054,252101,34,'sicker','uprisings','Hodges','A');
+INSERT INTO t2 VALUES (1055,252102,34,'Italianization','narrowed','translatable','');
+INSERT INTO t2 VALUES (1056,252301,34,'alphabetic','cannot','duality','A');
+INSERT INTO t2 VALUES (1057,252302,34,'pharmaceutic','vest','recording','A');
+INSERT INTO t2 VALUES (1058,252303,34,'creator','famine','rouses','A');
+INSERT INTO t2 VALUES (1059,252304,34,'chess','sugars','poison','');
+INSERT INTO t2 VALUES (1060,252305,34,'charcoal','exterminated','attitude','');
+INSERT INTO t2 VALUES (1061,252306,34,'Epiphany','belays','dusted','');
+INSERT INTO t2 VALUES (1062,252307,34,'bulldozes','Hodges','encompasses','');
+INSERT INTO t2 VALUES (1063,252308,34,'Pygmalion','translatable','presentation','');
+INSERT INTO t2 VALUES (1064,252309,34,'caressing','duality','Kantian','');
+INSERT INTO t2 VALUES (1065,256001,34,'Palestine','recording','imprecision','A');
+INSERT INTO t2 VALUES (1066,256002,34,'regimented','rouses','saving','');
+INSERT INTO t2 VALUES (1067,256003,34,'scars','poison','maternal','');
+INSERT INTO t2 VALUES (1068,256004,34,'realest','attitude','hewed','');
+INSERT INTO t2 VALUES (1069,256005,34,'diffusing','dusted','kerosene','');
+INSERT INTO t2 VALUES (1070,258001,34,'clubroom','encompasses','Cubans','');
+INSERT INTO t2 VALUES (1071,258002,34,'Blythe','presentation','photographers','');
+INSERT INTO t2 VALUES (1072,258003,34,'ahead','Kantian','nymph','A');
+INSERT INTO t2 VALUES (1073,258004,34,'reviver','imprecision','bedlam','A');
+INSERT INTO t2 VALUES (1074,258005,34,'retransmitting','saving','north','A');
+INSERT INTO t2 VALUES (1075,258006,34,'landslide','maternal','Schoenberg','A');
+INSERT INTO t2 VALUES (1076,258007,34,'Eiffel','hewed','botany','A');
+INSERT INTO t2 VALUES (1077,258008,34,'absentee','kerosene','curs','');
+INSERT INTO t2 VALUES (1078,258009,34,'aye','Cubans','solidification','');
+INSERT INTO t2 VALUES (1079,258010,34,'forked','photographers','inheritresses','');
+INSERT INTO t2 VALUES (1080,258011,34,'Peruvianizes','nymph','stiller','');
+INSERT INTO t2 VALUES (1081,258101,68,'clerked','bedlam','t1','A');
+INSERT INTO t2 VALUES (1082,258102,68,'tutor','north','suite','A');
+INSERT INTO t2 VALUES (1083,258103,34,'boulevard','Schoenberg','ransomer','');
+INSERT INTO t2 VALUES (1084,258104,68,'shuttered','botany','Willy','');
+INSERT INTO t2 VALUES (1085,258105,68,'quotes','curs','Rena','A');
+INSERT INTO t2 VALUES (1086,258106,68,'Caltech','solidification','Seattle','A');
+INSERT INTO t2 VALUES (1087,258107,68,'Mossberg','inheritresses','relaxes','A');
+INSERT INTO t2 VALUES (1088,258108,68,'kept','stiller','exclaim','');
+INSERT INTO t2 VALUES (1089,258109,68,'roundly','t1','implicated','A');
+INSERT INTO t2 VALUES (1090,258110,68,'features','suite','distinguish','');
+INSERT INTO t2 VALUES (1091,258111,68,'imaginable','ransomer','assayed','');
+INSERT INTO t2 VALUES (1092,258112,68,'controller','Willy','homeowner','');
+INSERT INTO t2 VALUES (1093,258113,68,'racial','Rena','and','');
+INSERT INTO t2 VALUES (1094,258201,34,'uprisings','Seattle','stealth','');
+INSERT INTO t2 VALUES (1095,258202,34,'narrowed','relaxes','coinciding','A');
+INSERT INTO t2 VALUES (1096,258203,34,'cannot','exclaim','founder','A');
+INSERT INTO t2 VALUES (1097,258204,34,'vest','implicated','environing','');
+INSERT INTO t2 VALUES (1098,258205,34,'famine','distinguish','jewelry','');
+INSERT INTO t2 VALUES (1099,258301,34,'sugars','assayed','lemons','A');
+INSERT INTO t2 VALUES (1100,258401,34,'exterminated','homeowner','brokenness','A');
+INSERT INTO t2 VALUES (1101,258402,34,'belays','and','bedpost','A');
+INSERT INTO t2 VALUES (1102,258403,34,'Hodges','stealth','assurers','A');
+INSERT INTO t2 VALUES (1103,258404,34,'translatable','coinciding','annoyers','');
+INSERT INTO t2 VALUES (1104,258405,34,'duality','founder','affixed','');
+INSERT INTO t2 VALUES (1105,258406,34,'recording','environing','warbling','');
+INSERT INTO t2 VALUES (1106,258407,34,'rouses','jewelry','seriously','');
+INSERT INTO t2 VALUES (1107,228123,37,'poison','lemons','boasted','');
+INSERT INTO t2 VALUES (1108,250606,34,'attitude','brokenness','Chantilly','');
+INSERT INTO t2 VALUES (1109,208405,37,'dusted','bedpost','Iranizes','');
+INSERT INTO t2 VALUES (1110,212101,37,'encompasses','assurers','violinist','');
+INSERT INTO t2 VALUES (1111,218206,37,'presentation','annoyers','extramarital','');
+INSERT INTO t2 VALUES (1112,150401,37,'Kantian','affixed','spates','');
+INSERT INTO t2 VALUES (1113,248212,41,'imprecision','warbling','cloakroom','');
+INSERT INTO t2 VALUES (1114,128026,00,'saving','seriously','gazer','');
+INSERT INTO t2 VALUES (1115,128024,00,'maternal','boasted','hand','');
+INSERT INTO t2 VALUES (1116,128027,00,'hewed','Chantilly','tucked','');
+INSERT INTO t2 VALUES (1117,128025,00,'kerosene','Iranizes','gems','');
+INSERT INTO t2 VALUES (1118,128109,00,'Cubans','violinist','clinker','');
+INSERT INTO t2 VALUES (1119,128705,00,'photographers','extramarital','refiner','');
+INSERT INTO t2 VALUES (1120,126303,00,'nymph','spates','callus','');
+INSERT INTO t2 VALUES (1121,128308,00,'bedlam','cloakroom','leopards','');
+INSERT INTO t2 VALUES (1122,128204,00,'north','gazer','comfortingly','');
+INSERT INTO t2 VALUES (1123,128205,00,'Schoenberg','hand','generically','');
+INSERT INTO t2 VALUES (1124,128206,00,'botany','tucked','getters','');
+INSERT INTO t2 VALUES (1125,128207,00,'curs','gems','sexually','');
+INSERT INTO t2 VALUES (1126,118205,00,'solidification','clinker','spear','');
+INSERT INTO t2 VALUES (1127,116801,00,'inheritresses','refiner','serums','');
+INSERT INTO t2 VALUES (1128,116803,00,'stiller','callus','Italianization','');
+INSERT INTO t2 VALUES (1129,116804,00,'t1','leopards','attendants','');
+INSERT INTO t2 VALUES (1130,116802,00,'suite','comfortingly','spies','');
+INSERT INTO t2 VALUES (1131,128605,00,'ransomer','generically','Anthony','');
+INSERT INTO t2 VALUES (1132,118308,00,'Willy','getters','planar','');
+INSERT INTO t2 VALUES (1133,113702,00,'Rena','sexually','cupped','');
+INSERT INTO t2 VALUES (1134,113703,00,'Seattle','spear','cleanser','');
+INSERT INTO t2 VALUES (1135,112103,00,'relaxes','serums','commuters','');
+INSERT INTO t2 VALUES (1136,118009,00,'exclaim','Italianization','honeysuckle','');
+INSERT INTO t2 VALUES (5136,1118009,00,'exclaim','Italianization','honeysuckle','');
+INSERT INTO t2 VALUES (1137,138011,00,'implicated','attendants','orphanage','');
+INSERT INTO t2 VALUES (1138,138010,00,'distinguish','spies','skies','');
+INSERT INTO t2 VALUES (1139,138012,00,'assayed','Anthony','crushers','');
+INSERT INTO t2 VALUES (1140,068304,00,'homeowner','planar','Puritan','');
+INSERT INTO t2 VALUES (1141,078009,00,'and','cupped','squeezer','');
+INSERT INTO t2 VALUES (1142,108013,00,'stealth','cleanser','bruises','');
+INSERT INTO t2 VALUES (1143,084004,00,'coinciding','commuters','bonfire','');
+INSERT INTO t2 VALUES (1144,083402,00,'founder','honeysuckle','Colombo','');
+INSERT INTO t2 VALUES (1145,084003,00,'environing','orphanage','nondecreasing','');
+INSERT INTO t2 VALUES (1146,088504,00,'jewelry','skies','innocents','');
+INSERT INTO t2 VALUES (1147,088005,00,'lemons','crushers','masked','');
+INSERT INTO t2 VALUES (1148,088007,00,'brokenness','Puritan','file','');
+INSERT INTO t2 VALUES (1149,088006,00,'bedpost','squeezer','brush','');
+INSERT INTO t2 VALUES (1150,148025,00,'assurers','bruises','mutilate','');
+INSERT INTO t2 VALUES (1151,148024,00,'annoyers','bonfire','mommy','');
+INSERT INTO t2 VALUES (1152,138305,00,'affixed','Colombo','bulkheads','');
+INSERT INTO t2 VALUES (1153,138306,00,'warbling','nondecreasing','undeclared','');
+INSERT INTO t2 VALUES (1154,152701,00,'seriously','innocents','displacements','');
+INSERT INTO t2 VALUES (1155,148505,00,'boasted','masked','nieces','');
+INSERT INTO t2 VALUES (1156,158003,00,'Chantilly','file','coeducation','');
+INSERT INTO t2 VALUES (1157,156201,00,'Iranizes','brush','brassy','');
+INSERT INTO t2 VALUES (1158,156202,00,'violinist','mutilate','authenticator','');
+INSERT INTO t2 VALUES (1159,158307,00,'extramarital','mommy','Washoe','');
+INSERT INTO t2 VALUES (1160,158402,00,'spates','bulkheads','penny','');
+INSERT INTO t2 VALUES (1161,158401,00,'cloakroom','undeclared','Flagler','');
+INSERT INTO t2 VALUES (1162,068013,00,'gazer','displacements','stoned','');
+INSERT INTO t2 VALUES (1163,068012,00,'hand','nieces','cranes','');
+INSERT INTO t2 VALUES (1164,068203,00,'tucked','coeducation','masterful','');
+INSERT INTO t2 VALUES (1165,088205,00,'gems','brassy','biracial','');
+INSERT INTO t2 VALUES (1166,068704,00,'clinker','authenticator','steamships','');
+INSERT INTO t2 VALUES (1167,068604,00,'refiner','Washoe','windmills','');
+INSERT INTO t2 VALUES (1168,158502,00,'callus','penny','exploit','');
+INSERT INTO t2 VALUES (1169,123103,00,'leopards','Flagler','riverfront','');
+INSERT INTO t2 VALUES (1170,148026,00,'comfortingly','stoned','sisterly','');
+INSERT INTO t2 VALUES (1171,123302,00,'generically','cranes','sharpshoot','');
+INSERT INTO t2 VALUES (1172,076503,00,'getters','masterful','mittens','');
+INSERT INTO t2 VALUES (1173,126304,00,'sexually','biracial','interdependency','');
+INSERT INTO t2 VALUES (1174,068306,00,'spear','steamships','policy','');
+INSERT INTO t2 VALUES (1175,143504,00,'serums','windmills','unleashing','');
+INSERT INTO t2 VALUES (1176,160201,00,'Italianization','exploit','pretenders','');
+INSERT INTO t2 VALUES (1177,148028,00,'attendants','riverfront','overstatements','');
+INSERT INTO t2 VALUES (1178,148027,00,'spies','sisterly','birthed','');
+INSERT INTO t2 VALUES (1179,143505,00,'Anthony','sharpshoot','opportunism','');
+INSERT INTO t2 VALUES (1180,108014,00,'planar','mittens','showroom','');
+INSERT INTO t2 VALUES (1181,076104,00,'cupped','interdependency','compromisingly','');
+INSERT INTO t2 VALUES (1182,078106,00,'cleanser','policy','Medicare','');
+INSERT INTO t2 VALUES (1183,126102,00,'commuters','unleashing','corresponds','');
+INSERT INTO t2 VALUES (1184,128029,00,'honeysuckle','pretenders','hardware','');
+INSERT INTO t2 VALUES (1185,128028,00,'orphanage','overstatements','implant','');
+INSERT INTO t2 VALUES (1186,018410,00,'skies','birthed','Alicia','');
+INSERT INTO t2 VALUES (1187,128110,00,'crushers','opportunism','requesting','');
+INSERT INTO t2 VALUES (1188,148506,00,'Puritan','showroom','produced','');
+INSERT INTO t2 VALUES (1189,123303,00,'squeezer','compromisingly','criticizes','');
+INSERT INTO t2 VALUES (1190,123304,00,'bruises','Medicare','backer','');
+INSERT INTO t2 VALUES (1191,068504,00,'bonfire','corresponds','positively','');
+INSERT INTO t2 VALUES (1192,068305,00,'Colombo','hardware','colicky','');
+INSERT INTO t2 VALUES (1193,000000,00,'nondecreasing','implant','thrillingly','');
+--enable_query_log
+
+#
+# Search with a key
+#
+
+select t2.fld3 from t2 where companynr = 58 and fld3 like "%imaginable%";
+select fld3 from t2 where fld3 like "%cultivation" ;
+
+#
+# Search with a key using sorting and limit the same time
+#
+
+select t2.fld3,companynr from t2 where companynr = 57+1 order by fld3;
+select fld3,companynr from t2 where companynr = 58 order by fld3;
+
+select fld3 from t2 order by fld3 desc limit 10;
+select fld3 from t2 order by fld3 desc limit 5;
+select fld3 from t2 order by fld3 desc limit 5,5;
+
+#
+# Update
+#
+
+UPDATE t2 SET fld3="foo" WHERE fld3="b%";
+select fld3 from t2;
+
+
+#
+# Update randomly
+#
+
+UPDATE t2 SET fld3="bar" WHERE fld3="s%";
+select fld3 from t2;
+
+#
+# Delete with constant
+#
+
+DELETE FROM t2 WHERE fld3="r%";
+SELECT fld3 FROM t2;
+
+#
+# Delete with Random
+#
+
+DELETE FROM t2 WHERE fld3="d%" ORDER BY RAND();
+SELECT fld3 FROM t2;
+
+#
+# Rename table
+#
+
+DROP TABLE t1;
+ALTER TABLE t2 RENAME t1
+
+#
+# Drop and recreate
+#
+
+
+DROP TABLE t1;
+CREATE TABLE t1 (
+ Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
+ Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
+) ENGINE = CSV;
+
+INSERT INTO t1 VALUES (9410,9412);
+
+select period from t1;
+
+drop table if exists t1,t2,t3,t4;
diff --git a/mysql-test/t/ctype_big5.test b/mysql-test/t/ctype_big5.test
new file mode 100644
index 00000000000..b1d71a6af15
--- /dev/null
+++ b/mysql-test/t/ctype_big5.test
@@ -0,0 +1,12 @@
+-- source include/have_big5.inc
+
+#
+# Tests with the big5 character set
+#
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+SET @test_character_set= 'big5';
+SET @test_collation= 'big5_chinese_ci';
+-- source include/ctype_common.inc
diff --git a/mysql-test/t/ctype_collate.test b/mysql-test/t/ctype_collate.test
new file mode 100644
index 00000000000..3599beeacc4
--- /dev/null
+++ b/mysql-test/t/ctype_collate.test
@@ -0,0 +1,196 @@
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+--enable_warnings
+
+CREATE TABLE t1 (
+ latin1_f CHAR(32) CHARACTER SET latin1 NOT NULL
+);
+
+--error 1253
+CREATE TABLE t2 (
+ latin1_f CHAR(32) CHARACTER SET latin1 COLLATE koi8r_general_ci NOT NULL
+);
+
+--error 1273
+CREATE TABLE t2 (
+ latin1_f CHAR(32) CHARACTER SET latin1 COLLATE some_non_existing_col NOT NULL
+);
+
+
+INSERT INTO t1 (latin1_f) VALUES (_latin1'A');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'a');
+
+INSERT INTO t1 (latin1_f) VALUES (_latin1'AD');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'ad');
+
+INSERT INTO t1 (latin1_f) VALUES (_latin1'AE');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'ae');
+
+INSERT INTO t1 (latin1_f) VALUES (_latin1'AF');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'af');
+
+INSERT INTO t1 (latin1_f) VALUES (_latin1'Ä');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'ä');
+
+INSERT INTO t1 (latin1_f) VALUES (_latin1'Å');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'å');
+
+INSERT INTO t1 (latin1_f) VALUES (_latin1'B');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'b');
+
+INSERT INTO t1 (latin1_f) VALUES (_latin1'U');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'u');
+
+INSERT INTO t1 (latin1_f) VALUES (_latin1'UE');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'ue');
+
+INSERT INTO t1 (latin1_f) VALUES (_latin1'Ü');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'ü');
+
+INSERT INTO t1 (latin1_f) VALUES (_latin1'SS');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'ss');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'ß');
+
+INSERT INTO t1 (latin1_f) VALUES (_latin1'Y');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'y');
+
+INSERT INTO t1 (latin1_f) VALUES (_latin1'Z');
+INSERT INTO t1 (latin1_f) VALUES (_latin1'z');
+
+
+-- ORDER BY
+
+SELECT latin1_f FROM t1 ORDER BY latin1_f;
+SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE latin1_swedish_ci;
+SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE latin1_german2_ci;
+SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE latin1_general_ci;
+SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE latin1_bin;
+--error 1253
+SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE koi8r_general_ci;
+
+--SELECT latin1_f COLLATE koi8r FROM t1 ;
+
+-- AS + ORDER BY
+SELECT latin1_f COLLATE latin1_swedish_ci AS latin1_f_as FROM t1 ORDER BY latin1_f_as;
+SELECT latin1_f COLLATE latin1_german2_ci AS latin1_f_as FROM t1 ORDER BY latin1_f_as;
+SELECT latin1_f COLLATE latin1_general_ci AS latin1_f_as FROM t1 ORDER BY latin1_f_as;
+SELECT latin1_f COLLATE latin1_bin AS latin1_f_as FROM t1 ORDER BY latin1_f_as;
+--error 1253
+SELECT latin1_f COLLATE koi8r_general_ci AS latin1_f_as FROM t1 ORDER BY latin1_f_as;
+
+
+-- GROUP BY
+
+SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f;
+SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE latin1_swedish_ci;
+SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE latin1_german2_ci;
+SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE latin1_general_ci;
+SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE latin1_bin;
+--error 1253
+SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE koi8r_general_ci;
+
+
+-- DISTINCT
+
+SELECT DISTINCT latin1_f FROM t1;
+SELECT DISTINCT latin1_f COLLATE latin1_swedish_ci FROM t1;
+SELECT DISTINCT latin1_f COLLATE latin1_german2_ci FROM t1;
+SELECT DISTINCT latin1_f COLLATE latin1_general_ci FROM t1;
+SELECT DISTINCT latin1_f COLLATE latin1_bin FROM t1;
+--error 1273
+SELECT DISTINCT latin1_f COLLATE koi8r FROM t1;
+
+
+-- Aggregates
+--SELECT MAX(k COLLATE latin1_german2_ci)
+--FROM t1
+
+
+-- WHERE
+--SELECT *
+--FROM t1
+--WHERE (_latin1'Mu"ller' COLLATE latin1_german2_ci) = k
+
+--HAVING
+--SELECT *
+--FROM t1
+--HAVING (_latin1'Mu"ller' COLLATE latin1_german2_ci) = k
+
+
+#
+# Check that SHOW displays COLLATE clause
+#
+
+SHOW CREATE TABLE t1;
+SHOW FIELDS FROM t1;
+ALTER TABLE t1 CHANGE latin1_f
+latin1_f CHAR(32) CHARACTER SET latin1 COLLATE latin1_bin;
+SHOW CREATE TABLE t1;
+SHOW FIELDS FROM t1;
+ALTER TABLE t1 CHARACTER SET latin1 COLLATE latin1_bin;
+SHOW CREATE TABLE t1;
+SHOW FIELDS FROM t1;
+
+#
+# Check SET CHARACTER SET
+#
+
+SET CHARACTER SET 'latin1';
+SHOW VARIABLES LIKE 'character_set_client';
+SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
+explain extended SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
+
+SET CHARACTER SET koi8r;
+SHOW VARIABLES LIKE 'collation_client';
+SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
+
+--error 1115
+SET CHARACTER SET 'DEFAULT';
+
+DROP TABLE t1;
+
+CREATE TABLE t1
+(s1 CHAR(5) COLLATE latin1_german1_ci,
+ s2 CHAR(5) COLLATE latin1_swedish_ci);
+--error 1267
+SELECT * FROM t1 WHERE s1 = s2;
+DROP TABLE t1;
+
+
+#
+# Test that optimizer doesn't use indexes with wrong collation
+#
+SET NAMES latin1;
+CREATE TABLE t1
+(s1 char(10) COLLATE latin1_german1_ci,
+ s2 char(10) COLLATE latin1_swedish_ci,
+ KEY(s1),
+ KEY(s2));
+
+INSERT INTO t1 VALUES ('a','a');
+INSERT INTO t1 VALUES ('b','b');
+INSERT INTO t1 VALUES ('c','c');
+INSERT INTO t1 VALUES ('d','d');
+INSERT INTO t1 VALUES ('e','e');
+INSERT INTO t1 VALUES ('f','f');
+INSERT INTO t1 VALUES ('g','g');
+INSERT INTO t1 VALUES ('h','h');
+INSERT INTO t1 VALUES ('i','i');
+INSERT INTO t1 VALUES ('j','j');
+
+EXPLAIN SELECT * FROM t1 WHERE s1='a';
+EXPLAIN SELECT * FROM t1 WHERE s2='a';
+EXPLAIN SELECT * FROM t1 WHERE s1='a' COLLATE latin1_german1_ci;
+EXPLAIN SELECT * FROM t1 WHERE s2='a' COLLATE latin1_german1_ci;
+
+EXPLAIN SELECT * FROM t1 WHERE s1 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci;
+EXPLAIN SELECT * FROM t1 WHERE s2 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci;
+
+EXPLAIN SELECT * FROM t1 WHERE s1 IN ('a','b' COLLATE latin1_german1_ci);
+EXPLAIN SELECT * FROM t1 WHERE s2 IN ('a','b' COLLATE latin1_german1_ci);
+
+EXPLAIN SELECT * FROM t1 WHERE s1 LIKE 'a' COLLATE latin1_german1_ci;
+EXPLAIN SELECT * FROM t1 WHERE s2 LIKE 'a' COLLATE latin1_german1_ci;
+
+DROP TABLE t1;
diff --git a/mysql-test/t/ctype_cp1251.test b/mysql-test/t/ctype_cp1251.test
index fffade35389..66a8a5aa909 100644
--- a/mysql-test/t/ctype_cp1251.test
+++ b/mysql-test/t/ctype_cp1251.test
@@ -4,6 +4,8 @@
drop table if exists t1;
--enable_warnings
+SET NAMES cp1251;
+
#
# Test problem with LEFT() (Bug #514)
#
@@ -15,3 +17,18 @@ select a, left(a,1) as b from t1;
select a, left(a,1) as b from t1 group by a;
SELECT DISTINCT RIGHT(a,1) from t1;
drop table t1;
+
+#
+# Test of binary and upper/lower
+#
+create table t1 (a char(15) binary, b binary(15));
+insert into t1 values ('aaa','bbb'),('AAA','BBB');
+select upper(a),upper(b) from t1;
+select lower(a),lower(b) from t1;
+select * from t1 where upper(a)='AAA';
+select * from t1 where lower(a)='aaa';
+select * from t1 where upper(b)='BBB';
+select * from t1 where lower(b)='bbb';
+select charset(a), charset(b), charset(binary 'ccc') from t1 limit 1;
+select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1;
+drop table t1;
diff --git a/mysql-test/t/ctype_create.test b/mysql-test/t/ctype_create.test
new file mode 100644
index 00000000000..e97017ab416
--- /dev/null
+++ b/mysql-test/t/ctype_create.test
@@ -0,0 +1,100 @@
+#
+# Test for various CREATE statements and character sets
+#
+
+
+# Check that the database charset is taken from server charset by default:
+# - Change local character_set_server variable to latin5.
+# - Create database with and without CHARACTER SET specification.
+# At the same time check fix for the
+# Bug#2151:
+# "USE db" with non-default character set should never affect
+# further CREATE DATABASEs.
+
+
+SET @@character_set_server=latin5;
+CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET cp1251;
+USE mysqltest1;
+CREATE DATABASE mysqltest2;
+
+#
+# This should be cp1251
+#
+SHOW CREATE DATABASE mysqltest1;
+
+#
+# Database "mysqltest2" should take the default latin5 value from
+# the server level.
+# Afterwards, table "d2.t1" should inherit the default latin5 value from
+# the database "mysqltest2", using database option hash.
+#
+SHOW CREATE DATABASE mysqltest2;
+CREATE TABLE mysqltest2.t1 (a char(10));
+SHOW CREATE TABLE mysqltest2.t1;
+DROP TABLE mysqltest2.t1;
+
+#
+# Now we check if the database charset is updated in
+# the database options hash when we ALTER DATABASE.
+#
+ALTER DATABASE mysqltest2 DEFAULT CHARACTER SET latin7;
+CREATE TABLE mysqltest2.t1 (a char(10));
+SHOW CREATE TABLE mysqltest2.t1;
+DROP DATABASE mysqltest2;
+
+#
+# Now we check if the database charset is removed from
+# the database option hash when we DROP DATABASE.
+#
+CREATE DATABASE mysqltest2 CHARACTER SET latin2;
+CREATE TABLE mysqltest2.t1 (a char(10));
+SHOW CREATE TABLE mysqltest2.t1;
+DROP DATABASE mysqltest2;
+
+#
+# Check that table value uses database level by default
+#
+USE mysqltest1;
+CREATE TABLE t1 (a char(10));
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+#
+# Bug#3255
+#
+CREATE TABLE t1 (a char(10)) DEFAULT CHARACTER SET latin1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 (a char(10))
+DEFAULT CHARACTER SET latin1 COLLATE latin1_german1_ci;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+#
+# Bug#
+# CREATE TABLE and CREATE DATABASE didn't fail in some cases
+#
+--error 1302
+create table t1 (a char) character set latin1 character set latin2;
+--error 1253
+create table t1 (a char) character set latin1 collate latin2_bin;
+--error 1302
+create database d1 default character set latin1 character set latin2;
+--error 1253
+create database d1 default character set latin1 collate latin2_bin;
+
+#
+#
+DROP DATABASE mysqltest1;
+
+
+#
+# Synatx: 'ALTER DATABASE' without db_name
+#
+CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET latin7;
+use mysqltest2;
+ALTER DATABASE DEFAULT CHARACTER SET latin2;
+show create database mysqltest2;
+drop database mysqltest2;
+--error 1046
+ALTER DATABASE DEFAULT CHARACTER SET latin2;
diff --git a/mysql-test/t/ctype_latin1.test b/mysql-test/t/ctype_latin1.test
new file mode 100644
index 00000000000..677acd9faa9
--- /dev/null
+++ b/mysql-test/t/ctype_latin1.test
@@ -0,0 +1,62 @@
+#
+# Tests with the latin1 character set
+#
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# WL 1494: Treat latin1 as cp1252 for unicode conversion
+#
+
+SET NAMES latin1;
+CREATE TABLE t1 (a char(1) character set latin1);
+INSERT INTO t1 VALUES (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07);
+INSERT INTO t1 VALUES (0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+INSERT INTO t1 VALUES (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17);
+INSERT INTO t1 VALUES (0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+INSERT INTO t1 VALUES (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27);
+INSERT INTO t1 VALUES (0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+INSERT INTO t1 VALUES (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37);
+INSERT INTO t1 VALUES (0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+INSERT INTO t1 VALUES (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47);
+INSERT INTO t1 VALUES (0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+INSERT INTO t1 VALUES (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57);
+INSERT INTO t1 VALUES (0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+INSERT INTO t1 VALUES (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67);
+INSERT INTO t1 VALUES (0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+INSERT INTO t1 VALUES (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77);
+INSERT INTO t1 VALUES (0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+INSERT INTO t1 VALUES (0x80),(0x81),(0x82),(0x83),(0x84),(0x85),(0x86),(0x87);
+INSERT INTO t1 VALUES (0x88),(0x89),(0x8A),(0x8B),(0x8C),(0x8D),(0x8E),(0x8F);
+INSERT INTO t1 VALUES (0x90),(0x91),(0x92),(0x93),(0x94),(0x95),(0x96),(0x97);
+INSERT INTO t1 VALUES (0x98),(0x99),(0x9A),(0x9B),(0x9C),(0x9D),(0x9E),(0x9F);
+INSERT INTO t1 VALUES (0xA0),(0xA1),(0xA2),(0xA3),(0xA4),(0xA5),(0xA6),(0xA7);
+INSERT INTO t1 VALUES (0xA8),(0xA9),(0xAA),(0xAB),(0xAC),(0xAD),(0xAE),(0xAF);
+INSERT INTO t1 VALUES (0xB0),(0xB1),(0xB2),(0xB3),(0xB4),(0xB5),(0xB6),(0xB7);
+INSERT INTO t1 VALUES (0xB8),(0xB9),(0xBA),(0xBB),(0xBC),(0xBD),(0xBE),(0xBF);
+INSERT INTO t1 VALUES (0xC0),(0xC1),(0xC2),(0xC3),(0xC4),(0xC5),(0xC6),(0xC7);
+INSERT INTO t1 VALUES (0xC8),(0xC9),(0xCA),(0xCB),(0xCC),(0xCD),(0xCE),(0xCF);
+INSERT INTO t1 VALUES (0xD0),(0xD1),(0xD2),(0xD3),(0xD4),(0xD5),(0xD6),(0xD7);
+INSERT INTO t1 VALUES (0xD8),(0xD9),(0xDA),(0xDB),(0xDC),(0xDD),(0xDE),(0xDF);
+INSERT INTO t1 VALUES (0xE0),(0xE1),(0xE2),(0xE3),(0xE4),(0xE5),(0xE6),(0xE7);
+INSERT INTO t1 VALUES (0xE8),(0xE9),(0xEA),(0xEB),(0xEC),(0xED),(0xEE),(0xEF);
+INSERT INTO t1 VALUES (0xF0),(0xF1),(0xF2),(0xF3),(0xF4),(0xF5),(0xF6),(0xF7);
+INSERT INTO t1 VALUES (0xF8),(0xF9),(0xFA),(0xFB),(0xFC),(0xFD),(0xFE),(0xFF);
+
+#
+# 0x81 0x8D 0x8F 0x90 0x9D are undefined in cp1252
+#
+SELECT
+ hex(a),
+ hex(@u:=convert(a using utf8)),
+ hex(@l:=convert(@u using latin1)),
+ a=@l FROM t1;
+DROP TABLE t1;
+
+#
+# Bug #6737: REGEXP gives wrong result with case sensitive collation
+#
+select 'a' regexp 'A' collate latin1_general_ci;
+select 'a' regexp 'A' collate latin1_general_cs;
+select 'a' regexp 'A' collate latin1_bin;
diff --git a/mysql-test/t/ctype_latin1_de-master.opt b/mysql-test/t/ctype_latin1_de-master.opt
index 895a62364d6..79fdb1c63dc 100644
--- a/mysql-test/t/ctype_latin1_de-master.opt
+++ b/mysql-test/t/ctype_latin1_de-master.opt
@@ -1,2 +1 @@
---default-character-set=latin1_de --new
-
+--default-character-set=latin1 --default-collation=latin1_german2_ci
diff --git a/mysql-test/t/ctype_latin1_de.test b/mysql-test/t/ctype_latin1_de.test
index d6c12683d94..1c9576c1c56 100644
--- a/mysql-test/t/ctype_latin1_de.test
+++ b/mysql-test/t/ctype_latin1_de.test
@@ -1,7 +1,16 @@
#
# Test latin_de character set
#
+
+set names latin1;
+set @@collation_connection=latin1_german2_ci;
+
+select @@collation_connection;
+
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+
create table t1 (a char (20) not null, b int not null auto_increment, index (a,b));
insert into t1 (a) values ('ä'),('ac'),('ae'),('ad'),('Äc'),('aeb');
insert into t1 (a) values ('üc'),('uc'),('ue'),('ud'),('Ü'),('ueb'),('uf');
@@ -54,29 +63,32 @@ drop table t1;
# Test bug report #152 (problem with index on latin1_de)
#
+#
+# The below checks both binary and character comparisons.
+#
create table t1 (word varchar(255) not null, word2 varchar(255) not null, index(word));
+show create table t1;
insert into t1 (word) values ('ss'),(0xDF),(0xE4),('ae');
update t1 set word2=word;
-select word, word=0xdf as t from t1 having t > 0;
+select word, word=binary 0xdf as t from t1 having t > 0;
select word, word=cast(0xdf AS CHAR) as t from t1 having t > 0;
-select * from t1 where word=0xDF;
+select * from t1 where word=binary 0xDF;
select * from t1 where word=CAST(0xDF as CHAR);
-select * from t1 where word2=0xDF;
+select * from t1 where word2=binary 0xDF;
select * from t1 where word2=CAST(0xDF as CHAR);
select * from t1 where word='ae';
select * from t1 where word= 0xe4 or word=CAST(0xe4 as CHAR);
-select * from t1 where word between 0xDF and 0xDF;
+select * from t1 where word between binary 0xDF and binary 0xDF;
select * from t1 where word between CAST(0xDF AS CHAR) and CAST(0xDF AS CHAR);
select * from t1 where word like 'ae';
select * from t1 where word like 'AE';
-select * from t1 where word like 0xDF;
+select * from t1 where word like binary 0xDF;
select * from t1 where word like CAST(0xDF as CHAR);
drop table t1;
#
# Bug #5447 Select does not find records
#
-DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
autor varchar(80) NOT NULL default '',
PRIMARY KEY (autor)
@@ -86,3 +98,19 @@ INSERT INTO t1 VALUES ('Powell, B.'),('Powell, Bud.'),('Powell, L. H.'),('Power,
('Pozzi, Samuel-Jean.'),('Pozzo, A.'),('Pozzoli, Serge.');
SELECT * FROM t1 WHERE autor LIKE 'Poz%' ORDER BY autor;
DROP TABLE t1;
+
+#
+# Test of special character in german collation
+#
+
+CREATE TABLE t1 (
+s1 CHAR(5) CHARACTER SET latin1 COLLATE latin1_german2_ci
+);
+show create table t1;
+INSERT INTO t1 VALUES ('Ü');
+INSERT INTO t1 VALUES ('ue');
+SELECT DISTINCT s1 FROM t1;
+SELECT s1,COUNT(*) FROM t1 GROUP BY s1;
+SELECT COUNT(DISTINCT s1) FROM t1;
+SELECT FIELD('ue',s1), FIELD('Ü',s1), s1='ue', s1='Ü' FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/t/ctype_many.test b/mysql-test/t/ctype_many.test
new file mode 100644
index 00000000000..26057e7c997
--- /dev/null
+++ b/mysql-test/t/ctype_many.test
@@ -0,0 +1,211 @@
+-- source include/have_ucs2.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+SET CHARACTER SET latin1;
+
+CREATE TABLE t1 (
+ comment CHAR(32) ASCII NOT NULL,
+ koi8_ru_f CHAR(32) CHARACTER SET koi8r NOT NULL
+) CHARSET=latin5;
+
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 CHANGE comment comment CHAR(32) CHARACTER SET latin2 NOT NULL;
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 ADD latin5_f CHAR(32) NOT NULL;
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 DEFAULT CHARSET=latin2;
+ALTER TABLE t1 ADD latin2_f CHAR(32) NOT NULL;
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 DROP latin2_f, DROP latin5_f;
+SHOW CREATE TABLE t1;
+
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('a','LAT SMALL A');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('b','LAT SMALL B');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('c','LAT SMALL C');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('d','LAT SMALL D');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('e','LAT SMALL E');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('f','LAT SMALL F');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('g','LAT SMALL G');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('h','LAT SMALL H');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('i','LAT SMALL I');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('j','LAT SMALL J');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('k','LAT SMALL K');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('l','LAT SMALL L');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('m','LAT SMALL M');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('n','LAT SMALL N');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('o','LAT SMALL O');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('p','LAT SMALL P');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('q','LAT SMALL Q');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('r','LAT SMALL R');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('s','LAT SMALL S');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('t','LAT SMALL T');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('u','LAT SMALL U');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('v','LAT SMALL V');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('w','LAT SMALL W');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('x','LAT SMALL X');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('y','LAT SMALL Y');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('z','LAT SMALL Z');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('A','LAT CAPIT A');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('B','LAT CAPIT B');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('C','LAT CAPIT C');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('D','LAT CAPIT D');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('E','LAT CAPIT E');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('F','LAT CAPIT F');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('G','LAT CAPIT G');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('H','LAT CAPIT H');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('I','LAT CAPIT I');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('J','LAT CAPIT J');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('K','LAT CAPIT K');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('L','LAT CAPIT L');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('M','LAT CAPIT M');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('N','LAT CAPIT N');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('O','LAT CAPIT O');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('P','LAT CAPIT P');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Q','LAT CAPIT Q');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('R','LAT CAPIT R');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('S','LAT CAPIT S');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('T','LAT CAPIT T');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('U','LAT CAPIT U');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('V','LAT CAPIT V');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('W','LAT CAPIT W');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('X','LAT CAPIT X');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Y','LAT CAPIT Y');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Z','LAT CAPIT Z');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Á','CYR SMALL A');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Â','CYR SMALL BE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'×','CYR SMALL VE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ç','CYR SMALL GE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ä','CYR SMALL DE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Å','CYR SMALL IE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'£','CYR SMALL IO');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ö','CYR SMALL ZHE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ú','CYR SMALL ZE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'É','CYR SMALL I');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ë','CYR SMALL KA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ì','CYR SMALL EL');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Í','CYR SMALL EM');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Î','CYR SMALL EN');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ï','CYR SMALL O');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ð','CYR SMALL PE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ò','CYR SMALL ER');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ó','CYR SMALL ES');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ô','CYR SMALL TE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Õ','CYR SMALL U');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Æ','CYR SMALL EF');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'È','CYR SMALL HA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ã','CYR SMALL TSE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Þ','CYR SMALL CHE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Û','CYR SMALL SHA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ý','CYR SMALL SCHA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ß','CYR SMALL HARD SIGN');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ù','CYR SMALL YERU');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ø','CYR SMALL SOFT SIGN');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ü','CYR SMALL E');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'À','CYR SMALL YU');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ñ','CYR SMALL YA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'á','CYR CAPIT A');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'â','CYR CAPIT BE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'÷','CYR CAPIT VE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ç','CYR CAPIT GE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ä','CYR CAPIT DE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'å','CYR CAPIT IE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'³','CYR CAPIT IO');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ö','CYR CAPIT ZHE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ú','CYR CAPIT ZE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'é','CYR CAPIT I');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ë','CYR CAPIT KA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ì','CYR CAPIT EL');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'í','CYR CAPIT EM');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'î','CYR CAPIT EN');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ï','CYR CAPIT O');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ð','CYR CAPIT PE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ò','CYR CAPIT ER');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ó','CYR CAPIT ES');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ô','CYR CAPIT TE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'õ','CYR CAPIT U');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'æ','CYR CAPIT EF');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'è','CYR CAPIT HA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ã','CYR CAPIT TSE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'þ','CYR CAPIT CHE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'û','CYR CAPIT SHA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ý','CYR CAPIT SCHA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ÿ','CYR CAPIT HARD SIGN');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ù','CYR CAPIT YERU');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ø','CYR CAPIT SOFT SIGN');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ü','CYR CAPIT E');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'à','CYR CAPIT YU');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ñ','CYR CAPIT YA');
+
+SET CHARACTER SET utf8;
+SELECT koi8_ru_f,MIN(comment),COUNT(*) FROM t1 GROUP BY 1;
+
+ALTER TABLE t1 ADD utf8_f CHAR(32) CHARACTER SET utf8 NOT NULL;
+UPDATE t1 SET utf8_f=CONVERT(koi8_ru_f USING utf8);
+SET CHARACTER SET koi8r;
+SELECT * FROM t1;
+
+
+ALTER TABLE t1 ADD bin_f CHAR(32) BYTE NOT NULL;
+UPDATE t1 SET bin_f=koi8_ru_f;
+SELECT COUNT(DISTINCT bin_f),COUNT(DISTINCT koi8_ru_f),COUNT(DISTINCT utf8_f) FROM t1;
+
+SELECT koi8_ru_f,MIN(comment) FROM t1 GROUP BY 1;
+SELECT utf8_f,MIN(comment) FROM t1 GROUP BY 1;
+SELECT DISTINCT koi8_ru_f FROM t1;
+SELECT DISTINCT utf8_f FROM t1;
+SELECT lower(koi8_ru_f) FROM t1 ORDER BY 1 DESC;
+SELECT lower(utf8_f) FROM t1 ORDER BY 1 DESC;
+
+SELECT t11.comment,t12.comment
+FROM t1 t11,t1 t12 WHERE CONVERT(t11.koi8_ru_f USING utf8)=t12.utf8_f
+ORDER BY t11.koi8_ru_f,t11.comment,t12.comment;
+
+SELECT t11.comment,t12.comment
+FROM t1 t11,t1 t12
+WHERE t11.koi8_ru_f=CONVERT(t12.utf8_f USING koi8r)
+ORDER BY t12.utf8_f,t11.comment,t12.comment;
+
+SET CHARACTER SET utf8;
+ALTER TABLE t1 ADD ucs2_f CHAR(32) CHARACTER SET ucs2;
+
+--disable_warnings
+ALTER TABLE t1 CHANGE ucs2_f ucs2_f CHAR(32) UNICODE NOT NULL;
+--enable_warnings
+
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0391,'GREEK CAPIT ALPHA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0392,'GREEK CAPIT BETA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0393,'GREEK CAPIT GAMMA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0394,'GREEK CAPIT DELTA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0395,'GREEK CAPIT EPSILON');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B1,'GREEK SMALL ALPHA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B2,'GREEK SMALL BETA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B3,'GREEK SMALL GAMMA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B4,'GREEK SMALL DELTA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B5,'GREEK SMALL EPSILON');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0531,'ARMENIAN CAPIT AYB');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0532,'ARMENIAN CAPIT BEN');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0533,'ARMENIAN CAPIT GIM');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0534,'ARMENIAN CAPIT DA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0535,'ARMENIAN CAPIT ECH');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0536,'ARMENIAN CAPIT ZA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0561,'ARMENIAN SMALL YAB');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0562,'ARMENIAN SMALL BEN');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0563,'ARMENIAN SMALL GIM');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0564,'ARMENIAN SMALL DA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0565,'ARMENIAN SMALL ECH');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0566,'ARMENIAN SMALL ZA');
+
+ALTER TABLE t1 ADD armscii8_f CHAR(32) CHARACTER SET armscii8 NOT NULL;
+ALTER TABLE t1 ADD greek_f CHAR(32) CHARACTER SET greek NOT NULL;
+UPDATE t1 SET greek_f=CONVERT(ucs2_f USING greek) WHERE comment LIKE _latin2'GRE%';
+UPDATE t1 SET armscii8_f=CONVERT(ucs2_f USING armscii8) WHERE comment LIKE _latin2'ARM%';
+UPDATE t1 SET utf8_f=CONVERT(ucs2_f USING utf8) WHERE utf8_f=_utf8'';
+UPDATE t1 SET ucs2_f=CONVERT(utf8_f USING ucs2) WHERE ucs2_f=_ucs2'';
+SELECT * FROM t1;
+SET CHARACTER SET 'binary';
+SELECT * FROM t1;
+SELECT min(comment),count(*) FROM t1 GROUP BY ucs2_f;
+DROP TABLE t1;
diff --git a/mysql-test/t/ctype_mb.test b/mysql-test/t/ctype_mb.test
new file mode 100644
index 00000000000..b0ccab8e345
--- /dev/null
+++ b/mysql-test/t/ctype_mb.test
@@ -0,0 +1,26 @@
+#
+# Test of alter table
+#
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+CREATE TABLE t1 SELECT _utf8'test' as c1, _utf8'тест' as c2;
+SHOW CREATE TABLE t1;
+DELETE FROM t1;
+ALTER TABLE t1 ADD c3 CHAR(4) CHARACTER SET utf8;
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES ('aaaabbbbccccdddd','aaaabbbbccccdddd','aaaabbbbccccdddd');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a CHAR(4) CHARACTER SET utf8, KEY key_a(a(3)));
+SHOW CREATE TABLE t1;
+SHOW KEYS FROM t1;
+ALTER TABLE t1 CHANGE a a CHAR(4);
+SHOW CREATE TABLE t1;
+SHOW KEYS FROM t1;
+ALTER TABLE t1 CHANGE a a CHAR(4) CHARACTER SET utf8;
+SHOW CREATE TABLE t1;
+SHOW KEYS FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/t/ctype_recoding.test b/mysql-test/t/ctype_recoding.test
new file mode 100644
index 00000000000..0e5e954c720
--- /dev/null
+++ b/mysql-test/t/ctype_recoding.test
@@ -0,0 +1,181 @@
+SET CHARACTER SET koi8r;
+
+--disable_warnings
+DROP TABLE IF EXISTS ÔÁÂÌÉÃÁ, t1, t2;
+--enable_warnings
+
+SET CHARACTER SET koi8r;
+CREATE TABLE t1 (a CHAR(10) CHARACTER SET cp1251) SELECT _koi8r'ÐÒÏÂÁ' AS a;
+CREATE TABLE t2 (a CHAR(10) CHARACTER SET utf8);
+SHOW CREATE TABLE t1;
+SELECT a FROM t1;
+SELECT HEX(a) FROM t1;
+INSERT t2 SELECT * FROM t1;
+SELECT HEX(a) FROM t2;
+DROP TABLE t1, t2;
+
+
+#
+# Check that long strings conversion does not fail (bug#2218)
+#
+CREATE TABLE t1 (description text character set cp1250 NOT NULL);
+INSERT INTO t1 (description) VALUES (_latin2'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddde');
+SELECT description FROM t1;
+DROP TABLE t1;
+
+# same with TEXT
+CREATE TABLE t1 (a TEXT CHARACTER SET cp1251) SELECT _koi8r'ÐÒÏÂÁ' AS a;
+CREATE TABLE t2 (a TEXT CHARACTER SET utf8);
+SHOW CREATE TABLE t1;
+SELECT HEX(a) FROM t1;
+INSERT t2 SELECT * FROM t1;
+SELECT HEX(a) FROM t2;
+DROP TABLE t1, t2;
+
+CREATE TABLE `ÔÁÂÌÉÃÁ`
+(
+ ÐÏÌÅ CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT "ËÏÍÍÅÎÔÁÒÉÊ ÐÏÌÑ"
+) COMMENT "ËÏÍÍÅÎÔÁÒÉÊ ÔÁÂÌÉÃÙ";
+
+SHOW TABLES;
+SHOW CREATE TABLE ÔÁÂÌÉÃÁ;
+SHOW FIELDS FROM ÔÁÂÌÉÃÁ;
+
+SET CHARACTER SET cp1251;
+SHOW TABLES;
+SHOW CREATE TABLE òàáëèöà;
+SHOW FIELDS FROM òàáëèöà;
+
+
+SET CHARACTER SET utf8;
+SHOW TABLES;
+SHOW CREATE TABLE таблОца;
+SHOW FIELDS FROM таблОца;
+
+SET CHARACTER SET koi8r;
+DROP TABLE ÔÁÂÌÉÃÁ;
+SET CHARACTER SET default;
+
+# Test for Item_func_conv_charset::fix_fields (bug #3704)
+SET NAMES UTF8;
+CREATE TABLE t1 (t text) DEFAULT CHARSET UTF8;
+INSERT INTO t1 (t) VALUES ('x');
+SELECT 1 FROM t1 WHERE CONCAT(_latin1'x') = t;
+DROP TABLE t1;
+
+SET CHARACTER SET koi8r;
+CREATE DATABASE ÔÅÓÔ;
+USE ÔÅÓÔ;
+SHOW TABLES;
+SHOW TABLES IN ÔÅÓÔ;
+SET CHARACTER SET cp1251;
+SHOW TABLES;
+SHOW TABLES IN òåñò;
+SET CHARACTER SET koi8r;
+DROP DATABASE ÔÅÓÔ;
+
+SET NAMES koi8r;
+SELECT hex('ÔÅÓÔ');
+SET character_set_connection=cp1251;
+SELECT hex('ÔÅÓÔ');
+
+USE test;
+
+# Bug#4417
+# Check that identifiers and strings are not converted
+# when the client character set is binary.
+
+SET NAMES binary;
+CREATE TABLE `тест` (`тест` int);
+SHOW CREATE TABLE `тест`;
+SET NAMES utf8;
+SHOW CREATE TABLE `тест`;
+DROP TABLE `тест`;
+SET NAMES binary;
+SET character_set_connection=utf8;
+SELECT 'тест' as s;
+SET NAMES utf8;
+SET character_set_connection=binary;
+SELECT 'тест' as s;
+
+# Bug#4417, another aspect:
+# Check that both "SHOW CREATE TABLE" and "SHOW COLUMNS"
+# return column names and default values in UTF8 after "SET NAMES BINARY"
+
+SET NAMES latin1;
+CREATE TABLE t1 (`ä` CHAR(128) DEFAULT 'ä', `ä1` ENUM('ä1','ä2') DEFAULT 'ä2');
+SHOW CREATE TABLE t1;
+SHOW COLUMNS FROM t1;
+SET NAMES binary;
+SHOW CREATE TABLE t1;
+SHOW COLUMNS FROM t1;
+DROP TABLE t1;
+
+
+#
+# Test that we allow only well-formed UTF8 identitiers
+#
+SET NAMES binary;
+--error 1300
+CREATE TABLE `goodÐÌÏÈÏ` (a int);
+SET NAMES utf8;
+--error 1300
+CREATE TABLE `goodÐÌÏÈÏ` (a int);
+
+
+#
+# Test that we produce a warnign when conversion loses data.
+#
+set names latin1;
+create table t1 (a char(10) character set koi8r, b text character set koi8r);
+insert into t1 values ('test','test');
+insert into t1 values ('ÊÃÕË','ÊÃÕË');
+drop table t1;
+
+#
+# Try to apply an automatic conversion in some cases:
+# E.g. when mixing a column to a string, the string
+# is converted into the column character set.
+# If conversion loses data, then error. Otherwise,
+# the string is replaced by its converted representation
+#
+set names koi8r;
+create table t1 (a char(10) character set cp1251);
+insert into t1 values (_koi8r'×ÁÓÑ');
+# this is possible:
+select * from t1 where a=_koi8r'×ÁÓÑ';
+# this is not possible, because we have a function, not just a constant:
+--error 1267
+select * from t1 where a=concat(_koi8r'×ÁÓÑ');
+# this is not posible, cannot convert _latin1'×ÁÓÑ' into cp1251:
+--error 1267
+select * from t1 where a=_latin1'×ÁÓÑ';
+drop table t1;
+set names latin1;
+
+#
+# Check more automatic conversion
+#
+set names koi8r;
+create table t1 (c1 char(10) character set cp1251);
+insert into t1 values ('ß');
+select c1 from t1 where c1 between 'ß' and 'ß';
+select ifnull(c1,'ß'), ifnull(null,c1) from t1;
+select if(1,c1,'ö'), if(0,c1,'ö') from t1;
+select coalesce('ö',c1), coalesce(null,c1) from t1;
+select least(c1,'ö'), greatest(c1,'ö') from t1;
+select locate(c1,'ß'), locate('ß',c1) from t1;
+select field(c1,'ß'),field('ß',c1) from t1;
+select concat(c1,'ö'), concat('ö',c1) from t1;
+select concat_ws(c1,'ö','ß'), concat_ws('ö',c1,'ß') from t1;
+select replace(c1,'ß','ö'), replace('ß',c1,'ö') from t1;
+select substring_index(c1,'öößß',2) from t1;
+select elt(1,c1,'ö'),elt(1,'ö',c1) from t1;
+select make_set(3,c1,'ö'), make_set(3,'ö',c1) from t1;
+select insert(c1,1,2,'ö'),insert('ö',1,2,c1) from t1;
+select trim(c1 from 'ß'),trim('ß' from c1) from t1;
+select lpad(c1,3,'ö'), lpad('ö',3,c1) from t1;
+select rpad(c1,3,'ö'), rpad('ö',3,c1) from t1;
+# TODO
+#select case c1 when 'ß' then 'ß' when 'ö' then 'ö' else 'c' end from t1;
+#select export_set(5,c1,'ö'), export_set(5,'ö',c1) from t1;
diff --git a/mysql-test/t/ctype_sjis.test b/mysql-test/t/ctype_sjis.test
new file mode 100644
index 00000000000..a3a44789975
--- /dev/null
+++ b/mysql-test/t/ctype_sjis.test
@@ -0,0 +1,64 @@
+-- source include/have_sjis.inc
+
+#
+# Tests with the sjis character set
+#
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+set names sjis;
+
+select 'a' like 'a';
+select 'A' like 'a';
+select 'A' like 'a' collate sjis_bin;
+
+set @sjis1= _sjis 0xa1a2a3a4a5a6a7a8a9aaabacadaeaf;
+set @sjis2= _sjis 0xb0b1b2b3b4b5b6b7b8b9babbbcbdbebf;
+set @sjis3= _sjis 0xc0c1c2c3c4c5c6c7c8c9cacbcccdcecf;
+set @sjis4= _sjis 0xd0d1d2d3d4d5d6d7d8d9dadbdcdddedf;
+
+set @utf81= CONVERT(@sjis1 USING utf8);
+set @utf82= CONVERT(@sjis2 USING utf8);
+set @utf83= CONVERT(@sjis3 USING utf8);
+set @utf84= CONVERT(@sjis4 USING utf8);
+
+select hex(@utf81);
+select hex(@utf82);
+select hex(@utf83);
+select hex(@utf84);
+
+select hex(CONVERT(@utf81 USING sjis));
+select hex(CONVERT(@utf82 USING sjis));
+select hex(CONVERT(@utf83 USING sjis));
+select hex(CONVERT(@utf84 USING sjis));
+
+#
+# Allow to insert extra CP932 characters
+# into a SJIS column
+#
+create table t1 (a char(10) character set sjis);
+insert into t1 values (0x878A);
+select hex(a) from t1;
+drop table t1;
+
+#
+# Bug #6206 ENUMs are not case sensitive even if declared BINARY
+#
+create table t1(c enum(0x9353,0x9373) character set sjis);
+show create table t1;
+insert into t1 values (0x9353);
+insert into t1 values (0x9373);
+select hex(c) from t1;
+drop table t1;
+
+#
+# Bug #6223 Japanese half-width kana characters get truncated
+#
+SET NAMES sjis;
+CREATE TABLE t1 (
+ c char(16) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=sjis;
+insert into t1 values(0xb1),(0xb2),(0xb3);
+select hex(c) from t1;
+drop table t1;
diff --git a/mysql-test/t/ctype_tis620-master.opt b/mysql-test/t/ctype_tis620-master.opt
deleted file mode 100644
index 69d47c06e42..00000000000
--- a/mysql-test/t/ctype_tis620-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---default-character-set=tis620
diff --git a/mysql-test/t/ctype_tis620.test b/mysql-test/t/ctype_tis620.test
index 7314b52e301..21ec314dca7 100644
--- a/mysql-test/t/ctype_tis620.test
+++ b/mysql-test/t/ctype_tis620.test
@@ -1,12 +1,77 @@
+-- source include/have_tis620.inc
+
+#
+# Tests with the big5 character set
+#
--disable_warnings
drop table if exists t1;
--enable_warnings
+#
+# Bug 1552: tis620 <-> unicode conversion crashed
+# Check tis620 -> utf8 -> tis620 round trip conversion
+#
+
+SET @pl0= _tis620 0x000102030405060708090A0B0C0D0E0F;
+SET @pl1= _tis620 0x101112131415161718191A1B1C1D1E1F;
+SET @pl2= _tis620 0x202122232425262728292A2B2C2D2E2F;
+SET @pl3= _tis620 0x303132333435363738393A3B3C3D3E3F;
+SET @pl4= _tis620 0x404142434445464748494A4B4C4D4E4F;
+SET @pl5= _tis620 0x505152535455565758595A5B5C5D5E5F;
+SET @pl6= _tis620 0x606162636465666768696A6B6C6D6E6F;
+SET @pl7= _tis620 0x707172737475767778797A7B7C7D7E7F;
+SET @pl8= _tis620 0x808182838485868788898A8B8C8D8E8F;
+SET @pl9= _tis620 0x909192939495969798999A9B9C9D9E9F;
+SET @plA= _tis620 0xA0A1A2A3A4A5A6A7A8A9AAABACADAEAF;
+SET @plB= _tis620 0xB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF;
+SET @plC= _tis620 0xC0C1C2C3C4C5C6C7C8C9CACBCCCDCECF;
+SET @plD= _tis620 0xD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF;
+SET @plE= _tis620 0xE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF;
+SET @plF= _tis620 0xF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF;
+
+SELECT hex(@u0:=convert(@pl0 using utf8));
+SELECT hex(@u1:=convert(@pl1 using utf8));
+SELECT hex(@u2:=convert(@pl2 using utf8));
+SELECT hex(@u3:=convert(@pl3 using utf8));
+SELECT hex(@u4:=convert(@pl4 using utf8));
+SELECT hex(@u5:=convert(@pl5 using utf8));
+SELECT hex(@u6:=convert(@pl6 using utf8));
+SELECT hex(@u7:=convert(@pl7 using utf8));
+SELECT hex(@u8:=convert(@pl8 using utf8));
+SELECT hex(@u9:=convert(@pl9 using utf8));
+SELECT hex(@uA:=convert(@plA using utf8));
+SELECT hex(@uB:=convert(@plB using utf8));
+SELECT hex(@uC:=convert(@plC using utf8));
+SELECT hex(@uD:=convert(@plD using utf8));
+SELECT hex(@uE:=convert(@plE using utf8));
+SELECT hex(@uF:=convert(@plF using utf8));
+
+SELECT hex(convert(@u0 USING tis620));
+SELECT hex(convert(@u1 USING tis620));
+SELECT hex(convert(@u2 USING tis620));
+SELECT hex(convert(@u3 USING tis620));
+SELECT hex(convert(@u4 USING tis620));
+SELECT hex(convert(@u5 USING tis620));
+SELECT hex(convert(@u6 USING tis620));
+SELECT hex(convert(@u7 USING tis620));
+SELECT hex(convert(@u8 USING tis620));
+SELECT hex(convert(@u9 USING tis620));
+SELECT hex(convert(@uA USING tis620));
+SELECT hex(convert(@uB USING tis620));
+SELECT hex(convert(@uC USING tis620));
+SELECT hex(convert(@uD USING tis620));
+SELECT hex(convert(@uE USING tis620));
+SELECT hex(convert(@uF USING tis620));
+
+SET NAMES tis620;
+
CREATE TABLE t1 (
recid int(11) NOT NULL auto_increment,
dyninfo text,
PRIMARY KEY (recid)
-) ENGINE=MyISAM;
+) ENGINE=MyISAM CHARACTER SET tis620;
+
+show create table t1;
INSERT INTO t1 VALUES (1,'color=\"STB,NPG\"\r\nengine=\"J30A13\"\r\nframe=\"MRHCG1640YP4\"\r\ngrade=\"V6\"\r\nmodel=\"ACCORD\"\r\nmodelcode=\"CG164YEN\"\r\ntype=\"VT6\"\r\n');
INSERT INTO t1 VALUES (2,'color=\"HTM,NPG,DEG,RGS\"\r\nengine=\"F23A5YP1\"\r\nframe=\"MRHCF8640YP3\"\r\ngrade=\"EXi AT\"\r\nmodel=\"ACCORD\"\r\nmodelcode=\"CF864YE\"\r\ntype=\"EXA\"\r\n');
@@ -21,3 +86,68 @@ FROM t1
HAVING year != '' ORDER BY year;
DROP TABLE t1;
+
+
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1
+(
+ name varchar(50) NOT NULL default '',
+ excelorder int(11) NOT NULL default '0',
+ neworder int(11) NOT NULL default '0'
+) ENGINE=MyISAM DEFAULT CHARSET=tis620;
+
+INSERT INTO `t1` VALUES ('+45 BRETT',4,1),('+55 BRETT',5,2),('+56 BRETT',6,3),('-.55 BRETT',2,4),('-45 BRETT',8,5),('-55 BRETT',13,6),('.-55 BRETT',3,7),('.55 BRETT',1,8),('45 BRETT',7,9),('5 5 BRETT3',9,10),('5 5 BRETT2',10,11),('5 5 BRETT1',11,12),('5-5 BRETT',14,13),('55 BRETT',12,14),('55+ BRETT',17,15),('55- BRETT',15,16),('55. BRETT',16,17),('Ã.µË­Ô§ ŸÍãš',1630,1630),('ÂÃç€ì',1599,1599),('ÃÁÂìšÃÃÂì',1638,1638),('àÁàšÍÃìÍØµÊÒË¡ÃÃÁä·Â (1989)',1583,1583),('àÁâ·ÃʻԹ¹Ôè§',1586,1586),('àÃÇѵ',1706,1706),('àÂ繚ԵÃ',1623,1623),('àÂ繚Եµì',1622,1622),('àÁÉÂÒ',1591,1591),('àÁÉÔ³Õ',1592,1592),('áÁé¹ÁÒµÃ',1595,1595),('àÂÒÇàÃÈ',1627,1627),('àÂÒÇÀÒ',1626,1626),('àÂÒÇÅѡɳì',1628,1628),('àÂÒÇŽÕ',1624,1624),('àÂÒÇŸÒ',1625,1625),('àÃÔ§ÃÐÇÕ',1708,1708),('àÃÔ§Ä·žÔì',1709,1709),('àÃÔ§·ÔÇÒ',1707,1707),('ÀÃÒŽÃ',1496,1496),('àâ­Ò',1702,1702),('âç§Ò¹àËÅç¡¡ÃØ§à·ŸÏ',1712,1712),('âÚ¹ì»ÃÐàÊÃÔ°',1713,1713),('àóÙ',1703,1703),('àÁŽÔ€ÃÒ¿·ì',1584,1584),('àÁµµÒ',1585,1585),('áÁ··ÕàÃÕÂÅ¡ÃØê» šÓ¡ÑŽ',1594,1594),('àÁžÒ',1587,1587),('àÁžÕ',1590,1590),('àÁžÒÇÕ',1588,1588),('âžԹ',1629,1629),('àÁžÔ¹Õ',1589,1589),('Áâ¹',1553,1553),('Á⹪',1554,1554),('àßៀ à·ÃŽŽÔé§',1704,1704),('áßៀ €Í¹ÊµÃÑ€ªÑè¹',1711,1711),('àßៀ€Í¹ÊµÃÑ€ªÑè¹',1705,1705),('àÃ×ͧÂÈ',1710,1710),('àÁ×ͧ·Í§',1593,1593),('ÁÂØÃÕ',1555,1555),('áÇÇÇÔÀÒ',1952,1952),('áÇÇÇŽÕ',1951,1951),('àÇèÂà©Ô¹ÍÔ¹ŽÑÊàµÃÕ¹',1949,1949),('àÇÍÃìâ¡é ·ÃҹʻÍÃìµ',1950,1950),('ÀÇÔ¹',1497,1497),('Ãǧ·Í§',1639,1639),('ÁÐÅÔÇÑÅÂì',1560,1560),('ÃеÃÕ',1643,1643),('ÃПԹ·Ãì',1644,1644),('ÃП՟Ã',1645,1645),('ÃП՟Ãó',1646,1646),('ÃП՟Å',1647,1647),('àËÁÇŽÕ',2452,2452),('âÊÃÊ',2438,2438),('àÈÃɰžÃ',2050,2050),('àÈÃɰŸ§Éì',2051,2051),('âÊÃÑš',2439,2439),('ÁËÀÑ®',1558,1558),('àÊÁÒ',2410,2410),('àÊÃÕ',2413,2413),('âÊÀÒ',2432,2432),('âÊÀÕ',2435,2435),('àÊÃÔÁÈÑ¡ŽÔì',2412,2412),('àÊÃÔÁäªÂ€éÒ¡ÃÐŽÒÉ',2411,2411),('àËÃÕ­',2455,2455),('âÊÀÒŸÃó',2434,2434),('âÊÀÒŸš¹Õ',2433,2433),('âÊÚԵ',2436,2436),('âÊÀ³',2431,2431),('âÈÃŽÒ',2052,2052),('âÊÃŽÒ',2437,2437),('àËÁ×͹¢ÇÑ­',2453,2453),('àËÁ×͹Ÿ¹Í',2454,2454),('àÊÇÂ',2414,2414),('áÊǧ',2430,2430),('Áéǹáµé',1557,1557),('ÃÊÊØ€¹žì',1641,1641),('âÊÌÊ',2440,2440),('ÃÈÑ¡ŽÔì',1640,1640),('ÁËÒÃÒª',1559,1559),('àÊÒÇÅѡɳì',2420,2420),('àÊÒÇ€¹žì',2415,2415),('àÊÒdzÕ',2416,2416),('àÊÒdzÕÂì',2417,2417),('àÊÒǹÕÂì',2419,2419),('àÊÒǹԵÂì',2418,2418),('áËÅÁ·Í§ÊË¡ÒÃ',2456,2456),('àÊ¡ÊÃÃ',2405,2405),('àÊ¡ÊÃÀì',2406,2406),('áʧÃÐÇÕ',2424,2424),('Âè§àΧÇѲ¹Ò¡ÒßÔÁŸì',1598,1598),('áʧàŽ×͹',2422,2422),('áʧªÑÂ',2421,2421),('áʧ·Í§',2423,2423),('àʶÕÂÃ',2407,2407),('áʹÃÑ¡',2428,2428),('áʹÂÒ¡Ã',2427,2427),('áʹÀŸ',2426,2426),('àʹËì',2408,2408),('áÊ¹ÊØ¢',2429,2429),('àʹÕÂì',2409,2409),('áʹ·ÇÕà·ç¡«ìä·Åì',2425,2425),('àÍ.àš.ŸÅÒÊ·ì',2676,2676),('âÍàÃÕÂÅ·ÍÅ ¿ØéŽ',2716,2716),('áÍÃì«Õ à¿Ã· ¿ÍÃìàÇÔŽàµÍÃì',2712,2712),('áÍÃìŸÕàŸÔÅÍÔ¹àµÍÃì๪Ñè¹á¹Å',2713,2713),('ÃÍÂÑÅàÍ繚Ôà¹ÕÂÃÔè§',1642,1642),('àÍàªÕÂàÊÃÔÁ¡ÔšÅÔÊ«Ôè§',2687,2687),('àÍçÁ .«Õ.ŸÕÅÔÊ«Ôè§',2690,2690),('àÍçÁ «Õ ÍÐâ¡Ãà€ÁÕ€ÍÅ',2691,2691),('àÍçÁ.àÍçÁ.«Õ.â»ÅÔàÁÍÃì',2693,2693),('àÍçÁ.«Õ.ŸÕ. ÅÔÊ«Ôè§',2692,2692),('àÍçÁ«ÕÊÂÒÁ âÅšÕʵԀÊì',2694,2694),('âÍÇÍÐËÅÑèŸÒÃì·à«ç¹àµÍÃì',2717,2717),('àÍç¡«Õà«ÅàŹ¿ÍÃìÁ',2678,2678),('àÍçª àÍçÁ «Õ â»ÅÕàÁÍÃì',2684,2684),('àÍçª.àÍçÁ.«Õ.â»ÅÔàÁÍÃì',2685,2685),('àÍçª.àÍçÁ.«Õ.â»ÅÕàÁÍÃì (ºš¡.)',2686,2686),('àÍç¹ ŽÕ à€ (»ÃÐà·Èä·Â)',2688,2688),('àÍÊ àÍÊ à€ ¡Å¡ÒÃ',2697,2697),('àÍÊ àš ŸÅÒÊ·ì á͹Žì ៀ',2695,2695),('àÍÊ ŸÕ Ê᡹',2696,2696),('àÍÊ.àÍçÁ.ÇÕ ÊË¡ÒÃ',2701,2701),('àÍÊ.àÍÊ.à€ ¡Å¡ÒÃ',2702,2702),('àÍÊ.àÍÊ.à€.¡Å¡ÒÃ',2703,2703),('àÍÊ.àÍÊ.ÍÔ¹¡Íµ ÍÅÙÁÔà¹ÕÂÁ1999',2704,2704),('àÍÊ.à€.ÍÕ.',2698,2698),('àÍÊ.«Õ.ŸÕ.ៀ',2699,2699),('àÍÊ.ŸÕ.¹ÔµµÔé§',2700,2700),('áÍÊષŸÅÑÊ',2715,2715),('àÍÊÇÕ¹Ô··Ñ¹ŸÃÔ«ÔªÑè¹',2705,2705),('áÍÅ¿èÒ â»Ãà«Ê«Ôè§',2714,2714),('àÍ¡ÃÒª',2679,2679),('àÍ¡ÃÔ¹·Ãì',2680,2680),('àÍ¡ÊÔ·žÔì',2681,2681),('àÍ¡ÍÃö',2683,2683),('à͡͹ѹµì',2682,2682),('àÍ¡ªÑÂ',2677,2677),('àΧàšÃÔ­ªÑ ¡ÃØê» ÍÔ¹ŽÑÊàµÃÕÂÅ',2725,2725),('ÂÍŽàŸªÃ',1600,1600),('á͹¹Ò',2709,2709),('á͹¹ÒÃÕ',2710,2710),('áͺºÕà€ÃÊ·ì(»ÃÐà·Èä·Â)',2711,2711),('àÍ¿ ÍÕ «Ô€ÅÔ€ (¡Ãاෟ)',2689,2689),('àÍ×éÍÁŸÃ',2707,2707),('àÍ×éÍÍÒÃÕ',2708,2708),('àÍ×é͟ѹžØì',2706,2706),('ÃÑÈÁÕ',1674,1674),('ÃÑÈÁÕÀÑÊÊÃ',1675,1675),('ÀÑÊÇÃó',1511,1511),('ÀÑÊÅÔ¹',1510,1510),('ÁÑÅÅÔ¡Ò',1564,1564),('ÃÑ¡ÈÑ¡ŽÔì',1649,1649),('ÃÑ¡ÉÔµÀÑ·Ã',1650,1650),('ÀÑ¡ŽÕ',1498,1498),('ÃÑ¡ŽÕ',1648,1648),('ÀÑ€šÔÃÒ',1499,1499),('ÃѧÊÃÀì',1651,1651),('ÃѧÊѹµì',1652,1652),('ÃѧÊÔÁÒ',1653,1653),('Áѧ¡Ãä·ÂʵÕźÒÃì',1561,1561),('ÃѪà¡ÅéÒ',1654,1654),('ÃѪ®Ò',1655,1655),('ÃѪ®ÒŸÃ',1656,1656),('ÃѪŽÒ',1657,1657),('ÃѪ¹Õ',1658,1658),('ÃѪ¹Õ¡Ã',1659,1659),('ÃѪ¹ÕŸÃ',1660,1660),('ÃÑ°ÊØŽÒ',1662,1662),('ÃѰŸ§Éì',1661,1661),('Àѳ±ÔÃÒ',1500,1500),('Áѳ±¹Ò',1562,1562),('ÃѵÔÂÒ',1672,1672),('ÃѵÔÂÒÀóì',1673,1673),('Ãѵ³Ò',1663,1663),('ÃѵµÔÂÒ',1665,1665),('ÃѵµªÑÂ',1664,1664),('Ãѵ¹Àóì',1667,1667),('Ãѵ¹Á³Õ',1668,1668),('Ãѵ¹Ò',1669,1669),('Ãѵ¹ÒÀóì',1671,1671),('Ãѵ¹ÒŸÃ',1670,1670),('Ãѵ¹ªÑÂ',1666,1666),('ÀÑ·ÃÀÃ',1505,1505),('ÀÑ·ÃÃѧÊÕ',1506,1506),('ÀÑ·ÃÒÀóì',1508,1508),('ÀÑ·ÃÔ¹·Ãì',1509,1509),('ÀÑ·ÃÄŽÕ',1507,1507),('Àѷ÷ÔÃÒ',1501,1501),('ÀѷßÃ',1503,1503),('ÀѷßÅ',1504,1504),('Àѷß§Èì',1502,1502),('ÁÑ·¹Ò',1563,1563),('Âѹ áÍÅ à€âÂÊ',1601,1601),('ÃÒàÁÈÃì',1681,1681),('ÁÒÃÔÉÒ',1572,1572),('ÃÒÂÕ¹',1682,1682),('ÃÒહ',1678,1678),('ÀÒÃŽÕ',1521,1521),('ÀÔÃŽÕ',1531,1531),('ÁÒ⹪³ì',1570,1570),('ÁÒâ¹·',1571,1571),('ÀÒÇÔ³Õ',1524,1524),('ÀÒÇÔ¹',1525,1525),('ÀÒÇÔ¹Õ',1526,1526),('ÀÒǹÒ',1522,1522),('ÀÒǟѹž¹ì',1523,1523),('ÀÒÉÔµÒ',1527,1527),('ÂÔè§ÇÃó',1602,1602),('ÁÔÅàŹà¹ÕèÂÁ âÍ.àÍ 2000',1578,1578),('ÁÒÅÑÂ',1573,1573),('ÁÒÅÕ',1575,1575),('ÁÒÅÕÇÃó',1576,1576),('ÁÒÅÔ¹Õ',1574,1574),('ÀÒ¡Ã',1512,1512),('ÀÒ€ÀÙÁÔ',1513,1513),('ÀÔšÔµÃÒ',1528,1528),('ÁÒªÍÃì¡ÇÒ¹',1565,1565),('ÃҪѹÂì',1676,1676),('ÃÒªÒÍÙªÔâ¹',1677,1677),('ÀÔ­â­',1530,1530),('ÀÔ­­ŸÑ¡µÃì',1529,1529),('ÀÒ³Õ',1514,1514),('ÁÒ³Õ',1566,1566),('ÃÒ³Õ',1679,1679),('ÀÒ³Ø',1515,1515),('ÀÒ³ØÇÃó',1517,1517),('Àҳ؟Å',1516,1516),('ÃÒµÃÕ',1680,1680),('ÁÔµ·ÔÃÒ',1577,1577),('ÁÒ¹Ð',1568,1568),('ÁÒ¹ÔµÂì',1569,1569),('ÁÒ¹Ÿ',1567,1567),('ÀÒ¹ØÇѲ¹ì',1518,1518),('ÀÒ¹ØÇѵÃ',1519,1519),('ÀÒŸÃ',1520,1520),('ÁÕŸÅ',1579,1579),('ÀÙÃÔÇÃò¡ì',1535,1535),('ÀÙÁÔ°Ò¹',1533,1533),('ÀÙÃÔŸ§Èì',1534,1534),('ÂÙà¹Õè¹á¡êÊá͹ŽìàÅÁÔ€ÑÅÊì',1621,1621),('ÀÙàºÈ',1532,1532),('ÃÙàºÕÂÍØµÊÒË¡ÃÃÁ',1701,1701),('ÁÙËÐÁÐŽ×ÍàÃÐ',1582,1582),('ÀÙÉÔµ',1536,1536),('ÂÙ¹ÔÅÕàÇÍÃì ä·Â âÎÅŽÔé§Êì',1618,1618),('ÂÙ¹ÔÅÕàÇÍÃìä·Â âÎÅŽÔé§Êì',1619,1619),('ÂÙ¹Õ€ ÍÍÃì€ÔŽ',1620,1620),('âÅËСԚʵÕÅ',1744,1744),('àÅÍÊÃÀì',1739,1739),('àÅÍÈÑ¡ŽÔì',1738,1738),('àÅÍÊØ¢',1740,1740),('àÅͪÑÂ',1737,1737),('àÅÔÈÈÑ¡ŽÔì',1742,1742),('àÅÔÈÊÒÁÒö âžÒ',1743,1743),('àÅÔȪÑÂ',1741,1741),('ÁÅÄŽÕ',1556,1556),('â¡àÁÈ',206,206),('â¡àÇȹì',211,211),('à¡ÃÕ§§ÍÔ¹àµÍÃì๪Ñè¹á¹Å',179,179),('à¡ÃÕ§ÈÑ¡ŽÔì',180,180),('à¡ÃÕ§ä¡Ã',177,177),('à¡ÃÕ§ªÑÂ',178,178),('à¡ÃÔ¡',174,174),('à¡ÃÔ¡ä¡Ã',175,175),('à¡ÃÔ¡Ÿ§Éì',176,176),('Á¡Ãҹѹ·ì',1537,1537),('â¡Áşѹžì',205,205),('â¡ÇÔ·',208,208),('â¡ÇÔ·Âì',209,209),('â¡ÇÔ¹',210,210),('à¡çšŸÔÃØ³',170,170),('à¡ÉÁ',190,190),('à¡ÊÃ',196,195),('à¡ÉÁÊѹµì',191,191),('à¡ÊÃì',195,196),('à¡ÈÃÒ',182,182),('à¡ÉÃÒ',192,192),('à¡ÉÃÕ',193,193),('à¡ÈÃÔ¹·Ãì',183,183),('á¡éÇ',203,203),('á¡éÇãš',204,204),('à¡ÈÇÅÕ',184,184),('à¡ÈÈÔÃÔ',185,185),('à¡ÈÊØŽÒ',186,186),('à¡ÉÕÂÃ',194,194),('à¡ÈÔ¹Õ',187,187),('â¡ÊÔ¹·Ãì',213,213),('â¡ÈÅ',212,212),('à¡È¡ØÅÀÒ',181,181),('à¡É³Õ',188,188),('à¡ÉŽÒ',189,189),('à¡ÕÂõÔ',197,197),('à¡ÕÂõÔÊÇÑÊŽÔì',201,201),('à¡ÕÂõÔÈÑ¡ŽÔì',200,200),('à¡ÕÂõԻÀÒ',198,198),('à¡ÕÂõԟ§Éì',199,199),('â¡ÅºÍÅ €Í¹à¹ç€ªÑè¹Êì',207,207),('ࡪÒ',171,171),('ࡳԡÒ',172,172),('ࡵØÁ³Õ',173,173),('à¡×éÍ¡ÙÅ',202,202),('á¢ä¢',235,235),('à€ ÊËÒÂÍÔÁà»ê¡«ì',262,262),('à€.«Õ.ŸÕ. áÁªªÕ¹à¹ÍÃÕè',263,263),('â€Ãà¹Ê (ä·ÂᏎì)',270,270),('à€Ã×ÍÇÑÅÂì',267,267),('á€ÐšéÍÂ',269,269),('à€·Õ·ÕÅÔÊ«Ôè§',264,264),('à€¹ áÁç¡«ì (»ÃÐà·Èä·Â)',266,266),('à€¹ áÁ¡«ì (»ÃÐà·Èä·Â)',265,265),('္¹Ù ÍÔ¹àµÍÃìà·ÃŽ',268,268),('âŠÉÔµ',271,271),('Â§ÂØ·ž',1597,1597),('à§Ô¹·Ø¹à¡ÕÂõԹҀԹ',274,274),('Á§¡Ø®Ãѵ¹ì',1538,1538),('Á§€Å',1539,1539),('Á§€Å¡Òûѡ',1540,1540),('àšÃÕ§',409,409),('àšÃÔ­',407,407),('àšÃÔ­ªÑÂËÁéÍá»Å§ä¿¿éÒ',408,408),('ášèÁ',414,414),('ãšÊÇÇÀì',415,415),('àšéÒŸÃÐÂÒÁÒÃì€',411,411),('àšÉ®Ò',410,410),('àšÕÂÁšÔµ',413,413),('àšÔÁªÑÂ',412,412),('àšµ¹ì',401,401),('àš¹',402,402),('àš¹à¹ÍÃÑÅ乫ì (»ÃÐà·Èä·Â)',405,405),('àš¹ÇÔ·Âì',406,406),('Ú¹Ò',1631,1631),('àš¹šÔÃÒ',403,403),('àš¹µì³Ã§€ì',404,404),('â©ÁÊØŽÒ',436,436),('â©ÁÅŽÒ',435,435),('à©Ô¹',434,434),('à©ÅÔÁ',428,428),('à©ÅÕÂÇ',433,433),('à©ÅÔÁ¢ÇÑ­',429,429),('à©ÅÔÁªÑÂ',430,430),('à©ÅÔÁªÒµÔ',431,431),('à©ÅÔÁŸÑ¹žØì',432,432),('àªÉ°Ò',555,555),('àªÍÃÔè§-ŸÅÒÇ á͹ÔÁÑÅ àÎéŪ',556,556),('àªÍÃÔè§-ŸÅÒÇá͹ÔÁÑÅàÎçÅž',557,557),('àªÕ§àΧ¡ÒêèÒ§',563,563),('àªÒÇÅÔµ',559,559),('àªÒǹҭ',558,558),('àªÕèÂǪҭ ÍÔ¹ŽÑÊ·ÃÕè (1989)',564,564),('àªÕèÂǪҭÍÔ¹ŽÑÊ·ÃÕ (1989)',565,565),('àªÕèÂǪҭÍÔ¹ŽÑÊ·ÃÕè (1989)',566,566),('àªÕèÂǪҭÍÔ¹ŽÑÊ·ÃÕè(1989)',567,567),('àªÔŽÈÑ¡ŽÔì',562,562),('àªÔŽšÔµµì',560,560),('àªÔŽªÑÂ',561,561),('⪀',568,568),('⪀ªÑÂ',569,569),('ય°¡Ã',554,554),('⪵Ô',570,570),('⪵ÔÃÊ',571,571),('⪵ÔÇØž',572,572),('à«ÕÂÁà¡ÕÂÇ',589,589),('à«ÒÐ',588,588),('óç€ì',1632,1632),('Á³à±ÕÂÃ',1546,1546),('Á³ÕÃѵ¹ì',1547,1547),('Á³°ÔŽÒ',1541,1541),('Á³±Ò',1545,1545),('Á³±ÅÕ',1544,1544),('Á³±¹ì¡Ò­š¹ì',1542,1542),('Á³±¹Ôš',1543,1543),('âŽÁ',708,708),('àŽÍЀÇÍÅÔµäÇÃì',705,705),('ÃŽÒ',1633,1633),('àŽª',703,703),('àŽªÒ',704,704),('àŽ×͹àŸç­',707,707),('àŽ×͹¹ÀÒ',706,706),('àµçÁàŽª',720,720),('ãµé à«é§ «Ñ¹',723,723),('àµ×͹ãš',721,721),('àµ×͹µÒ',722,722),('à¶ÅÔ§ÈÑ¡ŽÔì',734,734),('à·ÇÒ',802,802),('à·ÇÕ',803,803),('à·ÔŽä·',804,804),('à·Ÿ',799,799),('à·ŸÄ·žÔì',801,801),('à·ŸŸÔºÙÅ',800,800),('Á¹ÑÊ',1550,1550),('Á¹ÑÊÇÕ',1551,1551),('à¹ÒÇÃѵ¹ì',1043,1043),('ùԮ°Ò',1634,1634),('Á¹Ù­',1552,1552),('Á¹µÃÕ',1549,1549),('๵ÎÒÇ',1042,1042),('Á¹µìªÑÂ',1548,1548),('àºç­ÇÃó',1117,1117),('àºç·à·ÍÃì äÅ¿ì',1118,1118),('ອšÁÒ',1114,1114),('ອšÇÃó',1116,1116),('ອšÅÑ¡É³ì ŸÃÔé¹µÔé§',1115,1115),('ອšŸÃ',1113,1113),('à»ÃÁ',1265,1265),('à»ÃÁÈÃÕ',1268,1268),('à»ÃÁÊÔ·žÔì',1269,1269),('à»ÃÁÄŽÕ',1267,1267),('à»ÃÁ»ÃÐÀÒ',1266,1266),('à»à»ÍÃìÅÔ¿',1264,1264),('à»ÕèÂÁÊØ¢',1270,1270),('á»Å¹âÁ·Ô¿',1271,1271),('àŒÔ§',1291,1291),('àŒŽçš',1290,1290),('áŸÃÇ',1475,1475),('áŸÃÇÒ',1476,1476),('àŸÃÔÁàÁ¹¹Ôª ÍâÃáÁµÔê¡Êì ŸÕ·ÕÍÕ ÅÔÁÔàµçŽ',1468,1468),('àŸç§ ¿Ù ËÅÔ¹',1456,1456),('àŸçªÃì',1457,1457),('àŸç­ÈÃÕ',1467,1467),('àŸç­šÑ¹·Ãì',1461,1461),('àŸç­·ÔŸÂì',1462,1462),('àŸç­¹ÀÒ',1463,1463),('àŸç­»ÃÐÀÒ',1464,1464),('àŸç­Œ¡Ò',1465,1465),('àŸç­ŸÔäÅ',1466,1466),('ßÕÀÑ·Ã',1637,1637),('àŸÕ§ŸÃ',1471,1471),('ß՟Ã',1635,1635),('ß՟Ѳ¹ì',1636,1636),('àŸÅԹĎÕ',1470,1470),('àŸÅÔ¹šÔµµì',1469,1469),('àŸªÃÃѵ¹ì',1458,1458),('àŸªÃÔ¹·Ãì',1460,1460),('àŸªÃÅŽÒ',1459,1459),('៎ŽÔé§ (ä·ÂᏎì)',1472,1472),('៎ŽÔé§(ä·ÂᏎì)',1473,1473),('៹ŽéÒ à»à»ÍÃì €ÒÃìµÑ¹Ê',1474,1474),('á¿ÃìàÇÂì ÍÔ¹àµÍÃì๪Ñè¹á¹Å',1495,1495),('á¿Ã§€ì',1494,1494),('Ã×è¹ÇÃÒËì',1683,1683),('ÂØÀÒÀóì',1615,1615),('ÂØÀÒŸÃ',1614,1614),('ÂØÇÃÕ',1617,1617),('ÂØÇŽÕ',1616,1616),('ÃØËйÒ',1700,1700),('ÃØé§',1684,1684),('ÃØè§âÚ¹ì',1693,1693),('ÃØè§âڹ좹Êè§',1694,1694),('ÃØè§àÃ×ͧ',1692,1692),('ÃØè§ÃÑÈÁÕ',1691,1691),('ÃØè§ÃѪ¹Õ',1689,1689),('ÃØè§Ãѵ¹ì',1690,1690),('ÃØè§àŸªÃ',1688,1688),('ÃØè§ÇÔ·Âì',1696,1696),('ÃØè§ÍÃØ³',1697,1697),('ÃØé§ÅÒÇÃó',1695,1695),('ÃØè§·ÔÇÒ',1686,1686),('ÃØè§·ÔŸÂì',1685,1685),('ÃØè§¹ÀÒ',1687,1687),('ÁØ¢',1580,1580),('ÂØ€ÅŸÃ',1603,1603),('ÃØšÒ',1698,1698),('ÃØšÒÀÒ',1699,1699),('ÂØŽÒ',1604,1604),('ÁØ·ÔµÒ',1581,1581),('ÂØ·žÂ§',1607,1607),('ÂØ·ž¹Ò',1605,1605),('ÂØ·ž¹ÒÇÕ',1606,1606),('ÂØžÒÁÒµÂì',1608,1608),('ÂØ¹â¡Ð',1609,1609),('ÂØŸÒ',1610,1610),('ÂØŸÒÇŽÕ',1612,1612),('ÂØŸÔ¹',1613,1613),('ÂØŸÒŸÃ',1611,1611),('ÇÃÃѪ',1792,1792),('ÇÃÁÅ',1768,1768),('ÇÃóÀóì',1785,1785),('ÇÃóÀÒ',1786,1786),('ÇÃóÀŸ',1784,1784),('ÇÃóàŸç­',1783,1783),('ÇÃóǎÕ',1787,1787),('ÇÃóÈÔÃÔ',1788,1788),('ÇÃóìŽÕ',1773,1774),('ÇÃóÒ',1789,1789),('ÇÃóÕ',1790,1790),('ÇÃóšÔµ',1770,1770),('ÇÃóªÑÂ',1771,1771),('ÇÃó±¹Ò',1772,1772),('ÇÃóŽÕ',1774,1773),('ÇÃó·¹Ò',1775,1775),('ÇÃó·¹Õ',1776,1776),('ÇÃóžÁÅ',1778,1778),('ÇÃóž³Õ',1777,1777),('ÇÃó¹ÀÒ',1779,1779),('ÇÃó¹ÒÃÕ',1780,1780),('ÇÃóŸÃ',1781,1781),('ÇÃóŸÒ',1782,1782),('ÇÃà·Ÿ',1762,1762),('ÇÃÞ¹Ò',1791,1791),('ÇÃÂØ·žì',1769,1769),('ÇÃÇÃó',1794,1794),('ÇÃÇÃÞ¹ì',1795,1795),('ÇÃÇѲ¹ì',1796,1796),('ÇÃÇÔÀÒ',1797,1797),('ÇÃÑ­žÃ',1798,1798),('ÇÃÒ',1799,1799),('ÇÃÒÀóì',1803,1803),('ÇÃÒÃѵ¹ì',1804,1804),('ÇÃÔÁÒ',1810,1810),('ÇÃÕÇÃó',1812,1812),('ÇÃÒÇØ²Ô',1806,1806),('ÇÃÒÇØž',1807,1807),('ÇÃÔÈÃÒ',1811,1811),('ÇÃÒÅѡɳì',1805,1805),('ÇÃÒ§Ãѵ¹ì',1801,1801),('ÇÃÒ§€³Ò',1800,1800),('ÇÃÔ¹·Ãì',1808,1808),('ÇÃÔ¹žÃ',1809,1809),('ÇÃÒŸÃ',1802,1802),('ÇÃÅѡɳì',1793,1793),('ÇáÒÃ',1758,1758),('ÇêÑÂ',1759,1759),('ÇêҵÔ',1760,1760),('ÇÃŽÔɰì',1761,1761),('ÇÞѹÂì',1763,1763),('Çùت',1764,1764),('ÇßÅ',1767,1767),('Çß§Éì',1765,1765),('Çßš¹ì',1766,1766),('ÇÃØ³',1813,1813),('Çèͧ',1819,1819),('ÇÊѹµì',1817,1817),('ÇÈÔ³Ò',1815,1815),('ÇÈÔ¹',1816,1816),('ÇÊØ',1818,1818),('CHEE KUNG FOOK',18,18),('CHEN CHIA YI',19,19),('CHI WAI DAVIT',20,20),('ÇÑʹÑÂ',1843,1843),('ÇÑÈŸÅ',1842,1842),('ÇÑÅÅÀ',1839,1839),('ÇÑÅÅÀÒ',1840,1840),('ÇÑÅÅÒÀÒ',1841,1841),('ÇѪÃÐ',1822,1822),('ÇѪÃÑ­­Ò',1823,1823),('ÇѪÃÕ',1825,1825),('ÇѪÃÔ¹·Ãì',1824,1824),('ÇѪáÃ',1820,1820),('ÇѪßÅ',1821,1821),('ÇѲ¹Ð',1826,1826),('ÇѲ¹Ò',1827,1827),('ÇѹÃѪŽÒ',1836,1836),('Çѹà©ÅÔÁ',1828,1828),('ÇѹàŸç­',1835,1835),('ÇѹÇÔÊÒ¢ì',1837,1837),('ÇѹʶÒ',1838,1838),('ÇѹªÑÂ',1829,1829),('ÇѹªÒµÔ',1830,1830),('ÇѹŽÕ',1831,1831),('Çѹ·¹Ò',1832,1832),('Çѹ·¹Õ',1833,1833),('Çѹ·¹ÕÂì',1834,1834),('ÇÕ àÍÊ à¹à¹ÍÃÑÅ à€Á',1916,1916),('ÇÔÃÁÅ',1886,1886),('ÇÔâÚ¹ì',1889,1889),('ÇÕÃ⪵Ô',1921,1921),('ÇÕÃàŽª',1922,1922),('ÇÕÃÂØ·Âì',1925,1925),('ÇÕÃÇÃó',1926,1926),('ÇÕÃÐ',1929,1929),('ÇÕÃÐàŽª',1933,1933),('ÇÕÃÐÂØ·žì',1936,1936),('ÇÕÃÐÇÃó',1937,1937),('ÇÕÃÐÇѲ¹ì',1938,1938),('ÇÕÃÐÈÑ¡ŽÔì',1939,1939),('ÇÕÃЪÑÂ',1930,1930),('ÇÕÃЪÒÂ',1932,1932),('ÇÕÃЪҵÔ',1931,1931),('ÇÕÃПÅ',1935,1935),('ÇÕÃП§Éì',1934,1934),('ÇÕÃÈÑ¡ŽÔì',1927,1927),('ÇÕÃÊÔ·žÔì',1928,1928),('ÇÔÃѪ',1887,1887),('ÇÔÃѵ¹ì',1888,1888),('ÇÒÃÕ',1849,1849),('ÇÔÀÒ',1875,1875),('ÇÕÃÒÀóì',1940,1940),('ÇÔÀÒÃѵ¹ì',1879,1879),('ÇÔÀÒÊ',1881,1881),('ÇÔÀÒɳÕÂì',1880,1880),('ÇÔÀҡóì',1876,1876),('ÇÔÀÒ€',1877,1877),('ÇÒÃÔª',1848,1848),('ÇÔÀÒŸÃó',1878,1878),('ÇÔÀÙÉÔµ',1882,1882),('ÇÔÁÅ',1883,1883),('ÇÔÁÅÇÃó',1885,1885),('ÇÔÁÅŸÃ',1884,1884),('ÇÔàªÉ°',1863,1863),('ÇÕêÑÂ',1920,1920),('ÇÔàªÕÂÃ',1864,1864),('ÇÕßÅ',1924,1924),('ÇÕß§Èì',1923,1923),('ÇÒÃØ³Õ',1850,1850),('ÇÔÇ',1901,1901),('ÇÔÇÃÞ¹ì',1902,1902),('ÇÔÇѲ¹ì',1903,1903),('ÇÔÇѲ¹ìªÑÂ',1904,1904),('ÇÔÉÃØš¹ì',1910,1910),('ÇÔÈÃØµ',1906,1906),('ÇÔÈÔÉ®ì',1908,1908),('ÇÔÈÔɰì',1909,1909),('ÇÔÈÒÅ',1907,1907),('ÇÔÊÔ°ÈÑ¡ŽÔì',1911,1911),('ÇÔÊÔ·žÔì',1912,1912),('ÇÔÊÙµ',1915,1915),('ÇÒʹÒ',1851,1851),('ÇÔȹÕ',1905,1905),('ÇÔÊØ·žÔ',1914,1913),('ÇÔÊØ·žÔì',1913,1914),('ÇÔÅÇѳÂì',1890,1890),('ÇÔÅÒÇÃó',1891,1891),('ÇÔÅÒÇÑÅÂì',1893,1893),('ÇÔÅÒÇѳÂì',1892,1892),('ÇÔÅÒÊÔ¹Õ',1894,1894),('ÇÔÅÔµ',1895,1895),('ÇÔäÅ',1896,1896),('ÇÔäÅÃѵ¹ì',1898,1898),('ÇÔäÅÇÃó',1900,1900),('ÇÔäÅÅѡɳì',1899,1899),('ÇÔäÅŸÃ',1897,1897),('ÇÔ€Á',1853,1853),('ÇÔ€µÍÃÕè âŸÃà¡Ã·',1852,1852),('ÇÔšÔÃÒ',1856,1856),('ÇÔšÒóì',1854,1854),('ÇÔšÔµÃ',1855,1855),('ÇÔªÑÂ',1859,1859),('ÇÔªÒ­',1860,1860),('ÇÔªÔµ',1861,1861),('ÇÔªªÒ',1857,1857),('ÇÔª­ÐÃØš',1858,1858),('ÇԪ؎Ò',1862,1862),('ÇÕ«èÒ (2000)',1917,1917),('ÇÔ­­ØŽÒ',1865,1865),('ÇÔ±ÙÅÂì',1866,1866),('ÇÒ³Õ',1844,1844),('ÇÕ³Ò',1918,1918),('ÇÔ·ÂÒ',1868,1868),('ÇÔ·ÇÑÊ',1869,1869),('ÇÒ·Ôµ',1845,1845),('ÇÒ·Ô¹',1846,1846),('ÇÒ·Ô¹ÕÂì',1847,1847),('ÇÔ·ÙÃ',1870,1870),('ÇÔ·žÇѪ',1867,1867),('ÇÔ¹ÊÃÀì',1871,1871),('ÇÔ¹ÑÂ',1872,1872),('ÇÕ¹ÑÊ',1919,1919),('ÇÔ¹Ôš',1873,1873),('ÇÔºÙÅÂì',1874,1874),('ÇÅÑŸÃ',1814,1814),('ǧàŽ×͹',1745,1745),('ǧÈìÇÒµ',1749,1749),('ǧÈìÊØÀÒ',1750,1750),('ǧÈì䟱ÙÃÂì¡Ãç» º',1746,1746),('ǧÈì䟱ÙÃÂì¡ÃÙê»',1748,1748),('ǧÈì䟱ÙÃÂì¡ÃØê»',1747,1747),('ÇšÕÃѵ¹ì',1751,1751),('ǪÔÃÒÀÒ',1752,1752),('ǹÑʹѹ·ì',1754,1754),('ǹѪŸÃ',1753,1753),('ǹÒ',1755,1755),('ǹԪ',1756,1756),('ǹԎÒ',1757,1757),('ÇØ²ÔÃѵ¹ì',1948,1948),('ÇØ²Ô¡Ã',1941,1941),('ÇØ²ÔªÑÂ',1942,1942),('ÇØ²Ô¹ÑÂ',1944,1944),('ÇØ²Ô¹Ñ¹·ì',1943,1943),('ÇØ²ÔŸÅ',1947,1947),('ÇØ²ÔŸ§Èì',1945,1945),('ÇØ²ÔŸš¹ì',1946,1946),('Ê ÍÒŽ',2054,2054),('Ê.͹ѹµìàÍ繚Ôà¹ÕÂÃÔè§ á͹€Í¹ÊµÃÑ€ªÑè¹',2055,2055),('ÊÁ',2078,2078),('ÊÁÃ',2113,2113),('ÊÃÃàÊÃÔ°­',2142,2142),('ÊÁâÀª¹ì',2108,2108),('ÊÁâÁ·',2111,2111),('ÊÁÂÈ',2112,2112),('ÊÁÃÑ¡Éì',2114,2114),('ÊÁÁÒö',2109,2109),('ÊÁÁÒȹì',2110,2110),('ÊÁà¡ÕÂõÔ',2080,2080),('ÊÁãš',2088,2088),('ÊÁ⪀',2093,2093),('ÊÁàŽª',2095,2095),('ÊÁÀŸ',2107,2107),('ÈÃÇÑÅÂì',1959,1959),('ÊÁǧÉì',2119,2119),('ÊÁÈÃÕ',2120,2120),('ÊÁËÁÒÂ',2126,2126),('ÊÁËÇѧ',2127,2127),('ÊÁÈÑ¡ŽÔì',2121,2121),('ÊÁÈÔÃÔ',2122,2122),('ÊÁË­Ô§',2125,2125),('ÊÁÊØ¢',2123,2123),('ÊÁÊØ¹ÕÂì',2124,2124),('ÊÁÑÂ',2128,2128),('ÈÃÑ­­Ò',1960,1960),('ÊÃÑ­­Ò',2143,2143),('ÈÃѳÂì',1962,1962),('ÈÃѳŸÃ',1961,1961),('ÊÂÒÁ',2133,2133),('ÊÂÒÁàÁŠÕâŸÅÕàÁÍÃì',2139,2139),('ÊÂÒÁÂÙ¹Ôâ«Å',2140,2140),('ÈÃÕÃѵ¹ì',1977,1977),('ÈÃÕÀÒ',1976,1976),('ÈÃÒÁÒÈ',1963,1963),('ÈÂÒÁÅ',1957,1957),('ÊÂÒÁäŽà€ÕÂÇ',2136,2136),('ÊÂÒÁ€Í¹àÇàÂÍÃì',2134,2134),('ÊÂÒÁªÑÂâŸÅÕàÁÍÃì',2135,2135),('ÊÂÒÁ¹ÔÊÊѹ ÍÍâµéâÁºÔÅ',2137,2137),('ÊÂÒÁŸÃà·ÃŽà«ç¹àµÍÃì',2138,2138),('ÈÃÕàŸç­',1975,1975),('ÊÃÒÂØž',2146,2146),('ÈÃÕÇÑš¹Ò',1978,1978),('ÈÃÕÇѲ¹Ò',1979,1979),('ÈÃÕÇÔ¡Ò',1980,1980),('ÈÃÒÇØ²Ô',1964,1964),('ÊÃÒÇØ²Ô',2147,2147),('ÈÃÒÇØž',1965,1965),('ÊÃÒÇØž',2148,2148),('ÈÃÕÊÁÃ\nÈÃÕÊÁÃ',1984,1983),('ÈÃÕÊÁÃ',1983,1984),('ÈÃÕÈÑ¡ŽÔì',1981,1981),('ÈÃÕÊ¡ØÅ',1982,1982),('ÈÃÕÊØÇÃó€Í¹àÇàÂÍÃìàºÅ·ì á͹Žì ÃѺàºÍÃì',1985,1985),('ÈÃÕÍÓŸÅÍØµÊÒË¡ÃÃÁ',1987,1987),('ÈÃÕ͹§€ì',1986,1986),('ÊÃÒ¡Ã',2144,2144),('ÈÃ՚ѹ·Ãì',1967,1967),('ÈÃ՚ѹ·ÃÒ',1968,1968),('ÊÃÒ­šÔµ',2145,2145),('ÈÃշͧà¹ÁàŸÅ·',1969,1969),('ÈÃÕ·Í§ÍØµÊÒË¡ÃÃÁ«ÑŸŸÅÒÂ',1970,1970),('ÊÁÔ·žÔ',2131,2130),('ÊÁÔ·žÔì',2130,2131),('ÊÁÒ¹',2129,2129),('ËÃÔ¹',2446,2446),('ÊÃÔ¹ÃÒ',2149,2149),('ÈÃÕ¹ÇÅ',1971,1971),('ÈÃÔ¹·Ãì',1966,1966),('ÈÃÕ»ÃÐÀÒ',1973,1973),('ÈÃÕ»ÃÐäŸ',1972,1972),('ÈÃÕŸ§Éì',1974,1974),('ÈÁÅÇÃó',1956,1956),('ÊÁÅѡɳì',2118,2118),('ÊàÅ€·ì¿ÍÃìÁà¿ÍÃì¹ÔàšÍÃìáÅкصÃ',2152,2152),('ÊÁÄŽÕ',2115,2115),('ÊÁÄ·ÑÂ',2117,2117),('ÊÁÄ·žÔì',2116,2116),('ÊÁ¡ÁÅ',2079,2079),('ÊÁ€ÇÃ',2081,2081),('ÊÁ€ÔŽ',2082,2082),('ÊÁšÔµ',2083,2083),('ÊÁšÔµÃ',2086,2085),('ÊÁšÔµÃì',2085,2086),('ÊÁšÔµµì',2084,2084),('ÊÁšÔ¹µ¹Ò',2087,2087),('ÈêÑÂ',1958,1958),('ÊÁªÑÂ',2089,2089),('ÊÁªÒÂ',2092,2092),('ÊÁªÒ­',2090,2090),('ÊÁªÒµÔ',2091,2091),('ÊÁŽÕ',2094,2094),('Êáµ¹ŽÒÃìŽ ªÒÃìàµÍÃì (»ÃÐà·Èä·Â)',2066,2066),('ÊÁ·Ã§',2096,2096),('ÊÁ¹Ö¡',2097,2097),('ÊÁºÑµÔ',2098,2098),('ÊÁºÙóì',2100,2100),('ÊÁºØ­',2099,2099),('Êà»ç€ àŽç¹ µÑÅ áź',2076,2076),('ÊÁ»Í§',2101,2101),('Ê໫€ÍÁ',2077,2077),('ÊÁŸÃ',2104,2104),('ÊÁŸÔÈ',2106,2106),('ÊÁŸÅ',2105,2105),('ÊÁŸ§Éì',2102,2102),('ÊÁŸš¹ì',2103,2103),('ÊÂØÁŸÃ',2141,2141),('ÊÃØš',2150,2150),('ÊÁتªÅ',2132,2132),('ÊÇÑÊŽÔì',2154,2154),('ÊÇÕâÚ¹ì',2155,2155),('ÊÇÕÇÃó',2156,2156),('ËÇÒ¹',2448,2448),('ÊÇÅѡɳì',2153,2153),('Êзé͹',2161,2161),('ÈÈÁÅ',1989,1989),('ÊËà¡ÕÂõÔâÅËÐà¡ÕÂõÔ',2158,2158),('ÈÈÔ',1990,1990),('ÈÈÔÀÒ',1993,1993),('ÈÈÔÁÒ',1994,1994),('ÈÈÔÇÔÁÅ',1995,1995),('ÈÈÔÉÒ',1996,1996),('ÈÈÔžÃ',1991,1991),('ÈÈÔŸÃ',1992,1992),('ÊÊԟѹžØì',2157,2157),('Êè§àÊÃÔÁ',2062,2062),('Êè§ÈÃÕ',2061,2061),('ÊËŸÅ',2159,2159),('ËÍÁšÑ¹·Ãì',2449,2449),('ÊÍÒŽ',2160,2160),('ÊÑÁÄ·žÔì',2170,2170),('ÊÑÁŸÑ¹žì',2169,2169),('ËÑÊÂÒ',2451,2451),('ËÑʹÕ',2450,2450),('ÈÑ¡ÃÔ¹·Ãì',2003,2003),('ÈÑ¡ŽÒ',1997,1997),('ÈÑ¡ŽÔì',1998,1998),('ÈÑ¡ŽÔìàªÇ§',2000,2000),('ÈÑ¡ŽÔìÇÔºÙÅÂì',2002,2002),('ÈÑ¡ŽÔìªÑÂ',1999,1999),('ÈÑ¡ŽÔìŽÒ',2001,2001),('ÊѧÇÒÅÂì',2162,2162),('ÊÑšŸ§Éì',2163,2163),('ÊÑ­ªÑÂ',2165,2165),('ÊÑ­ª¹Ò',2164,2164),('ÊÑ­­Ò',2166,2166),('ÈѹʹÕÂì',2004,2004),('ÊѹµÔ',2167,2167),('ÊѹµÔªÑÂ',2168,2168),('ÊÒÂãš',2176,2176),('ÈÔâÚ¹ì',2030,2030),('ÊÒâÚ¹ì',2188,2188),('ÊÔâÚ¹ì',2228,2228),('ÊÒâê',2189,2189),('ÊÒ¹µì',2181,2181),('ÊÒÁÀŸ',2174,2174),('ÊÓÃÇÁ',2195,2195),('ÊÓÃÇÂ',2196,2196),('ÊÒÂÊÁÃ',2183,2183),('ÈÔÃÉÒ',2007,2007),('ÊÒÂÊØ³Õ',2184,2184),('ÊÒÂÊØ¹ÕÂì',2185,2185),('ÊÒÂѳ',2186,2186),('ÊÒÂѳËì',2187,2187),('ÈÔÃÔ',2009,2009),('ÈÔÃÔÃÑš¹ì',2024,2024),('ÈÔÃÔÃѵ¹ì',2025,2025),('ÊÔÃÔÃѵ¹ì',2223,2223),('ÈÔÁÒÃÕ',2006,2006),('ÈÔÃÔÁÒ',2023,2023),('ÊÔÃÔÁÒ',2222,2222),('ÈÔÃÔâ©Á',2012,2012),('ÊÔÃÔàŽª',2214,2214),('ÊÒÁÒö',2175,2175),('ÈÔÃÔàŸç­',2022,2022),('ÈÔÃÔÇÃó',2027,2027),('ÊÔÃÔÇÃó',2225,2225),('ÊÔÃÔÇѲ¡ì',2226,2226),('ÈÔÃÔÇѲ¹ì',2028,2028),('ÊÔÃÔÇѲ¹Ò',2227,2227),('ÈÔÃÔÈÑ¡ŽÔì',2029,2029),('ÈÔÃÔÅѡɳì',2026,2026),('ÊÔÃÔÅѡɳì',2224,2224),('ÈÔÃÔ¡ØÅ',2010,2010),('ÈÔÃԚѹ·Ãì',2011,2011),('ÈÔÃÔªÑÂ',2013,2013),('ÊÔÃÔªÑÂ',2213,2213),('ÊÓÃÒ­',2197,2197),('ÈÔÃÔ·Ñȹì',2014,2014),('ÈÔÃÔžÃ',2015,2015),('ÊÔÃÔ¹Ãѵ¹ì',2216,2216),('ÈÔÃÔ¹Òö',2017,2017),('ÈÔÃÔ¹­Ò',2016,2016),('ÊÔÃÔ¹ŸÃ',2215,2215),('ÈÔÃԹت',2018,2018),('ÊÔÃÔ»ÃÐÀÒ',2217,2217),('ÈÔÃÒŸÃ',2008,2008),('ÈÔÃÔŸÃ',2020,2020),('ÊÔÃÔŸÃ',2219,2219),('ÈÔÃÔŸÃó',2021,2021),('ÊÔÃÔŸÃó',2220,2220),('ÊÔÃԟѹžì',2221,2221),('ÈÔÃÔŸ§Éì',2019,2019),('ÊÔÃÔŸ§Éì',2218,2218),('ÊÒÂÅÁ',2182,2182),('ÊÒÂä¿¿éÒä·Â-ÂÒ«Ò¡Ô',2180,2180),('ÊÒªÅ',2177,2177),('ÊÓà¹Õ§',2194,2194),('ÊÒ¹·Õ',2178,2178),('ÊÒœ¹',2179,2179),('ÈÔÇÒÀóì',2036,2036),('ÊÕÇÔ¡Ò',2231,2231),('ÊÒÇÔµÃÕ',2192,2192),('ÈÔÇÒŸÃ',2035,2035),('ÊÔÇÅÕ',2229,2229),('ÈÔÇŸÃ',2033,2033),('ÈÔÇŸÅ',2034,2034),('ÈÔÅÒ',2032,2032),('ÊÒÅÕ',2190,2190),('ÊÓÅÕ',2199,2199),('ÊÒÅÕè',2191,2191),('ÈÔÅ»ªÑÂ',2031,2031),('ÊÓÄ·žÔì',2198,2198),('ÊÒ€Ã',2171,2171),('ÊÔ§Ëì',2200,2200),('ÊÔ§ËìŸÅ',2201,2201),('ÊÔ§ËÒ',2202,2202),('ÊԵҹѹ',2203,2203),('ÊÔµÒŸÃ',2204,2204),('ÊÔ·žÒ',2205,2205),('ÊÔ·žÔàŽª',2208,2208),('ÊÔ·žÔì',2206,2206),('ÊÔ·žÔªÑÂ',2207,2207),('ÊÔ·žÔŸÃ',2209,2209),('ÊÔ·žÔŸÃó',2210,2210),('ÊÔ·žÔŸÅ',2211,2211),('ÊÒžÔµ',2172,2172),('ÊÕ¹ÇÅ',2230,2230),('Êӹѡ¹âºÒÂáÅÐጹ¡ÃاෟÁËÒ¹€Ã',2193,2193),('ÊÒ¹ÔµÂì',2173,2173),('ÈÒ¹µÔᏎì',2005,2005),('ÊÔ¹·ÇÕ',2212,2212),('ÊÅÑ¡šÔµÃ',2151,2151),('ÈÅÔÉÒ',1988,1988),('ËÄ·Â',2447,2447),('Ê¡ÒÇÃѵ¹ì',2057,2057),('Ê¡ÅÃѵ¹ì',2056,2056),('È¡ÅÇÃó',1954,1954),('˧',2441,2441),('ʧǹ',2060,2060),('ʧèÒ',2064,2064),('ʧю',2063,2063),('ʧ¡ÃÒ¹µì',2059,2059),('ʧ¡Ã³ì',2058,2058),('ÈšÕ',1955,1955),('ʎѺŸÔ³',2065,2065),('ʶÔÃÂÒ',2068,2068),('ʶҟÃ',2067,2067),('Ë·ÑÂ',2442,2442),('Ë·ÑÂÃѵ¹ì',2444,2444),('Ë·Ñ·ԟÂì',2443,2443),('ʹãš',2069,2069),('ʹͧ',2073,2073),('ʹÑè¹',2074,2074),('ʹԎÒ',2075,2075),('˹Öè§Ä·ÑÂ',2445,2445),('ʹ·ÂÒ',2070,2070),('ʹžÂÒ',2072,2072),('ʹžŸ',2071,2071),('ÈØÀÃ',2042,2042),('ÈØÀÃѵ¹ì',2043,2043),('ÈØÀÃÒÀóì',2044,2044),('ÊØÀÁÒÊ',2329,2329),('ÈØÀÁÔµÃ',2041,2041),('ÊØÃàªÉ°ì',2353,2353),('ÊØÀ⪀',2328,2328),('ÊØÃàŽª',2354,2354),('ÊØàÁž',2348,2348),('ÊØàÁžÕ¡ì',2349,2349),('ÉØÀÁ¹',2053,2053),('ÈØÀÇѲ¹ì',2046,2046),('ÈØÀÇÔ·Âì',2047,2047),('ÈØÀÈÑ¡ŽÔì',2048,2048),('ÊØÃÈÑ¡ŽÔì',2360,2360),('ÊØÃÊÔ·žÔì',2361,2361),('ÊØÀÑ€',2330,2330),('ÊØÃѪ¹Õ¡Ã',2362,2362),('ÊØÀѵÃÒ',2331,2331),('ÊØÃѵÂÒ',2367,2367),('ÊØÃѵ¹ÇŽÕ',2365,2364),('ÊØÃѵ¹ì',2363,2363),('ÊØÃѵ¹ìÇŽÕ',2364,2365),('ÊØÃѵ¹Ò',2366,2366),('ÊØÀÑ·ÃÒ',2332,2332),('ÊØÀÒ',2333,2333),('ÊØÀÒÀóì',2338,2338),('ÊØÃÕÂì',2381,2381),('ÊØÃÕÂìŸÃ',2382,2382),('ÊØÃÕÃѵ¹ì',2383,2383),('ÊØÃÔÂѹ',2375,2375),('ÊØÃÔÂѹµì',2376,2376),('ÊØÃÔÂÒ',2377,2377),('ÊØÃÕÁÒÈ',2380,2380),('ÊØÃÔ§Èì',2371,2371),('ÊØÀÒÃŽÕ',2339,2339),('ÊØÃÔ¹',2372,2372),('ÊØÃÔ¹µì',2373,2373),('ÊØÃÔŸ§Èì',2374,2374),('ÊØÀÒÇŽÕ',2340,2340),('ÈØÀÔÊÃÒ',2049,2049),('ÊØÁÒÊÕ',2345,2345),('ÊØÁÒÅÕ',2344,2344),('ÊØÃÒ§€¹Ò',2368,2368),('ÊØÃÔªÑÂ',2369,2369),('ÊØÀÔ­­Ò',2341,2341),('ÊØÀÒ³Õ',2334,2334),('ÊØÁÔµÃ',2346,2346),('ÊØÁÔµÃÒ',2347,2347),('ÊØÃÕžÒŸÃ',2378,2378),('ÊØÃÔ¹·Ãì',2370,2370),('ÊØÀÒŸ',2335,2335),('ÊØÀÒŸÃ',2336,2336),('ÊØÃÕŸÃ',2379,2379),('ÊØÀÒŸÃó',2337,2337),('ÈØÀÅѡɳì',2045,2045),('ÈØÀ¡Ã',2037,2037),('ÈØÀ¡Ôš',2038,2038),('ÊØÀ¡Ôš',2326,2326),('ÊØÃ¡Ôš',2350,2350),('ÈØÀªÑÂ',2039,2039),('ÊØÃªÑÂ',2351,2351),('ÊØÀªÒ',2327,2327),('ÊØÃªÒµÔ',2352,2352),('ÊØÃ·Ô¹',2355,2355),('ÊØà·Ÿ',2289,2289),('ÊØÁ¹Ò',2343,2343),('ÊØà¹µÃ',2307,2307),('ÊØÁ¹µì',2342,2342),('ÈØÀŸÃ',2040,2040),('ÊØÃŸÑ¹žì',2358,2358),('ÊØÃŸÑ¹žØì',2359,2359),('ÊØÃŸÅ',2357,2357),('ÊØÃŸ§Éì',2356,2356),('ÊØÇÃó',2386,2386),('ÊØÇÃóÒ',2388,2388),('ÊØÇÃóÕ',2389,2389),('ÊØÇÃóÕÂì',2390,2390),('ÊØÇÃóªÑÂ',2387,2387),('ÊØÇÃѵ¹ì',2391,2391),('ÊØÇÀÑ·Ãì',2385,2385),('ÊØÇѲ¹ì',2392,2392),('ÊØÇѲ¹ìªÑÂ',2393,2393),('ÊØÇѲ¹Ò',2394,2394),('ÊØÇѵªÑÂ',2395,2395),('ÊØÇÔÃѪ',2402,2402),('ÊØÇÒÃÕ',2396,2396),('ÊØÇÔÁÅ',2401,2401),('ÊØÇÔªÑÂ',2397,2397),('ÊØÇÔªÒ',2398,2398),('ÊØÇÔŽÒ',2399,2399),('ÊØÇÔ·Âì',2400,2400),('ÊØËÑʪÒ',2404,2404),('ÊØÊÔÃÔ',2403,2403),('ÊØÅÑŽŽÒ',2384,2384),('ÊØ¡ÃÕ',2232,2232),('ÊØ¡Ñ­­Ò',2233,2233),('ÊØ¡Ôš',2235,2235),('ÊØ¡ÔµÔì',2236,2236),('ÊØ¡ÕµÔì',2237,2237),('ÊØ¡Ò¹ŽÒ',2234,2234),('ÊØ¡ØÁÒ',2238,2238),('ÊØ¢',2239,2239),('ÊØ¢ÊÇÑÊŽÔì¡Å¡ÒÃ',2242,2242),('ÊØ¢Êѹµì',2243,2243),('ÊØ¢ÄŽÕ',2241,2241),('ÊØ¢ªÒÂ',2240,2240),('ÊØ¢ØÁ',2244,2244),('ÊØ€¹žì',2245,2245),('ÊØ€¹žÒ',2246,2246),('ÊØšÒÃÕ',2247,2247),('ÊØšÔµ',2248,2248),('ÊØšÔµÃÒ',2250,2250),('ÊØšÔµµÒ',2249,2249),('ÊØšÔ¹ŽÒ',2251,2251),('ÊØšÔ¹µì',2252,2252),('ÊØšÔ¹µ¹ì',2253,2253),('ÊØªÑÂ',2255,2255),('ÊØªÒÂ',2258,2258),('ÊØªÒÊÔ¹Õ',2259,2259),('ÊØªÒŽÒ',2256,2256),('ÊØªÔµ',2260,2260),('ÊØªÒµÔ',2257,2257),('ÊØªÔ¹',2261,2261),('ÊØªÅ',2254,2254),('ÊØ±ÒÁÒÈ',2262,2262),('ÊØ³Õ',2263,2263),('ÊØŽÊÇÒ·',2265,2265),('ÊØŽÊ§Ç¹',2264,2264),('ÊØŽÒ',2266,2266),('ÊØŽÒÃѵ¹ì',2270,2270),('ÊØŽÒÀÒ',2269,2269),('ÊØŽÒÃÒ',2271,2271),('ÊØŽÕàŸé¹·ìà«ç¹àµÍÃì',2272,2272),('ÊØŽÒªÅÕ',2267,2267),('ÊØŽÒŸÃ',2268,2268),('ÊØ·ÃÕ',2282,2282),('ÊØ·ÑÈ',2283,2283),('ÊØ·Ñȹì',2284,2284),('ÊØ·ÔÈÒ',2288,2288),('ÊØ·ÔµÂì',2285,2285),('ÊØ·Ô¹',2286,2286),('ÊØ·ÔŸÒ',2287,2287),('ÊØ·žÔÇѲ¹ì',2280,2280),('ÊØ·žÔÈÑ¡ŽÔì',2281,2281),('ÊØ·žÔ쟧Éì',2278,2278),('ÊØ·žÔ¡Òš',2274,2274),('ÊØ·žÔªÑÂ',2275,2275),('ÊØ·žÒ·ÔŸÂì',2273,2273),('ÊØ·žÔ¹Ñ¹·ì',2276,2276),('ÊØ·žÔ¹Õ',2277,2277),('ÊØ·žÔŸÃó',2279,2279),('ÊØžÕ',2294,2294),('ÊØžÕÃì',2295,2295),('ÊØžÕÃÒ',2296,2296),('ÊØžÔÈÑ¡ŽÔì',2293,2293),('ÊØžÔŽÒ',2292,2292),('ÊØžÒ·ÔŸÂì',2290,2290),('ÊØžÒ¹ÔžÔ',2291,2291),('ÊØ¹Ñ··Õ',2299,2299),('ÊØ¹Ñ¹·ì',2300,2300),('ÊØ¹Ñ¹·Ò',2301,2301),('ÊØ¹ÕÂì',2306,2306),('ÊØ¹ÔÈÒ',2303,2303),('ÊØ¹ÔÉÒ',2304,2304),('ÊØ¹ÔÊÒ',2305,2305),('ÊØ¹ÔµÒ',2302,2302),('ÊØ¹·Ã',2297,2297),('ÊØ¹·ÃÕ',2298,2298),('ÊØ»ÃÐÇÕ³ì',2309,2309),('ÊØ»ÃÐŽÔɰì',2308,2308),('ÊØ»ÃÕÃÐŽÒ',2312,2312),('ÊØ»ÃÕÂÒ',2311,2311),('ÊØ»ÃÒ³Õ',2310,2310),('ÊØ»Ñ­­Ò',2313,2313),('ÊØŸÃ',2316,2316),('ÊØŸÃÃÉÒ',2318,2318),('ÊØŸÃóÕ',2317,2317),('ÊØŸÑ²¹ì',2320,2320),('ÊØŸÑµÃÒ',2321,2321),('ÊØŸÕÃìªÑÂ',2325,2325),('ÊØŸÔÈ',2324,2324),('ÊØŸÔª­ìª­Ò',2322,2322),('ÊØŸÔ¹',2323,2323),('ÊØŸÅ',2319,2319),('ÊØŸšÁÒÅÂì',2315,2315),('ÊØŸš¹ì',2314,2314),('GEORGE',21,21),('Í.àšÃÔ­ÎÒÃìŽáÇÃì',2457,2457),('ÍÁÃÃѵ¹ì',2515,2515),('ÍÁÃà·Ÿ',2514,2514),('ÍÁÃÈÑ¡ŽÔì',2516,2516),('ÍÁÃÊÔÃÔ',2517,2517),('ÍÃÀÑ·Ãì',2534,2534),('ÍÁÃÒÅѡɳì',2518,2518),('ÍÃÊÂì',2535,2535),('ÍÁêÑÂ',2513,2513),('ÍÃóŸ',2536,2536),('ÍÃöÊÔ·žÔì',2540,2540),('ÍÃöŸÃ',2538,2538),('ÍÃöŸÅ',2539,2539),('ÍÃöŸ¹žì',2537,2537),('ÍÃ๵Ã',2530,2530),('ÍÃÇÃó',2542,2542),('ÍÃÇÔ· ÍÔ¹àµÍÃì๪Ñè¹á¹Å',2543,2543),('ÍÃÈÁ',2544,2544),('ÍÃÈÃÕ',2545,2545),('ÍÃÊÒ',2546,2546),('ÍÃèÒÁÈÃÕ',2551,2551),('ÍÃ͹§€ì',2547,2547),('ÍÃÍØÁÒ',2548,2548),('ÍÃÑ­',2549,2549),('ÍÃÑ­­Ò',2550,2550),('ÍÀѹµÃÕÊì',2496,2496),('ÍÀÔÃÑ¡Éì',2507,2507),('ÍÃÔÂÒ',2555,2555),('ÍÃÔÂÒÀóì',2556,2556),('ÍÀÔÀÒŽÒ',2505,2505),('ÍÀÔવ',2501,2501),('ÍÀÔÃŽÕ',2506,2506),('ÍÀÔàŽª',2503,2503),('ÍÀÔÇѲ¹ì',2508,2508),('ÍÀÔÇѹ·ì',2509,2509),('ÍÀÔÊÃ',2511,2511),('ÍÃÔÈÃÒ',2557,2557),('ÍÃÔÊÃÒ',2558,2558),('ÍÀÔÈÑ¡ŽÔì',2510,2510),('ÍÃÔÊÒ',2559,2559),('ÍÀÔÊÔ·žÔì',2512,2512),('ÍÀÔªÑÂ',2497,2497),('ÍÃÔªÑÂ',2552,2552),('ÍÀÔªÒ µÔ',2498,2498),('ÍÀÔªÒµ',2499,2499),('ÍÀÔªÒµÔ',2500,2500),('ÍÀÔ­­Ò',2502,2502),('ÍÁÔµÒ',2519,2519),('ÍÀԹѹ·ì',2504,2504),('ÍÃÔ¹ª¹Ò',2553,2553),('ÍÁÔ¹µÒ',2520,2520),('ÍÃÔ¹·ÁÒ',2554,2554),('ÍÃÄŽÕ',2541,2541),('ÍÚÔÃÒ',2522,2522),('ÍêÃ',2523,2523),('ÍêسËì',2524,2524),('Íóѭªì',2525,2525),('Íâ³·ÂÒ',2459,2459),('Í÷ÑÂ',2526,2526),('Í÷ԪÒ',2527,2527),('ÍùԵÂì',2528,2528),('Í⹪Ò',2495,2495),('Íùت',2529,2529),('ÍßÃó',2531,2531),('ÍßԹ',2532,2532),('ÍßԹ·Ãì',2533,2533),('ÍÃØ³',2560,2560),('ÍÃØ³Ãѵ¹ì',2561,2561),('ÍÃØ³ÃØè§',2562,2562),('ÍÃØ³ÈÃÕ',2563,2563),('ÍÃØ³Õ',2564,2564),('ÍÂØžÂѹ',2521,2521),('ÍǪÑÂ',2567,2567),('ÍÐÅÒ¹',2574,2574),('ÍЀÙà·ç€·ì',2573,2573),('ÍéÍ·ԟÂì',2571,2571),('ÍéÒÂÍÔé§',2612,2612),('ÍÍâµàÁªÑè¹à«ÍÃìÇÔÊ',2570,2570),('ÍÍÊ·ì ÍÍÂÊì',2572,2572),('ÎÍÊ·ì ÍÍÂÅì',2723,2723),('ÍÍ€µéÒ àÁÁâÁàÃÕÂÅ',2568,2568),('ÍÍ€µéÒàÁÁâÁàÃÕÂÅ',2569,2569),('ÍÑÁäŸÇÃó',2594,2594),('ÍÑÁŸÃ',2592,2592),('ÍÑÁŸÃó',2593,2593),('ÍÑ€ÃàŽª',2575,2575),('ÍÑ€ÃÇÔ·Âì',2578,2578),('ÍÑ€ÃÇÔ¹·ì',2579,2579),('ÍÑ€ÃÒ',2580,2580),('Íрßњ¹ì',2577,2577),('Íрß¹žì',2576,2576),('ÍѧʹÒ',2581,2581),('ÍÑš©ÃÒ',2582,2582),('ÍѪÂÒ',2583,2583),('ÍÑ­ªÅÕ',2587,2587),('ÍÑ­ª³ÒŸÃ',2584,2584),('ÍÑ­ªŽÒ',2585,2585),('ÍÑ­ª¹Ò',2586,2586),('ÍÑ­ªØÅÕ',2588,2588),('ÍÑ®ÉÁÒ',2589,2589),('ÍѹÊÃÕÂì',2590,2590),('ÍÑ»ÊÃ',2591,2591),('ÍÒÃÂѹ',2616,2616),('ÍÒÃÂÒ',2617,2617),('ÍÔÁâ¡éáŸç€ €ÍÃì»ÍÃìàêÑè¹',2641,2641),('ÍÒÀóì',2606,2606),('ÍÒÃÁ³ì',2615,2615),('ÍÒÃì«Õ ¹ÔµáÇÃì',2613,2613),('ÍÒÃì«Ø»à»ÍÃì⫹ԀŸÔ€ÍÑŸÊì',2614,2614),('ÍÒÃÑ¡Éì',2618,2618),('ÍÒÀÒ',2607,2607),('ÍÒÃÕ',2621,2621),('ÍÓÀÒ',2633,2633),('ÍÒÀÒÀóì',2611,2611),('ÍÒÃÕÂì',2622,2622),('ÍÒÃÕÂì àÊÁÒ©ÔÁ (ä·Âູ¡Ñ¹',2623,2623),('ÍÒÃÕÃѵ¹ì',2624,2624),('ÍÒÃÔÂÒ',2620,2620),('ÍÒÃÕÇÃó',2625,2625),('ÍÒÀÒ¡Ã',2608,2608),('ÍÒÀÒ³Õ',2609,2609),('ÍÒÀÒŸÃ',2610,2610),('ÍÒÃÒŸÃ',2619,2619),('ÍÔÈÃÒ',2642,2642),('ÍÔê¡«èÒ ÍÔ¹àµÍÃì๪Ñè¹á¹Åàš¹à¹ÃÑÅ à«ÅÅì',2634,2634),('ÍÓäŸ',2632,2632),('ÍÒ€Á',2595,2595),('ÍÔ§Ë·ÑÂ',2635,2635),('ÍÒš³Ã§€ì',2596,2596),('ÍÒ«ÒÎÕ-ä·Â ÍÑÅÅÍÂ',2597,2597),('ÍҳѹÂì',2598,2598),('ÍÒ·Ô¡Ã',2599,2599),('ÍÕ·Õ«Õ',2643,2643),('ÍÒ·Ôµ',2600,2600),('ÍÔ·žÔŸÅ',2636,2636),('ÍÔ¹àµÍÃìàÇç·(»ÃÐà·Èä·Â)',2638,2638),('ÍÓ¹ÇÂ',2626,2626),('Íҹю',2603,2603),('ÍҹѹµÂÒ',2604,2604),('ÍÓ¹Òš',2627,2627),('ÍԹ䫷ìà€Á',2637,2637),('ÍÔ¹·ÔÃÒ',2639,2639),('ÍÒ¹¹·ì',2601,2601),('ÍÒ¹Ÿ',2602,2602),('ÍÒ¹ØÀÒŸ',2605,2605),('ÍÔŸ',2640,2640),('ÍÓŸÃ',2628,2628),('ÍÓŸÃó',2629,2629),('Íӟѹžì',2631,2631),('ÍÓŸÅ',2630,2630),('ÎÙàÇÍÃìÍØµÊÒË¡ÃÃÁ(»ÃÐà·Èä·Â)',2724,2724),('Íŧ¡Ã³ì',2566,2566),('Íŧ¡µ',2565,2565),('ͧÍÒš',2458,2458),('ÍŽÔàá',2460,2460),('ÍŽÔÈÃ',2461,2461),('ÍŽÔÈÑ¡ŽÔì',2462,2462),('ÍŽØÅ',2463,2463),('ÍŽØÅÂìàŽª',2465,2465),('ÍŽØÅŸÑ²¹ì',2464,2464),('͵Թت',2466,2466),('͵ԟÃ',2467,2467),('ͶԪÒ',2468,2468),('ÍžÔ»ŸÅ',2469,2469),('͹ÇѪ',2473,2473),('͹ѭ­Ò',2474,2474),('͹ѹµÈÑ¡ŽÔì',2476,2476),('͹ѹµì',2475,2475),('͹§€ìÇÃó',2471,2471),('͹§€ì¹Ò®',2470,2470),('͹¹·ì',2472,2472),('͹ØÃÑÉì',2491,2491),('͹ØÃÑ¡Éì',2489,2489),('͹ØÃѵ¹ì',2490,2490),('͹ØÇѲ¹ì',2492,2492),('͹ØÊóì',2494,2494),('͹ØÈÑ¡ŽÔì',2493,2493),('͹ءԵÔ',2477,2477),('͹ءÙÅ',2478,2478),('͹تÒ',2479,2479),('͹تԵ',2480,2480),('͹؎Ò',2481,2481),('͹صÃ',2483,2483),('͹صµÃÒ',2482,2482),('͹طԵÒ',2484,2484),('͹؟Ã',2487,2487),('͹؟ѹžì',2488,2488),('͹؟§Èì',2485,2485),('͹؟§Éì',2486,2486),('ÍØÁÒ',2665,2665),('ÍØÃÕÂì',2667,2667),('ÍØÁÒŸÃ',2666,2666),('ÍØà·¹·Ãì',2660,2660),('ÍØÉÒ',2673,2673),('ÍØÊÒËì',2674,2674),('ÍØè§á€Ð',2644,2644),('ÍØÉ³Õ',2672,2672),('ÍØè¹ãš',2661,2661),('ÍØÌÒÃ',2675,2675),('ÍØäÃ',2668,2668),('ÍØäÃÃѵ¹ì',2670,2670),('ÍØäÃÇÃó',2671,2671),('ÍØäßÃ',2669,2669),('ÍØ³ÒÇŽÕ',2645,2645),('ÍØŽÁ',2646,2646),('ÍØŽÃ',2654,2654),('ÍØŽÁàÁŽÔ€ÍÅ ÍÔ€ÇÔ»àÁé¹',2650,2650),('ÍØŽÁÇßѹžì',2652,2652),('ÍØŽÁÈÑ¡ŽÔì',2653,2653),('ÍØŽÁÅѡɳì',2651,2651),('ÍØŽÁŸÃ',2648,2648),('ÍØŽÁŸÑ¹žì',2649,2649),('ÍØŽÁŸ§Èì',2647,2647),('ÍØµâÁ·Âì',2655,2655),('ÍØµÊÒË¡ÃÃÁŒéÒà€Å×ͺŸÅÒʵԡä·Â',2656,2656),('ÍØ·ÑÂ',2657,2657),('ÍØ·ÑÂÇÃó',2658,2658),('ÍØ·ØÁŸÃ',2659,2659),('ÍØºÅ',2662,2662),('ÍØºÅÇÃó',2664,2664),('ÍØºÅŸÃó',2663,2663),('KAWAIJIT',22,22),('KAWALJIT',23,23),('KOJI',24,24),('LOUIS',25,25),('PETER',26,26),('SHERMAN',27,27),('TAN',28,28),('Willem Arnold',29,29),('WONG',30,30),('WU',31,31),('ÅÐÁèÍÁ',1718,1718),('ÅÐàÍÕÂŽ',1721,1721),('ÅÐÁÑÂ',1719,1719),('ÅÐÍͧŽÒÇ',1720,1720),('ÅÑ¡ÉÁÕ',1724,1724),('ÅѡɳÒ',1723,1723),('ÅÑ¡¢³Ò',1722,1722),('ÅÑ­ª¹Ò',1725,1725),('ÅÑŽŽÒ',1726,1726),('ÅÑŽŽÒÇÃó',1727,1727),('ÅÑŽŽÒÇÑÅÂì',1728,1728),('ÅÑ·žÈÑ¡ŽÔì',1729,1729),('ÅÔÁ',1734,1734),('ÅÒÇѳÂì',1730,1730),('ÅÔÅÒÀóì',1735,1735),('ÅÓäÂ',1732,1732),('ÅÓäŸ',1731,1731),('ÅÔ¹ŽÒÇÃó',1733,1733),('ÅÅÔŽÒ',1716,1716),('ÅÅÔµÒ',1717,1717),('Å×ͪÑÂ',1736,1736),('äÁµÃÕ',1596,1596),('äÇ·Ô¹',1953,1953),('äÍ.àÍÊ.äÍ.ÍÔ¹àµÍÃì๪Ñè¹á¹Å',2721,2721),('äÍ.«Õ.«Õ.ÍÔ¹àµÍÃì๪Ñè¹á¹Å (ÁËÒª¹)',2718,2718),('äÍ.·Õ.áÍŽìÇÒ¹« à·€ šÓ¡ÑŽ',2719,2719),('äÍ.·Õ.á͹ŽìÇÒ¹« à·€ šÓ¡ÑŽ',2720,2720),('äÍÂàÃÈ',2722,2722),('ä¡Ãà·Ÿ',215,215),('ä¡Ã€Ó',214,214),('ä¡ÃžÇѪ',216,216),('äªÂÃѵ¹ì',575,575),('äªÂÁ§€Å',574,574),('äªÂÒ',576,576),('äªÂ¹Ñ¹·¹ì',573,573),('äŽÍСÅêÒÊ',709,709),('äµÃç€ì',726,726),('äµÃà·Ÿ',725,725),('äµÃ·È',724,724),('ä·Â',805,805),('ä·Â €Í¹Êì á͹Žì ºÔÅŽÔé§',806,806),('ä·Â ŽÕ à͹ ·Õ àŸ¹·ì',807,807),('ä·Â-àÍà«Õ ŸÕ.ÍÕ.äŸéŸì',824,808),('ä·ÂàÇÅ€Í¹ÍØµÊÒ¡ÃÃÁ',821,822),('ä·ÂÂÙà¹Õ¹€ÇÍÅÅÔµÕé',820,821),('ä·Âà¡ÃÕ§ÊÔè§·Í',808,809),('ä·Âà€ÁÕÀѳ±ì',810,811),('ä·Âà«çÅ·ÃÑÅà€ÁÕ ª¹)',813,814),('ä·Âà«ç¹·ÃÑÅ à€ÁÕ ª¹)',811,812),('ä·Âà«ç¹·ÃÑÅà€ÁÕ',812,813),('ä·ÂàŸÔèÁŸÅÒʵԡ',819,820),('ä·ÂÍÔ¹àµÍÃì ÍÐâÃàÁµÔ¡Êì',823,824),('ä·ÂÍÔ¹àµÍÃì €ÍµµÍ¹¡Ò÷Í',822,823),('ä·Â€Òà«ÎÔ¹',809,810),('ä·ÂŽÕà͹·ÕàŸ¹·ì',814,815),('ä·Âµ§¹ÔµµÔé§',815,816),('ä·ÂžÒ¹Õà€ÁÕ',817,818),('ä·Âž¹ÒŸÒ³ÔªÂì',816,817),('ä·ÂŸÃçÍ¡«ì',818,819),('Ä·žÔì',1714,1714),('Ä·žÔªÑÂ',1715,1715),('䌷',1292,1292),('äŸàÃÒÐ',1485,1485),('äŸâÚ¹ì',1486,1486),('äŸÃÊÔ·žÔì',1481,1481),('äŸÃʳ±ì',1480,1480),('äŸÃѪ',1482,1482),('äŸÃѵ¹ì',1483,1483),('äŸÃÔ¹·Ãì',1484,1484),('äŸÃÄ·žÔì',1479,1479),('äŸÇÑÅÂì',1488,1488),('äŸÈÔÃÔ',1490,1490),('äŸÈÒÅ',1489,1489),('äŸÊÔ°',1491,1491),('äŸÅÔ¹',1487,1487),('䟱ÙÃÂì',1477,1477),('䟺ÙÅÂì',1478,1478),('¡.µÃÕ·ÔŸÂì €Í¹«ÑÅáµ¹·ì',32,32),('¡ÃíԡÒÃì',65,65),('¡ÃóԡÒ',66,66),('¡ÃóԡÒÃì',67,67),('¡ÃÇÔ·Âì',69,69),('¡ÃÇÅÑÂ',68,68),('¡ÃК¡ä·ÂÍÒ«ÒÎÕ',72,72),('¡Ãͧá¡éÇ',70,70),('¡Ãͧ·ÔŸÂì',71,71),('¡ÃÕ±Ò',73,73),('¡ÁÅ',49,49),('¡ÁÅÃѪµì',55,55),('¡ÁÅÃѵ¹ì',56,56),('¡ÁÅÁÒÅÂì',54,54),('¡ÁÅÇÃó',57,57),('¡ÁũѵÃ',50,50),('¡ÁÅ·ÔŸÂì',51,51),('¡ÁÅŸÃ',52,52),('¡ÁÅŸÃó',53,53),('¡Ã¡ÁÅ',60,60),('¡Ã¡¹¡',58,58),('¡Ã¡ŸÃ',59,59),('¡ÃªÑÂ',61,61),('¡Ã³ì',62,62),('¡Ã¹Ñ¹·ì',63,63),('¡Ã»ÃÕÂÒ',64,64),('¡ÃاෟŒÅÔµàËÅç¡',74,74),('¡Ãاä·ÂÍØ»¡Ã³ì',76,76),('¡Ãاä·Â€ÒÃìàÃé¹·ì ÍÔ¹àµÍÃì๪Ñè¹á¹Å',75,75),('¡ÃسÒ',77,77),('¡ÇÕ',93,93),('¡ÉÁÒ',94,94),('¡èÍà¡ÕÂõÔ',98,98),('¡ÊÔÇѹ',97,97),('¡ÉÔª­ì',95,95),('¡ÉÔŽÔÈ',96,96),('¡Íºá¡éÇ',100,100),('¡ÍºÅÒÀ',102,102),('¡Íº¡ØÅ',99,99),('¡ÍººØ­',101,101),('¡Ñ ÅÂÒ',103,103),('¡ÑÁ»¹Ò¶',117,117),('¡ÑÁ»¹Ò·',118,118),('¡ÑÅÂÒ',119,119),('¡ÑÅÂÒÃѵ¹ì',121,121),('¡ÑÅÂÒ³Õ',120,120),('¡Ñ­ªŸÃ',104,104),('¡Ñ­­ÀÑ€',105,105),('¡Ñ­­ìÇÃÒ',106,106),('¡Ñ­­ÒÁÒÈ',107,107),('¡Ñ­­ÒÇÕÃì',108,108),('¡Ñ³°Ô¡Ò',110,110),('¡Ñ³°ªÒ',109,109),('¡Ñ³·ÔÁÒ',111,111),('¡Ñ¹ÂÒÃѵ¹ì',116,116),('¡Ñ¹µì',112,112),('¡Ñ¹µÔ¡Ã',113,113),('¡Ñ¹žÔÁÒ',115,115),('¡Ñ¹žÔªÒ',114,114),('¡ÒÃÇÔÍÃ',128,128),('¡ÒÂÊÔ·žÔì',127,127),('¡Óá˧',134,134),('¡ÔÁÅÑé§',157,157),('¡ÕõÔ',158,158),('¡ÒÃØ³Õ',129,129),('¡ÒÈÔ',130,130),('¡Ôè§¡Ò­š¹ì',135,135),('¡ÓäÃ',133,133),('¡ÔšÇÃó',137,137),('¡ÔšµÔÂÒ',136,136),('¡Ò­š¹ÇÃó',122,122),('¡Ò­š¹Ò',123,123),('¡ÔµÔ¡Ã',153,153),('¡ÔµÔ¡Ã³ì',154,154),('¡ÔµÔ¡Ñ­­Ò',155,155),('¡ÔµÔªÒ­',156,156),('¡ÔµµÔ',138,138),('¡ÔµµÔÃѵ¹ì',150,150),('¡ÔµµÔÁÒ',148,148),('¡ÔµµÔÂÒ',149,149),('¡ÔµµÔÇѲ¹ì',151,151),('¡ÔµµÔÈÑ¡ŽÔì',152,152),('¡ÔµµÔ¡Ñ¹µì',139,139),('¡ÔµµÔªÑÂ',140,140),('¡ÔµµÔ­Ò',141,141),('¡ÔµµÔ¹Ñ¹·ì',142,142),('¡ÔµµÔŸÑ²¹ì',146,146),('¡ÔµµÔŸÑ¹žì',147,147),('¡ÔµµÔŸÅ',145,145),('¡ÔµµÔŸ§Èì',143,143),('¡ÔµµÔŸ§Éì',144,144),('¡ÓžÃ',131,131),('¡Ò¹ŽÒ',124,124),('¡Ò¹µì',125,125),('¡Ò¹µìÃÇÕ',126,126),('¡ÓŸÅ',132,132),('¡ÙêŽÇÔÅ ÍÔ¹ŽÑʵÃÕé',169,169),('¡ÄÉ®Ò',84,84),('¡ÄÉ®Õ',85,85),('¡Äɮ՟Ã',86,86),('¡ÄɳÐ',89,89),('¡ÄɳÒ',90,90),('¡ÄɳÕ',91,91),('¡ÄɳŸÅ',88,88),('¡ÄɳŸš¹ì',87,87),('¡ÄÉŽÒ',92,92),('¡ÄÈŸÃó',83,83),('¡ÄªÇÃó',78,78),('¡ÄµÂÒ',80,80),('¡ÄµÔÂÒ',82,82),('¡ÄµÔ¡Ò¹·ì',81,81),('¡ÄµºŸÔž',79,79),('¡ªÁÅ',35,35),('¡ª¡Ã',33,33),('¡ªŸÃ',34,34),('¡µÑ­­Ù',36,36),('¡¹ÔɰÒ',48,48),('¡¹¡',37,37),('¡¹¡Ãѵ¹ì',43,43),('¡¹¡ÇÃó',45,45),('¡¹¡ÈÃÕ',46,46),('¡¹¡Ò­š¹ì',47,47),('¡¹¡Ä·žÔì',44,44),('¡¹¡¡Ò­š¹ì',38,38),('¡¹¡ªÑÂ',39,39),('¡¹¡¹ÔÀÒ',40,40),('¡¹¡¹Øª',41,41),('¡¹¡ŸÃ',42,42),('¡ØÁØ·ŸÑ¹žì',159,159),('¡ØéÂà«é§ ÍÔÁ»ÍÃìµ á͹Žì àÍç¡«ì»ÍÃìµ',160,160),('¡ØËÅÒº',168,168),('¡ØÊØÁÒ',167,167),('¡ØÅÂÒ',163,163),('¡ØÅÇŽÕ',165,165),('¡ØÅÈÔÃÔ',166,166),('¡ØÅÅŽÒ',164,164),('¡ØÅ¹Ñ¹·ì',161,161),('¡ØÅ¹ÒÃÕ',162,162),('¢ÇÑ­àÁ×èͧ',228,228),('¢ÇÑ­àÃ×͹',231,231),('¢ÇÑ­ãš',223,223),('¢ÇÑ­àŽ×͹',225,225),('¢ÇÑ­àŸçªÃ',227,227),('¢ÇÑ­ÃØé§',230,230),('¢ÇÑ­ÂØŸÒ',229,229),('¢ÇÑ­ªÑÂ',224,224),('¢ÇÑ­µÒ',226,226),('¢éÒÇÍÔèÁ·ÔŸÂì',233,233),('¢ÑµµÔÂÒ³Õ',232,232),('¢šÃ',217,217),('¢šÃà¡ÕÂõÔ',218,218),('¢šÃÈÃÕ',219,219),('¢šÃÈÑ¡ŽÔì',220,220),('¢¹Ôɰì',221,221),('¢¹ÔɰÒ',222,222),('¢Ø¹·Í§',234,234),('€ÁàŸçªÃ',249,249),('€ÃÒ¿·ìàŽÍÐàºÊ·ì',250,250),('€Á¡ÃÔª',247,247),('€ÁšÑ¡Ã',248,248),('€àª¹·Ãì',238,238),('€à³È',244,244),('€à¹Âì',246,246),('€ÍÊÁÔ€ €Í¹€ÍÃìŽ €ÍÃì»ÍàêÑè¹',251,251),('€ÔÁ§€ì',257,257),('€Óá˧',256,256),('€ÒÃìâ»Ãà¿ÊªÑè¹á¹Å',253,253),('€Óó',255,255),('€ÒÇÒ€Ô¹',254,254),('€Ò«ÙâÍÐ',252,252),('€ÙèºØ­',260,260),('€Ù»Ò¹Ò',261,261),('€§àŽª',237,237),('€§¡ÄÈ',236,236),('€³ÒÇØ²Ô',240,240),('€³ÔÈÃ',241,241),('€³ÔÊÃ',242,242),('€³Ò¡Ã',239,239),('€³ØµÁì',243,243),('€žÒ',245,245),('€Ø³Ò¡Ã',258,258),('€Ø³Õ·Ã',259,259),('§ÒÁàŸç­',273,273),('§ÒÁ¹Ôš',272,272),('šàÃ',298,298),('šÃÃÂÒ',285,285),('šàÃÈÑ¡ŽÔì',299,299),('šÃÇÃÞ¹ì',287,287),('šÃÇŸÃ',286,286),('šÃÑʪÑÂ',290,290),('šÃÑÊŸÅ',291,291),('šÃÑÅ',289,289),('šÃÑ­',288,288),('šÃÔÂÒ',294,294),('šÃÔÂÒÀóì',295,295),('šÃÔ¹·Ãì',292,292),('šÃÔ¹žÃ',293,293),('šÃÙ­',297,297),('šÃØžÔŽÒ',296,296),('šÍÁ¢ÇÑ­ãš',300,300),('šÑ¡ÃÇÒÅ',304,304),('šÑ¡Ãѵ¹ì',305,305),('šÑ¡ÃÕ',307,307),('šÑ¡ÃÔ¹·Ãì',306,306),('šÑ¡Ã¡Äɳì',302,302),('šÑ¡Ã¡Äª',301,301),('šÑ¡ÃŸÑ¹žì',303,303),('šÑ¡ÉÇѯ',308,308),('šÑŽËÒ§Ò¹ÎÔÇáÁ¹àÍ繚Ôà¹ÕÂÃÔè§',309,309),('šÑµÃŽÒÇ',310,310),('šÑ¹šÔÃÒ',311,311),('šÑ¹·Ã',314,314),('šÑ¹·ÃìÃѵ¹ì',321,321),('šÑ¹·ÃìàšéÒ',315,315),('šÑ¹·ÃìàŸç­',320,320),('šÑ¹·ÃìÇÔÁÅ',322,322),('šÑ¹·ÃìÇÔäÅ',323,323),('šÑ¹·ÃìÊØŽÒ',324,324),('šÑ¹·Ãì·ÔŸÂì',316,316),('šÑ¹·ÃìžÔÀÒ',317,317),('šÑ¹·Ãì¹ÀÒ',318,318),('šÑ¹·ÃìŸÃ',319,319),('šÑ¹·ÔÀÒ',326,326),('šÑ¹·ÔÁÒ',327,327),('šÑ¹·ÔÃÒ',329,329),('šÑ¹·ÔÁÒÀóì',328,328),('šÑ¹·Ô¡Ò',325,325),('šÑ¹··Õ',312,312),('šÑ¹·¹Ò',313,313),('šÔÃÀÑ·Ã',361,361),('šÔÃÀÒ',362,362),('šÓàÃÔ­',344,344),('šÔÃÇÃó',363,363),('šÔÃÇѲ¹ì',364,364),('šÔÃÐÀÒ',369,369),('šÕÃÐÇѲ¹ì',386,386),('šÔÃÐÈÑ¡ŽÔì',370,370),('šÕÃйѹ·ì',385,385),('šÔÃПÃ',367,367),('šÔÃПÃó',368,368),('šÔÃÈÑ¡ŽÔì',365,365),('šÕÃÈÑ¡ŽÔì',384,384),('šÔÃÊØŽÒ',366,366),('šÕâÍà·€¹Ô€ (ä·ÂᏎì)',388,388),('šÓÃÑÊ',343,343),('šÔÃѪŽÒ',371,371),('šÔÃѰµÔì',372,372),('šÔÃÒÀóì',376,376),('šÒÃÕÃѵ¹ì',333,333),('šÔÃÒÀÒ',377,377),('šÔÃÒÂØ',378,378),('šÔÃÒÇÃó',379,379),('šÔÃÒÇÑÅÂì',380,380),('šÔÃÒÇØ²Ô',381,381),('šÔÃÒ€Á',373,373),('šÔÃҹت',374,374),('šÔÃÒŸÃ',375,375),('šÔßÃ',359,359),('šÕßÃó',383,383),('šÔßѹžì',360,360),('šÒÃØÃѵ¹ì',338,338),('šÒÃØÇÃó',339,339),('šÒÃØ³Õ',334,334),('šÒÃØ³ÕÂì',335,335),('šÒÃØ¹Ñ¹',336,336),('šÒÃØºØµÃ',337,337),('šÕÍÕ á€»»ÔµÍÅ (»ÃÐà·Èä·Â)',387,387),('šÓÅͧ',345,345),('šÔ³³ì',346,346),('šÔµÃÒ',354,354),('šÔµÃÒÀóì',355,355),('šÔµÃÅŽÒ',353,353),('šÔµµÁÒÊ',349,349),('šÔµµì',347,347),('šÔµµì¹ÔÉÒ',348,348),('šÔµµÒ',350,350),('šÔµµÔ',351,351),('šÔµµÔ¹¹Ñ¹·ì',352,352),('šÒµØÃ§€ì',331,331),('šÒµØÃ¹µì',332,332),('šÒµØŸÃ',330,330),('šÕ·Õ«Õ ·Ã§ŸÑ¹žì)',382,382),('šÓ¹§',340,340),('šÓ¹§€ì',341,341),('šÔ¹ŽÒ',356,356),('šÔ¹µìšØ±Ò',357,357),('šÔ¹µ¹Ò',358,358),('šÓ»Õ',342,342),('š§ÃÑ¡',277,277),('š§ÃÑ¡Éì',278,278),('š§Åѡɳì',279,279),('š§¡Å',275,275),('š§¡Å³Õ',276,276),('šµØÃ§€ì',283,283),('šµØÄ·žÔì',284,284),('šµØŸÃ',280,280),('šµØŸÑ¹žì',282,282),('šµØŸÅ',281,281),('šØÃÕÃѵ¹ì',395,395),('šØÌÒ',397,397),('šØÌÒÀóì',398,398),('šØÌÒÀÒ',399,399),('šØÌÒÅѡɳì',400,400),('šØÅÅŽÒ',396,396),('šØ±ÒÃѵ¹ì',393,393),('šØ±ÒÁÒÈ',391,391),('šØ±ÒÁÒÊ',392,392),('šØ±ÒÇÃó',394,394),('šØ±Ò·ÔŸÂì',389,389),('šØ±ÒŸÑ¹žì',390,390),('©ÇÕÇÃó',419,419),('©Íé͹',420,420),('©ÑµÃÀóì',422,422),('©ÑµÃÈÔÃÔ',423,423),('©ÑµÃªÑÂ',421,421),('©Ñ¹·Ãѵ¹ì',425,425),('©Ñ¹·¹Ò',424,424),('©ÅÇÂ',416,416),('©Åͧ',417,417),('©ÅÒŽ',418,418),('©×èÍ šÔé¹ ÎÑéÇ',426,426),('©×èÍšÔé¹ÎÑéÇ',427,427),('ª.ÊÂÒÁšÑ¡ÃÂÒ¹àŽç¡àÅè¹',437,437),('ªÁ',450,450),('ªÁÀÑÊÊÃ',454,454),('ªÁÀٹت',455,455),('ªÁÑŸÃ',456,456),('ªÃÑÊÃÒ',463,463),('ªÃѪÊÃÒ',461,461),('ªÃѶšÑ¹·Ãì',462,462),('ªÂÒÀóì',460,460),('ªÃÔ¹Ãѵ¹ì',465,465),('ªÃÔ¹·Ãì',464,464),('ªÂÒŸÅ',459,459),('ªÂ¹',458,458),('ªÁŸÙ¹Øª',452,452),('ªÁŸÙ¹Ø·',453,453),('ªÁŸÅ',451,451),('ªÇÔÈÒ',479,479),('ªÇÅÔµ',478,478),('ªÇ¹',475,475),('ªÇ¹ªÁ',476,476),('ªÇ¹ŸÔÈ',477,477),('ªÐÍé͹',485,485),('ªÐ¹ÔÅ',484,484),('ªèÍ',480,480),('ªèÍÍÑ­ªÑ­',483,483),('ªèͩѵÃ',481,481),('ªèÍ·ÔŸÂì',482,482),('ªÑÂÂÐ',509,509),('ªÑÂÂÈ',508,508),('ªÑÂÃѵ¹ì',511,511),('ªÑÂÀÑ·Ã',505,505),('ªÑÂÁ§€Å',506,506),('ªÑ§³ì',507,507),('ªÑÂàšÃÔ­ãªèËÅÕʵÕÅ',496,496),('ªÑÂÂØ·ž',510,510),('ªÑÂÇѲ¹ì',512,512),('ªÑÂÊÔ·žÔì',513,513),('ªÑÂÊÔ¹žØì',514,514),('ªÑªҭ',498,498),('ªÑª¹Ð',497,497),('ªÑ³ç€ì',499,499),('ªÑžÇѲ¹ì',500,500),('ªÑ¹ѹ·ì',502,502),('ªÑ¹€Ã',501,501),('ªÑŸÃ',503,503),('ªÑŸÅ',504,504),('ªÑªÀÑÊÊÃ',489,489),('ªÑªÀ³',488,488),('ªÑªÁ³±ì',490,490),('ªÑªÁ¹±ì',491,491),('ªÑªÇÒÅÂì',493,492),('ªÑªÇÒÅìÂ',492,493),('ªÑªªÑÂ',486,486),('ªÑª®Ò',487,487),('ªÑ­ÉÒ',495,495),('ªÑ­­Ò',494,494),('ªÒÂ',524,524),('ªÒÇѳÂì',526,526),('ªÕÇÒŸÃ',534,534),('ªÒÅÕ',525,525),('ªÒ­',515,515),('ªÒ­ÂØ·ž',518,518),('ªÒ­ÈÑ¡ŽÔì',519,519),('ªÒ­ªÑÂ',516,516),('ªÒ­³Ã§€ì',517,517),('ªÔŽª¹¡',529,529),('ªÒµÃÕ',520,520),('ªÒµÔªÒÂ',521,521),('ªÒ¹',522,522),('ªÔ¹',530,530),('ªÔ¹Ãѵ¹ì',532,532),('ªÔ¹ÇѲ¹ì',533,533),('ªÓ¹Ô',528,528),('ªÓ¹Ò­',527,527),('ªÒ¹¹·ì',523,523),('ªÔ¹ŸÑ¹žì',531,531),('ªÙà¡ÉÁ',544,544),('ªÙà¡ÕÂõÔ',545,545),('ªÙÈÑ¡ŽÔì',553,553),('ªÙšÔµ',546,546),('ªÙšÔµµì',547,547),('ªÙªÑÂ',548,548),('ªÙªÒµÔ',549,549),('ªÙªÕŸ',550,550),('ªÙŸ§Èì',551,551),('ªÙŸ§Éì',552,552),('ªÅÍ',468,468),('ªÅÍÁ',469,469),('ªÅÒ¡Ã',470,470),('ªÅÔ¡Ò',471,471),('ªÅÔŽÒ',472,472),('ªÅÔµ',473,473),('ªÅÔµÒ',474,474),('ªÅžÕ',467,467),('ªÅžÔªÒ',466,466),('ªäÁŸÃ',457,457),('ª®ÒÃѪ',438,438),('ªŽÒ¡Ã',439,439),('ª¹ÁìÊØÇÃó',442,442),('ª¹Ð',443,443),('ª¹Ð⪵Ô',444,444),('ª¹Ñ­­Ò',445,445),('ª¹Ñ°',446,446),('ª¹Ñ¹Àóì',447,447),('ª¹ÒÀÒ',448,448),('ª¹ÔŽÒ',449,449),('ª¹¹Ñ¹·ì',440,440),('ª¹¹ÔÈÒ',441,441),('ª×蹚Եµì',535,535),('ªØÁÊÒÂ',542,542),('ªØÁÈÔÃÔ',541,541),('ªØÁŸÃ',539,539),('ªØÁŸÅ',540,540),('ªØÅÕŸÃ',543,543),('ªØŽÒŸÃ',536,536),('ªØµÔÁÒ',538,538),('ªØµÔ¡Ò­š¹ì',537,537),('«è͹¡ÅÔè¹',577,577),('«Õ àÍç¹ äÍ',580,580),('«Õ ŽÕ àÍçÁ àÍç¹àµÍÃìäŸÃÊì',581,581),('«Õ.ÇÕ.àÍÊ.ÍÔ¹ŽÑʵÃÕé',584,584),('«Õ.ŽÕ.ÍØµÊÒË¡ÃÃÁ',582,582),('«Õ.·Õ.à·àÅ€ÍÁ',583,583),('«ÕàÍç¹äÍàÍ繚Ôà¹ÕÂÃÔè§«ÑŸŸÅÒÂ',586,586),('«Òâµéâ€à¡ÕÂÇ ¡Ãاෟ',578,578),('«Ô¡»éÒ (»ÃÐà·Èä·Â)',579,579),('«ÕŽÕ ÍØµÊÒË¡ÃÃÁ',585,585),('«Ù',587,587),('­Ò³ÀÑ€',590,590),('­Õ¹ÀÒ',591,591),('¯Ç§¡ÁÅ',592,592),('°ÔµÔÃѪµì',605,605),('°ÔµÔÃѵ¹ì',606,606),('°ÔµÔÁÒ',604,604),('°ÔµÔàžÕÂÃ',600,600),('°ÔµÔ¡Ò¹µì',598,598),('°ÔµÔ³Ñ°',599,599),('°ÔµÔ¹Ñ¹·ì',601,601),('°ÔµÔŸÃ',603,603),('°ÔµÔŸ§Èì',602,602),('°Ôµ¡Ò¹µì',597,597),('°Ò¹Ñ¹·ì',593,593),('°Ò¹ÔÊÃ',595,595),('°Ò¹ÔµÂì',594,594),('°Ò»¹ÇÔ·Âì',596,596),('±ÔÁÀì¹Øª',607,607),('³ÀÑ·Ã',609,609),('³Àѷáóì',610,610),('³Ã§ÃÑ¡Éì',617,617),('³Ã§ÈÑ¡ŽÔì',619,619),('³Ã§Ä·žÔì',618,618),('³Ã§€ì',611,611),('³Ã§€ìÇÔ·Âì',615,615),('³Ã§€ìÈÑ¡ŽÔì',616,616),('³Ã§€ìÄ·žÔì',614,614),('³Ã§€ìªÑÂ',612,612),('³Ã§€ìŸÑªÃì',613,613),('³Ë·ÑÂ',620,620),('³ÑªªÒ',621,621),('³Ñ­­Ò',622,622),('³Ñ®°ÁÑÂ',623,623),('³Ñ®°ÇÃó',624,624),('³Ñ¯ŸÅ',625,625),('³Ñ°',626,626),('³Ñ°ÁÒ',645,645),('³Ñ°ÂÒ',646,646),('³Ñ°ÀÙÁÔ',643,643),('³Ñ°Á¹',644,644),('³Ñ°ÇÃÕÂì',647,647),('³Ñ°ÇѪÃì',648,648),('³Ñ°ÇѲ¹ì',649,649),('³Ñ°ÇѵÔ',650,650),('³Ñ°ÇزÔ',651,651),('³Ñ°ÊÃÑ­',653,653),('³Ñ°ÈÑ¡Âì',652,652),('³Ñ°Ë·ÑÂ',654,654),('³Ñ°Ô¡Ò',655,655),('³Ñ°¡Ã³ÔÈÒ',627,627),('³Ñ°¡Ò¹µì',629,629),('³Ñ°¡ÄµÒ',628,628),('³Ñ°¢šÃ',630,630),('³Ñ°ªÒ',632,632),('³Ñ°ª¹Ñ­',631,631),('³Ñ°°Ò',633,633),('³Ñ°µÂÒ',634,634),('³Ñ°¹Ñ¹·ì',636,636),('³Ñ°¹¹·ì',635,635),('³Ñ°»¡Ã³ì',637,637),('³Ñ°ŸÃ',641,641),('³Ñ°ŸÅ',642,642),('³Ñ°Ÿ§Èì',638,638),('³Ñ°Ÿ§Éì',639,639),('³Ñ°Ÿš¹ì',640,640),('³Õç€ì',657,657),('³ÔªÒ¡Ã',656,656),('³žÔµÒ',608,608),('³Øªª¹Ò',658,658),('ŽÃÃ쪹Õ',661,661),('ŽÃسÕ',662,662),('ŽÇ§Ãѵ¹ì',674,674),('ŽÇ§ãš',667,667),('ŽÇ§àŽ×͹',669,669),('ŽÇ§Á¹·Ãì',673,673),('ŽÇ§Ë·ÑÂ',675,675),('ŽÇ§¡ÁÅ',665,665),('ŽÇ§šÑ¹·Ãì',666,666),('ŽÇ§ŽÒÇ',668,668),('ŽÇ§¹ÀÒ',670,670),('ŽÇ§ºÅ',671,671),('ŽÇ§ŸÃ',672,672),('ŽÍ¡äÁé',676,676),('ŽÕ.ºÕ.äŽÁ͹Žì (»ÃÐà·Èä·Â)',695,695),('ŽÔàá',692,692),('ŽÒÃÒÃѵ¹ì',680,680),('ŽÒÃÒÇÃó',681,681),('ŽÒÃÔ¡Ò',682,682),('ŽÒÃÔ³Õ',683,683),('ŽÒÃÔ¹',684,684),('ŽÒÃÒ¹ÕÅì',679,679),('ŽÓç',689,689),('ŽÓç€ì',690,690),('ŽÒóÕ',677,677),('ŽÒùÕÂì',678,678),('ŽÓà¹Ô¹',688,688),('ŽÒÃØ³Õ',685,685),('ŽÒÇÃÕ',687,687),('ŽÒÇ»ÃСÒÂ',686,686),('ŽÓËÃÔ',691,691),('ŽÔÈ¡ØÅ',693,693),('ŽÔʷѵ',694,694),('ŽÅÄŽÕ',663,663),('ŽÅÄ·ÑÂ',664,664),('޹ÑÂ',659,659),('Ž¹ØŸÅ',660,660),('ŽØÊÔµ',701,701),('ŽØÊÔµà€ÁÕÀѳ±ì',702,702),('ŽØÉ®Õ',698,698),('ިɳÕ',699,699),('ŽØÉŽÕ',700,700),('ŽØÅÂìŸÑ²¹ì',697,697),('ŽØÅŸÅ',696,696),('µÐÇѹ',712,712),('µÐÅèÍÁÊÔ¹ŸÅÒʵԡ',711,711),('µè͚ѡÃ',710,710),('µÑè§šÑè§ËÅÍŽä¿',713,713),('µÒà¿çŽ',714,714),('µØê',715,715),('µØéÁ',717,717),('µØëÂ',718,718),('µØê¡µÒ',716,716),('µØÅÒÅѡɳì',719,719),('¶ÇÑÅ',729,729),('¶ÇÑÅÂì',730,730),('¶ÇÔÅ',731,731),('¶ÒÇÃ',733,733),('¶Ò³ØŸ§Èì',732,732),('¶¹ÍÁÈÑ¡ŽÔì',727,727),('¶¹ÔµŸÅ',728,728),('·ÃÃȹÕÂì',745,745),('·ÃÑŸÂì¶ÒÇÀéÒÇÑÊŽØ',746,746),('·Ã§',737,737),('·Ã§ÇزÔ',741,741),('·Ã§ÈÃÕ',742,742),('·Ã§ÈÑ¡ŽÔì',743,743),('·Ã§ÈÔÃÔ',744,744),('·Ã§ªÑ»Ñè¹·Í',738,738),('·Ã§žÃÃÁ',739,739),('·Ã§ŸÅ',740,740),('·ÇÕ',748,748),('·ÇÕÇѲ¹ì',752,752),('·ÇÕÈÃÕ',753,753),('·ÇÕÈÑ¡ŽÔì',754,754),('·ÇÔª',747,747),('·ÇÕªÑÂ',749,749),('·ÇÕ»',750,750),('·ÇÕŸÃ',751,751),('·èÒ·ÃÒÂášé§ÇѲ¹Ò',773,773),('·ÈŸÃ',755,755),('·ÈŸÅ',756,756),('·Í§ãº',759,759),('·Í§ÊØ¢',763,763),('·Í§ÍÔ¹·Ãì',764,764),('·Í§¢ÒÇ',757,757),('·Í§€Ó',758,758),('·Í§»Ò¹',760,760),('·Í§ŸÑ¹žì',761,761),('·Í§ŸÑ¹žØì',762,762),('·ÑÈÇÃó',772,772),('·ÑȹÇÃó',768,768),('·ÑȹÕÂì',770,770),('·ÑȹÕÂÒ',771,771),('·Ñȹ՟Ã',769,769),('·Ñ¡ÉÁ³¹ì',765,765),('·ÑŽŽÒÇ',766,766),('·Ñº·ÔÁ',767,767),('·Õ «Õ ŸÕ ÍÔ¹ŽÑÊ·ÃÕé',791,791),('·Õ.àÍÊ.äÇÃì€Ñ· á͹Žì áÁªªÕ¹ŸÒÃì·',794,794),('·Õ.äÍ.·Õ.ÍÔ¹àµÍÃì๪Ñè¹á¹Å',795,795),('·Õ.«Õ.«Õ.ŸÃçÍŸàŸÍÃìµÕé',792,792),('·Õ.«Õ.ŸÕ.ÍÔ¹ŽÑÊ·ÃÕé',793,793),('·ÕâÍàÍ âŽ¿à€Á ÍÔ¹ŽÃÑʵÕé',796,796),('·ÔÇÒ',789,789),('·ÔÈŸÅ',790,790),('·ÔŠÑÁŸÃ',774,774),('·Ô¹á€¹ ÍÔ¹ŽÑÊ·ÃÕ',775,775),('·ÔŸÂìÇÃó',778,778),('·ÔŸÂìÇÃØ³',779,779),('·ÔŸÂìÇÑÅÂì',780,780),('·ÔŸÂìÇÒÃÕ',781,781),('·ÔŸÂìÇÔÁÅ',782,782),('·ÔŸÂìÇŽÕ',777,777),('·ÔŸÂìŸÒŸÃ',776,776),('·ÔŸÇÃó',783,783),('·ÔŸÇÑÅÂì',784,784),('·ÔŸÇÔÁÅ',785,785),('·ÔŸÊØŽÒ',786,786),('·ÔŸÒÇÃó',788,788),('·ÔŸÒ¡Ã',787,787),('·ÙÃ',798,798),('·ÙÁÔ¹Ô·Êì ºÔ«Ôà¹Ê',797,797),('·¹§ÈÑ¡ŽÔì',735,735),('·¹Ø',736,736),('žÃÃÁÈÒʵÃì',861,861),('žÃÃÁ¹Ù­',860,860),('žà¹È',857,857),('žà¹ÈÃì',858,858),('žÁ¹Ñ¹·ì',859,859),('žÇÑÅÃѵ¹ì',865,865),('žÇѪ',863,863),('žÇѪªÑÂ',864,864),('žÑªÇѲ¹ì',869,869),('žÑªÇŽÕ',868,868),('žÑª¡Ã',866,866),('žÑªŸÅ',867,867),('žÑ­ÃŽÒ',877,877),('žÑ­ª¹¡',870,870),('žÑ­­žÃ',871,871),('žÑ­­ŸÑ²¹ì',872,872),('žÑ­³ÔªÒ',873,873),('žÑ­¹Ñ¹·ì',874,874),('žÑ­ŸÃ',875,875),('žÑ­ŸÔÊÔ·žÔì',876,876),('žÕÃÀÑ·Ãì',896,896),('žÕÃÀÒŸ',897,897),('žÕÃÇѲ¹ì',898,898),('žÕÃÐ',901,901),('žÕÃÐÇѲ¹ì',904,904),('žÕÃЪÑÂ',902,902),('žÕÃПÅ',903,903),('žÕÃÈÑ¡ŽÔì',899,899),('žÕÃÈÒ¹µÔŸÑ¹žì',900,900),('žÒÃÒ',883,883),('žÒÃÔ¹Õ',884,884),('žÓçÃѵ¹ì',886,886),('žÓç€ì',885,885),('žÕêÑÂ',890,890),('žÒ÷ԟÂì',882,882),('žÕùت',891,891),('žÕßѲ¹ì',895,895),('žÕßÅ',894,894),('žÕß§Èì',892,892),('žÕß§Éì',893,893),('žÒ¡Ã',878,878),('žÒŽÒ',879,879),('žÔŽÒÃѵ¹ì',887,887),('žÔµÔ¹Ñ¹·ì',888,888),('žÒ¹Õ',881,881),('žÔ¹Õ¡Ò­š¹ì',889,889),('žÒ¹Ô¹·Ãì',880,880),('žÄµ',862,862),('ž§äªÂ',826,826),('ž§ªÑÂ',825,825),('ž³Ñ°',827,827),('ž¹âÚ¹ì',834,834),('ž¹ÃѪ',832,832),('ž¹Ãѵ¹ì',833,833),('ž¹ÇѲ¹ì',836,836),('ž¹Çѹ',837,837),('ž¹ÇÔµµ',838,838),('ž¹ÇÔ·Âì',839,839),('ž¹ÇŽÕ',835,835),('ž¹ÐÃѪµì',841,841),('ž¹ÊÔ·žÔì',840,840),('ž¹ÑÊ',846,846),('ž¹ÑªžÔŽÒ',842,842),('ž¹Ñ­­Ò',843,843),('ž¹Ñ¹µì',844,844),('ž¹Ñ¹·ì',845,845),('ž¹Ò',847,847),('ž¹ÒÀóì',850,850),('ž¹ÒÃÑ¡Éì',852,852),('ž¹ÒÀÒ',851,851),('ž¹ÒÇѪÃì',853,853),('ž¹ÔɰÒ',855,855),('ž¹Ò€ÒÃÂÙâÍºÕ Ãѵ¹ÊÔ¹ ÊÒ¢ÒËÑÇËÁÒ¡',849,849),('ž¹Ò€ÒÃ¡ÃØ§ÈÃÕÍÂØžÂÒ º',848,848),('ž¹ÔŽÒ',854,854),('ž¹Ù',856,856),('ž¹¡Ã',828,828),('ž¹¡Äµ',829,829),('ž¹ŸÃ',830,830),('ž¹ŸÅ',831,831),('¹ à¿ÃÔÁàÁ¹¹Ôª ÍâÃáÁµÔê¡Êì ŸÕ·ÕÍÕ ÅÔÁÔàµç',906,906),('¹ ŸŽÅ',905,905),('¹àÃÈ',946,946),('¹ÃÀÑ·Ãì',939,939),('¹âõÁì',947,947),('¹ÀÇÃó',929,929),('¹ÀÑÊÊÃ',930,930),('¹ÀÑÊÊØÇÃó',931,931),('¹ÀÒ',932,932),('¹ÃÒ',940,940),('¹ÃÕ',945,945),('¹ÀÒÂØ·žì',934,934),('¹ÀÒÇÃó',935,935),('¹ÃÔÈ',943,943),('¹ÃÔɰ',944,944),('¹ÀÔ¹·Ã',936,936),('¹ÃÔ¹·Ãì',941,941),('¹ÃÔ¹·ÃìàŽª',942,942),('¹ÀÒŸÃ',933,933),('¹ÃªÑÂ',937,937),('¹ÀŽÅ',928,928),('¹ÃŸÅ',938,938),('¹ÇÃѵ¹ì',956,956),('¹ÇÅÅÐÍÍ',960,960),('¹ÇŚѹ·Ãì',957,957),('¹ÇÅ©ÇÕ',958,958),('¹ÇÅŸÃ',959,959),('¹Ç¡Ã³ì',954,954),('¹ÇŸÅ',955,955),('¹éÓÁѹ€ÒÅà·ê¡«ì',992,992),('¹éÓàŸªÃ',991,991),('¹éÓÍéÍÂ',994,994),('¹éÓ·ÔŸÂì',988,988),('¹éÓœ¹',989,989),('¹Ñ¹Ò',980,980),('¹Ñ­ªÅÒ',961,961),('¹Ñ¯ŸÃ',962,962),('¹Ñ±ŸÃ',963,963),('¹Ñ·ª¹¡',964,964),('¹Ñ·žÁ¹',965,965),('¹Ñ¹ªÑÂ',966,966),('¹Ñ¹·Ãѵ¹ì',973,973),('¹Ñ¹·ÁÒÊ',972,972),('¹Ñ¹·ÇÃó',975,975),('¹Ñ¹·Ç§Éì',974,974),('¹Ñ¹·ÈÑ¡ŽÔì',976,976),('¹Ñ¹·Ò',977,977),('¹Ñ¹·ÔÂÒ',979,979),('¹Ñ¹·Ô¡Ò¹µì',978,978),('¹Ñ¹·ªÑÂ',967,967),('¹Ñ¹·¹ì',968,968),('¹Ñ¹·¹Ò',969,969),('¹Ñ¹·ŸÃ',970,970),('¹Ñ¹·ŸÅ',971,971),('¹ÒÁ',983,983),('¹ÔÂÁ',1016,1016),('¹ÔÃÁÅ',1017,1017),('¹ÔÃѹŽÃ',1018,1018),('¹ÒÃÕ',985,985),('¹ÔÀÒ',1015,1015),('¹ÒÃÕÃѵ¹ì',986,986),('¹ÔÃÒÇÃóì',1019,1019),('¹ÒÃÔ¹·Ãì',984,984),('¹ÔâźÅ',1024,1024),('¹Ôà«Ð',998,998),('¹ÓÃØè§ä·Â ¡ÒÃìàÁ¹·ì',993,993),('¹ÔÃØš¹ì',1020,1020),('¹ÔÃØµµì',1021,1021),('¹ÔÇૹšÙÃÕèŸÃÔé¹µÔé§á͹Žì ៀ࡚šÔé§',1025,1025),('¹ÔÇѲ¹ì',1026,1026),('¹ÔÇѵÃì',1027,1027),('¹ÔÇѵÔ',1028,1028),('¹ÔÇÒµ',1029,1029),('¹ÒÇÔ¹Õ',987,987),('¹ÔÈÃÒ',1030,1030),('¹ÔÊÒ',1033,1033),('¹ÔÈÒªÅ',1031,1031),('¹ÔÈÒŸÃ',1032,1032),('¹ÔÅÀÒ',1022,1022),('¹ÔÅØºÅ',1023,1023),('¹Ô¡Éì',995,995),('¹Ô€Á',996,996),('¹ÔªÃªÕŸ',997,997),('¹Ò¯Êǧ',981,981),('¹ÔŽ',999,999),('¹ÔŽÒ',1000,1000),('¹ÔµÂì',1001,1001),('¹ÒµÂÒ',982,982),('¹ÔµÂÒ',1002,1002),('¹ÔµÔ',1003,1003),('¹ÕµÔ',1034,1034),('¹ÔµÔÁÒ',1005,1005),('¹ÔµÔŸ§Éì',1004,1004),('¹Ô·ÃÒ',1006,1006),('¹Ô·Ñȹì',1007,1007),('¹Ô·ÑȹÕÂì',1008,1008),('¹ÔžÔÇŽÕ',1009,1009),('¹Ô»»Í¹àŸ¹µì(»ÃÐà·Èä·Â)',1010,1010),('¹ÔŸÑ·žÒ',1013,1013),('¹ÔŸÑ¹',1014,1014),('¹ÓŸÅ',990,990),('¹ÔŸÅ',1012,1012),('¹ÔŸ¹žì',1011,1011),('¹ÅŸÃó',953,953),('¹ÄÁÒ³',952,952),('¹ÄÁÅ',951,951),('¹Ä³Õ',948,948),('¹ÄŽÕ',949,949),('¹Ä·žÔì',950,950),('¹€Ã',907,907),('¹€Ã»°Á Î͹ŽéÒ€ÒÃìÊì (1994)',908,908),('¹§Åѡɳì',911,911),('¹§ª¹¡',909,909),('¹§¹Øª',910,910),('¹·',912,912),('¹·Õ',914,914),('¹·Ô¹',913,913),('¹¹·ÈÑ¡ŽÔì',915,915),('¹ŸÃѵ¹ì',924,924),('¹ŸÁÒÈ',923,923),('¹Ÿà¡éÒ',916,916),('¹ŸÇÃó',926,926),('¹ŸÒŸÃ',927,927),('¹ŸÄÔ·žÔì',925,925),('¹ŸŽÅ',917,917),('¹ŸŽÅÂì',918,918),('¹Ÿ·Ñµ',919,919),('¹ŸŸÃ',921,921),('¹ŸŸÅ',922,922),('¹ŸŸ§€ì',920,920),('¹ØÈÃÒ',1039,1039),('¹ØÊÃÒ',1041,1041),('¹ØÊºÒ',1040,1040),('¹ØªÂÒ',1037,1037),('¹ØªÃÕ',1038,1038),('¹ØªšÃÔ¹·Ãì',1035,1035),('¹Øª¹Ò¶',1036,1036),('ºÃç',1050,1050),('ºÃÃàšÔŽ',1049,1049),('ºÃÃÊÒÃ',1051,1051),('ºÃÚ§',1047,1047),('ºÃÚº',1048,1048),('ºÃÔÇÃõ',1052,1052),('ºÇêÑÂ',1053,1053),('ºÑ§ÍÃ',1054,1054),('ºÑ­ªÒ',1055,1055),('ºÑ­­ÑµÔ',1056,1056),('ºÑ³±Ôµ',1057,1057),('ºÑ³±ÔµÂì',1058,1058),('ºÑµÃ¡ÃاÈÃÕÍÂØžÂÒ',1060,1060),('ºÑµÃ¡Ãاä·Â',1059,1059),('ºÑ¹Å×ÍÈÑ¡ŽÔì',1061,1061),('ºÕ á͹Žì «Õ ŸÙÅÒÊ¡Õé',1067,1067),('ºÕ ÇÒ €ÍÃìâŸàêÑè¹ šÓ¡ÑŽ',1066,1066),('ºÕ.àÍç¹.ºÃÒàŽÍÃì',1068,1068),('ºÕ.àÍÊ.äÍ.àËÅç¡¡èÍÊÃéÒ§',1069,1069),('ºÓÃØ§ä·Â',1064,1064),('ºÔǵÕéៀ',1065,1065),('ºÒ§¡Í¡ªÕ·àÁç··ÑÅ',1062,1062),('ºÒ¹ªéÍÂ',1063,1063),('ºÙê·Êì (»ÃÐà·Èä·Â)',1111,1111),('ºÙê·ÊìáÁ¹Ùá¿€àšÍÃìÃÔè§ (»ÃÐà·Èä·Â)',1112,1112),('º§¡ª',1044,1044),('º§¡µÃѵ¹ì',1045,1045),('º«ì ÍÔ¹â¿Ãì à«ÍÃìÇÔÊ',1046,1046),('ºØÃÑ­ªÅÕ',1101,1101),('ºØÃÔ¹·Ãì',1102,1102),('ºØÈÃÒ',1103,1103),('ºØÉÂÒ',1108,1108),('ºØÉÃÒÀóì',1109,1109),('ºØÈÃÔ¹·Ãì',1105,1105),('ºØÈÃÒŸÃ',1104,1104),('ºØËÅÑè¹',1110,1110),('ºØÉ¡Ã',1106,1106),('ºØÉºÒ',1107,1107),('ºØ­àÂÕèÂÁ',1085,1085),('ºØ­ÃèÇÁ',1086,1086),('ºØ­áʧ',1098,1098),('ºØ­ÃÑ¡',1087,1087),('ºØ­Âѧ',1084,1084),('ºØ­ÁÕ',1083,1083),('ºØ­àÅÔÈ',1090,1090),('ºØ­à¡ÕÂõÔ',1070,1070),('ºØ­àªÔŽ',1075,1075),('ºØ­ÈÃÕ',1091,1091),('ºØ­Êè§',1093,1093),('ºØ­ÈÔÃÔ ŽÕÇÔÅÍ»àÁ¹·ì',1092,1092),('ºØ­ÊÔ¹',1095,1095),('ºØ­Ê¹Í§',1094,1094),('ºØ­Ê׺',1096,1096),('ºØ­ÊØ¢',1097,1097),('ºØ­ÅѺ',1088,1088),('ºØ­Å×Í',1089,1089),('ºØ­€§',1071,1071),('ºØ­ªèÇÂ',1072,1072),('ºØ­ªÑÂ',1073,1073),('ºØ­ªØº',1074,1074),('ºØ­«é͹',1076,1076),('ºØ­·ÃÑŸÂì',1077,1077),('ºØ­·ÇÕ',1078,1078),('ºØ­·Í§',1079,1079),('ºØ­žÃÃÁ',1080,1080),('ºØ­»ÃÐÊÔ·žÔì',1081,1081),('ºØ­Ÿ§Éì',1082,1082),('ºØ³±Ôµ',1099,1099),('ºØ»ŒÒ',1100,1100),('»ÃÐ⪹ì',1179,1179),('»ÃÐàÇÈ',1186,1186),('»ÃÐÁÇÅ',1171,1171),('»ÃÐàÊÃÔ°',1193,1193),('»ÃÐÁÑŸÃ',1172,1172),('»ÃÐÀÑÊ',1163,1163),('»ÃÐÀÑÊÃì',1164,1164),('»ÃÐÀÑÊÃÒŸÃ',1165,1165),('»ÃÐÀÑÊÊÃ',1166,1166),('»ÃÐÀÒÀóì',1169,1169),('»ÃÐÀÒÊ',1170,1170),('»ÃÐÂÔ¹',1175,1175),('»ÃÐÀÒŸÃ',1167,1167),('»ÃÐÀÒŸÃó',1168,1168),('»ÃÐÂÙÃ',1177,1177),('»ÃÐÂÙÃÈÃÕ',1178,1178),('»ÃÐÁÙÅ',1173,1173),('»ÃЧ€ì',1174,1174),('»ÃÐà·×ͧ',1156,1156),('»ÃÐÂØ·ž',1176,1176),('»ÃÐÇѵÃ',1180,1180),('»ÃÐÇѵÔ',1181,1181),('»ÃÐÇÕ³Ò',1185,1185),('»ÃÐÇÔµÃ',1182,1182),('»ÃÐÇÔ·',1183,1183),('»ÃÐÇÔ·Âì',1184,1184),('»ÃÐÊÒÃ',1190,1190),('»ÃÐÊÒ·',1188,1188),('»ÃÐÊÔ·žÔì',1191,1191),('»ÃÐÊÒ¹',1189,1189),('»ÃÐʧ€ì',1187,1187),('»ÃÐÊ׺',1192,1192),('»ÃÐäŸ',1162,1162),('»ÃСͺ',1138,1138),('»ÃСÒÈ',1139,1139),('»ÃСÒÈÔµ',1140,1140),('»ÃСԚ',1141,1141),('»ÃСԵ',1142,1142),('»ÃЀͧ',1143,1143),('»ÃКǺ',1145,1145),('»ÃКѡÉì',1146,1146),('»ÃКԵÃ',1147,1147),('»ÃК§šÔµ',1144,1144),('»ÃЪÒ',1148,1148),('»ÃЪԵ',1149,1149),('»ÃЪØÁŸÃ',1150,1150),('»Ãгµ',1151,1151),('»ÃÐŽÔɰì',1152,1152),('»ÃзѺãš',1153,1153),('»Ãзջ',1154,1154),('»ÃзØÁ·ÔŸÂì',1155,1155),('»ÃПѲ¹ì',1160,1160),('»ÃПѹžì',1161,1161),('»ÃПķžÔì',1159,1159),('»ÃПš¹ì',1157,1157),('»ÃП¹žì',1158,1158),('»ÀÑÊÊÃ',1132,1132),('»ÃѪ­Ò',1194,1194),('»ÃÒâÁ·Âì',1200,1200),('»ÃÕÂÒÀóì',1213,1213),('»ÃÔÂÒÇÃó',1208,1208),('»ÃÒö¹Ò',1201,1201),('»ÀÒÇÃÔ¹·ì',1135,1135),('»ÀÒÇÕ',1136,1136),('»ÀÒÇŽÕ',1134,1134),('»ÃÔȹÒ',1209,1209),('»ÃÔȹÕ',1210,1210),('»ÃÒ¡ÒÃ',1195,1195),('»ÃÒ§³Õ',1196,1196),('»ÃÕªÒ',1211,1211),('»ÃÒª­ì',1197,1197),('»ÃÕ­Ò',1212,1212),('»ÃÔ­­ì',1202,1202),('»ÃÔ­­Ò',1203,1203),('»ÃÔ­ŽÒ',1204,1204),('»ÃÒ³Õ',1198,1198),('»ÃÒ³ÕÂì',1199,1199),('»ÃÔ³ŽÒ',1205,1205),('»ÀÒ³Ø',1133,1133),('»ÃÔ·ÑÈ',1206,1206),('»ÃÔ¹ŽÒ',1207,1207),('»ÂصÒ',1137,1137),('»ÇÕ³ÃѪ',1214,1214),('»ÇÕ³Ò',1215,1215),('»Êѹµì',1216,1216),('»Êѹ¹ì',1217,1217),('»Í§ÀŸ',1218,1218),('»Ñ­šÃÑÈÁÔì',1219,1219),('»Ñ­­Ò',1220,1220),('»Ñ­­ÒŸÃ',1221,1221),('»Ñ­­ÒŸÅ',1222,1222),('»Ñ³ÃÊÕ',1223,1223),('»Ñ·Á',1224,1224),('»Ñ·ÁÒ',1225,1225),('»Ñ·ÁÒÇŽÕ',1226,1226),('»ÔÂÃѵ¹ì',1246,1246),('»ÔÂÁÒÀóì',1245,1245),('»ÔÂÇÃó',1247,1247),('»ÔÂÇѲ¹ì',1248,1248),('»ÔÂÐ',1250,1250),('»ÔÂÐÁÒÈ',1259,1259),('»ÔÂÐÈÑ¡ŽÔì',1260,1260),('»ÔÂЪÑÂ',1251,1251),('»ÔÂйѹ·ì',1253,1253),('»ÔÂй¹·ì',1252,1252),('»ÔÂйت',1254,1254),('»ÔÂПÃ',1256,1256),('»ÔÂПѹžì',1257,1257),('»ÔÂПѹžØì',1258,1258),('»ÔÂП§Èì',1255,1255),('»ÔÂÈÑ¡ŽÔì',1249,1249),('»ÒÃÔªÒµ',1230,1230),('»ÒÃÔªÒµÔ',1231,1231),('»ÒÃÕ³Ò',1233,1233),('»ÔÂÒŸÃ',1261,1261),('»ÒÃԟѹžì',1232,1232),('»Ô¡ҭš¹ì',1239,1239),('»Ô¹ѹ·ì',1240,1240),('»Ô¹ү',1241,1241),('»ÔŸÃ',1244,1244),('»ÔŸ§Èì',1242,1242),('»ÔŸ§Éì',1243,1243),('»Ôè¹ÁÒ⹪',1238,1238),('»Ôè¹Á³Õ',1237,1237),('»Ò˹ѹ',1234,1234),('»ÔÅѹ­Ò',1262,1262),('»Ò³ÔÊÃÒ',1227,1227),('»ÔµÔ',1235,1235),('»ÔµÔÇѪÃì',1236,1236),('»Ò¹',1228,1228),('»Ò¹àŸªÃ',1229,1229),('»¡Ã³ì',1119,1119),('»®ÔÁÒ',1120,1120),('»¯ÔÁÒ',1123,1123),('»¯Ô­­Ò',1121,1121),('»¯ÔŸÅ',1122,1122),('»°ÁÇѲ¹ì',1124,1124),('»³ÔŽÒ',1126,1126),('»³ÔµÒ',1127,1127),('»³ªÑÂ',1125,1125),('»·ØÁ',1128,1128),('»·ØÁÒ',1130,1130),('»·ØÁŸÃ',1129,1129),('»¹ÑŽŽÒ',1131,1131),('»Ø³³ÂÒ',1263,1263),('ŒàŽÔÁ',1277,1277),('ŒèͧÈÃÕ',1279,1279),('ŒèͧŸÃó',1278,1278),('Œè͹»ÃÐÀÒ',1280,1280),('ŒèÒ¡ÒÀÅѧ¡Í§¡ÅÒ§Êӹѡ»ÅÑŽ¡ÃاෟÁËÒ¹€Ã',1285,1285),('ŒéÒ¢¹Ë¹ÙªÔ¹àΧ',1281,1281),('ŒéÒ¢¹Ë¹Ù«Ô¹àΧ',1282,1282),('ŒéҢع˹٫ԹàΧ',1283,1283),('ŒèÒ¹¿éÒ àÍ繚Ôà¹ÕÂÃÔè§',1284,1284),('ŒÒÊØ¢',1286,1286),('ŒÙéãË­èàÅç¡',1289,1289),('ŒÙéàŒŽçš',1288,1288),('Œ¡Ò¡Ãͧ',1272,1272),('Œ¡ÒŸÃó',1273,1273),('Œ§',1274,1274),('Œš§šÔµµì',1275,1275),('ŒŽØ§ÈÑ¡ŽÔì',1276,1276),('ŒØÊŽÕ',1287,1287),('œèÒ¡ÒÀÅѧ¡Í§¡ÅÒ§ Êӹѡ»ÅÑŽ¡ÃاෟÁËÒ¹€Ã',1293,1293),('ŸÃ',1319,1319),('ŸÃÁ§€Åà¿ÍÃì¹ÔàšÍÃì',1338,1338),('ŸÃóÃÒ³ì',1344,1344),('ŸÃóÊóì',1345,1345),('ŸÃóÕ',1347,1347),('ŸÃóԡÒ',1346,1346),('ŸÃó·ÔÀÒ',1339,1339),('ŸÃó¹ÔÀÒ',1340,1340),('ŸÃó»ÃÐäŸÇŽÕ',1341,1341),('ŸÃóŸÃÃÉ',1342,1342),('ŸÃóŸÔÁÅ',1343,1343),('ŸÃà·Ÿ',1326,1326),('ŸÃÞԎÒ',1348,1348),('ŸÃàŸç­',1337,1337),('ŸÃÇÔÁÅ',1349,1349),('ŸÃÇÔäÅ',1350,1350),('ŸÃÐÃÒÁ 3 Î͹ŽéÒ€ÒÃìÊì',1360,1360),('ŸÃÐÃÒÁ 3 €ÒÃìà«ç¹àµÍÃì',1359,1359),('ŸÃлÃÐᎧ Î͹ŽéÒ€ÒÃìÊì',1357,1357),('ŸÃлÃÐᎧ Î͹ŽéÒ€ÒÃìÊì šÓ¡ÑŽ',1358,1358),('ŸÃÊÃǧ',1353,1353),('ŸÃËÁŸÑ²¹ì',1355,1355),('ŸÃÊÇÃÀì',1354,1354),('ŸÃéÍÁªÑÂ',1356,1356),('ŸÃÈÑ¡ŽÔì',1351,1351),('ŸÃÈÔÃÔ',1352,1352),('ŸÃÕàÁÕÂÃìà€ÁÔ€ÑÅ á͹ŽìŸÅÒʵԡ',1362,1362),('ŸÃÕàÁÕÂÃìÍÔ¹àµÍÃìÅÔ««Ôè§',1363,1363),('ŸÃÔéÁàŸÃÒ',1361,1361),('ŸÃ¡ÇÕ',1320,1320),('ŸÃšÔµµì',1321,1321),('ŸÃªÑÂ',1322,1322),('ŸÃ·ÔÀÒ',1325,1325),('ŸÃ·ÔŸÂì',1323,1323),('ŸÃ·ÔŸÒ',1324,1324),('ŸÃ¹ÀÒ',1328,1328),('ŸÃ¹ÔµÔ¿ÔÅìÁá͹ŽìÇÕŽÕâÍ',1329,1329),('ŸÂ¹µì',1317,1317),('ŸÃ¹·Õ',1327,1327),('ŸÃŸÃó',1332,1332),('ŸÃŸÔÁÅ',1335,1335),('ŸÃŸÔäÅ',1336,1336),('ŸÃŸÅ',1333,1333),('ŸÃŸÅÒ§ÒÁ',1334,1334),('ŸÃŸ§Éì',1330,1330),('ŸÃŸ¹Ò',1331,1331),('ŸÂا',1318,1318),('ŸÇ§Ãѵ¹ì',1372,1372),('ŸÇ§àŸç­',1371,1371),('ŸÇ§·Í§',1370,1370),('ŸÈÔ¹',1373,1373),('ŸÊØà¡µÔì',1374,1374),('ŸÑÊŸÃ',1391,1391),('ŸÑÅÅÀ',1390,1390),('ŸÑªÃ',1376,1376),('ŸÑªÃÇäÅ',1377,1377),('ŸÑªÃÒ',1378,1378),('ŸÑªÃÕ',1382,1382),('ŸÑªÃÒÀóì',1379,1379),('ŸÑªÃÕÀóì',1384,1384),('ŸÑªÃÒÀÒ',1380,1380),('ŸÑªÃÔ¹·Ãì',1381,1381),('ŸÑªÃÕŸÃ',1383,1383),('ŸÑª¹Õ',1375,1375),('ŸÑ²·ÇÕ',1385,1385),('ŸÑ²¹Ð',1387,1387),('ŸÑ²¹ªÑÂ',1386,1386),('ŸÑ²Ÿ§Éì',1388,1388),('ŸÑ·žìžÕÃÒ',1389,1389),('ŸÔ ÈÁÑÂ',1397,1397),('ŸÕ.àÍÊ.šÕ ÅÔÊ«Ôè§',1439,1439),('ŸÕ.àÍÊ.ŸÅÒʵԡºÃÒàŽÍÃì á͹Žì«Ñ¹',1440,1440),('ŸÕ.àÍÊ.ŸÅÒʵԡºÃÒàŽÍÃìá͹Žì«Ñ¹',1441,1441),('ŸÕ.«Õ.àºÊ·ì €ÃÕàÍ·',1438,1438),('ŸÔÃÁÂì',1430,1430),('ŸÔÁÀÒ',1428,1428),('ŸÕÃÇØ²Ô',1446,1446),('ŸÕÃÐ',1448,1448),('ŸÕÃÐÈÑ¡ŽÔì',1451,1451),('ŸÕÃПÅ',1450,1450),('ŸÕÃП§Èì',1449,1449),('ŸÕÃÈÔÅ»ì',1447,1447),('ŸÒÃҡ͹ÍÔ¹â¿à·€',1396,1396),('ŸÔÁÅ',1429,1429),('ŸÔàªÉ°',1409,1408),('ŸÔàªÉ°ì',1408,1409),('ŸÔય',1406,1406),('ŸÔય°ì',1407,1407),('ŸÒâµà€ÁÕÍØµÊÒË¡ÃÃÁ',1394,1394),('ŸÕ÷ѵ',1444,1444),('ŸÔà·Ÿ',1415,1415),('ŸÔÀŸ',1420,1420),('ŸÔÁŸìÀóì',1425,1425),('ŸÔÁŸìÀÑ€',1426,1426),('ŸÔÁŸìãš',1421,1421),('ŸÔÁŸìÇÔÁÅ',1427,1427),('ŸÔÁŸìª¹¡',1422,1422),('ŸÔÁŸì»ÃПÃó',1423,1423),('ŸÔÁŸìŸÃ',1424,1424),('ŸÕßѲ¹ì',1445,1445),('ŸÔÃØ³',1431,1431),('ŸÔÊÁÑÂ',1434,1434),('ŸÔÈÔɰì',1432,1432),('ŸÔÊÔɰì',1437,1437),('ŸÔÊÔ°',1435,1435),('ŸÔÊÔ·žÔì',1436,1436),('ŸÔɳØ',1433,1433),('ŸÔšÔµÃÒ',1398,1398),('ŸÔªÂÒ',1401,1401),('ŸÔªÑÂ',1402,1402),('ŸÔªÑÂÇѲ¹ì',1403,1403),('ŸÔªÔµ',1404,1404),('ŸÔªÔµŸÅ',1405,1405),('ŸÔª­ì',1399,1399),('ŸÔªŽÒ',1400,1400),('ŸÔ±ÙÃÂì',1410,1410),('ŸÒ³Õ',1393,1393),('ŸÒ³ÔªÂì',1392,1392),('ŸÔ³ªØŽÒ',1411,1411),('ŸÔ³¹ÀÒ',1412,1412),('ŸÔ·ÂÒ',1413,1413),('ŸÔ·Ñ¡Éì',1414,1414),('ŸÔžÒ¹¡Ã',1416,1416),('ŸÕ¹Ô¡«ì àÍç¡«ìàŸÃÊ',1442,1442),('ŸÕ¹Ô¡«ìàÍç¡«ìàŸÃÊ',1443,1443),('ŸÒ¹·Í§',1395,1395),('ŸÔ¹¹ÔÀÒ',1417,1417),('ŸÔºÙÅÂì',1418,1418),('ŸÔŸÑ²¹ì',1419,1419),('ŸÙŷͧŸÃçÍŸàŸÍÃìµÕé_',1454,1454),('ŸÙÅŒÅ',1455,1455),('ŸÙ¹ÈÑ¡ŽÔì',1453,1453),('ŸÙ¹ŸÑ¹žì',1452,1452),('ŸÅà·Ÿ',1366,1366),('ŸÅÊÔ·žÔì',1369,1369),('ŸÅ¡Äɳì',1364,1364),('ŸÅªÑÂ',1365,1365),('ŸÅŸÑªÃì',1367,1367),('ŸÅŸÑ²¹ì',1368,1368),('Ÿ§ÈìÀÑ€',1300,1300),('Ÿ§Èìà¡ÕÂõÔ',1294,1294),('Ÿ§Èìà·Ÿ',1296,1296),('Ÿ§Éìà·Ÿ',1302,1302),('Ÿ§ÉìÈÑ¡ŽÔì',1304,1304),('Ÿ§ÉìÊѹµì',1305,1305),('Ÿ§ÈìÊØà¡ÉÁ',1301,1301),('Ÿ§Éì͹ѹµì',1306,1306),('Ÿ§ÈìªÒÂ',1295,1295),('Ÿ§ÉìŸÃ',1303,1303),('Ÿ§ÈìŸÑ¹žì',1298,1298),('Ÿ§ÈìŸÔŸÑ²¹ì',1299,1299),('Ÿ§ÈžÃ',1297,1297),('ŸšÁÒÅÂì',1312,1312),('ŸšÁÒ¹',1311,1311),('Ÿš¹ì',1307,1307),('Ÿš¹Ò',1308,1308),('Ÿš¹ÕÂì',1310,1310),('Ÿš¹Òö',1309,1309),('Ÿ¹Á',1313,1313),('Ÿ¹ÁªÑÂ',1314,1314),('Ÿ¹ÒÊѹ±ì',1315,1315),('Ÿ¹ÔŽÒ',1316,1316),('¿Õ¹Ô¡«ì àÍç¡«ìàŸÃÊ',1493,1493),('¿ÅØÊÊÔ¡à€Á',1492,1492);
+SELECT name FROM t1 ORDER BY name;
+DROP TABLE t1;
+
+#
+# Check the following:
+# "a" == "a "
+# "a\0" < "a"
+# "a\0" < "a "
+
+SELECT 'a' = 'a ';
+SELECT 'a\0' < 'a';
+SELECT 'a\0' < 'a ';
+SELECT 'a\t' < 'a';
+SELECT 'a\t' < 'a ';
+
+CREATE TABLE t1 (a char(10) not null) CHARACTER SET tis620;
+INSERT INTO t1 VALUES ('a'),('a\0'),('a\t'),('a ');
+SELECT hex(a),STRCMP(a,'a'), STRCMP(a,'a ') FROM t1;
+DROP TABLE t1;
+
+#
+# Bug#6608
+#
+CREATE TABLE t1 (
+ `id` int(11) NOT NULL auto_increment,
+ `url` varchar(200) NOT NULL default '',
+ `name` varchar(250) NOT NULL default '',
+ `type` int(11) NOT NULL default '0',
+ `website` varchar(250) NOT NULL default '',
+ `adddate` date NOT NULL default '0000-00-00',
+ `size` varchar(20) NOT NULL default '',
+ `movieid` int(11) NOT NULL default '0',
+ `musicid` int(11) NOT NULL default '0',
+ `star` varchar(20) NOT NULL default '',
+ `download` int(11) NOT NULL default '0',
+ `lastweek` int(11) NOT NULL default '0',
+ `thisweek` int(11) NOT NULL default '0',
+ `page` varchar(250) NOT NULL default '',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `url` (`url`)
+) CHARACTER SET tis620;
+
+INSERT INTO t1 VALUES
+(1,'http://www.siamzone.com/download/download/000001-frodo_1024.jpg','The Lord
+of the Rings
+Wallpapers',1,'http://www.lordoftherings.net','2002-01-22','',448,0,'',3805,0,0,
+'');
+INSERT INTO t1 VALUES (2,'http://www.othemovie.com/OScreenSaver1.EXE','O
+Screensaver',2,'','2002-01-22','',491,0,'',519,0,0,'');
+INSERT INTO t1 VALUES
+(3,'http://www.siamzone.com/download/download/000003-jasonx2(800x600).jpg','Jaso
+n X Wallpapers',1,'','2002-05-31','',579,0,'',1091,0,0,'');
+select * from t1 order by id;
+DROP TABLE t1;
diff --git a/mysql-test/t/ctype_uca.test b/mysql-test/t/ctype_uca.test
new file mode 100644
index 00000000000..8bca2a4b3c2
--- /dev/null
+++ b/mysql-test/t/ctype_uca.test
@@ -0,0 +1,454 @@
+-- source include/have_ucs2.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+#
+# Test Unicode collations.
+#
+set names utf8;
+
+#
+# Check trailing spaces
+#
+set collation_connection=utf8_unicode_ci;
+
+select 'a' = 'a', 'a' = 'a ', 'a ' = 'a';
+
+select 'a\t' = 'a' , 'a\t' < 'a' , 'a\t' > 'a';
+select 'a\t' = 'a ', 'a\t' < 'a ', 'a\t' > 'a ';
+
+select 'a' = 'a\t', 'a' < 'a\t', 'a' > 'a\t';
+select 'a ' = 'a\t', 'a ' < 'a\t', 'a ' > 'a\t';
+
+select 'a a' > 'a', 'a \t' < 'a';
+
+#
+# Bug #6787 LIKE not working properly with _ and utf8 data
+#
+select 'c' like '\_' as want0;
+
+#
+# Bug #5679 utf8_unicode_ci LIKE--trailing % doesn't equal zero characters
+#
+CREATE TABLE t (
+ c char(20) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+INSERT INTO t VALUES ('a'),('ab'),('aba');
+ALTER TABLE t ADD INDEX (c);
+SELECT c FROM t WHERE c LIKE 'a%';
+#should find 3 rows but only found 2
+DROP TABLE t;
+
+create table t1 (c1 char(10) character set utf8 collate utf8_bin);
+
+#
+# Basic Latin
+#
+insert into t1 values ('A'),('a');
+insert into t1 values ('B'),('b');
+insert into t1 values ('C'),('c');
+insert into t1 values ('D'),('d');
+insert into t1 values ('E'),('e');
+insert into t1 values ('F'),('f');
+insert into t1 values ('G'),('g');
+insert into t1 values ('H'),('h');
+insert into t1 values ('I'),('i');
+insert into t1 values ('J'),('j');
+insert into t1 values ('K'),('k');
+insert into t1 values ('L'),('l');
+insert into t1 values ('M'),('m');
+insert into t1 values ('N'),('n');
+insert into t1 values ('O'),('o');
+insert into t1 values ('P'),('p');
+insert into t1 values ('Q'),('q');
+insert into t1 values ('R'),('r');
+insert into t1 values ('S'),('s');
+insert into t1 values ('T'),('t');
+insert into t1 values ('U'),('u');
+insert into t1 values ('V'),('v');
+insert into t1 values ('W'),('w');
+insert into t1 values ('X'),('x');
+insert into t1 values ('Y'),('y');
+insert into t1 values ('Z'),('z');
+
+#
+# Latin1 suppliment
+#
+insert into t1 values (_ucs2 0x00e0),(_ucs2 0x00c0);
+insert into t1 values (_ucs2 0x00e1),(_ucs2 0x00c1);
+insert into t1 values (_ucs2 0x00e2),(_ucs2 0x00c2);
+insert into t1 values (_ucs2 0x00e3),(_ucs2 0x00c3);
+insert into t1 values (_ucs2 0x00e4),(_ucs2 0x00c4);
+insert into t1 values (_ucs2 0x00e5),(_ucs2 0x00c5);
+insert into t1 values (_ucs2 0x00e6),(_ucs2 0x00c6);
+insert into t1 values (_ucs2 0x00e7),(_ucs2 0x00c7);
+insert into t1 values (_ucs2 0x00e8),(_ucs2 0x00c8);
+insert into t1 values (_ucs2 0x00e9),(_ucs2 0x00c9);
+insert into t1 values (_ucs2 0x00ea),(_ucs2 0x00ca);
+insert into t1 values (_ucs2 0x00eb),(_ucs2 0x00cb);
+insert into t1 values (_ucs2 0x00ec),(_ucs2 0x00cc);
+insert into t1 values (_ucs2 0x00ed),(_ucs2 0x00cd);
+insert into t1 values (_ucs2 0x00ee),(_ucs2 0x00ce);
+insert into t1 values (_ucs2 0x00ef),(_ucs2 0x00cf);
+
+insert into t1 values (_ucs2 0x00f0),(_ucs2 0x00d0);
+insert into t1 values (_ucs2 0x00f1),(_ucs2 0x00d1);
+insert into t1 values (_ucs2 0x00f2),(_ucs2 0x00d2);
+insert into t1 values (_ucs2 0x00f3),(_ucs2 0x00d3);
+insert into t1 values (_ucs2 0x00f4),(_ucs2 0x00d4);
+insert into t1 values (_ucs2 0x00f5),(_ucs2 0x00d5);
+insert into t1 values (_ucs2 0x00f6),(_ucs2 0x00d6);
+insert into t1 values (_ucs2 0x00f7),(_ucs2 0x00d7);
+insert into t1 values (_ucs2 0x00f8),(_ucs2 0x00d8);
+insert into t1 values (_ucs2 0x00f9),(_ucs2 0x00d9);
+insert into t1 values (_ucs2 0x00fa),(_ucs2 0x00da);
+insert into t1 values (_ucs2 0x00fb),(_ucs2 0x00db);
+insert into t1 values (_ucs2 0x00fc),(_ucs2 0x00dc);
+insert into t1 values (_ucs2 0x00fd),(_ucs2 0x00dd);
+insert into t1 values (_ucs2 0x00fe),(_ucs2 0x00de);
+insert into t1 values (_ucs2 0x00ff),(_ucs2 0x00df);
+
+#
+# Latin extended-A, 0100-017F
+#
+insert into t1 values (_ucs2 0x0100),(_ucs2 0x0101),(_ucs2 0x0102),(_ucs2 0x0103);
+insert into t1 values (_ucs2 0x0104),(_ucs2 0x0105),(_ucs2 0x0106),(_ucs2 0x0107);
+insert into t1 values (_ucs2 0x0108),(_ucs2 0x0109),(_ucs2 0x010a),(_ucs2 0x010b);
+insert into t1 values (_ucs2 0x010c),(_ucs2 0x010d),(_ucs2 0x010e),(_ucs2 0x010f);
+insert into t1 values (_ucs2 0x0110),(_ucs2 0x0111),(_ucs2 0x0112),(_ucs2 0x0113);
+insert into t1 values (_ucs2 0x0114),(_ucs2 0x0115),(_ucs2 0x0116),(_ucs2 0x0117);
+insert into t1 values (_ucs2 0x0118),(_ucs2 0x0119),(_ucs2 0x011a),(_ucs2 0x011b);
+insert into t1 values (_ucs2 0x011c),(_ucs2 0x011d),(_ucs2 0x011e),(_ucs2 0x011f);
+insert into t1 values (_ucs2 0x0120),(_ucs2 0x0121),(_ucs2 0x0122),(_ucs2 0x0123);
+insert into t1 values (_ucs2 0x0124),(_ucs2 0x0125),(_ucs2 0x0126),(_ucs2 0x0127);
+insert into t1 values (_ucs2 0x0128),(_ucs2 0x0129),(_ucs2 0x012a),(_ucs2 0x012b);
+insert into t1 values (_ucs2 0x012c),(_ucs2 0x012d),(_ucs2 0x012e),(_ucs2 0x012f);
+insert into t1 values (_ucs2 0x0130),(_ucs2 0x0131),(_ucs2 0x0132),(_ucs2 0x0133);
+insert into t1 values (_ucs2 0x0134),(_ucs2 0x0135),(_ucs2 0x0136),(_ucs2 0x0137);
+insert into t1 values (_ucs2 0x0138),(_ucs2 0x0139),(_ucs2 0x013a),(_ucs2 0x013b);
+insert into t1 values (_ucs2 0x013c),(_ucs2 0x013d),(_ucs2 0x013e),(_ucs2 0x013f);
+insert into t1 values (_ucs2 0x0140),(_ucs2 0x0141),(_ucs2 0x0142),(_ucs2 0x0143);
+insert into t1 values (_ucs2 0x0144),(_ucs2 0x0145),(_ucs2 0x0146),(_ucs2 0x0147);
+insert into t1 values (_ucs2 0x0148),(_ucs2 0x0149),(_ucs2 0x014a),(_ucs2 0x014b);
+insert into t1 values (_ucs2 0x014c),(_ucs2 0x014d),(_ucs2 0x014e),(_ucs2 0x014f);
+insert into t1 values (_ucs2 0x0150),(_ucs2 0x0151),(_ucs2 0x0152),(_ucs2 0x0153);
+insert into t1 values (_ucs2 0x0154),(_ucs2 0x0155),(_ucs2 0x0156),(_ucs2 0x0157);
+insert into t1 values (_ucs2 0x0158),(_ucs2 0x0159),(_ucs2 0x015a),(_ucs2 0x015b);
+insert into t1 values (_ucs2 0x015c),(_ucs2 0x015d),(_ucs2 0x015e),(_ucs2 0x015f);
+insert into t1 values (_ucs2 0x0160),(_ucs2 0x0161),(_ucs2 0x0162),(_ucs2 0x0163);
+insert into t1 values (_ucs2 0x0164),(_ucs2 0x0165),(_ucs2 0x0166),(_ucs2 0x0167);
+insert into t1 values (_ucs2 0x0168),(_ucs2 0x0169),(_ucs2 0x016a),(_ucs2 0x016b);
+insert into t1 values (_ucs2 0x016c),(_ucs2 0x016d),(_ucs2 0x016e),(_ucs2 0x016f);
+insert into t1 values (_ucs2 0x0170),(_ucs2 0x0171),(_ucs2 0x0172),(_ucs2 0x0173);
+insert into t1 values (_ucs2 0x0174),(_ucs2 0x0175),(_ucs2 0x0176),(_ucs2 0x0177);
+insert into t1 values (_ucs2 0x0178),(_ucs2 0x0179),(_ucs2 0x017a),(_ucs2 0x017b);
+insert into t1 values (_ucs2 0x017c),(_ucs2 0x017d),(_ucs2 0x017e),(_ucs2 0x017f);
+
+#
+# Latin extended-B, 0180-024F
+#
+insert into t1 values (_ucs2 0x0180),(_ucs2 0x0181),(_ucs2 0x0182),(_ucs2 0x0183);
+insert into t1 values (_ucs2 0x0184),(_ucs2 0x0185),(_ucs2 0x0186),(_ucs2 0x0187);
+insert into t1 values (_ucs2 0x0188),(_ucs2 0x0189),(_ucs2 0x018a),(_ucs2 0x018b);
+insert into t1 values (_ucs2 0x018c),(_ucs2 0x018d),(_ucs2 0x018e),(_ucs2 0x018f);
+insert into t1 values (_ucs2 0x0190),(_ucs2 0x0191),(_ucs2 0x0192),(_ucs2 0x0193);
+insert into t1 values (_ucs2 0x0194),(_ucs2 0x0195),(_ucs2 0x0196),(_ucs2 0x0197);
+insert into t1 values (_ucs2 0x0198),(_ucs2 0x0199),(_ucs2 0x019a),(_ucs2 0x019b);
+insert into t1 values (_ucs2 0x019c),(_ucs2 0x019d),(_ucs2 0x019e),(_ucs2 0x019f);
+insert into t1 values (_ucs2 0x01a0),(_ucs2 0x01a1),(_ucs2 0x01a2),(_ucs2 0x01a3);
+insert into t1 values (_ucs2 0x01a4),(_ucs2 0x01a5),(_ucs2 0x01a6),(_ucs2 0x01a7);
+insert into t1 values (_ucs2 0x01a8),(_ucs2 0x01a9),(_ucs2 0x01aa),(_ucs2 0x01ab);
+insert into t1 values (_ucs2 0x01ac),(_ucs2 0x01ad),(_ucs2 0x01ae),(_ucs2 0x01af);
+insert into t1 values (_ucs2 0x01b0),(_ucs2 0x01b1),(_ucs2 0x01b2),(_ucs2 0x01b3);
+insert into t1 values (_ucs2 0x01b4),(_ucs2 0x01b5),(_ucs2 0x01b6),(_ucs2 0x01b7);
+insert into t1 values (_ucs2 0x01b8),(_ucs2 0x01b9),(_ucs2 0x01ba),(_ucs2 0x01bb);
+insert into t1 values (_ucs2 0x01bc),(_ucs2 0x01bd),(_ucs2 0x01be),(_ucs2 0x01bf);
+insert into t1 values (_ucs2 0x01c0),(_ucs2 0x01c1),(_ucs2 0x01c2),(_ucs2 0x01c3);
+insert into t1 values (_ucs2 0x01c4),(_ucs2 0x01c5),(_ucs2 0x01c6),(_ucs2 0x01c7);
+insert into t1 values (_ucs2 0x01c8),(_ucs2 0x01c9),(_ucs2 0x01ca),(_ucs2 0x01cb);
+insert into t1 values (_ucs2 0x01cc),(_ucs2 0x01cd),(_ucs2 0x01ce),(_ucs2 0x01cf);
+insert into t1 values (_ucs2 0x01d0),(_ucs2 0x01d1),(_ucs2 0x01d2),(_ucs2 0x01d3);
+insert into t1 values (_ucs2 0x01d4),(_ucs2 0x01d5),(_ucs2 0x01d6),(_ucs2 0x01d7);
+insert into t1 values (_ucs2 0x01d8),(_ucs2 0x01d9),(_ucs2 0x01da),(_ucs2 0x01db);
+insert into t1 values (_ucs2 0x01dc),(_ucs2 0x01dd),(_ucs2 0x01de),(_ucs2 0x01df);
+insert into t1 values (_ucs2 0x01e0),(_ucs2 0x01e1),(_ucs2 0x01e2),(_ucs2 0x01e3);
+insert into t1 values (_ucs2 0x01e4),(_ucs2 0x01e5),(_ucs2 0x01e6),(_ucs2 0x01e7);
+insert into t1 values (_ucs2 0x01e8),(_ucs2 0x01e9),(_ucs2 0x01ea),(_ucs2 0x01eb);
+insert into t1 values (_ucs2 0x01ec),(_ucs2 0x01ed),(_ucs2 0x01ee),(_ucs2 0x01ef);
+insert into t1 values (_ucs2 0x01f0),(_ucs2 0x01f1),(_ucs2 0x01f2),(_ucs2 0x01f3);
+insert into t1 values (_ucs2 0x01f4),(_ucs2 0x01f5),(_ucs2 0x01f6),(_ucs2 0x01f7);
+insert into t1 values (_ucs2 0x01f8),(_ucs2 0x01f9),(_ucs2 0x01fa),(_ucs2 0x01fb);
+insert into t1 values (_ucs2 0x01fc),(_ucs2 0x01fd),(_ucs2 0x01fe),(_ucs2 0x01ff);
+
+
+insert into t1 values ('AA'),('Aa'),('aa'),('aA');
+insert into t1 values ('CH'),('Ch'),('ch'),('cH');
+insert into t1 values ('DZ'),('Dz'),('dz'),('dZ');
+insert into t1 values ('IJ'),('Ij'),('ij'),('iJ');
+insert into t1 values ('LJ'),('Lj'),('lj'),('lJ');
+insert into t1 values ('LL'),('Ll'),('ll'),('lL');
+insert into t1 values ('NJ'),('Nj'),('nj'),('nJ');
+insert into t1 values ('OE'),('Oe'),('oe'),('oE');
+insert into t1 values ('SS'),('Ss'),('ss'),('sS');
+insert into t1 values ('RR'),('Rr'),('rr'),('rR');
+
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_unicode_ci;
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_icelandic_ci;
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_latvian_ci;
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_romanian_ci;
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_slovenian_ci;
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_polish_ci;
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_estonian_ci;
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_spanish_ci;
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_swedish_ci;
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_turkish_ci;
+
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_czech_ci;
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_danish_ci;
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_lithuanian_ci;
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_slovak_ci;
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_spanish2_ci;
+select group_concat(c1 order by c1) from t1 group by c1 collate utf8_roman_ci;
+
+drop table t1;
+
+#
+# Bug#5324
+#
+SET NAMES utf8;
+#test1
+CREATE TABLE t1 (c varchar(255) NOT NULL COLLATE utf8_general_ci, INDEX (c));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B403B11F770308 USING utf8));
+#Check one row
+SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf8)
+COLLATE utf8_general_ci;
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B4 USING utf8));
+#Check two rows
+SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf8)
+COLLATE utf8_general_ci ORDER BY c;
+DROP TABLE t1;
+#test2
+CREATE TABLE t1 (c varchar(255) NOT NULL COLLATE ucs2_unicode_ci, INDEX (c));
+INSERT INTO t1 VALUES (_ucs2 0x039C03C903B403B11F770308);
+#Check one row
+SELECT * FROM t1 WHERE c LIKE _ucs2 0x039C0025 COLLATE ucs2_unicode_ci;
+INSERT INTO t1 VALUES (_ucs2 0x039C03C903B4);
+#Check two rows
+SELECT * FROM t1 WHERE c LIKE _ucs2 0x039C0025
+COLLATE ucs2_unicode_ci ORDER BY c;
+DROP TABLE t1;
+#test 3
+CREATE TABLE t1 (c varchar(255) NOT NULL COLLATE utf8_unicode_ci, INDEX (c));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B403B11F770308 USING utf8));
+#Check one row row
+SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf8) COLLATE utf8_unicode_ci;
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B4 USING utf8));
+#Check two rows
+SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf8)
+COLLATE utf8_unicode_ci ORDER BY c;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ col1 CHAR(32) CHARACTER SET utf8 NOT NULL
+);
+
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0041004100410627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0041004100410628 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0041004100410647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0041004100410648 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0633064A0651062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D06330646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0642064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06320627062F0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062806310627064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064706450647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F062706460634062C0648064A06270646064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A06270631064A062E USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062706460642064406270628 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A0631062706460650 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627062F064806270631062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280631062706480646200C06310627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062E064806270646062F0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0648 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A062D062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0623062B064A0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0642063106270631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06AF06310641062A0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270646062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0634062E0635064A0651062A064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628062706310632 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270633062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063906A90633 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270648060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D062F0648062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628064A0633062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0648067E0646062C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06330627064406AF064A060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063306270644 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606450627064A0646062F0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A06280631064A0632 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645062C06440633 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280648062F060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628064A0646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06350641062D0627062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A0646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A9062A06270628 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x068606340645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062E06480631062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0686064706310647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06420648064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450635064506510645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06310627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0646063406270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645064A200C062F0647062F060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647063106860646062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06390645064400BB USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A9064806340634 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064706500646064A064606AF USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627062D063306270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064A062706310634062706370631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450646062A06340631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0634062F0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0633062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A064806270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647064506270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064806510644 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0634062E064A0635 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0627062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A064106270648062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D06270644062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A064106A906510631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063A064406280647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06270631062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064A06A9064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270632 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063106470628063106270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606470636062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064506340631064806370647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A063106270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0646064A0632 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064A06A9 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645062D064206510642 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0637063106270632 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064106310647064606AF USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0645062F06510646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A063106270646064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280648062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90627063106470627064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270648 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0639063106350647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064506480631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0633064A06270633064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A063106270646060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D064806320647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063906440645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F062706460634 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450642062706440627062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F064A06AF0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0648064A06980647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0646062706450647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064506480631062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628062D062B USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628063106310633064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606480634062A0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A064606470627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0622064606860647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F064806310647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064206270645062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x067E0631062F062706320645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0698062706460648064A0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0648064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06390648062A0650 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063306500631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0646064A0633064F0646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063106270633 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647064A0626062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0639064406480645200C063406310642064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280639062F0627064B USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645062F063106330647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062206410631064A06420627064A064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06270646063406AF06270647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06440646062F0646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x067E064A06480633062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647064606AF06270645064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x067E0633 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0622063A06270632 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062C064606AF USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062C064706270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F064806510645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063406470631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A9064506280631064A062C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450646062A06420644 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90631062F0646062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06470645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06310641062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220646062C0627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064506270646062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062706A9062A06280631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606380631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06480644062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06480628062706310647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606330628062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645063306270639062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0634062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06480632064A0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645062E062A06270631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06330641064A0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064606AF0644064A0633 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0642064A200C06320627062F0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280627063206AF0634062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647064506330631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220644064506270646064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270634 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220645062F0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A906270631064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x067E0631062F0627062E062A0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063906440645064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627062F0628064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D062F0651 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606280648062F060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06480644064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063906480636060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06340627064A062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064506470645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220646060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06470645063306310634 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90627064606480646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062E0627064606480627062F06AF064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06AF06310645064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280648062C0648062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062206480631062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0648 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90627064506440627064B USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064A06A9062F064A06AF0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06AF USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F064406280633062A0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280648062F0646062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450647064506270646 USING utf8));
+SELECT HEX(CONVERT(col1 USING ucs2)) FROM t1 ORDER BY col1 COLLATE utf8_persian_ci, col1 COLLATE utf8_bin;
+DROP TABLE t1;
+
+SET @test_character_set= 'utf8';
+SET @test_collation= 'utf8_swedish_ci';
+-- source include/ctype_common.inc
+
+#
+# Bug 7111 server crashes when regexp is used
+#
+create table t1 (a varchar(1)) character set utf8 collate utf8_estonian_ci;
+insert into t1 values ('A'),('B'),('C'),('a'),('b'),('c');
+select a, a regexp '[a]' from t1 order by binary a;
+drop table t1;
diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test
new file mode 100644
index 00000000000..b9f77505446
--- /dev/null
+++ b/mysql-test/t/ctype_ucs.test
@@ -0,0 +1,386 @@
+-- source include/have_ucs2.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+SET NAMES latin1;
+SET character_set_connection=ucs2;
+-- source include/endspace.inc
+
+SET CHARACTER SET koi8r;
+
+#
+# Check that 0x20 is only trimmed when it is
+# a part of real SPACE character, not just a part
+# of a multibyte sequence.
+# Note, CYRILLIC LETTER ER is used as an example, which
+# is stored as 0x0420 in UCS2, thus contains 0x20 in the
+# low byte. The second character is THREE-PER-M, U+2004,
+# which contains 0x20 in the high byte.
+#
+
+CREATE TABLE t1 (word VARCHAR(64) CHARACTER SET ucs2);
+INSERT INTO t1 VALUES (_koi8r'ò'), (X'2004');
+SELECT hex(word) FROM t1 ORDER BY word;
+DELETE FROM t1;
+
+#
+# Check that real spaces are correctly trimmed.
+#
+
+INSERT INTO t1 VALUES (X'042000200020'), (X'200400200020');
+SELECT hex(word) FROM t1 ORDER BY word;
+DROP TABLE t1;
+
+#
+# Check LPAD/RPAD
+#
+SELECT LPAD(_ucs2 X'0420',10,_ucs2 X'0421');
+SELECT LPAD(_ucs2 X'0420',10,_ucs2 X'04210422');
+SELECT LPAD(_ucs2 X'0420',10,_ucs2 X'042104220423');
+SELECT LPAD(_ucs2 X'0420042104220423042404250426042704280429042A042B',10,_ucs2 X'042104220423');
+
+SELECT RPAD(_ucs2 X'0420',10,_ucs2 X'0421');
+SELECT RPAD(_ucs2 X'0420',10,_ucs2 X'04210422');
+SELECT RPAD(_ucs2 X'0420',10,_ucs2 X'042104220423');
+SELECT RPAD(_ucs2 X'0420042104220423042404250426042704280429042A042B',10,_ucs2 X'042104220423');
+
+CREATE TABLE t1 SELECT
+LPAD(_ucs2 X'0420',10,_ucs2 X'0421') l,
+RPAD(_ucs2 X'0420',10,_ucs2 X'0421') r;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+
+#
+# BUG3946
+#
+
+create table t2(f1 Char(30));
+insert into t2 values ("103000"), ("22720000"), ("3401200"), ("78000");
+select lpad(f1, 12, "-o-/") from t2;
+drop table t2;
+######################################################
+#
+# Test of like
+#
+
+SET NAMES koi8r;
+SET character_set_connection=ucs2;
+
+create table t1 (a varchar(10) character set ucs2, key(a));
+insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
+explain select * from t1 where a like 'abc%';
+explain select * from t1 where a like concat('abc','%');
+select * from t1 where a like "abc%";
+select * from t1 where a like concat("abc","%");
+select * from t1 where a like "ABC%";
+select * from t1 where a like "test%";
+select * from t1 where a like "te_t";
+select * from t1 where a like "%a%";
+select * from t1 where a like "%abcd%";
+select * from t1 where a like "%abc\d%";
+drop table t1;
+
+#
+# More LIKE test: bug#2619
+#
+select 'AA' like 'AA';
+select 'AA' like 'A%A';
+select 'AA' like 'A%%A';
+select 'AA' like 'AA%';
+select 'AA' like '%AA%';
+select 'AA' like '%A';
+select 'AA' like '%AA';
+select 'AA' like 'A%A%';
+select 'AA' like '_%_%';
+select 'AA' like '%A%A';
+select 'AAA'like 'A%A%A';
+
+select 'AZ' like 'AZ';
+select 'AZ' like 'A%Z';
+select 'AZ' like 'A%%Z';
+select 'AZ' like 'AZ%';
+select 'AZ' like '%AZ%';
+select 'AZ' like '%Z';
+select 'AZ' like '%AZ';
+select 'AZ' like 'A%Z%';
+select 'AZ' like '_%_%';
+select 'AZ' like '%A%Z';
+select 'AZ' like 'A_';
+select 'AZ' like '_Z';
+select 'AMZ'like 'A%M%Z';
+
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ucs2);
+INSERT INTO t1 VALUES ('ÆÙ×Á'),('æÙ×Á'),('Æù×Á'),('ÆÙ÷Á'),('ÆÙ×á'),('æù÷á');
+INSERT INTO t1 VALUES ('ÆÙ×ÁÐÒÏÌÄÖ'),('æÙ×ÁÐÒÏÌÄÖ'),('Æù×ÁÐÒÏÌÄÖ'),('ÆÙ÷ÁÐÒÏÌÄÖ');
+INSERT INTO t1 VALUES ('ÆÙ×áÐÒÏÌÄÖ'),('ÆÙ×ÁðÒÏÌÄÖ'),('ÆÙ×ÁÐòÏÌÄÖ'),('ÆÙ×ÁÐÒïÌÄÖ');
+INSERT INTO t1 VALUES ('ÆÙ×ÁÐÒÏìÄÖ'),('ÆÙ×ÁÐÒÏÌäÖ'),('ÆÙ×ÁÐÒÏÌÄö'),('æù÷áðòïìäö');
+SELECT * FROM t1 WHERE a LIKE '%Æù×Á%';
+SELECT * FROM t1 WHERE a LIKE '%Æù×%';
+SELECT * FROM t1 WHERE a LIKE 'Æù×Á%';
+SELECT * FROM t1 WHERE a LIKE 'Æù×Á%' COLLATE ucs2_bin;
+DROP TABLE t1;
+
+#
+# Bug 1181
+#
+CREATE TABLE t1 (word varchar(64) NOT NULL, PRIMARY KEY (word))
+ENGINE=MyISAM CHARACTER SET ucs2 COLLATE ucs2_general_ci;
+INSERT INTO t1 (word) VALUES ("cat");
+SELECT * FROM t1 WHERE word LIKE "c%";
+SELECT * FROM t1 WHERE word LIKE "ca_";
+SELECT * FROM t1 WHERE word LIKE "cat";
+SELECT * FROM t1 WHERE word LIKE _ucs2 x'00630025';
+SELECT * FROM t1 WHERE word LIKE _ucs2 x'00630061005F';
+DROP TABLE t1;
+
+#
+# Check that INSERT works fine.
+# This invokes charpos() function.
+select insert(_ucs2 0x006100620063,10,2,_ucs2 0x006400650066);
+select insert(_ucs2 0x006100620063,1,2,_ucs2 0x006400650066);
+
+######################################################
+
+#
+# Bug 1264
+#
+# Description:
+#
+# When using a ucs2 table in MySQL,
+# either with ucs2_general_ci or ucs2_bin collation,
+# words are returned in an incorrect order when using ORDER BY
+# on an _indexed_ CHAR or VARCHAR column. They are sorted with
+# the longest word *first* instead of last. I.E. The word "aardvark"
+# is in the results before the word "a".
+#
+# If there is no index for the column, the problem does not occur.
+#
+# Interestingly, if there is no second column, the words are returned
+# in the correct order.
+#
+# According to EXPLAIN, it looks like when the output includes columns that
+# are not part of the index sorted on, it does a filesort, which fails.
+# Using a straight index yields correct results.
+
+SET NAMES latin1;
+
+#
+# Two fields, index
+#
+
+CREATE TABLE t1 (
+ word VARCHAR(64),
+ bar INT(11) default 0,
+ PRIMARY KEY (word))
+ ENGINE=MyISAM
+ CHARSET ucs2
+ COLLATE ucs2_general_ci ;
+
+INSERT INTO t1 (word) VALUES ("aar");
+INSERT INTO t1 (word) VALUES ("a");
+INSERT INTO t1 (word) VALUES ("aardvar");
+INSERT INTO t1 (word) VALUES ("aardvark");
+INSERT INTO t1 (word) VALUES ("aardvara");
+INSERT INTO t1 (word) VALUES ("aardvarz");
+EXPLAIN SELECT * FROM t1 ORDER BY word;
+SELECT * FROM t1 ORDER BY word;
+EXPLAIN SELECT word FROM t1 ORDER BY word;
+SELECT word FROM t1 ORDER by word;
+DROP TABLE t1;
+
+#
+# One field, index
+#
+
+CREATE TABLE t1 (
+ word VARCHAR(64) ,
+ PRIMARY KEY (word))
+ ENGINE=MyISAM
+ CHARSET ucs2
+ COLLATE ucs2_general_ci;
+
+INSERT INTO t1 (word) VALUES ("aar");
+INSERT INTO t1 (word) VALUES ("a");
+INSERT INTO t1 (word) VALUES ("aardvar");
+INSERT INTO t1 (word) VALUES ("aardvark");
+INSERT INTO t1 (word) VALUES ("aardvara");
+INSERT INTO t1 (word) VALUES ("aardvarz");
+EXPLAIN SELECT * FROM t1 ORDER BY WORD;
+SELECT * FROM t1 ORDER BY word;
+DROP TABLE t1;
+
+
+#
+# Two fields, no index
+#
+
+CREATE TABLE t1 (
+ word TEXT,
+ bar INT(11) AUTO_INCREMENT,
+ PRIMARY KEY (bar))
+ ENGINE=MyISAM
+ CHARSET ucs2
+ COLLATE ucs2_general_ci ;
+INSERT INTO t1 (word) VALUES ("aar");
+INSERT INTO t1 (word) VALUES ("a" );
+INSERT INTO t1 (word) VALUES ("aardvar");
+INSERT INTO t1 (word) VALUES ("aardvark");
+INSERT INTO t1 (word) VALUES ("aardvara");
+INSERT INTO t1 (word) VALUES ("aardvarz");
+EXPLAIN SELECT * FROM t1 ORDER BY word;
+SELECT * FROM t1 ORDER BY word;
+EXPLAIN SELECT word FROM t1 ORDER BY word;
+SELECT word FROM t1 ORDER BY word;
+DROP TABLE t1;
+
+#
+# END OF Bug 1264 test
+#
+########################################################
+
+
+# Bug #2390
+# Check alignment for constants
+#
+SELECT HEX(_ucs2 0x0);
+SELECT HEX(_ucs2 0x01);
+SELECT HEX(_ucs2 0x012);
+SELECT HEX(_ucs2 0x0123);
+SELECT HEX(_ucs2 0x01234);
+SELECT HEX(_ucs2 0x012345);
+SELECT HEX(_ucs2 0x0123456);
+SELECT HEX(_ucs2 0x01234567);
+SELECT HEX(_ucs2 0x012345678);
+SELECT HEX(_ucs2 0x0123456789);
+SELECT HEX(_ucs2 0x0123456789A);
+SELECT HEX(_ucs2 0x0123456789AB);
+SELECT HEX(_ucs2 0x0123456789ABC);
+SELECT HEX(_ucs2 0x0123456789ABCD);
+SELECT HEX(_ucs2 0x0123456789ABCDE);
+SELECT HEX(_ucs2 0x0123456789ABCDEF);
+
+#
+# Check alignment for from-binary-conversion with CAST and CONVERT
+#
+SELECT hex(cast(0xAA as char character set ucs2));
+SELECT hex(convert(0xAA using ucs2));
+
+#
+# Check alignment for string types
+#
+CREATE TABLE t1 (a char(10) character set ucs2);
+INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
+SELECT HEX(a) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a varchar(10) character set ucs2);
+INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
+SELECT HEX(a) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a text character set ucs2);
+INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
+SELECT HEX(a) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a mediumtext character set ucs2);
+INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
+SELECT HEX(a) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a longtext character set ucs2);
+INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
+SELECT HEX(a) FROM t1;
+DROP TABLE t1;
+
+-- the same should be also done with enum and set
+
+
+#
+# Bug #5024 Server crashes with queries on fields
+# with certain charset/collation settings
+#
+
+create table t1 (s1 char character set `ucs2` collate `ucs2_czech_ci`);
+insert into t1 values ('0'),('1'),('2'),('a'),('b'),('c');
+select s1 from t1 where s1 > 'a' order by s1;
+drop table t1;
+
+#
+# Bug #5081 : UCS2 fields are filled with '0x2020'
+# after extending field length
+#
+create table t1(a char(1)) default charset = ucs2;
+insert into t1 values ('a'),('b'),('c');
+alter table t1 modify a char(5);
+select a, hex(a) from t1;
+drop table t1;
+
+#
+# Check prepare statement from an UCS2 string
+#
+set @ivar= 1234;
+set @str1 = 'select ?';
+set @str2 = convert(@str1 using ucs2);
+prepare stmt1 from @str2;
+execute stmt1 using @ivar;
+
+#
+# Check correct binlogging of UCS2 user variables (BUG#3875)
+#
+SET TIMESTAMP=10000;
+create table t2 (c char(30)) charset=ucs2;
+set @v=convert('abc' using ucs2);
+reset master;
+insert into t2 values (@v);
+show binlog events from 79;
+# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
+# absolutely need variables names to be quoted and strings to be
+# escaped).
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
+drop table t2;
+
+
+#
+# Check that ucs2 works with ENUM and SET type
+#
+set names latin1;
+create table t1 (a enum('x','y','z') character set ucs2);
+show create table t1;
+insert into t1 values ('x');
+insert into t1 values ('y');
+insert into t1 values ('z');
+select a, hex(a) from t1 order by a;
+alter table t1 change a a enum('x','y','z','d','e','ä','ö','ü') character set ucs2;
+show create table t1;
+insert into t1 values ('D');
+insert into t1 values ('E ');
+insert into t1 values ('Ä');
+insert into t1 values ('Ö');
+insert into t1 values ('Ü');
+select a, hex(a) from t1 order by a;
+drop table t1;
+
+create table t1 (a set ('x','y','z','ä','ö','ü') character set ucs2);
+show create table t1;
+insert into t1 values ('x');
+insert into t1 values ('y');
+insert into t1 values ('z');
+insert into t1 values ('x,y');
+insert into t1 values ('x,y,z,Ä,Ö,Ü');
+select a, hex(a) from t1 order by a;
+drop table t1;
+
+#
+# Bug#7302 UCS2 data in ENUM fields get truncated when new column is added
+#
+create table t1(a enum('a','b','c')) default character set ucs2;
+insert into t1 values('a'),('b'),('c');
+alter table t1 add b char(1);
+show warnings;
+select * from t1 order by a;
+drop table t1;
diff --git a/mysql-test/t/ctype_ujis-master.opt b/mysql-test/t/ctype_ujis-master.opt
deleted file mode 100644
index 1f4183d5027..00000000000
--- a/mysql-test/t/ctype_ujis-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---default-character-set=ujis
diff --git a/mysql-test/t/ctype_ujis.test b/mysql-test/t/ctype_ujis.test
index cd1dc965000..3f0e9882179 100644
--- a/mysql-test/t/ctype_ujis.test
+++ b/mysql-test/t/ctype_ujis.test
@@ -1,13 +1,1143 @@
+-- source include/have_ujis.inc
+
#
# Tests with the ujis character set
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+
+set names ujis;
#
# Test problem with LEFT()
#
-create table t1 (c text);
+create table t1 (c text character set ujis);
insert into t1 values (0xa4a2),(0xa4a3);
select hex(left(c,1)) from t1 group by c;
drop table t1;
+
+#
+#
+#
+select locate(0xa2a1,0xa1a2a1a3);
+select locate(_ujis 0xa2a1,_ujis 0xa1a2a1a3);
+select locate(_ujis 0xa2a1,_ujis 0xa1a2a1a3 collate ujis_bin);
+select locate('he','hello');
+select locate('he','hello',2);
+select locate('lo','hello',2);
+select locate('HE','hello');
+select locate('HE','hello',2);
+select locate('LO','hello',2);
+select locate('HE','hello' collate ujis_bin);
+select locate('HE','hello' collate ujis_bin,2);
+select locate('LO','hello' collate ujis_bin,2);
+select locate(_ujis 0xa1a3,_ujis 0xa1a2a1a3);
+
+select 0xa1a2a1a3 like concat(_binary'%',0xa2a1,_binary'%');
+select _ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%');
+select _ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%') collate ujis_bin;
+select 'a' like 'a';
+select 'A' like 'a';
+select 'A' like 'a' collate ujis_bin;
+
+#
+# Bug 3290: Hald-width Katakana conversion problem.
+# Check ujis-utf8-ujis round trip.
+#
+set @ujis1= _ujis 0x8EA18EA28EA38EA48EA58EA68EA78EA88EA98EAA8EAB8EAC8EAD8EAE8EAF;
+set @ujis2= _ujis 0x8EB08EB18EB28EB38EB48EB58EB68EB78EB88EB98EBA8EBB8EBC8EBD8EBE8EBF;
+set @ujis3= _ujis 0x8EC08EC18EC28EC38EC48EC58EC68EC78EC88EC98ECA8ECB8ECC8ECD8ECE8ECF;
+set @ujis4= _ujis 0x8ED08ED18ED28ED38ED48ED58ED68ED78ED88ED98EDA8EDB8EDC8EDD8EDE8EDF;
+
+select hex(@utf81:= CONVERT(@ujis1 USING utf8));
+select hex(@utf82:= CONVERT(@ujis2 USING utf8));
+select hex(@utf83:= CONVERT(@ujis3 USING utf8));
+select hex(@utf84:= CONVERT(@ujis4 USING utf8));
+
+select @ujis1 = CONVERT(@utf81 USING ujis);
+select @ujis2 = CONVERT(@utf82 USING ujis);
+select @ujis3 = CONVERT(@utf83 USING ujis);
+select @ujis4 = CONVERT(@utf84 USING ujis);
+
+#
+# Testing with '%' and index (Bug #3438)
+#
+
+drop table if exists t1;
+create table t1 (c1 varchar(8)) default character set 'ujis';
+insert into t1 values (0xA4A2),(0xA2A2),(0xA4A2);
+select c1 as 'no index' from t1 where c1 like cast(concat(0xA4A2, '%') as char character set ujis);
+create index idx_c1 on t1(c1);
+select c1 as 'using index' from t1 where c1 like cast(concat(0xA4A2, '%') as char character set ujis);
+select c1 as 'no index' from t1 where c1 like cast(concat('%',0xA4A2, '%') as char character set ujis);
+drop table t1;
+
+
+# Bug 2077
+CREATE TABLE t1 (
+ a char(1) NOT NULL default '',
+ b enum('€¢','€€') default NULL
+) CHARACTER SET ujis;
+SHOW CREATE TABLE t1;
+SHOW COLUMNS FROM t1;
+DROP TABLE t1;
+
+#
+# Bug #6345 Unexpected behaviour with partial indices
+#
+--disable_warnings
+CREATE TABLE t1
+(
+ a INTEGER NOT NULL,
+ b VARCHAR(50) NOT NULL DEFAULT '',
+ PRIMARY KEY (a),
+ KEY b (b(10))
+) TYPE=InnoDB CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
+--enable_warnings
+INSERT INTO t1 (a, b) VALUES (0, 'aaabbbcccddd');
+INSERT INTO t1 (a, b) VALUES (1, 'eeefffggghhh');
+INSERT INTO t1 (a, b) VALUES (2, 'iiijjjkkkl');
+SELECT t1.* FROM t1 WHERE b='aaabbbcccddd' ORDER BY a;
+SELECT t1.* FROM t1 WHERE b='eeefffggghhh' ORDER BY a;
+SELECT t1.* FROM t1 WHERE b='iiijjjkkkl' ORDER BY a;
+DROP TABLE t1;
+--disable_warnings
+CREATE TABLE t1
+(
+ a INTEGER NOT NULL,
+ b VARCHAR(50) NOT NULL DEFAULT '',
+ PRIMARY KEY (a),
+ KEY b (b(10))
+) TYPE=MyISAM CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
+--enable_warnings
+INSERT INTO t1 (a, b) VALUES (0, 'aaabbbcccddd');
+INSERT INTO t1 (a, b) VALUES (1, 'eeefffggghhh');
+INSERT INTO t1 (a, b) VALUES (2, 'iiijjjkkkl');
+SELECT t1.* FROM t1 WHERE b='aaabbbcccddd' ORDER BY a;
+SELECT t1.* FROM t1 WHERE b='eeefffggghhh' ORDER BY a;
+SELECT t1.* FROM t1 WHERE b='iiijjjkkkl' ORDER BY a;
+DROP TABLE t1;
+
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(c char(1)) character set ujis;
+INSERT INTO t1 VALUES(0xA2AF);
+INSERT INTO t1 VALUES(0xA2B0);
+INSERT INTO t1 VALUES(0xA2B1);
+INSERT INTO t1 VALUES(0xA2B2);
+INSERT INTO t1 VALUES(0xA2B3);
+INSERT INTO t1 VALUES(0xA2B4);
+INSERT INTO t1 VALUES(0xA2B5);
+INSERT INTO t1 VALUES(0xA2B6);
+INSERT INTO t1 VALUES(0xA2B7);
+INSERT INTO t1 VALUES(0xA2B8);
+INSERT INTO t1 VALUES(0xA2B9);
+INSERT INTO t1 VALUES(0xA2C2);
+INSERT INTO t1 VALUES(0xA2C3);
+INSERT INTO t1 VALUES(0xA2C4);
+INSERT INTO t1 VALUES(0xA2C5);
+INSERT INTO t1 VALUES(0xA2C6);
+INSERT INTO t1 VALUES(0xA2C7);
+INSERT INTO t1 VALUES(0xA2C8);
+INSERT INTO t1 VALUES(0xA2C9);
+INSERT INTO t1 VALUES(0xA2D1);
+INSERT INTO t1 VALUES(0xA2D2);
+INSERT INTO t1 VALUES(0xA2D3);
+INSERT INTO t1 VALUES(0xA2D4);
+INSERT INTO t1 VALUES(0xA2D5);
+INSERT INTO t1 VALUES(0xA2D6);
+INSERT INTO t1 VALUES(0xA2D7);
+INSERT INTO t1 VALUES(0xA2D8);
+INSERT INTO t1 VALUES(0xA2D9);
+INSERT INTO t1 VALUES(0xA2DA);
+INSERT INTO t1 VALUES(0xA2DB);
+INSERT INTO t1 VALUES(0xA2EB);
+INSERT INTO t1 VALUES(0xA2EC);
+INSERT INTO t1 VALUES(0xA2ED);
+INSERT INTO t1 VALUES(0xA2EE);
+INSERT INTO t1 VALUES(0xA2EF);
+INSERT INTO t1 VALUES(0xA2F0);
+INSERT INTO t1 VALUES(0xA2F1);
+INSERT INTO t1 VALUES(0xA2FA);
+INSERT INTO t1 VALUES(0xA2FB);
+INSERT INTO t1 VALUES(0xA2FC);
+INSERT INTO t1 VALUES(0xA2FD);
+INSERT INTO t1 VALUES(0xA3A1);
+INSERT INTO t1 VALUES(0xA3A2);
+INSERT INTO t1 VALUES(0xA3A3);
+INSERT INTO t1 VALUES(0xA3A4);
+INSERT INTO t1 VALUES(0xA3A5);
+INSERT INTO t1 VALUES(0xA3A6);
+INSERT INTO t1 VALUES(0xA3A7);
+INSERT INTO t1 VALUES(0xA3A8);
+INSERT INTO t1 VALUES(0xA3A9);
+INSERT INTO t1 VALUES(0xA3AA);
+INSERT INTO t1 VALUES(0xA3AB);
+INSERT INTO t1 VALUES(0xA3AC);
+INSERT INTO t1 VALUES(0xA3AD);
+INSERT INTO t1 VALUES(0xA3AE);
+INSERT INTO t1 VALUES(0xA3AF);
+INSERT INTO t1 VALUES(0xA3BA);
+INSERT INTO t1 VALUES(0xA3BB);
+INSERT INTO t1 VALUES(0xA3BC);
+INSERT INTO t1 VALUES(0xA3BD);
+INSERT INTO t1 VALUES(0xA3BE);
+INSERT INTO t1 VALUES(0xA3BF);
+INSERT INTO t1 VALUES(0xA3C0);
+INSERT INTO t1 VALUES(0xA3DB);
+INSERT INTO t1 VALUES(0xA3DC);
+INSERT INTO t1 VALUES(0xA3DD);
+INSERT INTO t1 VALUES(0xA3DE);
+INSERT INTO t1 VALUES(0xA3DF);
+INSERT INTO t1 VALUES(0xA3E0);
+INSERT INTO t1 VALUES(0xA3FB);
+INSERT INTO t1 VALUES(0xA3FC);
+INSERT INTO t1 VALUES(0xA3FD);
+INSERT INTO t1 VALUES(0xA3FE);
+INSERT INTO t1 VALUES(0xA4F4);
+INSERT INTO t1 VALUES(0xA4F5);
+INSERT INTO t1 VALUES(0xA4F6);
+INSERT INTO t1 VALUES(0xA4F7);
+INSERT INTO t1 VALUES(0xA4F8);
+INSERT INTO t1 VALUES(0xA4F9);
+INSERT INTO t1 VALUES(0xA4FA);
+INSERT INTO t1 VALUES(0xA4FB);
+INSERT INTO t1 VALUES(0xA4FC);
+INSERT INTO t1 VALUES(0xA4FD);
+INSERT INTO t1 VALUES(0xA4FE);
+INSERT INTO t1 VALUES(0xA5F7);
+INSERT INTO t1 VALUES(0xA5F8);
+INSERT INTO t1 VALUES(0xA5F9);
+INSERT INTO t1 VALUES(0xA5FA);
+INSERT INTO t1 VALUES(0xA5FB);
+INSERT INTO t1 VALUES(0xA5FC);
+INSERT INTO t1 VALUES(0xA5FD);
+INSERT INTO t1 VALUES(0xA5FE);
+INSERT INTO t1 VALUES(0xA6B9);
+INSERT INTO t1 VALUES(0xA6BA);
+INSERT INTO t1 VALUES(0xA6BB);
+INSERT INTO t1 VALUES(0xA6BC);
+INSERT INTO t1 VALUES(0xA6BD);
+INSERT INTO t1 VALUES(0xA6BE);
+INSERT INTO t1 VALUES(0xA6BF);
+INSERT INTO t1 VALUES(0xA6C0);
+INSERT INTO t1 VALUES(0xA6D9);
+INSERT INTO t1 VALUES(0xA6DA);
+INSERT INTO t1 VALUES(0xA6DB);
+INSERT INTO t1 VALUES(0xA6DC);
+INSERT INTO t1 VALUES(0xA6DD);
+INSERT INTO t1 VALUES(0xA6DE);
+INSERT INTO t1 VALUES(0xA6DF);
+INSERT INTO t1 VALUES(0xA6E0);
+INSERT INTO t1 VALUES(0xA6E1);
+INSERT INTO t1 VALUES(0xA6E2);
+INSERT INTO t1 VALUES(0xA6E3);
+INSERT INTO t1 VALUES(0xA6E4);
+INSERT INTO t1 VALUES(0xA6E5);
+INSERT INTO t1 VALUES(0xA6E6);
+INSERT INTO t1 VALUES(0xA6E7);
+INSERT INTO t1 VALUES(0xA6E8);
+INSERT INTO t1 VALUES(0xA6E9);
+INSERT INTO t1 VALUES(0xA6EA);
+INSERT INTO t1 VALUES(0xA6EB);
+INSERT INTO t1 VALUES(0xA6EC);
+INSERT INTO t1 VALUES(0xA6ED);
+INSERT INTO t1 VALUES(0xA6EE);
+INSERT INTO t1 VALUES(0xA6EF);
+INSERT INTO t1 VALUES(0xA6F0);
+INSERT INTO t1 VALUES(0xA6F1);
+INSERT INTO t1 VALUES(0xA6F2);
+INSERT INTO t1 VALUES(0xA6F3);
+INSERT INTO t1 VALUES(0xA6F4);
+INSERT INTO t1 VALUES(0xA6F5);
+INSERT INTO t1 VALUES(0xA6F6);
+INSERT INTO t1 VALUES(0xA6F7);
+INSERT INTO t1 VALUES(0xA6F8);
+INSERT INTO t1 VALUES(0xA6F9);
+INSERT INTO t1 VALUES(0xA6FA);
+INSERT INTO t1 VALUES(0xA6FB);
+INSERT INTO t1 VALUES(0xA6FC);
+INSERT INTO t1 VALUES(0xA6FD);
+INSERT INTO t1 VALUES(0xA6FE);
+INSERT INTO t1 VALUES(0xA7C2);
+INSERT INTO t1 VALUES(0xA7C3);
+INSERT INTO t1 VALUES(0xA7C4);
+INSERT INTO t1 VALUES(0xA7C5);
+INSERT INTO t1 VALUES(0xA7C6);
+INSERT INTO t1 VALUES(0xA7C7);
+INSERT INTO t1 VALUES(0xA7C8);
+INSERT INTO t1 VALUES(0xA7C9);
+INSERT INTO t1 VALUES(0xA7CA);
+INSERT INTO t1 VALUES(0xA7CB);
+INSERT INTO t1 VALUES(0xA7CC);
+INSERT INTO t1 VALUES(0xA7CD);
+INSERT INTO t1 VALUES(0xA7CE);
+INSERT INTO t1 VALUES(0xA7CF);
+INSERT INTO t1 VALUES(0xA7D0);
+INSERT INTO t1 VALUES(0xA7F2);
+INSERT INTO t1 VALUES(0xA7F3);
+INSERT INTO t1 VALUES(0xA7F4);
+INSERT INTO t1 VALUES(0xA7F5);
+INSERT INTO t1 VALUES(0xA7F6);
+INSERT INTO t1 VALUES(0xA7F7);
+INSERT INTO t1 VALUES(0xA7F8);
+INSERT INTO t1 VALUES(0xA7F9);
+INSERT INTO t1 VALUES(0xA7FA);
+INSERT INTO t1 VALUES(0xA7FB);
+INSERT INTO t1 VALUES(0xA7FC);
+INSERT INTO t1 VALUES(0xA7FD);
+INSERT INTO t1 VALUES(0xA7FE);
+INSERT INTO t1 VALUES(0xA8C1);
+INSERT INTO t1 VALUES(0xA8C2);
+INSERT INTO t1 VALUES(0xA8C3);
+INSERT INTO t1 VALUES(0xA8C4);
+INSERT INTO t1 VALUES(0xA8C5);
+INSERT INTO t1 VALUES(0xA8C6);
+INSERT INTO t1 VALUES(0xA8C7);
+INSERT INTO t1 VALUES(0xA8C8);
+INSERT INTO t1 VALUES(0xA8C9);
+INSERT INTO t1 VALUES(0xA8CA);
+INSERT INTO t1 VALUES(0xA8CB);
+INSERT INTO t1 VALUES(0xA8CC);
+INSERT INTO t1 VALUES(0xA8CD);
+INSERT INTO t1 VALUES(0xA8CE);
+INSERT INTO t1 VALUES(0xA8CF);
+INSERT INTO t1 VALUES(0xA8D0);
+INSERT INTO t1 VALUES(0xA8D1);
+INSERT INTO t1 VALUES(0xA8D2);
+INSERT INTO t1 VALUES(0xA8D3);
+INSERT INTO t1 VALUES(0xA8D4);
+INSERT INTO t1 VALUES(0xA8D5);
+INSERT INTO t1 VALUES(0xA8D6);
+INSERT INTO t1 VALUES(0xA8D7);
+INSERT INTO t1 VALUES(0xA8D8);
+INSERT INTO t1 VALUES(0xA8D9);
+INSERT INTO t1 VALUES(0xA8DA);
+INSERT INTO t1 VALUES(0xA8DB);
+INSERT INTO t1 VALUES(0xA8DC);
+INSERT INTO t1 VALUES(0xA8DD);
+INSERT INTO t1 VALUES(0xA8DE);
+INSERT INTO t1 VALUES(0xA8DF);
+INSERT INTO t1 VALUES(0xA8E0);
+INSERT INTO t1 VALUES(0xA8E1);
+INSERT INTO t1 VALUES(0xA8E2);
+INSERT INTO t1 VALUES(0xA8E3);
+INSERT INTO t1 VALUES(0xA8E4);
+INSERT INTO t1 VALUES(0xA8E5);
+INSERT INTO t1 VALUES(0xA8E6);
+INSERT INTO t1 VALUES(0xA8E7);
+INSERT INTO t1 VALUES(0xA8E8);
+INSERT INTO t1 VALUES(0xA8E9);
+INSERT INTO t1 VALUES(0xA8EA);
+INSERT INTO t1 VALUES(0xA8EB);
+INSERT INTO t1 VALUES(0xA8EC);
+INSERT INTO t1 VALUES(0xA8ED);
+INSERT INTO t1 VALUES(0xA8EE);
+INSERT INTO t1 VALUES(0xA8EF);
+INSERT INTO t1 VALUES(0xA8F0);
+INSERT INTO t1 VALUES(0xA8F1);
+INSERT INTO t1 VALUES(0xA8F2);
+INSERT INTO t1 VALUES(0xA8F3);
+INSERT INTO t1 VALUES(0xA8F4);
+INSERT INTO t1 VALUES(0xA8F5);
+INSERT INTO t1 VALUES(0xA8F6);
+INSERT INTO t1 VALUES(0xA8F7);
+INSERT INTO t1 VALUES(0xA8F8);
+INSERT INTO t1 VALUES(0xA8F9);
+INSERT INTO t1 VALUES(0xA8FA);
+INSERT INTO t1 VALUES(0xA8FB);
+INSERT INTO t1 VALUES(0xA8FC);
+INSERT INTO t1 VALUES(0xA8FD);
+INSERT INTO t1 VALUES(0xA8FE);
+INSERT INTO t1 VALUES(0xA9A1);
+INSERT INTO t1 VALUES(0xA9A2);
+INSERT INTO t1 VALUES(0xA9A3);
+INSERT INTO t1 VALUES(0xA9A4);
+INSERT INTO t1 VALUES(0xA9A5);
+INSERT INTO t1 VALUES(0xA9A6);
+INSERT INTO t1 VALUES(0xA9A7);
+INSERT INTO t1 VALUES(0xA9A8);
+INSERT INTO t1 VALUES(0xA9A9);
+INSERT INTO t1 VALUES(0xA9AA);
+INSERT INTO t1 VALUES(0xA9AB);
+INSERT INTO t1 VALUES(0xA9AC);
+INSERT INTO t1 VALUES(0xA9AD);
+INSERT INTO t1 VALUES(0xA9AE);
+INSERT INTO t1 VALUES(0xA9AF);
+INSERT INTO t1 VALUES(0xA9B0);
+INSERT INTO t1 VALUES(0xA9B1);
+INSERT INTO t1 VALUES(0xA9B2);
+INSERT INTO t1 VALUES(0xA9B3);
+INSERT INTO t1 VALUES(0xA9B4);
+INSERT INTO t1 VALUES(0xA9B5);
+INSERT INTO t1 VALUES(0xA9B6);
+INSERT INTO t1 VALUES(0xA9B7);
+INSERT INTO t1 VALUES(0xA9B8);
+INSERT INTO t1 VALUES(0xA9B9);
+INSERT INTO t1 VALUES(0xA9BA);
+INSERT INTO t1 VALUES(0xA9BB);
+INSERT INTO t1 VALUES(0xA9BC);
+INSERT INTO t1 VALUES(0xA9BD);
+INSERT INTO t1 VALUES(0xA9BE);
+INSERT INTO t1 VALUES(0xA9BF);
+INSERT INTO t1 VALUES(0xA9C0);
+INSERT INTO t1 VALUES(0xA9C1);
+INSERT INTO t1 VALUES(0xA9C2);
+INSERT INTO t1 VALUES(0xA9C3);
+INSERT INTO t1 VALUES(0xA9C4);
+INSERT INTO t1 VALUES(0xA9C5);
+INSERT INTO t1 VALUES(0xA9C6);
+INSERT INTO t1 VALUES(0xA9C7);
+INSERT INTO t1 VALUES(0xA9C8);
+INSERT INTO t1 VALUES(0xA9C9);
+INSERT INTO t1 VALUES(0xA9CA);
+INSERT INTO t1 VALUES(0xA9CB);
+INSERT INTO t1 VALUES(0xA9CC);
+INSERT INTO t1 VALUES(0xA9CD);
+INSERT INTO t1 VALUES(0xA9CE);
+INSERT INTO t1 VALUES(0xA9CF);
+INSERT INTO t1 VALUES(0xA9D0);
+INSERT INTO t1 VALUES(0xA9D1);
+INSERT INTO t1 VALUES(0xA9D2);
+INSERT INTO t1 VALUES(0xA9D3);
+INSERT INTO t1 VALUES(0xA9D4);
+INSERT INTO t1 VALUES(0xA9D5);
+INSERT INTO t1 VALUES(0xA9D6);
+INSERT INTO t1 VALUES(0xA9D7);
+INSERT INTO t1 VALUES(0xA9D8);
+INSERT INTO t1 VALUES(0xA9D9);
+INSERT INTO t1 VALUES(0xA9DA);
+INSERT INTO t1 VALUES(0xA9DB);
+INSERT INTO t1 VALUES(0xA9DC);
+INSERT INTO t1 VALUES(0xA9DD);
+INSERT INTO t1 VALUES(0xA9DE);
+INSERT INTO t1 VALUES(0xA9DF);
+INSERT INTO t1 VALUES(0xA9E0);
+INSERT INTO t1 VALUES(0xA9E1);
+INSERT INTO t1 VALUES(0xA9E2);
+INSERT INTO t1 VALUES(0xA9E3);
+INSERT INTO t1 VALUES(0xA9E4);
+INSERT INTO t1 VALUES(0xA9E5);
+INSERT INTO t1 VALUES(0xA9E6);
+INSERT INTO t1 VALUES(0xA9E7);
+INSERT INTO t1 VALUES(0xA9E8);
+INSERT INTO t1 VALUES(0xA9E9);
+INSERT INTO t1 VALUES(0xA9EA);
+INSERT INTO t1 VALUES(0xA9EB);
+INSERT INTO t1 VALUES(0xA9EC);
+INSERT INTO t1 VALUES(0xA9ED);
+INSERT INTO t1 VALUES(0xA9EE);
+INSERT INTO t1 VALUES(0xA9EF);
+INSERT INTO t1 VALUES(0xA9F0);
+INSERT INTO t1 VALUES(0xA9F1);
+INSERT INTO t1 VALUES(0xA9F2);
+INSERT INTO t1 VALUES(0xA9F3);
+INSERT INTO t1 VALUES(0xA9F4);
+INSERT INTO t1 VALUES(0xA9F5);
+INSERT INTO t1 VALUES(0xA9F6);
+INSERT INTO t1 VALUES(0xA9F7);
+INSERT INTO t1 VALUES(0xA9F8);
+INSERT INTO t1 VALUES(0xA9F9);
+INSERT INTO t1 VALUES(0xA9FA);
+INSERT INTO t1 VALUES(0xA9FB);
+INSERT INTO t1 VALUES(0xA9FC);
+INSERT INTO t1 VALUES(0xA9FD);
+INSERT INTO t1 VALUES(0xA9FE);
+INSERT INTO t1 VALUES(0xAAA1);
+INSERT INTO t1 VALUES(0xAAA2);
+INSERT INTO t1 VALUES(0xAAA3);
+INSERT INTO t1 VALUES(0xAAA4);
+INSERT INTO t1 VALUES(0xAAA5);
+INSERT INTO t1 VALUES(0xAAA6);
+INSERT INTO t1 VALUES(0xAAA7);
+INSERT INTO t1 VALUES(0xAAA8);
+INSERT INTO t1 VALUES(0xAAA9);
+INSERT INTO t1 VALUES(0xAAAA);
+INSERT INTO t1 VALUES(0xAAAB);
+INSERT INTO t1 VALUES(0xAAAC);
+INSERT INTO t1 VALUES(0xAAAD);
+INSERT INTO t1 VALUES(0xAAAE);
+INSERT INTO t1 VALUES(0xAAAF);
+INSERT INTO t1 VALUES(0xAAB0);
+INSERT INTO t1 VALUES(0xAAB1);
+INSERT INTO t1 VALUES(0xAAB2);
+INSERT INTO t1 VALUES(0xAAB3);
+INSERT INTO t1 VALUES(0xAAB4);
+INSERT INTO t1 VALUES(0xAAB5);
+INSERT INTO t1 VALUES(0xAAB6);
+INSERT INTO t1 VALUES(0xAAB7);
+INSERT INTO t1 VALUES(0xAAB8);
+INSERT INTO t1 VALUES(0xAAB9);
+INSERT INTO t1 VALUES(0xAABA);
+INSERT INTO t1 VALUES(0xAABB);
+INSERT INTO t1 VALUES(0xAABC);
+INSERT INTO t1 VALUES(0xAABD);
+INSERT INTO t1 VALUES(0xAABE);
+INSERT INTO t1 VALUES(0xAABF);
+INSERT INTO t1 VALUES(0xAAC0);
+INSERT INTO t1 VALUES(0xAAC1);
+INSERT INTO t1 VALUES(0xAAC2);
+INSERT INTO t1 VALUES(0xAAC3);
+INSERT INTO t1 VALUES(0xAAC4);
+INSERT INTO t1 VALUES(0xAAC5);
+INSERT INTO t1 VALUES(0xAAC6);
+INSERT INTO t1 VALUES(0xAAC7);
+INSERT INTO t1 VALUES(0xAAC8);
+INSERT INTO t1 VALUES(0xAAC9);
+INSERT INTO t1 VALUES(0xAACA);
+INSERT INTO t1 VALUES(0xAACB);
+INSERT INTO t1 VALUES(0xAACC);
+INSERT INTO t1 VALUES(0xAACD);
+INSERT INTO t1 VALUES(0xAACE);
+INSERT INTO t1 VALUES(0xAACF);
+INSERT INTO t1 VALUES(0xAAD0);
+INSERT INTO t1 VALUES(0xAAD1);
+INSERT INTO t1 VALUES(0xAAD2);
+INSERT INTO t1 VALUES(0xAAD3);
+INSERT INTO t1 VALUES(0xAAD4);
+INSERT INTO t1 VALUES(0xAAD5);
+INSERT INTO t1 VALUES(0xAAD6);
+INSERT INTO t1 VALUES(0xAAD7);
+INSERT INTO t1 VALUES(0xAAD8);
+INSERT INTO t1 VALUES(0xAAD9);
+INSERT INTO t1 VALUES(0xAADA);
+INSERT INTO t1 VALUES(0xAADB);
+INSERT INTO t1 VALUES(0xAADC);
+INSERT INTO t1 VALUES(0xAADD);
+INSERT INTO t1 VALUES(0xAADE);
+INSERT INTO t1 VALUES(0xAADF);
+INSERT INTO t1 VALUES(0xAAE0);
+INSERT INTO t1 VALUES(0xAAE1);
+INSERT INTO t1 VALUES(0xAAE2);
+INSERT INTO t1 VALUES(0xAAE3);
+INSERT INTO t1 VALUES(0xAAE4);
+INSERT INTO t1 VALUES(0xAAE5);
+INSERT INTO t1 VALUES(0xAAE6);
+INSERT INTO t1 VALUES(0xAAE7);
+INSERT INTO t1 VALUES(0xAAE8);
+INSERT INTO t1 VALUES(0xAAE9);
+INSERT INTO t1 VALUES(0xAAEA);
+INSERT INTO t1 VALUES(0xAAEB);
+INSERT INTO t1 VALUES(0xAAEC);
+INSERT INTO t1 VALUES(0xAAED);
+INSERT INTO t1 VALUES(0xAAEE);
+INSERT INTO t1 VALUES(0xAAEF);
+INSERT INTO t1 VALUES(0xAAF0);
+INSERT INTO t1 VALUES(0xAAF1);
+INSERT INTO t1 VALUES(0xAAF2);
+INSERT INTO t1 VALUES(0xAAF3);
+INSERT INTO t1 VALUES(0xAAF4);
+INSERT INTO t1 VALUES(0xAAF5);
+INSERT INTO t1 VALUES(0xAAF6);
+INSERT INTO t1 VALUES(0xAAF7);
+INSERT INTO t1 VALUES(0xAAF8);
+INSERT INTO t1 VALUES(0xAAF9);
+INSERT INTO t1 VALUES(0xAAFA);
+INSERT INTO t1 VALUES(0xAAFB);
+INSERT INTO t1 VALUES(0xAAFC);
+INSERT INTO t1 VALUES(0xAAFD);
+INSERT INTO t1 VALUES(0xAAFE);
+INSERT INTO t1 VALUES(0xABA1);
+INSERT INTO t1 VALUES(0xABA2);
+INSERT INTO t1 VALUES(0xABA3);
+INSERT INTO t1 VALUES(0xABA4);
+INSERT INTO t1 VALUES(0xABA5);
+INSERT INTO t1 VALUES(0xABA6);
+INSERT INTO t1 VALUES(0xABA7);
+INSERT INTO t1 VALUES(0xABA8);
+INSERT INTO t1 VALUES(0xABA9);
+INSERT INTO t1 VALUES(0xABAA);
+INSERT INTO t1 VALUES(0xABAB);
+INSERT INTO t1 VALUES(0xABAC);
+INSERT INTO t1 VALUES(0xABAD);
+INSERT INTO t1 VALUES(0xABAE);
+INSERT INTO t1 VALUES(0xABAF);
+INSERT INTO t1 VALUES(0xABB0);
+INSERT INTO t1 VALUES(0xABB1);
+INSERT INTO t1 VALUES(0xABB2);
+INSERT INTO t1 VALUES(0xABB3);
+INSERT INTO t1 VALUES(0xABB4);
+INSERT INTO t1 VALUES(0xABB5);
+INSERT INTO t1 VALUES(0xABB6);
+INSERT INTO t1 VALUES(0xABB7);
+INSERT INTO t1 VALUES(0xABB8);
+INSERT INTO t1 VALUES(0xABB9);
+INSERT INTO t1 VALUES(0xABBA);
+INSERT INTO t1 VALUES(0xABBB);
+INSERT INTO t1 VALUES(0xABBC);
+INSERT INTO t1 VALUES(0xABBD);
+INSERT INTO t1 VALUES(0xABBE);
+INSERT INTO t1 VALUES(0xABBF);
+INSERT INTO t1 VALUES(0xABC0);
+INSERT INTO t1 VALUES(0xABC1);
+INSERT INTO t1 VALUES(0xABC2);
+INSERT INTO t1 VALUES(0xABC3);
+INSERT INTO t1 VALUES(0xABC4);
+INSERT INTO t1 VALUES(0xABC5);
+INSERT INTO t1 VALUES(0xABC6);
+INSERT INTO t1 VALUES(0xABC7);
+INSERT INTO t1 VALUES(0xABC8);
+INSERT INTO t1 VALUES(0xABC9);
+INSERT INTO t1 VALUES(0xABCA);
+INSERT INTO t1 VALUES(0xABCB);
+INSERT INTO t1 VALUES(0xABCC);
+INSERT INTO t1 VALUES(0xABCD);
+INSERT INTO t1 VALUES(0xABCE);
+INSERT INTO t1 VALUES(0xABCF);
+INSERT INTO t1 VALUES(0xABD0);
+INSERT INTO t1 VALUES(0xABD1);
+INSERT INTO t1 VALUES(0xABD2);
+INSERT INTO t1 VALUES(0xABD3);
+INSERT INTO t1 VALUES(0xABD4);
+INSERT INTO t1 VALUES(0xABD5);
+INSERT INTO t1 VALUES(0xABD6);
+INSERT INTO t1 VALUES(0xABD7);
+INSERT INTO t1 VALUES(0xABD8);
+INSERT INTO t1 VALUES(0xABD9);
+INSERT INTO t1 VALUES(0xABDA);
+INSERT INTO t1 VALUES(0xABDB);
+INSERT INTO t1 VALUES(0xABDC);
+INSERT INTO t1 VALUES(0xABDD);
+INSERT INTO t1 VALUES(0xABDE);
+INSERT INTO t1 VALUES(0xABDF);
+INSERT INTO t1 VALUES(0xABE0);
+INSERT INTO t1 VALUES(0xABE1);
+INSERT INTO t1 VALUES(0xABE2);
+INSERT INTO t1 VALUES(0xABE3);
+INSERT INTO t1 VALUES(0xABE4);
+INSERT INTO t1 VALUES(0xABE5);
+INSERT INTO t1 VALUES(0xABE6);
+INSERT INTO t1 VALUES(0xABE7);
+INSERT INTO t1 VALUES(0xABE8);
+INSERT INTO t1 VALUES(0xABE9);
+INSERT INTO t1 VALUES(0xABEA);
+INSERT INTO t1 VALUES(0xABEB);
+INSERT INTO t1 VALUES(0xABEC);
+INSERT INTO t1 VALUES(0xABED);
+INSERT INTO t1 VALUES(0xABEE);
+INSERT INTO t1 VALUES(0xABEF);
+INSERT INTO t1 VALUES(0xABF0);
+INSERT INTO t1 VALUES(0xABF1);
+INSERT INTO t1 VALUES(0xABF2);
+INSERT INTO t1 VALUES(0xABF3);
+INSERT INTO t1 VALUES(0xABF4);
+INSERT INTO t1 VALUES(0xABF5);
+INSERT INTO t1 VALUES(0xABF6);
+INSERT INTO t1 VALUES(0xABF7);
+INSERT INTO t1 VALUES(0xABF8);
+INSERT INTO t1 VALUES(0xABF9);
+INSERT INTO t1 VALUES(0xABFA);
+INSERT INTO t1 VALUES(0xABFB);
+INSERT INTO t1 VALUES(0xABFC);
+INSERT INTO t1 VALUES(0xABFD);
+INSERT INTO t1 VALUES(0xABFE);
+INSERT INTO t1 VALUES(0xACA1);
+INSERT INTO t1 VALUES(0xACA2);
+INSERT INTO t1 VALUES(0xACA3);
+INSERT INTO t1 VALUES(0xACA4);
+INSERT INTO t1 VALUES(0xACA5);
+INSERT INTO t1 VALUES(0xACA6);
+INSERT INTO t1 VALUES(0xACA7);
+INSERT INTO t1 VALUES(0xACA8);
+INSERT INTO t1 VALUES(0xACA9);
+INSERT INTO t1 VALUES(0xACAA);
+INSERT INTO t1 VALUES(0xACAB);
+INSERT INTO t1 VALUES(0xACAC);
+INSERT INTO t1 VALUES(0xACAD);
+INSERT INTO t1 VALUES(0xACAE);
+INSERT INTO t1 VALUES(0xACAF);
+INSERT INTO t1 VALUES(0xACB0);
+INSERT INTO t1 VALUES(0xACB1);
+INSERT INTO t1 VALUES(0xACB2);
+INSERT INTO t1 VALUES(0xACB3);
+INSERT INTO t1 VALUES(0xACB4);
+INSERT INTO t1 VALUES(0xACB5);
+INSERT INTO t1 VALUES(0xACB6);
+INSERT INTO t1 VALUES(0xACB7);
+INSERT INTO t1 VALUES(0xACB8);
+INSERT INTO t1 VALUES(0xACB9);
+INSERT INTO t1 VALUES(0xACBA);
+INSERT INTO t1 VALUES(0xACBB);
+INSERT INTO t1 VALUES(0xACBC);
+INSERT INTO t1 VALUES(0xACBD);
+INSERT INTO t1 VALUES(0xACBE);
+INSERT INTO t1 VALUES(0xACBF);
+INSERT INTO t1 VALUES(0xACC0);
+INSERT INTO t1 VALUES(0xACC1);
+INSERT INTO t1 VALUES(0xACC2);
+INSERT INTO t1 VALUES(0xACC3);
+INSERT INTO t1 VALUES(0xACC4);
+INSERT INTO t1 VALUES(0xACC5);
+INSERT INTO t1 VALUES(0xACC6);
+INSERT INTO t1 VALUES(0xACC7);
+INSERT INTO t1 VALUES(0xACC8);
+INSERT INTO t1 VALUES(0xACC9);
+INSERT INTO t1 VALUES(0xACCA);
+INSERT INTO t1 VALUES(0xACCB);
+INSERT INTO t1 VALUES(0xACCC);
+INSERT INTO t1 VALUES(0xACCD);
+INSERT INTO t1 VALUES(0xACCE);
+INSERT INTO t1 VALUES(0xACCF);
+INSERT INTO t1 VALUES(0xACD0);
+INSERT INTO t1 VALUES(0xACD1);
+INSERT INTO t1 VALUES(0xACD2);
+INSERT INTO t1 VALUES(0xACD3);
+INSERT INTO t1 VALUES(0xACD4);
+INSERT INTO t1 VALUES(0xACD5);
+INSERT INTO t1 VALUES(0xACD6);
+INSERT INTO t1 VALUES(0xACD7);
+INSERT INTO t1 VALUES(0xACD8);
+INSERT INTO t1 VALUES(0xACD9);
+INSERT INTO t1 VALUES(0xACDA);
+INSERT INTO t1 VALUES(0xACDB);
+INSERT INTO t1 VALUES(0xACDC);
+INSERT INTO t1 VALUES(0xACDD);
+INSERT INTO t1 VALUES(0xACDE);
+INSERT INTO t1 VALUES(0xACDF);
+INSERT INTO t1 VALUES(0xACE0);
+INSERT INTO t1 VALUES(0xACE1);
+INSERT INTO t1 VALUES(0xACE2);
+INSERT INTO t1 VALUES(0xACE3);
+INSERT INTO t1 VALUES(0xACE4);
+INSERT INTO t1 VALUES(0xACE5);
+INSERT INTO t1 VALUES(0xACE6);
+INSERT INTO t1 VALUES(0xACE7);
+INSERT INTO t1 VALUES(0xACE8);
+INSERT INTO t1 VALUES(0xACE9);
+INSERT INTO t1 VALUES(0xACEA);
+INSERT INTO t1 VALUES(0xACEB);
+INSERT INTO t1 VALUES(0xACEC);
+INSERT INTO t1 VALUES(0xACED);
+INSERT INTO t1 VALUES(0xACEE);
+INSERT INTO t1 VALUES(0xACEF);
+INSERT INTO t1 VALUES(0xACF0);
+INSERT INTO t1 VALUES(0xACF1);
+INSERT INTO t1 VALUES(0xACF2);
+INSERT INTO t1 VALUES(0xACF3);
+INSERT INTO t1 VALUES(0xACF4);
+INSERT INTO t1 VALUES(0xACF5);
+INSERT INTO t1 VALUES(0xACF6);
+INSERT INTO t1 VALUES(0xACF7);
+INSERT INTO t1 VALUES(0xACF8);
+INSERT INTO t1 VALUES(0xACF9);
+INSERT INTO t1 VALUES(0xACFA);
+INSERT INTO t1 VALUES(0xACFB);
+INSERT INTO t1 VALUES(0xACFC);
+INSERT INTO t1 VALUES(0xACFD);
+INSERT INTO t1 VALUES(0xACFE);
+INSERT INTO t1 VALUES(0xADA1);
+INSERT INTO t1 VALUES(0xADA2);
+INSERT INTO t1 VALUES(0xADA3);
+INSERT INTO t1 VALUES(0xADA4);
+INSERT INTO t1 VALUES(0xADA5);
+INSERT INTO t1 VALUES(0xADA6);
+INSERT INTO t1 VALUES(0xADA7);
+INSERT INTO t1 VALUES(0xADA8);
+INSERT INTO t1 VALUES(0xADA9);
+INSERT INTO t1 VALUES(0xADAA);
+INSERT INTO t1 VALUES(0xADAB);
+INSERT INTO t1 VALUES(0xADAC);
+INSERT INTO t1 VALUES(0xADAD);
+INSERT INTO t1 VALUES(0xADAE);
+INSERT INTO t1 VALUES(0xADAF);
+INSERT INTO t1 VALUES(0xADB0);
+INSERT INTO t1 VALUES(0xADB1);
+INSERT INTO t1 VALUES(0xADB2);
+INSERT INTO t1 VALUES(0xADB3);
+INSERT INTO t1 VALUES(0xADB4);
+INSERT INTO t1 VALUES(0xADB5);
+INSERT INTO t1 VALUES(0xADB6);
+INSERT INTO t1 VALUES(0xADB7);
+INSERT INTO t1 VALUES(0xADB8);
+INSERT INTO t1 VALUES(0xADB9);
+INSERT INTO t1 VALUES(0xADBA);
+INSERT INTO t1 VALUES(0xADBB);
+INSERT INTO t1 VALUES(0xADBC);
+INSERT INTO t1 VALUES(0xADBD);
+INSERT INTO t1 VALUES(0xADBE);
+INSERT INTO t1 VALUES(0xADBF);
+INSERT INTO t1 VALUES(0xADC0);
+INSERT INTO t1 VALUES(0xADC1);
+INSERT INTO t1 VALUES(0xADC2);
+INSERT INTO t1 VALUES(0xADC3);
+INSERT INTO t1 VALUES(0xADC4);
+INSERT INTO t1 VALUES(0xADC5);
+INSERT INTO t1 VALUES(0xADC6);
+INSERT INTO t1 VALUES(0xADC7);
+INSERT INTO t1 VALUES(0xADC8);
+INSERT INTO t1 VALUES(0xADC9);
+INSERT INTO t1 VALUES(0xADCA);
+INSERT INTO t1 VALUES(0xADCB);
+INSERT INTO t1 VALUES(0xADCC);
+INSERT INTO t1 VALUES(0xADCD);
+INSERT INTO t1 VALUES(0xADCE);
+INSERT INTO t1 VALUES(0xADCF);
+INSERT INTO t1 VALUES(0xADD0);
+INSERT INTO t1 VALUES(0xADD1);
+INSERT INTO t1 VALUES(0xADD2);
+INSERT INTO t1 VALUES(0xADD3);
+INSERT INTO t1 VALUES(0xADD4);
+INSERT INTO t1 VALUES(0xADD5);
+INSERT INTO t1 VALUES(0xADD6);
+INSERT INTO t1 VALUES(0xADD7);
+INSERT INTO t1 VALUES(0xADD8);
+INSERT INTO t1 VALUES(0xADD9);
+INSERT INTO t1 VALUES(0xADDA);
+INSERT INTO t1 VALUES(0xADDB);
+INSERT INTO t1 VALUES(0xADDC);
+INSERT INTO t1 VALUES(0xADDD);
+INSERT INTO t1 VALUES(0xADDE);
+INSERT INTO t1 VALUES(0xADDF);
+INSERT INTO t1 VALUES(0xADE0);
+INSERT INTO t1 VALUES(0xADE1);
+INSERT INTO t1 VALUES(0xADE2);
+INSERT INTO t1 VALUES(0xADE3);
+INSERT INTO t1 VALUES(0xADE4);
+INSERT INTO t1 VALUES(0xADE5);
+INSERT INTO t1 VALUES(0xADE6);
+INSERT INTO t1 VALUES(0xADE7);
+INSERT INTO t1 VALUES(0xADE8);
+INSERT INTO t1 VALUES(0xADE9);
+INSERT INTO t1 VALUES(0xADEA);
+INSERT INTO t1 VALUES(0xADEB);
+INSERT INTO t1 VALUES(0xADEC);
+INSERT INTO t1 VALUES(0xADED);
+INSERT INTO t1 VALUES(0xADEE);
+INSERT INTO t1 VALUES(0xADEF);
+INSERT INTO t1 VALUES(0xADF0);
+INSERT INTO t1 VALUES(0xADF1);
+INSERT INTO t1 VALUES(0xADF2);
+INSERT INTO t1 VALUES(0xADF3);
+INSERT INTO t1 VALUES(0xADF4);
+INSERT INTO t1 VALUES(0xADF5);
+INSERT INTO t1 VALUES(0xADF6);
+INSERT INTO t1 VALUES(0xADF7);
+INSERT INTO t1 VALUES(0xADF8);
+INSERT INTO t1 VALUES(0xADF9);
+INSERT INTO t1 VALUES(0xADFA);
+INSERT INTO t1 VALUES(0xADFB);
+INSERT INTO t1 VALUES(0xADFC);
+INSERT INTO t1 VALUES(0xADFD);
+INSERT INTO t1 VALUES(0xADFE);
+INSERT INTO t1 VALUES(0xAEA1);
+INSERT INTO t1 VALUES(0xAEA2);
+INSERT INTO t1 VALUES(0xAEA3);
+INSERT INTO t1 VALUES(0xAEA4);
+INSERT INTO t1 VALUES(0xAEA5);
+INSERT INTO t1 VALUES(0xAEA6);
+INSERT INTO t1 VALUES(0xAEA7);
+INSERT INTO t1 VALUES(0xAEA8);
+INSERT INTO t1 VALUES(0xAEA9);
+INSERT INTO t1 VALUES(0xAEAA);
+INSERT INTO t1 VALUES(0xAEAB);
+INSERT INTO t1 VALUES(0xAEAC);
+INSERT INTO t1 VALUES(0xAEAD);
+INSERT INTO t1 VALUES(0xAEAE);
+INSERT INTO t1 VALUES(0xAEAF);
+INSERT INTO t1 VALUES(0xAEB0);
+INSERT INTO t1 VALUES(0xAEB1);
+INSERT INTO t1 VALUES(0xAEB2);
+INSERT INTO t1 VALUES(0xAEB3);
+INSERT INTO t1 VALUES(0xAEB4);
+INSERT INTO t1 VALUES(0xAEB5);
+INSERT INTO t1 VALUES(0xAEB6);
+INSERT INTO t1 VALUES(0xAEB7);
+INSERT INTO t1 VALUES(0xAEB8);
+INSERT INTO t1 VALUES(0xAEB9);
+INSERT INTO t1 VALUES(0xAEBA);
+INSERT INTO t1 VALUES(0xAEBB);
+INSERT INTO t1 VALUES(0xAEBC);
+INSERT INTO t1 VALUES(0xAEBD);
+INSERT INTO t1 VALUES(0xAEBE);
+INSERT INTO t1 VALUES(0xAEBF);
+INSERT INTO t1 VALUES(0xAEC0);
+INSERT INTO t1 VALUES(0xAEC1);
+INSERT INTO t1 VALUES(0xAEC2);
+INSERT INTO t1 VALUES(0xAEC3);
+INSERT INTO t1 VALUES(0xAEC4);
+INSERT INTO t1 VALUES(0xAEC5);
+INSERT INTO t1 VALUES(0xAEC6);
+INSERT INTO t1 VALUES(0xAEC7);
+INSERT INTO t1 VALUES(0xAEC8);
+INSERT INTO t1 VALUES(0xAEC9);
+INSERT INTO t1 VALUES(0xAECA);
+INSERT INTO t1 VALUES(0xAECB);
+INSERT INTO t1 VALUES(0xAECC);
+INSERT INTO t1 VALUES(0xAECD);
+INSERT INTO t1 VALUES(0xAECE);
+INSERT INTO t1 VALUES(0xAECF);
+INSERT INTO t1 VALUES(0xAED0);
+INSERT INTO t1 VALUES(0xAED1);
+INSERT INTO t1 VALUES(0xAED2);
+INSERT INTO t1 VALUES(0xAED3);
+INSERT INTO t1 VALUES(0xAED4);
+INSERT INTO t1 VALUES(0xAED5);
+INSERT INTO t1 VALUES(0xAED6);
+INSERT INTO t1 VALUES(0xAED7);
+INSERT INTO t1 VALUES(0xAED8);
+INSERT INTO t1 VALUES(0xAED9);
+INSERT INTO t1 VALUES(0xAEDA);
+INSERT INTO t1 VALUES(0xAEDB);
+INSERT INTO t1 VALUES(0xAEDC);
+INSERT INTO t1 VALUES(0xAEDD);
+INSERT INTO t1 VALUES(0xAEDE);
+INSERT INTO t1 VALUES(0xAEDF);
+INSERT INTO t1 VALUES(0xAEE0);
+INSERT INTO t1 VALUES(0xAEE1);
+INSERT INTO t1 VALUES(0xAEE2);
+INSERT INTO t1 VALUES(0xAEE3);
+INSERT INTO t1 VALUES(0xAEE4);
+INSERT INTO t1 VALUES(0xAEE5);
+INSERT INTO t1 VALUES(0xAEE6);
+INSERT INTO t1 VALUES(0xAEE7);
+INSERT INTO t1 VALUES(0xAEE8);
+INSERT INTO t1 VALUES(0xAEE9);
+INSERT INTO t1 VALUES(0xAEEA);
+INSERT INTO t1 VALUES(0xAEEB);
+INSERT INTO t1 VALUES(0xAEEC);
+INSERT INTO t1 VALUES(0xAEED);
+INSERT INTO t1 VALUES(0xAEEE);
+INSERT INTO t1 VALUES(0xAEEF);
+INSERT INTO t1 VALUES(0xAEF0);
+INSERT INTO t1 VALUES(0xAEF1);
+INSERT INTO t1 VALUES(0xAEF2);
+INSERT INTO t1 VALUES(0xAEF3);
+INSERT INTO t1 VALUES(0xAEF4);
+INSERT INTO t1 VALUES(0xAEF5);
+INSERT INTO t1 VALUES(0xAEF6);
+INSERT INTO t1 VALUES(0xAEF7);
+INSERT INTO t1 VALUES(0xAEF8);
+INSERT INTO t1 VALUES(0xAEF9);
+INSERT INTO t1 VALUES(0xAEFA);
+INSERT INTO t1 VALUES(0xAEFB);
+INSERT INTO t1 VALUES(0xAEFC);
+INSERT INTO t1 VALUES(0xAEFD);
+INSERT INTO t1 VALUES(0xAEFE);
+INSERT INTO t1 VALUES(0xAFA1);
+INSERT INTO t1 VALUES(0xAFA2);
+INSERT INTO t1 VALUES(0xAFA3);
+INSERT INTO t1 VALUES(0xAFA4);
+INSERT INTO t1 VALUES(0xAFA5);
+INSERT INTO t1 VALUES(0xAFA6);
+INSERT INTO t1 VALUES(0xAFA7);
+INSERT INTO t1 VALUES(0xAFA8);
+INSERT INTO t1 VALUES(0xAFA9);
+INSERT INTO t1 VALUES(0xAFAA);
+INSERT INTO t1 VALUES(0xAFAB);
+INSERT INTO t1 VALUES(0xAFAC);
+INSERT INTO t1 VALUES(0xAFAD);
+INSERT INTO t1 VALUES(0xAFAE);
+INSERT INTO t1 VALUES(0xAFAF);
+INSERT INTO t1 VALUES(0xAFB0);
+INSERT INTO t1 VALUES(0xAFB1);
+INSERT INTO t1 VALUES(0xAFB2);
+INSERT INTO t1 VALUES(0xAFB3);
+INSERT INTO t1 VALUES(0xAFB4);
+INSERT INTO t1 VALUES(0xAFB5);
+INSERT INTO t1 VALUES(0xAFB6);
+INSERT INTO t1 VALUES(0xAFB7);
+INSERT INTO t1 VALUES(0xAFB8);
+INSERT INTO t1 VALUES(0xAFB9);
+INSERT INTO t1 VALUES(0xAFBA);
+INSERT INTO t1 VALUES(0xAFBB);
+INSERT INTO t1 VALUES(0xAFBC);
+INSERT INTO t1 VALUES(0xAFBD);
+INSERT INTO t1 VALUES(0xAFBE);
+INSERT INTO t1 VALUES(0xAFBF);
+INSERT INTO t1 VALUES(0xAFC0);
+INSERT INTO t1 VALUES(0xAFC1);
+INSERT INTO t1 VALUES(0xAFC2);
+INSERT INTO t1 VALUES(0xAFC3);
+INSERT INTO t1 VALUES(0xAFC4);
+INSERT INTO t1 VALUES(0xAFC5);
+INSERT INTO t1 VALUES(0xAFC6);
+INSERT INTO t1 VALUES(0xAFC7);
+INSERT INTO t1 VALUES(0xAFC8);
+INSERT INTO t1 VALUES(0xAFC9);
+INSERT INTO t1 VALUES(0xAFCA);
+INSERT INTO t1 VALUES(0xAFCB);
+INSERT INTO t1 VALUES(0xAFCC);
+INSERT INTO t1 VALUES(0xAFCD);
+INSERT INTO t1 VALUES(0xAFCE);
+INSERT INTO t1 VALUES(0xAFCF);
+INSERT INTO t1 VALUES(0xAFD0);
+INSERT INTO t1 VALUES(0xAFD1);
+INSERT INTO t1 VALUES(0xAFD2);
+INSERT INTO t1 VALUES(0xAFD3);
+INSERT INTO t1 VALUES(0xAFD4);
+INSERT INTO t1 VALUES(0xAFD5);
+INSERT INTO t1 VALUES(0xAFD6);
+INSERT INTO t1 VALUES(0xAFD7);
+INSERT INTO t1 VALUES(0xAFD8);
+INSERT INTO t1 VALUES(0xAFD9);
+INSERT INTO t1 VALUES(0xAFDA);
+INSERT INTO t1 VALUES(0xAFDB);
+INSERT INTO t1 VALUES(0xAFDC);
+INSERT INTO t1 VALUES(0xAFDD);
+INSERT INTO t1 VALUES(0xAFDE);
+INSERT INTO t1 VALUES(0xAFDF);
+INSERT INTO t1 VALUES(0xAFE0);
+INSERT INTO t1 VALUES(0xAFE1);
+INSERT INTO t1 VALUES(0xAFE2);
+INSERT INTO t1 VALUES(0xAFE3);
+INSERT INTO t1 VALUES(0xAFE4);
+INSERT INTO t1 VALUES(0xAFE5);
+INSERT INTO t1 VALUES(0xAFE6);
+INSERT INTO t1 VALUES(0xAFE7);
+INSERT INTO t1 VALUES(0xAFE8);
+INSERT INTO t1 VALUES(0xAFE9);
+INSERT INTO t1 VALUES(0xAFEA);
+INSERT INTO t1 VALUES(0xAFEB);
+INSERT INTO t1 VALUES(0xAFEC);
+INSERT INTO t1 VALUES(0xAFED);
+INSERT INTO t1 VALUES(0xAFEE);
+INSERT INTO t1 VALUES(0xAFEF);
+INSERT INTO t1 VALUES(0xAFF0);
+INSERT INTO t1 VALUES(0xAFF1);
+INSERT INTO t1 VALUES(0xAFF2);
+INSERT INTO t1 VALUES(0xAFF3);
+INSERT INTO t1 VALUES(0xAFF4);
+INSERT INTO t1 VALUES(0xAFF5);
+INSERT INTO t1 VALUES(0xAFF6);
+INSERT INTO t1 VALUES(0xAFF7);
+INSERT INTO t1 VALUES(0xAFF8);
+INSERT INTO t1 VALUES(0xAFF9);
+INSERT INTO t1 VALUES(0xAFFA);
+INSERT INTO t1 VALUES(0xAFFB);
+INSERT INTO t1 VALUES(0xAFFC);
+INSERT INTO t1 VALUES(0xAFFD);
+INSERT INTO t1 VALUES(0xAFFE);
+INSERT INTO t1 VALUES(0xCFD4);
+INSERT INTO t1 VALUES(0xCFD5);
+INSERT INTO t1 VALUES(0xCFD6);
+INSERT INTO t1 VALUES(0xCFD7);
+INSERT INTO t1 VALUES(0xCFD8);
+INSERT INTO t1 VALUES(0xCFD9);
+INSERT INTO t1 VALUES(0xCFDA);
+INSERT INTO t1 VALUES(0xCFDB);
+INSERT INTO t1 VALUES(0xCFDC);
+INSERT INTO t1 VALUES(0xCFDD);
+INSERT INTO t1 VALUES(0xCFDE);
+INSERT INTO t1 VALUES(0xCFDF);
+INSERT INTO t1 VALUES(0xCFE0);
+INSERT INTO t1 VALUES(0xCFE1);
+INSERT INTO t1 VALUES(0xCFE2);
+INSERT INTO t1 VALUES(0xCFE3);
+INSERT INTO t1 VALUES(0xCFE4);
+INSERT INTO t1 VALUES(0xCFE5);
+INSERT INTO t1 VALUES(0xCFE6);
+INSERT INTO t1 VALUES(0xCFE7);
+INSERT INTO t1 VALUES(0xCFE8);
+INSERT INTO t1 VALUES(0xCFE9);
+INSERT INTO t1 VALUES(0xCFEA);
+INSERT INTO t1 VALUES(0xCFEB);
+INSERT INTO t1 VALUES(0xCFEC);
+INSERT INTO t1 VALUES(0xCFED);
+INSERT INTO t1 VALUES(0xCFEE);
+INSERT INTO t1 VALUES(0xCFEF);
+INSERT INTO t1 VALUES(0xCFF0);
+INSERT INTO t1 VALUES(0xCFF1);
+INSERT INTO t1 VALUES(0xCFF2);
+INSERT INTO t1 VALUES(0xCFF3);
+INSERT INTO t1 VALUES(0xCFF4);
+INSERT INTO t1 VALUES(0xCFF5);
+INSERT INTO t1 VALUES(0xCFF6);
+INSERT INTO t1 VALUES(0xCFF7);
+INSERT INTO t1 VALUES(0xCFF8);
+INSERT INTO t1 VALUES(0xCFF9);
+INSERT INTO t1 VALUES(0xCFFA);
+INSERT INTO t1 VALUES(0xCFFB);
+INSERT INTO t1 VALUES(0xCFFC);
+INSERT INTO t1 VALUES(0xCFFD);
+INSERT INTO t1 VALUES(0xCFFE);
+INSERT INTO t1 VALUES(0xF4A7);
+INSERT INTO t1 VALUES(0xF4A8);
+INSERT INTO t1 VALUES(0xF4A9);
+INSERT INTO t1 VALUES(0xF4AA);
+INSERT INTO t1 VALUES(0xF4AB);
+INSERT INTO t1 VALUES(0xF4AC);
+INSERT INTO t1 VALUES(0xF4AD);
+INSERT INTO t1 VALUES(0xF4AE);
+INSERT INTO t1 VALUES(0xF4AF);
+INSERT INTO t1 VALUES(0xF4B0);
+INSERT INTO t1 VALUES(0xF4B1);
+INSERT INTO t1 VALUES(0xF4B2);
+INSERT INTO t1 VALUES(0xF4B3);
+INSERT INTO t1 VALUES(0xF4B4);
+INSERT INTO t1 VALUES(0xF4B5);
+INSERT INTO t1 VALUES(0xF4B6);
+INSERT INTO t1 VALUES(0xF4B7);
+INSERT INTO t1 VALUES(0xF4B8);
+INSERT INTO t1 VALUES(0xF4B9);
+INSERT INTO t1 VALUES(0xF4BA);
+INSERT INTO t1 VALUES(0xF4BB);
+INSERT INTO t1 VALUES(0xF4BC);
+INSERT INTO t1 VALUES(0xF4BD);
+INSERT INTO t1 VALUES(0xF4BE);
+INSERT INTO t1 VALUES(0xF4BF);
+INSERT INTO t1 VALUES(0xF4C0);
+INSERT INTO t1 VALUES(0xF4C1);
+INSERT INTO t1 VALUES(0xF4C2);
+INSERT INTO t1 VALUES(0xF4C3);
+INSERT INTO t1 VALUES(0xF4C4);
+INSERT INTO t1 VALUES(0xF4C5);
+INSERT INTO t1 VALUES(0xF4C6);
+INSERT INTO t1 VALUES(0xF4C7);
+INSERT INTO t1 VALUES(0xF4C8);
+INSERT INTO t1 VALUES(0xF4C9);
+INSERT INTO t1 VALUES(0xF4CA);
+INSERT INTO t1 VALUES(0xF4CB);
+INSERT INTO t1 VALUES(0xF4CC);
+INSERT INTO t1 VALUES(0xF4CD);
+INSERT INTO t1 VALUES(0xF4CE);
+INSERT INTO t1 VALUES(0xF4CF);
+INSERT INTO t1 VALUES(0xF4D0);
+INSERT INTO t1 VALUES(0xF4D1);
+INSERT INTO t1 VALUES(0xF4D2);
+INSERT INTO t1 VALUES(0xF4D3);
+INSERT INTO t1 VALUES(0xF4D4);
+INSERT INTO t1 VALUES(0xF4D5);
+INSERT INTO t1 VALUES(0xF4D6);
+INSERT INTO t1 VALUES(0xF4D7);
+INSERT INTO t1 VALUES(0xF4D8);
+INSERT INTO t1 VALUES(0xF4D9);
+INSERT INTO t1 VALUES(0xF4DA);
+INSERT INTO t1 VALUES(0xF4DB);
+INSERT INTO t1 VALUES(0xF4DC);
+INSERT INTO t1 VALUES(0xF4DD);
+INSERT INTO t1 VALUES(0xF4DE);
+INSERT INTO t1 VALUES(0xF4DF);
+INSERT INTO t1 VALUES(0xF4E0);
+INSERT INTO t1 VALUES(0xF4E1);
+INSERT INTO t1 VALUES(0xF4E2);
+INSERT INTO t1 VALUES(0xF4E3);
+INSERT INTO t1 VALUES(0xF4E4);
+INSERT INTO t1 VALUES(0xF4E5);
+INSERT INTO t1 VALUES(0xF4E6);
+INSERT INTO t1 VALUES(0xF4E7);
+INSERT INTO t1 VALUES(0xF4E8);
+INSERT INTO t1 VALUES(0xF4E9);
+INSERT INTO t1 VALUES(0xF4EA);
+INSERT INTO t1 VALUES(0xF4EB);
+INSERT INTO t1 VALUES(0xF4EC);
+INSERT INTO t1 VALUES(0xF4ED);
+INSERT INTO t1 VALUES(0xF4EE);
+INSERT INTO t1 VALUES(0xF4EF);
+INSERT INTO t1 VALUES(0xF4F0);
+INSERT INTO t1 VALUES(0xF4F1);
+INSERT INTO t1 VALUES(0xF4F2);
+INSERT INTO t1 VALUES(0xF4F3);
+INSERT INTO t1 VALUES(0xF4F4);
+INSERT INTO t1 VALUES(0xF4F5);
+INSERT INTO t1 VALUES(0xF4F6);
+INSERT INTO t1 VALUES(0xF4F7);
+INSERT INTO t1 VALUES(0xF4F8);
+INSERT INTO t1 VALUES(0xF4F9);
+INSERT INTO t1 VALUES(0xF4FA);
+INSERT INTO t1 VALUES(0xF4FB);
+INSERT INTO t1 VALUES(0xF4FC);
+INSERT INTO t1 VALUES(0xF4FD);
+INSERT INTO t1 VALUES(0xF4FE);
+SELECT HEX(c) FROM t1 ORDER BY BINARY c;
+DROP TABLE t1;
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
new file mode 100644
index 00000000000..42031be8f3c
--- /dev/null
+++ b/mysql-test/t/ctype_utf8.test
@@ -0,0 +1,668 @@
+#
+# Tests with the utf8 character set
+#
+
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+set names utf8;
+
+select left(_utf8 0xD0B0D0B1D0B2,1);
+select right(_utf8 0xD0B0D0B2D0B2,1);
+
+select locate('he','hello');
+select locate('he','hello',2);
+select locate('lo','hello',2);
+select locate('HE','hello');
+select locate('HE','hello',2);
+select locate('LO','hello',2);
+select locate('HE','hello' collate utf8_bin);
+select locate('HE','hello' collate utf8_bin,2);
+select locate('LO','hello' collate utf8_bin,2);
+
+select locate(_utf8 0xD0B1, _utf8 0xD0B0D0B1D0B2);
+select locate(_utf8 0xD091, _utf8 0xD0B0D0B1D0B2);
+select locate(_utf8 0xD0B1, _utf8 0xD0B0D091D0B2);
+select locate(_utf8 0xD091, _utf8 0xD0B0D0B1D0B2 collate utf8_bin);
+select locate(_utf8 0xD0B1, _utf8 0xD0B0D091D0B2 collate utf8_bin);
+
+select length(_utf8 0xD0B1), bit_length(_utf8 0xD0B1), char_length(_utf8 0xD0B1);
+
+select 'a' like 'a';
+select 'A' like 'a';
+select 'A' like 'a' collate utf8_bin;
+select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%');
+
+# Bug #6040: can't retrieve records with umlaut
+# characters in case insensitive manner.
+# Case insensitive search LIKE comparison
+# was broken for multibyte characters:
+select convert(_latin1'Günter André' using utf8) like CONVERT(_latin1'GÜNTER%' USING utf8);
+select CONVERT(_koi8r'×ÁÓÑ' USING utf8) LIKE CONVERT(_koi8r'÷áóñ' USING utf8);
+select CONVERT(_koi8r'÷áóñ' USING utf8) LIKE CONVERT(_koi8r'×ÁÓÑ' USING utf8);
+
+#
+# Check the following:
+# "a" == "a "
+# "a\0" < "a"
+# "a\0" < "a "
+
+SELECT 'a' = 'a ';
+SELECT 'a\0' < 'a';
+SELECT 'a\0' < 'a ';
+SELECT 'a\t' < 'a';
+SELECT 'a\t' < 'a ';
+
+#
+# The same for binary collation
+#
+SELECT 'a' = 'a ' collate utf8_bin;
+SELECT 'a\0' < 'a' collate utf8_bin;
+SELECT 'a\0' < 'a ' collate utf8_bin;
+SELECT 'a\t' < 'a' collate utf8_bin;
+SELECT 'a\t' < 'a ' collate utf8_bin;
+
+CREATE TABLE t1 (a char(10) character set utf8 not null);
+INSERT INTO t1 VALUES ('a'),('a\0'),('a\t'),('a ');
+SELECT hex(a),STRCMP(a,'a'), STRCMP(a,'a ') FROM t1;
+DROP TABLE t1;
+
+#
+# Fix this, it should return 1:
+#
+#select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD091,_utf8 '%');
+#
+
+#
+# Bug 2367: INSERT() behaviour is different for different charsets.
+#
+select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
+select insert("aa",100,1,"b"),insert("aa",1,3,"b");
+
+#
+# LELF() didn't work well with utf8 in some cases too.
+#
+select char_length(left(@a:='тест',5)), length(@a), @a;
+
+
+#
+# CREATE ... SELECT
+#
+create table t1 select date_format("2004-01-19 10:10:10", "%Y-%m-%d");
+show create table t1;
+select * from t1;
+drop table t1;
+
+#
+# Bug #2366 Wrong utf8 behaviour when data is truncated
+#
+set names koi8r;
+create table t1 (s1 char(1) character set utf8);
+insert into t1 values (_koi8r'ÁÂ');
+select s1,hex(s1),char_length(s1),octet_length(s1) from t1;
+drop table t1;
+
+create table t1 (s1 tinytext character set utf8);
+insert into t1 select repeat('a',300);
+insert into t1 select repeat('Ñ',300);
+insert into t1 select repeat('aÑ',300);
+insert into t1 select repeat('Ña',300);
+insert into t1 select repeat('ÑÑ',300);
+select hex(s1) from t1;
+select length(s1),char_length(s1) from t1;
+drop table t1;
+
+create table t1 (s1 text character set utf8);
+insert into t1 select repeat('a',66000);
+insert into t1 select repeat('Ñ',66000);
+insert into t1 select repeat('aÑ',66000);
+insert into t1 select repeat('Ña',66000);
+insert into t1 select repeat('ÑÑ',66000);
+select length(s1),char_length(s1) from t1;
+drop table t1;
+
+#
+# Bug #2368 Multibyte charsets do not check that incoming data is well-formed
+#
+create table t1 (s1 char(10) character set utf8);
+insert into t1 values (0x41FF);
+select hex(s1) from t1;
+drop table t1;
+
+create table t1 (s1 varchar(10) character set utf8);
+insert into t1 values (0x41FF);
+select hex(s1) from t1;
+drop table t1;
+
+create table t1 (s1 text character set utf8);
+insert into t1 values (0x41FF);
+select hex(s1) from t1;
+drop table t1;
+
+#
+# Bug 2699
+# UTF8 breaks primary keys for cols > 333 characters
+#
+--error 1071
+create table t1 (a text character set utf8, primary key(a(360)));
+
+
+#
+# Bug 2959
+# UTF8 charset breaks joins with mixed column/string constant
+#
+CREATE TABLE t1 ( a varchar(10) ) CHARACTER SET utf8;
+INSERT INTO t1 VALUES ( 'test' );
+SELECT a.a, b.a FROM t1 a, t1 b WHERE a.a = b.a;
+SELECT a.a, b.a FROM t1 a, t1 b WHERE a.a = 'test' and b.a = 'test';
+SELECT a.a, b.a FROM t1 a, t1 b WHERE a.a = b.a and a.a = 'test';
+DROP TABLE t1;
+
+create table t1 (a char(255) character set utf8);
+insert into t1 values('b'),('b');
+select * from t1 where a = 'b';
+select * from t1 where a = 'b' and a = 'b';
+select * from t1 where a = 'b' and a != 'b';
+drop table t1;
+
+#
+# Bug #3928 regexp [[:>:]] and UTF-8
+#
+set names utf8;
+
+# This should return TRUE
+select 'вася' rlike '[[:<:]]вася[[:>:]]';
+select 'вася ' rlike '[[:<:]]вася[[:>:]]';
+select ' вася' rlike '[[:<:]]вася[[:>:]]';
+select ' вася ' rlike '[[:<:]]вася[[:>:]]';
+
+# This should return FALSE
+select 'васяz' rlike '[[:<:]]вася[[:>:]]';
+select 'zвася' rlike '[[:<:]]вася[[:>:]]';
+select 'zвасяz' rlike '[[:<:]]вася[[:>:]]';
+
+#
+# Bug #4555
+# ALTER TABLE crashes mysqld with enum column collated utf8_unicode_ci
+#
+CREATE TABLE t1 (a enum ('Y', 'N') DEFAULT 'N' COLLATE utf8_unicode_ci);
+ALTER TABLE t1 ADD COLUMN b CHAR(20);
+DROP TABLE t1;
+
+# Customer Support Center issue # 3299
+# ENUM and SET multibyte fields computed their length wronly
+# when converted into a char field
+set names utf8;
+create table t1 (a enum('aaaa','прПба') character set utf8);
+show create table t1;
+insert into t1 values ('прПба');
+select * from t1;
+create table t2 select ifnull(a,a) from t1;
+show create table t2;
+select * from t2;
+drop table t1;
+drop table t2;
+
+#
+# Bug 4521: unique key prefix interacts poorly with utf8
+# MYISAM: keys with prefix compression, case insensitive collation.
+#
+create table t1 (c varchar(30) character set utf8, unique(c(10)));
+insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
+insert into t1 values ('aaaaaaaaaa');
+--error 1062
+insert into t1 values ('aaaaaaaaaaa');
+--error 1062
+insert into t1 values ('aaaaaaaaaaaa');
+insert into t1 values (repeat('b',20));
+select c c1 from t1 where c='1';
+select c c2 from t1 where c='2';
+select c c3 from t1 where c='3';
+select c cx from t1 where c='x';
+select c cy from t1 where c='y';
+select c cz from t1 where c='z';
+select c ca10 from t1 where c='aaaaaaaaaa';
+select c cb20 from t1 where c=repeat('b',20);
+drop table t1;
+
+#
+# Bug 4521: unique key prefix interacts poorly with utf8
+# InnoDB: keys with prefix compression, case insensitive collation.
+#
+--disable_warnings
+create table t1 (c varchar(30) character set utf8, unique(c(10))) engine=innodb;
+--enable_warnings
+insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
+insert into t1 values ('aaaaaaaaaa');
+--error 1062
+insert into t1 values ('aaaaaaaaaaa');
+--error 1062
+insert into t1 values ('aaaaaaaaaaaa');
+insert into t1 values (repeat('b',20));
+select c c1 from t1 where c='1';
+select c c2 from t1 where c='2';
+select c c3 from t1 where c='3';
+select c cx from t1 where c='x';
+select c cy from t1 where c='y';
+select c cz from t1 where c='z';
+select c ca10 from t1 where c='aaaaaaaaaa';
+select c cb20 from t1 where c=repeat('b',20);
+drop table t1;
+#
+# Bug 4521: unique key prefix interacts poorly with utf8
+# MYISAM: fixed length keys, case insensitive collation
+#
+create table t1 (c char(3) character set utf8, unique (c(2)));
+insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
+insert into t1 values ('a');
+insert into t1 values ('aa');
+--error 1062
+insert into t1 values ('aaa');
+insert into t1 values ('b');
+insert into t1 values ('bb');
+--error 1062
+insert into t1 values ('bbb');
+insert into t1 values ('а');
+insert into t1 values ('аа');
+--error 1062
+insert into t1 values ('ааа');
+insert into t1 values ('б');
+insert into t1 values ('бб');
+--error 1062
+insert into t1 values ('ббб');
+insert into t1 values ('ꪪ');
+insert into t1 values ('ꪪꪪ');
+--error 1062
+insert into t1 values ('ꪪꪪꪪ');
+drop table t1;
+#
+# Bug 4521: unique key prefix interacts poorly with utf8
+# InnoDB: fixed length keys, case insensitive collation
+#
+--disable_warnings
+create table t1 (c char(3) character set utf8, unique (c(2))) engine=innodb;
+--enable_warnings
+insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
+insert into t1 values ('a');
+insert into t1 values ('aa');
+--error 1062
+insert into t1 values ('aaa');
+insert into t1 values ('b');
+insert into t1 values ('bb');
+--error 1062
+insert into t1 values ('bbb');
+insert into t1 values ('а');
+insert into t1 values ('аа');
+--error 1062
+insert into t1 values ('ааа');
+insert into t1 values ('б');
+insert into t1 values ('бб');
+--error 1062
+insert into t1 values ('ббб');
+insert into t1 values ('ꪪ');
+insert into t1 values ('ꪪꪪ');
+--error 1062
+insert into t1 values ('ꪪꪪꪪ');
+drop table t1;
+#
+# Bug 4531: unique key prefix interacts poorly with utf8
+# Check HEAP+HASH, case insensitive collation
+#
+create table t1 (
+c char(10) character set utf8,
+unique key a using hash (c(1))
+) engine=heap;
+show create table t1;
+insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
+--error 1062
+insert into t1 values ('aa');
+--error 1062
+insert into t1 values ('aaa');
+insert into t1 values ('б');
+--error 1062
+insert into t1 values ('бб');
+--error 1062
+insert into t1 values ('ббб');
+select c as c_all from t1 order by c;
+select c as c_a from t1 where c='a';
+select c as c_a from t1 where c='б';
+drop table t1;
+
+#
+# Bug 4531: unique key prefix interacts poorly with utf8
+# Check HEAP+BTREE, case insensitive collation
+#
+create table t1 (
+c char(10) character set utf8,
+unique key a using btree (c(1))
+) engine=heap;
+show create table t1;
+insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
+--error 1062
+insert into t1 values ('aa');
+--error 1062
+insert into t1 values ('aaa');
+insert into t1 values ('б');
+--error 1062
+insert into t1 values ('бб');
+--error 1062
+insert into t1 values ('ббб');
+select c as c_all from t1 order by c;
+select c as c_a from t1 where c='a';
+select c as c_a from t1 where c='б';
+drop table t1;
+
+#
+# Bug 4531: unique key prefix interacts poorly with utf8
+# Check BDB, case insensitive collation
+#
+--disable_warnings
+create table t1 (
+c char(10) character set utf8,
+unique key a (c(1))
+) engine=bdb;
+--enable_warnings
+insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
+--error 1062
+insert into t1 values ('aa');
+--error 1062
+insert into t1 values ('aaa');
+insert into t1 values ('б');
+--error 1062
+insert into t1 values ('бб');
+--error 1062
+insert into t1 values ('ббб');
+select c as c_all from t1 order by c;
+select c as c_a from t1 where c='a';
+select c as c_a from t1 where c='б';
+drop table t1;
+
+#
+# Bug 4521: unique key prefix interacts poorly with utf8
+# MYISAM: keys with prefix compression, binary collation.
+#
+create table t1 (c varchar(30) character set utf8 collate utf8_bin, unique(c(10)));
+insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
+insert into t1 values ('aaaaaaaaaa');
+--error 1062
+insert into t1 values ('aaaaaaaaaaa');
+--error 1062
+insert into t1 values ('aaaaaaaaaaaa');
+insert into t1 values (repeat('b',20));
+select c c1 from t1 where c='1';
+select c c2 from t1 where c='2';
+select c c3 from t1 where c='3';
+select c cx from t1 where c='x';
+select c cy from t1 where c='y';
+select c cz from t1 where c='z';
+select c ca10 from t1 where c='aaaaaaaaaa';
+select c cb20 from t1 where c=repeat('b',20);
+drop table t1;
+
+#
+# Bug 4521: unique key prefix interacts poorly with utf8
+# MYISAM: fixed length keys, binary collation
+#
+create table t1 (c char(3) character set utf8 collate utf8_bin, unique (c(2)));
+insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
+insert into t1 values ('a');
+insert into t1 values ('aa');
+--error 1062
+insert into t1 values ('aaa');
+insert into t1 values ('b');
+insert into t1 values ('bb');
+--error 1062
+insert into t1 values ('bbb');
+insert into t1 values ('а');
+insert into t1 values ('аа');
+--error 1062
+insert into t1 values ('ааа');
+insert into t1 values ('б');
+insert into t1 values ('бб');
+--error 1062
+insert into t1 values ('ббб');
+insert into t1 values ('ꪪ');
+insert into t1 values ('ꪪꪪ');
+--error 1062
+insert into t1 values ('ꪪꪪꪪ');
+drop table t1;
+
+#
+# Bug 4531: unique key prefix interacts poorly with utf8
+# Check HEAP+HASH, binary collation
+#
+create table t1 (
+c char(10) character set utf8 collate utf8_bin,
+unique key a using hash (c(1))
+) engine=heap;
+show create table t1;
+insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
+--error 1062
+insert into t1 values ('aa');
+--error 1062
+insert into t1 values ('aaa');
+insert into t1 values ('б');
+--error 1062
+insert into t1 values ('бб');
+--error 1062
+insert into t1 values ('ббб');
+select c as c_all from t1 order by c;
+select c as c_a from t1 where c='a';
+select c as c_a from t1 where c='б';
+drop table t1;
+
+#
+# Bug 4531: unique key prefix interacts poorly with utf8
+# Check HEAP+BTREE, binary collation
+#
+create table t1 (
+c char(10) character set utf8 collate utf8_bin,
+unique key a using btree (c(1))
+) engine=heap;
+show create table t1;
+insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
+--error 1062
+insert into t1 values ('aa');
+--error 1062
+insert into t1 values ('aaa');
+insert into t1 values ('б');
+--error 1062
+insert into t1 values ('бб');
+--error 1062
+insert into t1 values ('ббб');
+select c as c_all from t1 order by c;
+select c as c_a from t1 where c='a';
+select c as c_a from t1 where c='б';
+drop table t1;
+
+#
+# Bug 4531: unique key prefix interacts poorly with utf8
+# Check BDB, binary collation
+#
+--disable_warnings
+create table t1 (
+c char(10) character set utf8 collate utf8_bin,
+unique key a (c(1))
+) engine=bdb;
+--enable_warnings
+insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
+--error 1062
+insert into t1 values ('aa');
+--error 1062
+insert into t1 values ('aaa');
+insert into t1 values ('б');
+--error 1062
+insert into t1 values ('бб');
+--error 1062
+insert into t1 values ('ббб');
+select c as c_all from t1 order by c;
+select c as c_a from t1 where c='a';
+select c as c_a from t1 where c='б';
+drop table t1;
+
+
+# Bug#4594: column index make = failed for gbk, but like works
+# Check MYISAM
+#
+create table t1 (
+ str varchar(255) character set utf8 not null,
+ key str (str(2))
+) engine=myisam;
+INSERT INTO t1 VALUES ('str');
+INSERT INTO t1 VALUES ('str2');
+select * from t1 where str='str';
+drop table t1;
+
+# Bug#4594: column index make = failed for gbk, but like works
+# Check InnoDB
+#
+--disable_warnings
+create table t1 (
+ str varchar(255) character set utf8 not null,
+ key str (str(2))
+) engine=innodb;
+--enable_warnings
+INSERT INTO t1 VALUES ('str');
+INSERT INTO t1 VALUES ('str2');
+select * from t1 where str='str';
+drop table t1;
+
+# the same for HEAP+BTREE
+#
+
+create table t1 (
+ str varchar(255) character set utf8 not null,
+ key str using btree (str(2))
+) engine=heap;
+INSERT INTO t1 VALUES ('str');
+INSERT INTO t1 VALUES ('str2');
+select * from t1 where str='str';
+drop table t1;
+
+# the same for HEAP+HASH
+#
+
+create table t1 (
+ str varchar(255) character set utf8 not null,
+ key str using hash (str(2))
+) engine=heap;
+INSERT INTO t1 VALUES ('str');
+INSERT INTO t1 VALUES ('str2');
+select * from t1 where str='str';
+drop table t1;
+
+# the same for BDB
+#
+
+--disable_warnings
+create table t1 (
+ str varchar(255) character set utf8 not null,
+ key str (str(2))
+) engine=bdb;
+--enable_warnings
+INSERT INTO t1 VALUES ('str');
+INSERT INTO t1 VALUES ('str2');
+select * from t1 where str='str';
+drop table t1;
+
+#
+# Bug #5397: Crash with varchar binary and LIKE
+#
+CREATE TABLE t1 (a varchar(32) BINARY) CHARACTER SET utf8;
+INSERT INTO t1 VALUES ('test');
+SELECT a FROM t1 WHERE a LIKE '%te';
+DROP TABLE t1;
+
+#
+# Bug #5723: length(<varchar utf8 field>) returns varying results
+#
+--disable_warnings
+SET NAMES utf8;
+--disable_warnings
+CREATE TABLE t1 (
+ subject varchar(255) character set utf8 collate utf8_unicode_ci,
+ p varchar(15) character set utf8
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+--enable_warnings
+INSERT INTO t1 VALUES ('谷川俊二ず申したすが、むンタヌネット予玄の䌚員登録をしたしたずころ、メヌルアドレスを間違えおしたい䌚員が受け取るこずが出来たせんでした。間違えアドレスはtani-shun@n.vodafone.ne.jpを曞き蟌みたした。どうすればよいですか その他、䜏所等は間違えありたせん。連絡ください。よろしくお願いしたす。m(__)m','040312-000057');
+INSERT INTO t1 VALUES ('aaa','bbb');
+SELECT length(subject) FROM t1;
+SELECT length(subject) FROM t1 ORDER BY 1;
+DROP TABLE t1;
+
+#
+# Bug #5832 SELECT doesn't return records in some cases
+#
+CREATE TABLE t1 (
+ id int unsigned NOT NULL auto_increment,
+ list_id smallint unsigned NOT NULL,
+ term TEXT NOT NULL,
+ PRIMARY KEY(id),
+ INDEX(list_id, term(4))
+) ENGINE=MYISAM CHARSET=utf8;
+INSERT INTO t1 SET list_id = 1, term = "letterc";
+INSERT INTO t1 SET list_id = 1, term = "letterb";
+INSERT INTO t1 SET list_id = 1, term = "lettera";
+INSERT INTO t1 SET list_id = 1, term = "letterd";
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterc");
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterb");
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "lettera");
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd");
+DROP TABLE t1;
+
+
+#
+# Bug #6043 erratic searching for diacriticals in indexed MyISAM UTF-8 table
+#
+SET NAMES latin1;
+CREATE TABLE t1 (
+ id int unsigned NOT NULL auto_increment,
+ list_id smallint unsigned NOT NULL,
+ term text NOT NULL,
+ PRIMARY KEY(id),
+ INDEX(list_id, term(19))
+) ENGINE=MyISAM CHARSET=utf8;
+INSERT INTO t1 set list_id = 1, term = "testétest";
+INSERT INTO t1 set list_id = 1, term = "testetest";
+INSERT INTO t1 set list_id = 1, term = "testètest";
+SELECT id, term FROM t1 where (list_id = 1) AND (term = "testétest");
+SELECT id, term FROM t1 where (list_id = 1) AND (term = "testetest");
+SELECT id, term FROM t1 where (list_id = 1) AND (term = "testètest");
+DROP TABLE t1;
+
+#
+# Bug #6019 SELECT tries to use too short prefix index on utf8 data
+#
+set names utf8;
+--disable_warnings
+create table t1 (
+ a int primary key,
+ b varchar(6),
+ index b3(b(3))
+) engine=innodb character set=utf8;
+--enable_warnings
+insert into t1 values(1,'foo'),(2,'foobar');
+select * from t1 where b like 'foob%';
+--disable_warnings
+alter table t1 engine=bdb;
+--enable_warnings
+select * from t1 where b like 'foob%';
+drop table t1;
+
+#
+# Test for calculate_interval_lengths() function
+#
+create table t1 (
+ a enum('петя','вася','аМюта') character set utf8 not null default 'аМюта',
+ b set('петя','вася','аМюта') character set utf8 not null default 'аМюта'
+);
+create table t2 select concat(a,_utf8'') as a, concat(b,_utf8'')as b from t1;
+show create table t2;
+drop table t2;
+drop table t1;
+
+#
+# Bug #6787 LIKE not working properly with _ and utf8 data
+#
+select 'c' like '\_' as want0;
+
diff --git a/mysql-test/t/date_formats-master.opt b/mysql-test/t/date_formats-master.opt
new file mode 100644
index 00000000000..ab243fe729c
--- /dev/null
+++ b/mysql-test/t/date_formats-master.opt
@@ -0,0 +1 @@
+--date-format=%d.%m.%Y --time-format=%H.%i.%s
diff --git a/mysql-test/t/date_formats.test b/mysql-test/t/date_formats.test
new file mode 100644
index 00000000000..800e5880b09
--- /dev/null
+++ b/mysql-test/t/date_formats.test
@@ -0,0 +1,261 @@
+#
+# Test of date format functions
+#
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+SHOW GLOBAL VARIABLES LIKE "%_format%";
+SHOW SESSION VARIABLES LIKE "%_format%";
+
+#
+# Test setting a lot of different formats to see which formats are accepted and
+# which aren't
+#
+
+SET time_format='%H%i%s';
+SET time_format='%H:%i:%s.%f';
+SET time_format='%h-%i-%s.%f%p';
+SET time_format='%h:%i:%s.%f %p';
+SET time_format='%h:%i:%s%p';
+
+SET date_format='%Y%m%d';
+SET date_format='%Y.%m.%d';
+SET date_format='%d.%m.%Y';
+SET date_format='%m-%d-%Y';
+
+set datetime_format= '%Y%m%d%H%i%s';
+set datetime_format= '%Y-%m-%d %H:%i:%s';
+set datetime_format= '%m-%d-%y %H:%i:%s.%f';
+set datetime_format= '%d-%m-%Y %h:%i:%s%p';
+set datetime_format= '%H:%i:%s %Y-%m-%d';
+set datetime_format= '%H:%i:%s.%f %m-%d-%Y';
+set datetime_format= '%h:%i:%s %p %Y-%m-%d';
+set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d';
+
+SHOW SESSION VARIABLES LIKE "%format";
+
+--error 1231
+SET time_format='%h:%i:%s';
+--error 1231
+SET time_format='%H %i:%s';
+--error 1231
+SET time_format='%H::%i:%s';
+--error 1231
+SET time_format='%H:%i:%s%f';
+--error 1231
+SET time_format='%H:%i.%f:%s';
+--error 1231
+SET time_format='%H:%i:%s%p';
+--error 1231
+SET time_format='%h:%i:%s.%f %p %Y-%m-%d';
+--error 1231
+SET time_format='%H%i%s.%f';
+--error 1231
+SET time_format='%H:%i-%s.%f';
+--error 1231
+SET date_format='%d.%m.%d';
+--error 1231
+SET datetime_format='%h.%m.%y %d.%i.%s';
+--error 1231
+set datetime_format= '%H:%i:%s.%f %p %Y-%m-%d';
+
+#
+# Test GLOBAL values
+
+set GLOBAL datetime_format= '%H:%i:%s %Y-%m-%d';
+SET SESSION datetime_format=default;
+select @@global.datetime_format, @@session.datetime_format;
+SET GLOBAL datetime_format=default;
+SET SESSION datetime_format=default;
+select @@global.datetime_format, @@session.datetime_format;
+
+SET GLOBAL date_format=default;
+SET GLOBAL time_format=default;
+SET GLOBAL datetime_format=default;
+SET time_format=default;
+SET date_format=default;
+SET datetime_format=default;
+
+#
+# The following tests will work only when we at some point will enable
+# dynamic changing of formats
+#
+
+# SET date_format='%d.%m.%Y';
+# select CAST('01.01.2001' as DATE) as a;
+# SET datetime_format='%d.%m.%Y %H.%i.%s';
+# select CAST('01.01.2001 05.12.06' as DATETIME) as a;
+# SET time_format='%H.%i.%s';
+# select CAST('05.12.06' as TIME) as a;
+#
+# SET datetime_format='%d.%m.%Y %h:%i:%s %p';
+# select CAST('01.01.2001 05:12:06AM' as DATETIME) as a;
+# select CAST('01.01.2001 05:12:06 PM' as DATETIME) as a;
+#
+# SET time_format='%h:%i:%s %p';
+# select CAST('05:12:06 AM' as TIME) as a;
+# select CAST('05:12:06.1234PM' as TIME) as a;
+#
+# SET time_format='%h.%i.%s %p';
+# SET date_format='%d.%m.%y';
+# SET datetime_format='%d.%m.%y %h.%i.%s %p';
+# select CAST('12-12-06' as DATE) as a;
+#
+# select adddate('01.01.97 11.59.59.000001 PM', 10);
+# select datediff('31.12.97 11.59:59.000001 PM','01.01.98');
+# select weekofyear('31.11.97 11:59:59.000001 PM');
+# select makedate(1997,1);
+# select addtime('31.12.97 11.59.59.999999 PM', '1 1.1.1.000002');
+# select maketime(23,11,12);
+# select timediff('01.01.97 11:59:59.000001 PM','31.12.95 11:59:59.000002 PM');
+#
+# SET time_format='%i:%s:%H';
+# select cast(str_to_date('15-01-2001 12:59:59', '%d-%m-%Y %H:%i:%S') as TIME);
+
+#
+# Test of str_to_date
+#
+
+# PS doesn't support fraction of a seconds
+--disable_ps_protocol
+select str_to_date(concat('15-01-2001',' 2:59:58.999'),
+ concat('%d-%m-%Y',' ','%H:%i:%s.%f'));
+--enable_ps_protocol
+
+create table t1 (date char(30), format char(30) not null);
+insert into t1 values
+('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'),
+('03-01-02 8:11:2.123456', '%y-%m-%d %H:%i:%S.%#'),
+('2003-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p'),
+('2003-01-02 01:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f%p'),
+('2003-01-02 02:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f %p'),
+('2003-01-02 12:11:12.12345 am', '%Y-%m-%d %h:%i:%S.%f%p'),
+('2003-01-02 11:11:12Pm', '%Y-%m-%d %h:%i:%S%p'),
+('10:20:10', '%H:%i:%s'),
+('10:20:10', '%h:%i:%s.%f'),
+('10:20:10', '%T'),
+('10:20:10AM', '%h:%i:%s%p'),
+('10:20:10AM', '%r'),
+('10:20:10.44AM', '%h:%i:%s.%f%p'),
+('15-01-2001 12:59:58', '%d-%m-%Y %H:%i:%S'),
+('15 September 2001', '%d %M %Y'),
+('15 SEPTEMB 2001', '%d %M %Y'),
+('15 MAY 2001', '%d %b %Y'),
+('15th May 2001', '%D %b %Y'),
+('Sunday 15 MAY 2001', '%W %d %b %Y'),
+('Sund 15 MAY 2001', '%W %d %b %Y'),
+('Tuesday 00 2002', '%W %U %Y'),
+('Thursday 53 1998', '%W %u %Y'),
+('Sunday 01 2001', '%W %v %x'),
+('Tuesday 52 2001', '%W %V %X'),
+('060 2004', '%j %Y'),
+('4 53 1998', '%w %u %Y'),
+('15-01-2001', '%d-%m-%Y %H:%i:%S'),
+('15-01-20', '%d-%m-%y'),
+('15-2001-1', '%d-%Y-%c');
+
+# PS doesn't support fractional seconds
+--disable_ps_protocol
+select date,format,str_to_date(date, format) as str_to_date from t1;
+# Use as a string
+select date,format,concat('',str_to_date(date, format)) as con from t1;
+# Use as datetime
+select date,format,cast(str_to_date(date, format) as datetime) as datetime from t1;
+select date,format,DATE(str_to_date(date, format)) as date2 from t1;
+select date,format,TIME(str_to_date(date, format)) as time from t1;
+select date,format,concat(TIME(str_to_date(date, format))) as time2 from t1;
+# Test small bug in %f handling
+select concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d'));
+
+# Test wrong dates or converion specifiers
+
+truncate table t1;
+insert into t1 values
+('2003-01-02 10:11:12 PM', '%Y-%m-%d %H:%i:%S %p'),
+('2003-01-02 10:11:12.123456', '%Y-%m-%d %h:%i:%S %p'),
+('2003-01-02 10:11:12AM', '%Y-%m-%d %h:%i:%S.%f %p'),
+('2003-01-02 10:11:12AN', '%Y-%m-%d %h:%i:%S%p'),
+('2003-01-02 10:11:12 PM', '%y-%m-%d %H:%i:%S %p'),
+('10:20:10AM', '%H:%i:%s%p'),
+('15 Septembei 2001', '%d %M %Y'),
+('15 Ju 2001', '%d %M %Y'),
+('Sund 15 MA', '%W %d %b %Y'),
+('Thursdai 12 1998', '%W %u %Y'),
+('Sunday 01 2001', '%W %v %X'),
+('Tuesday 52 2001', '%W %V %x'),
+('Tuesday 52 2001', '%W %V %Y'),
+('Tuesday 52 2001', '%W %u %x'),
+('7 53 1998', '%w %u %Y'),
+(NULL, get_format(DATE,'USA'));
+select date,format,str_to_date(date, format) as str_to_date from t1;
+select date,format,concat(str_to_date(date, format),'') as con from t1;
+
+# Test 'maybe' date formats and 'strange but correct' results
+
+truncate table t1;
+insert into t1 values
+('10:20:10AM', '%h:%i:%s'),
+('2003-01-02 10:11:12', '%Y-%m-%d %h:%i:%S'),
+('03-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p');
+
+select date,format,str_to_date(date, format) as str_to_date from t1;
+select date,format,concat(str_to_date(date, format),'') as con from t1;
+
+drop table t1;
+--enable_ps_protocol
+
+#
+# Test of get_format
+#
+
+select get_format(DATE, 'USA') as a;
+select get_format(TIME, 'internal') as a;
+select get_format(DATETIME, 'eur') as a;
+select get_format(TIMESTAMP, 'eur') as a;
+select get_format(DATE, 'TEST') as a;
+select str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA'));
+
+explain extended select makedate(1997,1), addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM"),cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME), maketime(23,11,12),microsecond("1997-12-31 23:59:59.000001");
+
+#
+# Test of date_format()
+#
+
+create table t1 (d date);
+insert into t1 values ('2004-07-14'),('2005-07-14');
+select date_format(d,"%d") from t1 order by 1;
+drop table t1;
+
+# PS doesn't support fractional seconds
+--disable_ps_protocol
+select str_to_date("2003-....01ABCD-02 10:11:12.0012", "%Y-%.%m%@-%d %H:%i:%S.%f") as a;
+
+
+create table t1 select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f") as f1,
+ str_to_date("10:11:12.0012", "%H:%i:%S.%f") as f2,
+ str_to_date("2003-01-02", "%Y-%m-%d") as f3,
+ str_to_date("02", "%d") as f4, str_to_date("02 10", "%d %H") as f5;
+describe t1;
+select * from t1;
+drop table t1;
+
+create table t1 select "02 10" as a, "%d %H" as b;
+select str_to_date(a,b) from t1;
+create table t2 select str_to_date(a,b) from t1;
+describe t2;
+select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f") as f1,
+ str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S") as f2,
+ str_to_date("2003-01-02", "%Y-%m-%d") as f3,
+ str_to_date("02 10:11:12", "%d %H:%i:%S.%f") as f4,
+ str_to_date("02 10:11:12", "%d %H:%i:%S") as f5,
+ str_to_date("02 10", "%d %f") as f6;
+drop table t1, t2;
+select str_to_date("2003-01-02 10:11:12.0012ABCD", "%Y-%m-%d %H:%i:%S.%f") as f1,
+ addtime("-01:01:01.01 GGG", "-23:59:59.1") as f2,
+ microsecond("1997-12-31 23:59:59.01XXXX") as f3;
+
+select str_to_date("2003-04-05 g", "%Y-%m-%d") as f1,
+ str_to_date("2003-04-05 10:11:12.101010234567", "%Y-%m-%d %H:%i:%S.%f") as f2;
+--enable_ps_protocol
diff --git a/mysql-test/t/delayed.test b/mysql-test/t/delayed.test
index 67111ea1734..40bd7a912f3 100644
--- a/mysql-test/t/delayed.test
+++ b/mysql-test/t/delayed.test
@@ -3,7 +3,9 @@
# (Can't be tested with purify :( )
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
create table t1 (a char(10), tmsp timestamp);
insert into t1 set a = 1;
insert delayed into t1 set a = 2;
@@ -12,7 +14,7 @@ insert delayed into t1 set a = 4;
insert delayed into t1 set a = 5, tmsp = 19711006010203;
insert delayed into t1 (a, tmsp) values (6, 19711006010203);
insert delayed into t1 (a, tmsp) values (7, NULL);
---sleep 1
+--sleep 2
insert into t1 set a = 8,tmsp=19711006010203;
select * from t1 where tmsp=0;
select * from t1 where tmsp=19711006010203;
diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test
index 07cb9155b3f..0bf7187865d 100644
--- a/mysql-test/t/delete.test
+++ b/mysql-test/t/delete.test
@@ -2,7 +2,9 @@
# Check for problems with delete
#
-drop table if exists t1;
+--disable_warnings
+drop table if exists t1,t11,t12,t2;
+--enable_warnings
CREATE TABLE t1 (a tinyint(3), b tinyint(5));
INSERT INTO t1 VALUES (1,1);
INSERT LOW_PRIORITY INTO t1 VALUES (1,2);
@@ -27,15 +29,46 @@ drop table t1;
# (This assumes a block size of 1024)
#
-create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
-insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23);
+create table t1 (
+ a bigint not null,
+ b bigint not null default 0,
+ c bigint not null default 0,
+ d bigint not null default 0,
+ e bigint not null default 0,
+ f bigint not null default 0,
+ g bigint not null default 0,
+ h bigint not null default 0,
+ i bigint not null default 0,
+ j bigint not null default 0,
+ primary key (a,b,c,d,e,f,g,h,i,j));
+insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23);
delete from t1 where a=26;
drop table t1;
-create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
-insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
+create table t1 (
+ a bigint not null,
+ b bigint not null default 0,
+ c bigint not null default 0,
+ d bigint not null default 0,
+ e bigint not null default 0,
+ f bigint not null default 0,
+ g bigint not null default 0,
+ h bigint not null default 0,
+ i bigint not null default 0,
+ j bigint not null default 0,
+ primary key (a,b,c,d,e,f,g,h,i,j));
+insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
delete from t1 where a=27;
drop table t1;
+CREATE TABLE `t1` (
+ `i` int(10) NOT NULL default '0',
+ `i2` int(10) NOT NULL default '0',
+ PRIMARY KEY (`i`)
+);
+-- error 1054
+DELETE FROM t1 USING t1 WHERE post='1';
+drop table t1;
+
#
# CHAR(0) bug - not actually DELETE bug, but anyway...
#
@@ -45,7 +78,7 @@ CREATE TABLE t1 (
not_null varchar(20) binary NOT NULL default '',
misc integer not null,
PRIMARY KEY (not_null)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (NULL,'a',4), (NULL,'b',5), (NULL,'c',6), (NULL,'d',7);
@@ -60,7 +93,6 @@ delete from t1 where 3 > 2;
select count(*) from t1;
drop table t1;
-
#
# Bug #5733: Table handler error with self-join multi-table DELETE
#
@@ -71,3 +103,41 @@ select * from t1;
delete t1 from t1, t1 as t2 where t1.b = t2.b and t1.a > t2.a;
select * from t1;
drop table t1;
+
+#
+# IGNORE option
+#
+create table t11 (a int NOT NULL, b int, primary key (a));
+create table t12 (a int NOT NULL, b int, primary key (a));
+create table t2 (a int NOT NULL, b int, primary key (a));
+insert into t11 values (0, 10),(1, 11),(2, 12);
+insert into t12 values (33, 10),(0, 11),(2, 12);
+insert into t2 values (1, 21),(2, 12),(3, 23);
+select * from t11;
+select * from t12;
+select * from t2;
+-- error 1242
+delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
+select * from t11;
+select * from t12;
+delete ignore t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
+select * from t11;
+select * from t12;
+insert into t11 values (2, 12);
+-- error 1242
+delete from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
+select * from t11;
+delete ignore from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
+select * from t11;
+drop table t11, t12, t2;
+
+#
+# Bug #4198: deletion and KEYREAD
+#
+
+create table t1 (a int, b int, unique key (a), key (b));
+insert into t1 values (3, 3), (7, 7);
+delete t1 from t1 where a = 3;
+check table t1;
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test
new file mode 100644
index 00000000000..64e3fe8929b
--- /dev/null
+++ b/mysql-test/t/derived.test
@@ -0,0 +1,216 @@
+# Initialize
+--disable_warnings
+drop table if exists t1,t2,t3;
+--enable_warnings
+
+select * from (select 2 from DUAL) b;
+-- error 1054
+SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b;
+-- error 1054
+SELECT 1 as a FROM (SELECT a UNION SELECT 1) b;
+CREATE TABLE t1 (a int not null, b char (10) not null);
+insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
+CREATE TABLE t2 (a int not null, b char (10) not null);
+insert into t2 values (3,'c'),(4,'d'),(5,'f'),(6,'e');
+select t1.a,t3.y from t1,(select a as y from t2 where b='c') as t3 where t1.a = t3.y;
+select t1.a,t3.a from t1,(select * from t2 where b='c') as t3 where t1.a = t3.a;
+CREATE TABLE t3 (a int not null, b char (10) not null);
+insert into t3 values (3,'f'),(4,'y'),(5,'z'),(6,'c');
+select t1.a,t4.y from t1,(select t2.a as y from t2,(select t3.b from t3 where t3.a>3) as t5 where t2.b=t5.b) as t4 where t1.a = t4.y;
+--error 1054
+SELECT a FROM (SELECT 1 FROM (SELECT 1) a HAVING a=1) b;
+--error 1052
+SELECT a,b as a FROM (SELECT '1' as a,'2' as b) b HAVING a=1;
+SELECT a,2 as a FROM (SELECT '1' as a) b HAVING a=2;
+SELECT a,2 as a FROM (SELECT '1' as a) b HAVING a=1;
+--error 1054
+SELECT 1 FROM (SELECT 1) a WHERE a=2;
+--error 1054
+SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) as a;
+select * from t1 as x1, (select * from t1) as x2;
+explain select * from t1 as x1, (select * from t1) as x2;
+drop table if exists t2,t3;
+select * from (select 1) as a;
+select a from (select 1 as a) as b;
+select 1 from (select 1) as a;
+select * from (select * from t1 union select * from t1) a;
+select * from (select * from t1 union all select * from t1) a;
+select * from (select * from t1 union all select * from t1 limit 2) a;
+explain select * from (select * from t1 union select * from t1) a;
+explain select * from (select * from t1 union all select * from t1) a;
+CREATE TABLE t2 (a int not null);
+insert into t2 values(1);
+select * from (select * from t1 where t1.a=(select a from t2 where t2.a=t1.a)) a;
+select * from (select * from t1 where t1.a=(select t2.a from t2 where t2.a=t1.a) union select t1.a, t1.b from t1) a;
+explain select * from (select * from t1,t2 where t1.a=t2.a) t1;
+drop table t1, t2;
+create table t1(a int not null, t char(8), index(a));
+disable_query_log;
+let $1 = 10000;
+while ($1)
+ {
+ eval insert into t1 values ($1,'$1');
+ dec $1;
+ }
+enable_query_log;
+SELECT * FROM (SELECT * FROM t1) as b ORDER BY a ASC LIMIT 0,20;
+explain select count(*) from t1 as tt1, (select * from t1) as tt2;
+drop table t1;
+SELECT * FROM (SELECT (SELECT * FROM (SELECT 1 as a) as a )) as b;
+select * from (select 1 as a) b left join (select 2 as a) c using(a);
+--error 1054
+SELECT * FROM (SELECT 1 UNION SELECT a) b;
+--error 1054
+SELECT 1 as a FROM (SELECT a UNION SELECT 1) b;
+--error 1054
+SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b;
+--error 1054
+select 1 from (select 2) a order by 0;
+
+#
+# Test of explain (bug #251)
+#
+
+create table t1 (id int);
+insert into t1 values (1),(2),(3);
+describe select * from (select * from t1 group by id) bar;
+drop table t1;
+
+#
+# test->used_keys test for derived tables
+#
+create table t1 (mat_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, matintnum CHAR(6) NOT NULL, test MEDIUMINT UNSIGNED NULL);
+create table t2 (mat_id MEDIUMINT UNSIGNED NOT NULL, pla_id MEDIUMINT UNSIGNED NOT NULL);
+insert into t1 values (NULL, 'a', 1), (NULL, 'b', 2), (NULL, 'c', 3), (NULL, 'd', 4), (NULL, 'e', 5), (NULL, 'f', 6), (NULL, 'g', 7), (NULL, 'h', 8), (NULL, 'i', 9);
+insert into t2 values (1, 100), (1, 101), (1, 102), (2, 100), (2, 103), (2, 104), (3, 101), (3, 102), (3, 105);
+
+SELECT STRAIGHT_JOIN d.pla_id, m2.mat_id FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum;
+SELECT STRAIGHT_JOIN d.pla_id, m2.test FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum;
+
+explain SELECT STRAIGHT_JOIN d.pla_id, m2.mat_id FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum;
+explain SELECT STRAIGHT_JOIN d.pla_id, m2.test FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum;
+drop table t1,t2;
+
+#
+# derived table reference
+#
+SELECT a.x FROM (SELECT 1 AS x) AS a HAVING a.x = 1;
+
+#
+# Test for select if database is not selected.
+#
+# Connect without a database
+create table t1 select 1 as a;
+connect (con1,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK);
+connection con1;
+--error 1046
+select 2 as a from (select * from t1) b;
+use test;
+select 2 as a from (select * from t1) b;
+drop table t1;
+--error 1064
+select mail_id, if(folder.f_description!='', folder.f_description, folder.f_name) as folder_name, date, address_id, phrase, address, subject from folder, (select mail.mail_id as mail_id, date_format(mail.h_date, '%b %e, %Y %h:%i') as date, mail.folder_id, sender.address_id as address_id, sender.phrase as phrase, sender.address as address, mail.h_subject as subject from mail left join mxa as mxa_sender on mail.mail_id=mxa_sender.mail_id and mxa_sender.type='from' left join address as sender on mxa_sender.address_id=sender.address_id mxa as mxa_recipient, address as recipient, where 1 and mail.mail_id=mxa_recipient.mail_id and mxa_recipient.address_id=recipient.address_id and mxa_recipient.type='to' and match(sender.phrase, sender.address, sender.comment) against ('jeremy' in boolean mode) and match(recipient.phrase, recipient.address, recipient.comment) against ('monty' in boolean mode) order by mail.h_date desc limit 0, 25 ) as query where query.folder_id=folder.folder_id;
+
+#
+# UPDATE/DELETE/INSERT of derived tables
+#
+create table t1 (a int);
+insert into t1 values (1),(2),(3);
+-- error 1288
+update (select * from t1) as t1 set a = 5;
+-- error 1064
+delete from (select * from t1);
+-- error 1064
+insert into (select * from t1) values (5);
+drop table t1;
+
+#
+# deived tables with subquery inside all by one table
+#
+create table t1 (E1 INTEGER UNSIGNED NOT NULL, E2 INTEGER UNSIGNED NOT NULL, E3 INTEGER UNSIGNED NOT NULL, PRIMARY KEY(E1)
+);
+insert into t1 VALUES(1,1,1), (2,2,1);
+select count(*) from t1 INNER JOIN (SELECT A.E1, A.E2, A.E3 FROM t1 AS A WHERE A.E3 = (SELECT MAX(B.E3) FROM t1 AS B WHERE A.E2 = B.E2)) AS THEMAX ON t1.E1 = THEMAX.E2 AND t1.E1 = t1.E2;
+explain select count(*) from t1 INNER JOIN (SELECT A.E1, A.E2, A.E3 FROM t1 AS A WHERE A.E3 = (SELECT MAX(B.E3) FROM t1 AS B WHERE A.E2 = B.E2)) AS THEMAX ON t1.E1 = THEMAX.E2 AND t1.E1 = t1.E2;
+drop table t1;
+
+create table t1 (a int);
+insert into t1 values (1),(2);
+select * from ( select * from t1 union select * from t1) a,(select * from t1 union select * from t1) b;
+explain select * from ( select * from t1 union select * from t1) a,(select * from t1 union select * from t1) b;
+drop table t1;
+
+
+#
+# multi-update & multi-delete with derived tables
+#
+CREATE TABLE `t1` (
+ `N` int(11) unsigned NOT NULL default '0',
+ `M` tinyint(1) default '0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO `t1` (N, M) VALUES (1, 0),(1, 0),(1, 0),(2, 0),(2, 0),(3, 0);
+UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
+select * from t1;
+-- error 1288
+UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2, P2.N = 2;
+-- error 1054
+UPDATE `t1` AS P1 INNER JOIN (SELECT aaaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
+delete P1.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
+select * from t1;
+--replace_result P2 p2
+--error 1288
+delete P1.*,P2.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
+-- error 1054
+delete P1.* from `t1` AS P1 INNER JOIN (SELECT aaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
+drop table t1;
+
+#
+# correct lex->current_select
+#
+CREATE TABLE t1 (
+ OBJECTID int(11) NOT NULL default '0',
+ SORTORDER int(11) NOT NULL auto_increment,
+ KEY t1_SortIndex (SORTORDER),
+ KEY t1_IdIndex (OBJECTID)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+CREATE TABLE t2 (
+ ID int(11) default NULL,
+ PARID int(11) default NULL,
+ UNIQUE KEY t2_ID_IDX (ID),
+ KEY t2_PARID_IDX (PARID)
+) engine=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO t2 VALUES (1000,0),(1001,0),(1002,0),(1003,0),(1008,1),(1009,1),(1010,1),(1011,1),(1016,2);
+CREATE TABLE t3 (
+ ID int(11) default NULL,
+ DATA decimal(10,2) default NULL,
+ UNIQUE KEY t3_ID_IDX (ID)
+) engine=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO t3 VALUES (1000,0.00),(1001,0.25),(1002,0.50),(1003,0.75),(1008,1.00),(1009,1.25),(1010,1.50),(1011,1.75);
+select 497, TMP.ID, NULL from (select 497 as ID, MAX(t3.DATA) as DATA from t1 join t2 on (t1.ObjectID = t2.ID) join t3 on (t1.ObjectID = t3.ID) group by t2.ParID order by DATA DESC) as TMP;
+drop table t1, t2, t3;
+
+#
+# explain derived
+#
+CREATE TABLE t1 (name char(1) default NULL, val int(5) default NULL);
+INSERT INTO t1 VALUES ('a',1), ('a',2), ('a',2), ('a',2), ('a',3), ('a',6), ('a',7), ('a',11), ('a',11), ('a',12), ('a',13), ('a',13), ('a',20), ('b',2), ('b',3), ('b',4), ('b',5);
+SELECT s.name, AVG(s.val) AS median FROM (SELECT x.name, x.val FROM t1 x, t1 y WHERE x.name=y.name GROUP BY x.name, x.val HAVING SUM(y.val <= x.val) >= COUNT(*)/2 AND SUM(y.val >= x.val) >= COUNT(*)/2) AS s GROUP BY s.name;
+explain SELECT s.name, AVG(s.val) AS median FROM (SELECT x.name, x.val FROM t1 x, t1 y WHERE x.name=y.name GROUP BY x.name, x.val HAVING SUM(y.val <= x.val) >= COUNT(*)/2 AND SUM(y.val >= x.val) >= COUNT(*)/2) AS s GROUP BY s.name;
+drop table t1;
+
+#
+# "Using index" in explain
+#
+create table t2 (a int, b int, primary key (a));
+insert into t2 values (1,7),(2,7);
+explain select a from t2 where a>1;
+explain select a from (select a from t2 where a>1) tt;
+drop table t2;
+
+#
+# select list counter
+#
+CREATE TABLE `t1` ( `itemid` int(11) NOT NULL default '0', `grpid` varchar(15) NOT NULL default '', `vendor` int(11) NOT NULL default '0', `date_` date NOT NULL default '0000-00-00', `price` decimal(12,2) NOT NULL default '0.00', PRIMARY KEY (`itemid`,`grpid`,`vendor`,`date_`), KEY `itemid` (`itemid`,`vendor`), KEY `itemid_2` (`itemid`,`date_`));
+insert into t1 values (128, 'rozn', 2, now(), 10),(128, 'rozn', 1, now(), 10);
+SELECT MIN(price) min, MAX(price) max, AVG(price) avg FROM (SELECT SUBSTRING( MAX(concat(date_,";",price)), 12) price FROM t1 WHERE itemid=128 AND grpid='rozn' GROUP BY itemid, grpid, vendor) lastprices;
+DROP TABLE t1;
diff --git a/mysql-test/t/dirty_close.test b/mysql-test/t/dirty_close.test
index 3ed22f26d5b..f965df8cfea 100644
--- a/mysql-test/t/dirty_close.test
+++ b/mysql-test/t/dirty_close.test
@@ -3,7 +3,11 @@ connect (con2,localhost,root,,);
connection con1;
dirty_close con1;
connection con2;
+
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+
create table t1 (n int);
insert into t1 values (1),(2),(3);
select * from t1;
diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test
index 79770a17baa..3c1f18b7524 100644
--- a/mysql-test/t/distinct.test
+++ b/mysql-test/t/distinct.test
@@ -3,7 +3,9 @@
# Bug with group by and not used fields
#
+--disable_warnings
drop table if exists t1,t2,t3;
+--enable_warnings
CREATE TABLE t1 (id int,facility char(20));
CREATE TABLE t2 (facility char(20));
@@ -198,7 +200,6 @@ drop table t1,t2,t3;
# This also test the case when one doesn't use all fields in GROUP BY.
#
-drop table if exists t1;
create table t1 (a int not null, b int not null, t time);
insert into t1 values (1,1,"00:06:15"),(1,2,"00:06:15"),(1,2,"00:30:15"),(1,3,"00:06:15"),(1,3,"00:30:15");
select a,sec_to_time(sum(time_to_sec(t))) from t1 group by a,b;
@@ -222,7 +223,7 @@ drop table t1;
# Test problem with DISTINCT and ORDER BY DESC
#
-create table t1 (a char(1), key(a)) type=myisam;
+create table t1 (a char(1), key(a)) engine=myisam;
insert into t1 values('1'),('1');
select * from t1 where a >= '1';
select distinct a from t1 order by a desc;
@@ -256,12 +257,12 @@ drop table t1,t2;
# test with table.* in DISTINCT
#
-CREATE TABLE t1 (privatemessageid int(10) unsigned NOT NULL auto_increment, folderid smallint(6) NOT NULL default '0', userid int(10) unsigned NOT NULL default '0', touserid int(10) unsigned NOT NULL default '0', fromuserid int(10) unsigned NOT NULL default '0', title varchar(250) NOT NULL default '', message mediumtext NOT NULL, dateline int(10) unsigned NOT NULL default '0', showsignature smallint(6) NOT NULL default '0', iconid smallint(5) unsigned NOT NULL default '0', messageread smallint(6) NOT NULL default '0', readtime int(10) unsigned NOT NULL default '0', receipt smallint(6) unsigned NOT NULL default '0', deleteprompt smallint(6) unsigned NOT NULL default '0', multiplerecipients smallint(6) unsigned NOT NULL default '0', PRIMARY KEY (privatemessageid), KEY userid (userid)) TYPE=MyISAM;
+CREATE TABLE t1 (privatemessageid int(10) unsigned NOT NULL auto_increment, folderid smallint(6) NOT NULL default '0', userid int(10) unsigned NOT NULL default '0', touserid int(10) unsigned NOT NULL default '0', fromuserid int(10) unsigned NOT NULL default '0', title varchar(250) NOT NULL default '', message mediumtext NOT NULL, dateline int(10) unsigned NOT NULL default '0', showsignature smallint(6) NOT NULL default '0', iconid smallint(5) unsigned NOT NULL default '0', messageread smallint(6) NOT NULL default '0', readtime int(10) unsigned NOT NULL default '0', receipt smallint(6) unsigned NOT NULL default '0', deleteprompt smallint(6) unsigned NOT NULL default '0', multiplerecipients smallint(6) unsigned NOT NULL default '0', PRIMARY KEY (privatemessageid), KEY userid (userid)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (128,0,33,33,8,':D','',996121863,1,0,2,996122850,2,0,0);
-CREATE TABLE t2 (userid int(10) unsigned NOT NULL auto_increment, usergroupid smallint(5) unsigned NOT NULL default '0', username varchar(50) NOT NULL default '', password varchar(50) NOT NULL default '', email varchar(50) NOT NULL default '', styleid smallint(5) unsigned NOT NULL default '0', parentemail varchar(50) NOT NULL default '', coppauser smallint(6) NOT NULL default '0', homepage varchar(100) NOT NULL default '', icq varchar(20) NOT NULL default '', aim varchar(20) NOT NULL default '', yahoo varchar(20) NOT NULL default '', signature mediumtext NOT NULL, adminemail smallint(6) NOT NULL default '0', showemail smallint(6) NOT NULL default '0', invisible smallint(6) NOT NULL default '0', usertitle varchar(250) NOT NULL default '', customtitle smallint(6) NOT NULL default '0', joindate int(10) unsigned NOT NULL default '0', cookieuser smallint(6) NOT NULL default '0', daysprune smallint(6) NOT NULL default '0', lastvisit int(10) unsigned NOT NULL default '0', lastactivity int(10) unsigned NOT NULL default '0', lastpost int(10) unsigned NOT NULL default '0', posts smallint(5) unsigned NOT NULL default '0', timezoneoffset varchar(4) NOT NULL default '', emailnotification smallint(6) NOT NULL default '0', buddylist mediumtext NOT NULL, ignorelist mediumtext NOT NULL, pmfolders mediumtext NOT NULL, receivepm smallint(6) NOT NULL default '0', emailonpm smallint(6) NOT NULL default '0', pmpopup smallint(6) NOT NULL default '0', avatarid smallint(6) NOT NULL default '0', avatarrevision int(6) unsigned NOT NULL default '0', options smallint(6) NOT NULL default '15', birthday date NOT NULL default '0000-00-00', maxposts smallint(6) NOT NULL default '-1', startofweek smallint(6) NOT NULL default '1', ipaddress varchar(20) NOT NULL default '', referrerid int(10) unsigned NOT NULL default '0', nosessionhash smallint(6) NOT NULL default '0', autorefresh smallint(6) NOT NULL default '-1', messagepopup tinyint(2) NOT NULL default '0', inforum smallint(5) unsigned NOT NULL default '0', ratenum smallint(5) unsigned NOT NULL default '0', ratetotal smallint(5) unsigned NOT NULL default '0', allowrate smallint(5) unsigned NOT NULL default '1', PRIMARY KEY (userid), KEY usergroupid (usergroupid), KEY username (username), KEY inforum (inforum)) TYPE=MyISAM;
+CREATE TABLE t2 (userid int(10) unsigned NOT NULL auto_increment, usergroupid smallint(5) unsigned NOT NULL default '0', username varchar(50) NOT NULL default '', password varchar(50) NOT NULL default '', email varchar(50) NOT NULL default '', styleid smallint(5) unsigned NOT NULL default '0', parentemail varchar(50) NOT NULL default '', coppauser smallint(6) NOT NULL default '0', homepage varchar(100) NOT NULL default '', icq varchar(20) NOT NULL default '', aim varchar(20) NOT NULL default '', yahoo varchar(20) NOT NULL default '', signature mediumtext NOT NULL, adminemail smallint(6) NOT NULL default '0', showemail smallint(6) NOT NULL default '0', invisible smallint(6) NOT NULL default '0', usertitle varchar(250) NOT NULL default '', customtitle smallint(6) NOT NULL default '0', joindate int(10) unsigned NOT NULL default '0', cookieuser smallint(6) NOT NULL default '0', daysprune smallint(6) NOT NULL default '0', lastvisit int(10) unsigned NOT NULL default '0', lastactivity int(10) unsigned NOT NULL default '0', lastpost int(10) unsigned NOT NULL default '0', posts smallint(5) unsigned NOT NULL default '0', timezoneoffset varchar(4) NOT NULL default '', emailnotification smallint(6) NOT NULL default '0', buddylist mediumtext NOT NULL, ignorelist mediumtext NOT NULL, pmfolders mediumtext NOT NULL, receivepm smallint(6) NOT NULL default '0', emailonpm smallint(6) NOT NULL default '0', pmpopup smallint(6) NOT NULL default '0', avatarid smallint(6) NOT NULL default '0', avatarrevision int(6) unsigned NOT NULL default '0', options smallint(6) NOT NULL default '15', birthday date NOT NULL default '0000-00-00', maxposts smallint(6) NOT NULL default '-1', startofweek smallint(6) NOT NULL default '1', ipaddress varchar(20) NOT NULL default '', referrerid int(10) unsigned NOT NULL default '0', nosessionhash smallint(6) NOT NULL default '0', autorefresh smallint(6) NOT NULL default '-1', messagepopup tinyint(2) NOT NULL default '0', inforum smallint(5) unsigned NOT NULL default '0', ratenum smallint(5) unsigned NOT NULL default '0', ratetotal smallint(5) unsigned NOT NULL default '0', allowrate smallint(5) unsigned NOT NULL default '1', PRIMARY KEY (userid), KEY usergroupid (usergroupid), KEY username (username), KEY inforum (inforum)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (33,6,'Kevin','0','kevin@stileproject.com',1,'',0,'http://www.stileproject.com','','','','',1,1,0,'Administrator',0,996120694,1,-1,1030996168,1031027028,1030599436,36,'-6',0,'','','',1,0,1,0,0,15,'0000-00-00',-1,1,'64.0.0.0',0,1,-1,0,0,4,19,1);
SELECT DISTINCT t1.*, t2.* FROM t1 LEFT JOIN t2 ON (t2.userid = t1.touserid);
-DROP TABLE IF EXISTS t1,t2;
+DROP TABLE t1,t2;
#
# test with const_item in ORDER BY
@@ -272,15 +273,62 @@ INSERT t1 VALUES (1,2,3);
CREATE TABLE t2 (a int primary key, b int, c int);
INSERT t2 VALUES (3,4,5);
SELECT DISTINCT t1.a, t2.b FROM t1, t2 WHERE t1.a=1 ORDER BY t2.c;
-DROP TABLE IF EXISTS t1,t2;
+DROP TABLE t1,t2;
#
# Test of LEFT() with distinct
#
-CREATE table t1 ( `id` int(11) NOT NULL auto_increment, `name` varchar(50) NOT NULL default '', PRIMARY KEY (`id`)) TYPE=MyISAM AUTO_INCREMENT=3 ;
+CREATE table t1 ( `id` int(11) NOT NULL auto_increment, `name` varchar(50) NOT NULL default '', PRIMARY KEY (`id`)) ENGINE=MyISAM AUTO_INCREMENT=3 ;
INSERT INTO t1 VALUES (1, 'aaaaa');
INSERT INTO t1 VALUES (3, 'aaaaa');
INSERT INTO t1 VALUES (2, 'eeeeeee');
select distinct left(name,1) as name from t1;
drop table t1;
+
+#
+# Test case from sel000100
+#
+
+CREATE TABLE t1 (
+ ID int(11) NOT NULL auto_increment,
+ NAME varchar(75) DEFAULT '' NOT NULL,
+ LINK_ID int(11) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (ID),
+ KEY NAME (NAME),
+ KEY LINK_ID (LINK_ID)
+);
+
+INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (1,'Mike',0);
+INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (2,'Jack',0);
+INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (3,'Bill',0);
+
+CREATE TABLE t2 (
+ ID int(11) NOT NULL auto_increment,
+ NAME varchar(150) DEFAULT '' NOT NULL,
+ PRIMARY KEY (ID),
+ KEY NAME (NAME)
+);
+
+SELECT DISTINCT
+ t2.id AS key_link_id,
+ t2.name AS link
+FROM t1
+LEFT JOIN t2 ON t1.link_id=t2.id
+GROUP BY t1.id
+ORDER BY link;
+drop table t1,t2;
+
+#
+# test case for #674
+#
+
+CREATE TABLE t1 (
+ html varchar(5) default NULL,
+ rin int(11) default '0',
+ out int(11) default '0'
+) ENGINE=MyISAM;
+
+INSERT INTO t1 VALUES ('1',1,0);
+SELECT DISTINCT html,SUM(out)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin;
+drop table t1;
diff --git a/mysql-test/t/drop.test b/mysql-test/t/drop.test
index 2f3fa99bac0..88c47803f48 100644
--- a/mysql-test/t/drop.test
+++ b/mysql-test/t/drop.test
@@ -1,4 +1,9 @@
+# Initialise
+--disable_warnings
drop table if exists t1;
+drop database if exists mysqltest;
+--enable_warnings
+
--error 1051;
drop table t1;
create table t1(n int);
@@ -13,14 +18,15 @@ select * from t1;
# now test for a bug in drop database - it is important that the name
# of the table is the same as the name of the database - in the original
# code this triggered a bug
-drop database if exists mysqltest;
create database mysqltest;
drop database if exists mysqltest;
create database mysqltest;
create table mysqltest.mysqltest (n int);
insert into mysqltest.mysqltest values (4);
select * from mysqltest.mysqltest;
+--enable_info
drop database if exists mysqltest;
+--disable_info
create database mysqltest;
drop database mysqltest;
@@ -39,3 +45,13 @@ drop database mysqltest;
show databases;
--error 1008
drop database mysqltest;
+
+# test create table and FLUSH TABLES WITH READ LOCK
+drop table t1;
+flush tables with read lock;
+--error 1223;
+create table t1(n int);
+unlock tables;
+create table t1(n int);
+show tables;
+drop table t1;
diff --git a/mysql-test/t/empty_table.test b/mysql-test/t/empty_table.test
index 9ea79ee157f..db0a8e6a247 100644
--- a/mysql-test/t/empty_table.test
+++ b/mysql-test/t/empty_table.test
@@ -2,7 +2,10 @@
# Some special cases with empty tables
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+
create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr));
select count(*) from t1;
select * from t1;
diff --git a/mysql-test/t/endspace.test b/mysql-test/t/endspace.test
new file mode 100644
index 00000000000..462bc3083e1
--- /dev/null
+++ b/mysql-test/t/endspace.test
@@ -0,0 +1,96 @@
+#
+# Test problem with characters < ' ' at end of strings (Bug #3152)
+#
+
+-- source include/have_innodb.inc
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+-- source include/endspace.inc
+
+#
+# Test MyISAM tables.
+#
+
+create table t1 (text1 varchar(32) not NULL, KEY key1 (text1));
+insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
+check table t1;
+select * from t1 ignore key (key1) where text1='teststring' or text1 like 'teststring_%';
+select * from t1 where text1='teststring' or text1 like 'teststring_%';
+select * from t1 where text1='teststring' or text1 > 'teststring\t';
+select * from t1 order by text1;
+explain select * from t1 order by text1;
+
+alter table t1 modify text1 char(32) binary not null;
+check table t1;
+select * from t1 ignore key (key1) where text1='teststring' or text1 like 'teststring_%';
+select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
+select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
+select text1, length(text1) from t1 order by text1;
+select text1, length(text1) from t1 order by binary text1;
+
+alter table t1 modify text1 blob not null, drop key key1, add key key1 (text1(20));
+insert into t1 values ('teststring ');
+select concat('|', text1, '|') from t1 order by text1;
+select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
+select concat('|', text1, '|') from t1 where text1='teststring';
+select concat('|', text1, '|') from t1 where text1='teststring ';
+
+alter table t1 modify text1 text not null, pack_keys=1;
+select concat('|', text1, '|') from t1 where text1='teststring';
+select concat('|', text1, '|') from t1 where text1='teststring ';
+explain select concat('|', text1, '|') from t1 where text1='teststring ';
+select * from t1 where text1 like 'teststring_%';
+select * from t1 where text1='teststring' or text1 like 'teststring_%';
+select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
+select concat('|', text1, '|') from t1 order by text1;
+drop table t1;
+
+create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)) pack_keys=0;
+insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
+select * from t1 where text1='teststring' or text1 like 'teststring_%';
+select * from t1 where text1='teststring' or text1 >= 'teststring\t';
+drop table t1;
+
+# Test HEAP tables (with BTREE keys)
+
+create table t1 (text1 varchar(32) not NULL, KEY key1 using BTREE (text1)) engine=heap;
+insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
+select * from t1 ignore key (key1) where text1='teststring' or text1 like 'teststring_%';
+select * from t1 where text1='teststring' or text1 like 'teststring_%';
+select * from t1 where text1='teststring' or text1 >= 'teststring\t';
+select * from t1 order by text1;
+explain select * from t1 order by text1;
+
+alter table t1 modify text1 char(32) binary not null;
+select * from t1 order by text1;
+drop table t1;
+
+#
+# Test InnoDB tables
+#
+
+create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)) engine=innodb;
+insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
+check table t1;
+select * from t1 where text1='teststring' or text1 like 'teststring_%';
+select * from t1 where text1='teststring' or text1 > 'teststring\t';
+select * from t1 order by text1;
+explain select * from t1 order by text1;
+
+alter table t1 modify text1 char(32) binary not null;
+select * from t1 order by text1;
+
+alter table t1 modify text1 blob not null, drop key key1, add key key1 (text1(20));
+insert into t1 values ('teststring ');
+select concat('|', text1, '|') from t1 order by text1;
+
+alter table t1 modify text1 text not null, pack_keys=1;
+select * from t1 where text1 like 'teststring_%';
+
+# The following gives wrong result in InnoDB
+select text1, length(text1) from t1 where text1='teststring' or text1 like 'teststring_%';
+select text1, length(text1) from t1 where text1='teststring' or text1 >= 'teststring\t';
+select concat('|', text1, '|') from t1 order by text1;
+drop table t1;
diff --git a/mysql-test/t/errors.test b/mysql-test/t/errors.test
index afb0cce9005..b558c90b0c6 100644
--- a/mysql-test/t/errors.test
+++ b/mysql-test/t/errors.test
@@ -2,23 +2,22 @@
# Test some error conditions
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
--error 1146
insert into t1 values(1);
--error 1146
delete from t1;
--error 1146
update t1 set a=1;
-
-#
-
create table t1 (a int);
--error 1054
select count(test.t1.b) from t1;
--error 1109
select count(not_existing_database.t1) from t1;
--error 1109
- select count(not_existing_database.t1.a) from t1;
+select count(not_existing_database.t1.a) from t1;
--error 1044,1146
select count(not_existing_database.t1.a) from not_existing_database.t1;
--error 1054
diff --git a/mysql-test/t/exampledb.test b/mysql-test/t/exampledb.test
new file mode 100644
index 00000000000..c60a9d7f930
--- /dev/null
+++ b/mysql-test/t/exampledb.test
@@ -0,0 +1,16 @@
+#
+# Simple test for the example storage engine
+# Taken fromm the select test
+#
+-- source include/have_exampledb.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+CREATE TABLE t1 (
+ Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
+ Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
+) ENGINE=example;
+
+drop table t1;
diff --git a/mysql-test/t/explain.test b/mysql-test/t/explain.test
index 045598e97df..050939e5ad2 100644
--- a/mysql-test/t/explain.test
+++ b/mysql-test/t/explain.test
@@ -1,7 +1,9 @@
#
# Test of different EXPLAIN's
+--disable_warnings
drop table if exists t1;
+--enable_warnings
create table t1 (id int not null, str char(10), unique(str));
explain select * from t1;
insert into t1 values (1, null),(2, null),(3, "foo"),(4, "bar");
@@ -28,3 +30,14 @@ explain select count(*) from t1;
insert into t1 values(1);
explain select count(*) from t1;
drop table t1;
+
+#
+# Bug #3403 Wrong encoding in EXPLAIN SELECT output
+#
+set names koi8r;
+create table ÔÁÂ (ËÏÌ0 int, ËÏÌ1 int, key ÉÎÄ0 (ËÏÌ0), key ÉÎÄ01 (ËÏÌ0,ËÏÌ1));
+insert into ÔÁÂ (ËÏÌ0) values (1);
+insert into ÔÁÂ (ËÏÌ0) values (2);
+explain select ËÏÌ0 from ÔÁÂ where ËÏÌ0=1;
+drop table ÔÁÂ;
+set names latin1;
diff --git a/mysql-test/t/flush.test b/mysql-test/t/flush.test
index 7754fc2e197..9ee6b5d76b8 100644
--- a/mysql-test/t/flush.test
+++ b/mysql-test/t/flush.test
@@ -9,11 +9,13 @@
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
-drop table if exists t1;
+
+--disable_warnings
+drop table if exists t1,t2;
drop database if exists mysqltest;
+--enable_warnings
create temporary table t1(n int not null primary key);
-drop table if exists t2;
create table t2(n int);
insert into t2 values(3);
let $1=100;
diff --git a/mysql-test/t/flush_block_commit.test b/mysql-test/t/flush_block_commit.test
index 8b99a59c979..87715452089 100644
--- a/mysql-test/t/flush_block_commit.test
+++ b/mysql-test/t/flush_block_commit.test
@@ -1,6 +1,7 @@
# Let's see if FLUSH TABLES WITH READ LOCK blocks COMMIT of existing
# transactions.
# We verify that we did not introduce a deadlock.
+# This is intended to mimick how mysqldump and innobackup work.
-- source include/have_innodb.inc
@@ -8,8 +9,11 @@ connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connect (con3,localhost,root,,);
connection con1;
+
+--disable_warnings
drop table if exists t1;
-create table t1 (a int) type=innodb;
+--enable_warnings
+create table t1 (a int) engine=innodb;
# blocks COMMIT ?
@@ -60,4 +64,11 @@ unlock tables;
connection con2;
flush tables with read lock; # bug caused hang here
unlock tables;
+
+# BUG#7358 SHOW CREATE DATABASE fails if open transaction
+
+begin;
+select * from t1;
+show create database test;
+
drop table t1;
diff --git a/mysql-test/t/flush_table.test b/mysql-test/t/flush_table.test
index 58c12bad3fa..afb30d21da7 100644
--- a/mysql-test/t/flush_table.test
+++ b/mysql-test/t/flush_table.test
@@ -4,7 +4,9 @@
# Test of flush table
#
-drop table if exists t1;
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
create table t1 (a int not null auto_increment primary key);
insert into t1 values(0);
lock table t1 read;
@@ -17,10 +19,6 @@ drop table t1;
# (hang forever) if the fix for BUG #3565 is missing.
# And it shows that handler tables are re-opened after flush (BUG #4286).
#
---disable_warnings
-drop table if exists t1;
-drop table if exists t2;
---enable_warnings
create table t1(table_id char(20) primary key);
create table t2(table_id char(20) primary key);
insert into t1 values ('test.t1');
diff --git a/mysql-test/t/foreign_key.test b/mysql-test/t/foreign_key.test
index 1afcb546f6a..8c35fd65f74 100644
--- a/mysql-test/t/foreign_key.test
+++ b/mysql-test/t/foreign_key.test
@@ -2,7 +2,10 @@
# Test syntax of foreign keys
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+
create table t1 (
a int not null references t2,
b int not null references t2 (c),
diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test
index b44854860f9..008e965297f 100644
--- a/mysql-test/t/fulltext.test
+++ b/mysql-test/t/fulltext.test
@@ -2,7 +2,9 @@
# Test of fulltext index
#
+--disable_warnings
drop table if exists t1,t2,t3;
+--enable_warnings
CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b));
INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
@@ -15,8 +17,16 @@ SHOW INDEX FROM t1;
# nl search
select * from t1 where MATCH(a,b) AGAINST ("collections");
+explain extended select * from t1 where MATCH(a,b) AGAINST ("collections");
select * from t1 where MATCH(a,b) AGAINST ("indexes");
select * from t1 where MATCH(a,b) AGAINST ("indexes collections");
+select * from t1 where MATCH(a,b) AGAINST ("only");
+
+# query expansion
+
+select * from t1 where MATCH(a,b) AGAINST ("collections" WITH QUERY EXPANSION);
+select * from t1 where MATCH(a,b) AGAINST ("indexes" WITH QUERY EXPANSION);
+select * from t1 where MATCH(a,b) AGAINST ("indexes collections" WITH QUERY EXPANSION);
# add_ft_keys() tests
@@ -34,6 +44,7 @@ explain select * from t1 where MATCH(a,b) AGAINST ("collections")>0 and a like '
# boolean search
select * from t1 where MATCH(a,b) AGAINST("support -collections" IN BOOLEAN MODE);
+explain extended select * from t1 where MATCH(a,b) AGAINST("support -collections" IN BOOLEAN MODE);
select * from t1 where MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE);
select * from t1 where MATCH(a,b) AGAINST("support +collections" IN BOOLEAN MODE);
select * from t1 where MATCH(a,b) AGAINST("sear*" IN BOOLEAN MODE);
@@ -56,6 +67,7 @@ select * from t1 where MATCH a,b AGAINST ('"xt indexes"' IN BOOLEAN MODE);
select * from t1 where MATCH a,b AGAINST ('+(support collections) +foobar*' IN BOOLEAN MODE);
select * from t1 where MATCH a,b AGAINST ('+(+(support collections)) +foobar*' IN BOOLEAN MODE);
+select * from t1 where MATCH a,b AGAINST ('"xt indexes"' IN BOOLEAN MODE);
# bug#2708, bug#3870 crash
@@ -67,7 +79,6 @@ select * from t1 where MATCH a AGAINST ("search" IN BOOLEAN MODE);
select * from t1 where MATCH b AGAINST ("sear*" IN BOOLEAN MODE);
# UNION of fulltext's
-
select * from t1 where MATCH(a,b) AGAINST ("collections") UNION ALL select * from t1 where MATCH(a,b) AGAINST ("indexes");
#update/delete with fulltext index
@@ -144,6 +155,13 @@ select * from t2 having MATCH inhalt AGAINST ('foobar');
# check of fulltext errors
#
+--error 1283
+CREATE TABLE t3 (t int(11),i text,fulltext tix (t,i));
+--error 1283
+CREATE TABLE t3 (t int(11),i text,
+ j varchar(200) CHARACTER SET latin2,
+ fulltext tix (i,j));
+
CREATE TABLE t3 (
ticket int(11),
inhalt text,
@@ -168,10 +186,10 @@ CREATE TABLE t1 (
id int(11) auto_increment,
title varchar(100) default '',
PRIMARY KEY (id),
- KEY ind5 (title),
- FULLTEXT KEY FT1 (title)
-) TYPE=MyISAM;
+ KEY ind5 (title)
+) ENGINE=MyISAM;
+CREATE FULLTEXT INDEX ft1 ON t1(title);
insert into t1 (title) values ('this is a test');
select * from t1 where match title against ('test' in boolean mode);
update t1 set title='this is A test' where id=1;
@@ -184,7 +202,7 @@ drop table t1;
# one more bug - const_table related
-CREATE TABLE t1 (a int(11), b text, FULLTEXT KEY (b)) TYPE=MyISAM;
+CREATE TABLE t1 (a int(11), b text, FULLTEXT KEY (b)) ENGINE=MyISAM;
insert into t1 values (1,"I wonder why the fulltext index doesnt work?");
SELECT * from t1 where MATCH (b) AGAINST ('apples');
@@ -192,7 +210,7 @@ insert into t1 values (2,"fullaaa fullzzz");
select * from t1 where match b against ('full*' in boolean mode);
drop table t1;
-CREATE TABLE t1 ( id int(11) NOT NULL auto_increment primary key, mytext text NOT NULL, FULLTEXT KEY mytext (mytext)) TYPE=MyISAM;
+CREATE TABLE t1 ( id int(11) NOT NULL auto_increment primary key, mytext text NOT NULL, FULLTEXT KEY mytext (mytext)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,'my small mouse'),(2,'la-la-la'),(3,'It is so funny'),(4,'MySQL Tutorial');
select 8 from t1;
drop table t1;
@@ -202,7 +220,6 @@ drop table t1;
# ERROR 1030: Got error 127 from table handler
#
-drop table if exists t1;
create table t1 (a text, fulltext key (a));
insert into t1 values ('aaaa');
repair table t1;
@@ -214,7 +231,6 @@ drop table t1;
# FULLTEXT index on a TEXT filed converted to a CHAR field doesn't work anymore
#
-drop table if exists t1;
create table t1 ( ref_mag text not null, fulltext (ref_mag));
insert into t1 values ('test');
select ref_mag from t1 where match ref_mag against ('+test' in boolean mode);
@@ -239,10 +255,50 @@ select * from t1 join t2 using(`t1_id`) where match (t1.name, t2.name) against('
# bug with many short (< ft_min_word_len) words in boolean search
#
select * from t2 where match name against ('a* b* c* d* e* f*' in boolean mode);
-
drop table t1,t2;
#
+# bug with repair-by-sort and incorrect records estimation
+#
+
+create table t1 (a text, fulltext key (a));
+insert into t1 select "xxxx yyyy zzzz";
+drop table t1;
+
+#
+# UTF8
+#
+SET NAMES latin1;
+CREATE TABLE t1 (t text character set utf8 not null, fulltext(t));
+INSERT t1 VALUES ('Mit freundlichem Grüß'), ('aus Osnabrück');
+SET NAMES koi8r;
+INSERT t1 VALUES ("üÔÏ ÍÙ - ÏÐÉÌËÉ"),("ïÔÌÅÚØ, ÇÎÉÄÁ!"),
+ ("îÅ ×ÌÅÚÁÊ, ÕÂØÅÔ!"),("É ÂÕÄÅÔ ÐÒÁ×!");
+SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('ïðéìëé');
+SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('ðÒá*' IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH t AGAINST ('ÜÔÏ' IN BOOLEAN MODE);
+SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrück');
+SET NAMES latin1;
+SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrück');
+SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrueck');
+SELECT t, collation(t),FORMAT(MATCH t AGAINST ('Osnabruck'),6) FROM t1 WHERE MATCH t AGAINST ('Osnabruck');
+#alter table t1 modify t text character set latin1 collate latin1_german2_ci not null;
+alter table t1 modify t varchar(200) collate latin1_german2_ci not null;
+SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrück');
+SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrueck');
+DROP TABLE t1;
+
+#
+# bug#3964
+#
+
+CREATE TABLE t1 (s varchar(255), FULLTEXT (s)) DEFAULT CHARSET=utf8;
+insert into t1 (s) values ('pära para para'),('para para para');
+select * from t1 where match(s) against('para' in boolean mode);
+select * from t1 where match(s) against('par*' in boolean mode);
+DROP TABLE t1;
+
+#
# icc -ip bug (ip = interprocedural optimization)
# bug#5528
#
@@ -252,3 +308,16 @@ REPAIR TABLE t1;
select count(*) from t1;
drop table t1;
+#
+# bug#6784
+# mi_flush_bulk_insert (on dup key error in mi_write)
+# was mangling info->dupp_key_pos
+#
+
+create table t1 (a int primary key, b text, fulltext(b));
+create table t2 (a int, b text);
+insert t1 values (1, "aaaa"), (2, "bbbb");
+insert t2 values (10, "aaaa"), (2, "cccc");
+replace t1 select * from t2;
+drop table t1, t2;
+
diff --git a/mysql-test/t/fulltext2.test b/mysql-test/t/fulltext2.test
new file mode 100644
index 00000000000..1d3a5307412
--- /dev/null
+++ b/mysql-test/t/fulltext2.test
@@ -0,0 +1,184 @@
+#
+# test of new fulltext search features
+#
+
+#
+# two-level tree
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (
+ i int(10) unsigned not null auto_increment primary key,
+ a varchar(255) not null,
+ FULLTEXT KEY (a)
+) ENGINE=MyISAM;
+
+# two-level entry, second-level tree with depth 2
+--disable_query_log
+let $1=260;
+while ($1)
+{
+ eval insert t1 (a) values ('aaaxxx');
+ dec $1;
+}
+
+# two-level entry, second-level tree has only one page
+let $1=255;
+while ($1)
+{
+ eval insert t1 (a) values ('aaazzz');
+ dec $1;
+}
+
+# one-level entry (entries)
+let $1=250;
+while ($1)
+{
+ eval insert t1 (a) values ('aaayyy');
+ dec $1;
+}
+--enable_query_log
+
+# converting to two-level
+repair table t1 quick;
+check table t1;
+optimize table t1; # BUG#5327 - mi_sort_index() of 2-level tree
+check table t1;
+
+select count(*) from t1 where match a against ('aaaxxx');
+select count(*) from t1 where match a against ('aaayyy');
+select count(*) from t1 where match a against ('aaazzz');
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz');
+select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz' in boolean mode);
+
+select count(*) from t1 where match a against ('aaax*' in boolean mode);
+select count(*) from t1 where match a against ('aaay*' in boolean mode);
+select count(*) from t1 where match a against ('aaa*' in boolean mode);
+
+# mi_write:
+
+insert t1 (a) values ('aaaxxx'),('aaayyy');
+# call to enlarge_root() below
+insert t1 (a) values ('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz');
+select count(*) from t1 where match a against ('aaaxxx');
+select count(*) from t1 where match a against ('aaayyy');
+select count(*) from t1 where match a against ('aaazzz');
+
+# mi_delete
+insert t1 (a) values ('aaaxxx 000000');
+select count(*) from t1 where match a against ('000000');
+delete from t1 where match a against ('000000');
+select count(*) from t1 where match a against ('000000');
+select count(*) from t1 where match a against ('aaaxxx');
+delete from t1 where match a against ('aaazzz');
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+# double-check without index
+select count(*) from t1 where a = 'aaaxxx';
+select count(*) from t1 where a = 'aaayyy';
+select count(*) from t1 where a = 'aaazzz';
+
+# update
+insert t1 (a) values ('aaaxxx 000000');
+select count(*) from t1 where match a against ('000000');
+update t1 set a='aaazzz' where match a against ('000000');
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+update t1 set a='aaazzz' where a = 'aaaxxx';
+update t1 set a='aaaxxx' where a = 'aaayyy';
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+
+drop table t1;
+
+CREATE TABLE t1 (
+ i int(10) unsigned not null auto_increment primary key,
+ a varchar(255) not null,
+ FULLTEXT KEY (a)
+) ENGINE=MyISAM;
+
+#
+# now same as about but w/o repair table
+# 2-level tree created by mi_write
+#
+
+# two-level entry, second-level tree with depth 2
+--disable_query_log
+let $1=260;
+while ($1)
+{
+ eval insert t1 (a) values ('aaaxxx');
+ dec $1;
+}
+let $1=255;
+while ($1)
+{
+ eval insert t1 (a) values ('aaazzz');
+ dec $1;
+}
+let $1=250;
+while ($1)
+{
+ eval insert t1 (a) values ('aaayyy');
+ dec $1;
+}
+--enable_query_log
+
+select count(*) from t1 where match a against ('aaaxxx');
+select count(*) from t1 where match a against ('aaayyy');
+select count(*) from t1 where match a against ('aaazzz');
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz');
+select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz' in boolean mode);
+
+select count(*) from t1 where match a against ('aaax*' in boolean mode);
+select count(*) from t1 where match a against ('aaay*' in boolean mode);
+select count(*) from t1 where match a against ('aaa*' in boolean mode);
+
+# mi_write:
+
+insert t1 (a) values ('aaaxxx'),('aaayyy');
+insert t1 (a) values ('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz');
+select count(*) from t1 where match a against ('aaaxxx');
+select count(*) from t1 where match a against ('aaayyy');
+select count(*) from t1 where match a against ('aaazzz');
+
+# mi_delete
+insert t1 (a) values ('aaaxxx 000000');
+select count(*) from t1 where match a against ('000000');
+delete from t1 where match a against ('000000');
+select count(*) from t1 where match a against ('000000');
+select count(*) from t1 where match a against ('aaaxxx');
+delete from t1 where match a against ('aaazzz');
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+# double-check without index
+select count(*) from t1 where a = 'aaaxxx';
+select count(*) from t1 where a = 'aaayyy';
+select count(*) from t1 where a = 'aaazzz';
+
+# update
+insert t1 (a) values ('aaaxxx 000000');
+select count(*) from t1 where match a against ('000000');
+update t1 set a='aaazzz' where match a against ('000000');
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+update t1 set a='aaazzz' where a = 'aaaxxx';
+update t1 set a='aaaxxx' where a = 'aaayyy';
+select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
+select count(*) from t1 where match a against ('aaayyy' in boolean mode);
+select count(*) from t1 where match a against ('aaazzz' in boolean mode);
+
+drop table t1;
+
diff --git a/mysql-test/t/fulltext_cache.test b/mysql-test/t/fulltext_cache.test
index 0b15e57a97b..234deab91e6 100644
--- a/mysql-test/t/fulltext_cache.test
+++ b/mysql-test/t/fulltext_cache.test
@@ -2,7 +2,10 @@
# Bugreport due to Roy Nasser <roy@vem.ca>
#
+--disable_warnings
drop table if exists t1, t2;
+--enable_warnings
+
CREATE TABLE t1 (
id int(10) unsigned NOT NULL auto_increment,
q varchar(255) default NULL,
@@ -26,13 +29,13 @@ INSERT INTO t2 VALUES (6,2,'um chocolate Snickers');
INSERT INTO t2 VALUES (7,1,'Bife');
INSERT INTO t2 VALUES (8,1,'Pizza de Salmao');
-SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi')
+SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),8)
as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE)
as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
-SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi')
+SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),8)
as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE)
diff --git a/mysql-test/t/fulltext_distinct.test b/mysql-test/t/fulltext_distinct.test
index 86e2f7ca1b4..1f4cb8cd7bc 100644
--- a/mysql-test/t/fulltext_distinct.test
+++ b/mysql-test/t/fulltext_distinct.test
@@ -3,7 +3,10 @@
# bug reported by Tibor Simko <tibor.simko@cern.ch>
#
+--disable_warnings
DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
CREATE TABLE t1 (
id mediumint unsigned NOT NULL auto_increment,
tag char(6) NOT NULL default '',
@@ -12,14 +15,14 @@ CREATE TABLE t1 (
KEY kt(tag),
KEY kv(value(15)),
FULLTEXT KEY kvf(value)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
CREATE TABLE t2 (
id_t2 mediumint unsigned NOT NULL default '0',
id_t1 mediumint unsigned NOT NULL default '0',
field_number tinyint unsigned NOT NULL default '0',
PRIMARY KEY (id_t2,id_t1,field_number),
KEY id_t1(id_t1)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 (tag,value) VALUES ('foo123','bar111');
INSERT INTO t1 (tag,value) VALUES ('foo123','bar222');
diff --git a/mysql-test/t/fulltext_left_join.test b/mysql-test/t/fulltext_left_join.test
index a785cc6a61c..96751ef8678 100644
--- a/mysql-test/t/fulltext_left_join.test
+++ b/mysql-test/t/fulltext_left_join.test
@@ -2,7 +2,10 @@
# Test for bug from Jean-Cédric COSTA <jean-cedric.costa@ensmp.fr>
#
+--disable_warnings
drop table if exists t1, t2;
+--enable_warnings
+
CREATE TABLE t1 (
id VARCHAR(255) NOT NULL PRIMARY KEY,
sujet VARCHAR(255),
@@ -21,7 +24,7 @@ INSERT INTO t2 VALUES('123', 'moi');
INSERT INTO t2 VALUES('123', 'lui');
INSERT INTO t2 VALUES('456', 'lui');
-select match(t1.texte,t1.sujet,t1.motsclefs) against('droit')
+select round(match(t1.texte,t1.sujet,t1.motsclefs) against('droit'),5)
from t1 left join t2 on t2.id=t1.id;
select match(t1.texte,t1.sujet,t1.motsclefs) against('droit' IN BOOLEAN MODE)
from t1 left join t2 on t2.id=t1.id;
@@ -32,9 +35,9 @@ drop table t1, t2;
# Bug #484, reported by Stephen Brandon <stephen@brandonitconsulting.co.uk>
#
-create table t1 (venue_id int(11) default null, venue_text varchar(255) default null, dt datetime default null) type=myisam;
+create table t1 (venue_id int(11) default null, venue_text varchar(255) default null, dt datetime default null) engine=myisam;
insert into t1 (venue_id, venue_text, dt) values (1, 'a1', '2003-05-23 19:30:00'),(null, 'a2', '2003-05-23 19:30:00');
-create table t2 (name varchar(255) not null default '', entity_id int(11) not null auto_increment, primary key (entity_id), fulltext key name (name)) type=myisam;
+create table t2 (name varchar(255) not null default '', entity_id int(11) not null auto_increment, primary key (entity_id), fulltext key name (name)) engine=myisam;
insert into t2 (name, entity_id) values ('aberdeen town hall', 1), ('glasgow royal concert hall', 2), ('queen\'s hall, edinburgh', 3);
select * from t1 left join t2 on venue_id = entity_id where match(name) against('aberdeen' in boolean mode) and dt = '2003-05-23 19:30:00';
select * from t1 left join t2 on venue_id = entity_id where match(name) against('aberdeen') and dt = '2003-05-23 19:30:00';
diff --git a/mysql-test/t/fulltext_multi.test b/mysql-test/t/fulltext_multi.test
index f71704e1bb9..3a622a551bc 100644
--- a/mysql-test/t/fulltext_multi.test
+++ b/mysql-test/t/fulltext_multi.test
@@ -1,6 +1,8 @@
# several FULLTEXT indexes in one table test
-
+--disable_warnings
DROP TABLE IF EXISTS t1;
+--enable_warnings
+
CREATE TABLE t1 (
a int(11) NOT NULL auto_increment,
b text,
@@ -15,7 +17,7 @@ INSERT INTO t1 VALUES (1,'lala lolo lili','oooo aaaa pppp');
INSERT INTO t1 VALUES (2,'asdf fdsa','lkjh fghj');
INSERT INTO t1 VALUES (3,'qpwoei','zmxnvb');
-SELECT a, MATCH b AGAINST ('lala lkjh') FROM t1;
-SELECT a, MATCH c AGAINST ('lala lkjh') FROM t1;
-SELECT a, MATCH b,c AGAINST ('lala lkjh') FROM t1;
+SELECT a, round(MATCH b AGAINST ('lala lkjh'),5) FROM t1;
+SELECT a, round(MATCH c AGAINST ('lala lkjh'),5) FROM t1;
+SELECT a, round(MATCH b,c AGAINST ('lala lkjh'),5) FROM t1;
drop table t1;
diff --git a/mysql-test/t/fulltext_order_by.test b/mysql-test/t/fulltext_order_by.test
index 8c34230cfe3..5856f68ec9e 100644
--- a/mysql-test/t/fulltext_order_by.test
+++ b/mysql-test/t/fulltext_order_by.test
@@ -1,4 +1,7 @@
+--disable_warnings
DROP TABLE IF EXISTS t1;
+--enable_warnings
+
CREATE TABLE t1 (
a INT AUTO_INCREMENT PRIMARY KEY,
message CHAR(20),
@@ -7,25 +10,25 @@ CREATE TABLE t1 (
INSERT INTO t1 (message) VALUES ("Testing"),("table"),("testbug"),
("steve"),("is"),("cool"),("steve is cool");
# basic MATCH
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve');
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve');
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve');
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
# MATCH + ORDER BY (with ft-ranges)
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a;
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a;
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a;
# MATCH + ORDER BY (with normal ranges) + UNIQUE
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC;
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC;
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a DESC;
# MATCH + ORDER BY + UNIQUE (const_table)
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1;
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1;
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY 1;
# ORDER BY MATCH
-SELECT a, MATCH (message) AGAINST ('steve') as rel FROM t1 ORDER BY rel;
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) as rel FROM t1 ORDER BY rel;
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel;
drop table t1;
diff --git a/mysql-test/t/fulltext_update.test b/mysql-test/t/fulltext_update.test
index 9e2ce3ccba5..a1d133ba3fe 100644
--- a/mysql-test/t/fulltext_update.test
+++ b/mysql-test/t/fulltext_update.test
@@ -2,7 +2,9 @@
# Test for bug by voi@ims.at
#
+--disable_warnings
drop table if exists test;
+--enable_warnings
CREATE TABLE test (
gnr INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
url VARCHAR(80) DEFAULT '' NOT NULL,
diff --git a/mysql-test/t/fulltext_var.test b/mysql-test/t/fulltext_var.test
index 71213d1195a..8cc8acf60a6 100644
--- a/mysql-test/t/fulltext_var.test
+++ b/mysql-test/t/fulltext_var.test
@@ -1,5 +1,27 @@
#
# Fulltext configurable parameters
#
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
show variables like "ft\_%";
+
+create table t1 (b text not null);
+insert t1 values ('aaaaaa bbbbbb cccccc');
+insert t1 values ('bbbbbb cccccc');
+insert t1 values ('aaaaaa cccccc');
+select * from t1 where match b against ('+aaaaaa bbbbbb' in boolean mode);
+-- error 1229
+set ft_boolean_syntax=' +-><()~*:""&|';
+set global ft_boolean_syntax=' +-><()~*:""&|';
+select * from t1 where match b against ('+aaaaaa bbbbbb' in boolean mode);
+set global ft_boolean_syntax='@ -><()~*:""&|';
+select * from t1 where match b against ('+aaaaaa bbbbbb' in boolean mode);
+select * from t1 where match b against ('+aaaaaa @bbbbbb' in boolean mode);
+-- error 1231
+set global ft_boolean_syntax='@ -><()~*:""@|';
+-- error 1231
+set global ft_boolean_syntax='+ -><()~*:""@!|';
+drop table t1;
+
diff --git a/mysql-test/t/func_compress.test b/mysql-test/t/func_compress.test
new file mode 100644
index 00000000000..f46589e9e0e
--- /dev/null
+++ b/mysql-test/t/func_compress.test
@@ -0,0 +1,47 @@
+-- source include/have_compress.inc
+#
+# Test for compress and uncompress functions:
+#
+
+select @test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ';
+select length(@test_compress_string);
+
+select uncompress(compress(@test_compress_string));
+explain extended select uncompress(compress(@test_compress_string));
+select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
+explain extended select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
+select uncompressed_length(compress(@test_compress_string));
+select length(compress(@test_compress_string))<length(@test_compress_string);
+
+create table t1 (a text, b char(255), c char(4)) engine=myisam;
+insert into t1 (a,b,c) values (compress(@test_compress_string),compress(@test_compress_string),'d ');
+select uncompress(a) from t1;
+select uncompress(b) from t1;
+select concat('|',c,'|') from t1;
+drop table t1;
+
+select compress("");
+select uncompress("");
+select uncompress(compress(""));
+select uncompressed_length("");
+
+#
+# errors
+#
+
+create table t1 (a text);
+insert t1 values (compress(null)), ('A\0\0\0BBBBBBBB'), (compress(space(50000))), (space(50000));
+select length(a) from t1;
+select length(uncompress(a)) from t1;
+drop table t1;
+
+
+#
+# Bug #5497: a problem with large strings
+# note that when LOW_MEMORY is set the "test" below is meaningless
+#
+
+set @@max_allowed_packet=1048576*100;
+--replace_result "''" XXX "'1'" XXX
+eval select compress(repeat('aaaaaaaaaa', IF('$LOW_MEMORY', 10, 10000000))) is null;
+
diff --git a/mysql-test/t/func_concat.test b/mysql-test/t/func_concat.test
index d6da1d6a603..78818cdda4e 100644
--- a/mysql-test/t/func_concat.test
+++ b/mysql-test/t/func_concat.test
@@ -2,7 +2,10 @@
# Test of problem with CONCAT_WS() and long separators.
#
+--disable_warnings
DROP TABLE IF EXISTS t1;
+--enable_warnings
+
CREATE TABLE t1 ( number INT NOT NULL, alpha CHAR(6) NOT NULL );
INSERT INTO t1 VALUES (1413006,'idlfmv'),
(1413065,'smpsfz'),(1413127,'sljrhx'),(1413304,'qerfnd');
@@ -22,3 +25,28 @@ FROM t1 GROUP BY new LIMIT 1;
SELECT number, alpha, CONCAT_WS('<------------------>',number,alpha) AS new
FROM t1 GROUP BY new LIMIT 1;
drop table t1;
+
+#
+# Bug #5540: a problem with double type
+#
+
+create table t1 (a char(4), b double, c date, d tinyint(4));
+insert into t1 values ('AAAA', 105, '2003-03-01', 1);
+select * from t1 where concat(A,C,B,D) = 'AAAA2003-03-011051';
+drop table t1;
+
+# BUG#6825
+select 'a' union select concat('a', -4);
+select 'a' union select concat('a', -4.5);
+
+select 'a' union select concat('a', -(4 + 1));
+select 'a' union select concat('a', 4 - 5);
+
+select 'a' union select concat('a', -'3');
+select 'a' union select concat('a', -concat('3',4));
+
+select 'a' union select concat('a', -0);
+select 'a' union select concat('a', -0.0);
+
+select 'a' union select concat('a', -0.0000);
+
diff --git a/mysql-test/t/func_crypt.test b/mysql-test/t/func_crypt.test
index e612405c5e9..f352a98e3cd 100644
--- a/mysql-test/t/func_crypt.test
+++ b/mysql-test/t/func_crypt.test
@@ -1,15 +1,50 @@
-- source include/have_crypt.inc
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
select length(encrypt('foo', 'ff')) <> 0;
--replace_result $1$aa$4OSUA5cjdx0RUQ08opV27/ aaqPiZY5xR5l.
-select old_password('test'), password('test');
-select length(encrypt('test')), encrypt('test','aa');
-drop table if exists t1;
-create table t1 (name varchar(50), pw varchar(16));
+create table t1 (name varchar(50), pw varchar(64));
insert into t1 values ('tom', password('my_pass'));
set @pass='my_pass';
select name from t1 where name='tom' and pw=password(@pass);
select name from t1 where name='tom' and pw=password(@undefined);
drop table t1;
+# Test new and old password handling functions
+
+select password('abc');
+select password('');
+select old_password('abc');
+select old_password('');
+select password('gabbagabbahey');
+select old_password('idkfa');
+select length(password('1'));
+select length(encrypt('test'));
+select encrypt('test','aa');
+select old_password(NULL);
+select password(NULL);
+set global old_passwords=on;
+select password('');
+select old_password('');
+select password('idkfa');
+select old_password('idkfa');
+set old_passwords=on;
+select password('idkfa');
+select old_password('idkfa');
+set global old_passwords=off;
+select password('idkfa');
+select old_password('idkfa');
+
+# this test shows that new scrambles honor spaces in passwords:
+set old_passwords=off;
+select password('idkfa ');
+select password('idkfa');
+select password(' idkfa');
+select old_password('idkfa');
+select old_password(' i d k f a ');
+
+explain extended select password('idkfa '), old_password('idkfa');
diff --git a/mysql-test/t/func_date_add.test b/mysql-test/t/func_date_add.test
index c0250c6ece4..93c77daf86e 100644
--- a/mysql-test/t/func_date_add.test
+++ b/mysql-test/t/func_date_add.test
@@ -2,7 +2,10 @@
# Test of DATE_ADD
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+
CREATE TABLE t1 (
visitor_id int(10) unsigned DEFAULT '0' NOT NULL,
group_id int(10) unsigned DEFAULT '0' NOT NULL,
@@ -10,7 +13,7 @@ CREATE TABLE t1 (
sessions int(10) unsigned DEFAULT '0' NOT NULL,
ts timestamp(14),
PRIMARY KEY (visitor_id,group_id)
-)/*! type=MyISAM */;
+)/*! engine=MyISAM */;
INSERT INTO t1 VALUES (465931136,7,2,2,20000318160952);
INSERT INTO t1 VALUES (173865424,2,2,2,20000318233615);
INSERT INTO t1 VALUES (173865424,8,2,2,20000318233615);
diff --git a/mysql-test/t/func_default.test b/mysql-test/t/func_default.test
new file mode 100644
index 00000000000..6ae9f088f92
--- /dev/null
+++ b/mysql-test/t/func_default.test
@@ -0,0 +1,19 @@
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
+
+create table t1(str varchar(10) default 'def',strnull varchar(10),intg int default '10',rel double default '3.14');
+
+insert into t1 values ('','',0,0.0);
+select default(str), default(strnull), default(intg), default(rel) from t1;
+explain extended select default(str), default(strnull), default(intg), default(rel) from t1;
+select * from t1 where str <> default(str);
+explain select * from t1 where str <> default(str);
+
+#TODO: uncomment when bug will be fixed
+#create table t2 select default(str), default(strnull), default(intg), default(rel) from t1;
+#show create table from t1;
+#insert into t2 select select default(str), default(strnull), default(intg), default(rel) from t1;
+
+drop table t1; \ No newline at end of file
diff --git a/mysql-test/t/func_encrypt.test b/mysql-test/t/func_encrypt.test
index 3b6acc54ec9..fe81a814dda 100644
--- a/mysql-test/t/func_encrypt.test
+++ b/mysql-test/t/func_encrypt.test
@@ -1,6 +1,9 @@
-- source include/have_openssl.inc
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+
create table t1 (x blob);
insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','The quick red fox jumped over the lazy brown dog'));
insert into t1 values (des_encrypt('a','The quick red fox jumped over the lazy brown dog'));
@@ -65,3 +68,5 @@ select @a = des_decrypt(des_encrypt("hello"));
select hex("hello");
select hex(des_decrypt(des_encrypt("hello",4),'password2'));
select hex(des_decrypt(des_encrypt("hello","hidden")));
+
+explain extended select des_decrypt(des_encrypt("hello",4),'password2'), des_decrypt(des_encrypt("hello","hidden"));
diff --git a/mysql-test/t/func_equal.test b/mysql-test/t/func_equal.test
index 0d7a4ed9778..cbf589ffcc2 100644
--- a/mysql-test/t/func_equal.test
+++ b/mysql-test/t/func_equal.test
@@ -1,3 +1,8 @@
+# Initialise
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
#
# Testing of the <=> operator
#
@@ -15,7 +20,6 @@ select "A"<=>"B","A"<=>NULL,NULL<=>"A";
# Test with tables
#
-drop table if exists t1,t2;
create table t1 (id int, value int);
create table t2 (id int, value int);
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
new file mode 100644
index 00000000000..e0737a42221
--- /dev/null
+++ b/mysql-test/t/func_gconcat.test
@@ -0,0 +1,279 @@
+#
+# simple test of group_concat function
+#
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+
+create table t1 (grp int, a bigint unsigned, c char(10) not null, d char(10) not null);
+insert into t1 values (1,1,"a","a");
+insert into t1 values (2,2,"b","a");
+insert into t1 values (2,3,"c","b");
+insert into t1 values (3,4,"E","a");
+insert into t1 values (3,5,"C","b");
+insert into t1 values (3,6,"D","b");
+insert into t1 values (3,7,"d","d");
+insert into t1 values (3,8,"d","d");
+insert into t1 values (3,9,"D","c");
+
+# Test of MySQL simple request
+select grp,group_concat(c) from t1 group by grp;
+explain extended select grp,group_concat(c) from t1 group by grp;
+select grp,group_concat(a,c) from t1 group by grp;
+select grp,group_concat("(",a,":",c,")") from t1 group by grp;
+
+# Test of MySQL with options
+select grp,group_concat(c separator ",") from t1 group by grp;
+select grp,group_concat(c separator "---->") from t1 group by grp;
+select grp,group_concat(c order by c) from t1 group by grp;
+select grp,group_concat(c order by c desc) from t1 group by grp;
+select grp,group_concat(d order by a) from t1 group by grp;
+select grp,group_concat(d order by a desc) from t1 group by grp;
+select grp,group_concat(a order by a,d+c-ascii(c)-a) from t1 group by grp;
+select grp,group_concat(a order by d+c-ascii(c),a) from t1 group by grp;
+select grp,group_concat(c order by 1) from t1 group by grp;
+select grp,group_concat(c order by "c") from t1 group by grp;
+select grp,group_concat(distinct c order by c) from t1 group by grp;
+select grp,group_concat(distinct c order by c desc) from t1 group by grp;
+explain extended select grp,group_concat(distinct c order by c desc) from t1 group by grp;
+select grp,group_concat(c order by c separator ",") from t1 group by grp;
+select grp,group_concat(c order by c desc separator ",") from t1 group by grp;
+select grp,group_concat(distinct c order by c separator ",") from t1 group by grp;
+explain extended select grp,group_concat(distinct c order by c separator ",") from t1 group by grp;
+select grp,group_concat(distinct c order by c desc separator ",") from t1 group by grp;
+
+# Test of SQL_LIST objects
+select grp,group_concat(c order by grp desc) from t1 group by grp order by grp;
+
+
+# Test transfer to real values
+
+select grp, group_concat(a separator "")+0 from t1 group by grp;
+select grp, group_concat(a separator "")+0.0 from t1 group by grp;
+select grp, ROUND(group_concat(a separator "")) from t1 group by grp;
+drop table t1;
+
+# Test NULL values
+
+create table t1 (grp int, c char(10));
+insert into t1 values (1,NULL),(2,"b"),(2,NULL),(3,"E"),(3,NULL),(3,"D"),(3,NULL),(3,NULL),(3,"D"),(4,""),(5,NULL);
+select grp,group_concat(c order by c) from t1 group by grp;
+
+# Test warnings
+
+set group_concat_max_len = 4;
+select grp,group_concat(c) from t1 group by grp;
+show warnings;
+set group_concat_max_len = 1024;
+
+# Test errors
+
+--error 1111
+select group_concat(sum(a)) from t1 group by grp;
+--error 1054
+select grp,group_concat(c order by 2) from t1 group by grp;
+
+drop table t1;
+
+# Test variable length
+
+create table t1 ( URL_ID int(11), URL varchar(80));
+create table t2 ( REQ_ID int(11), URL_ID int(11));
+insert into t1 values (4,'www.host.com'), (5,'www.google.com'),(5,'www.help.com');
+insert into t2 values (1,4), (5,4), (5,5);
+# Make this order independent
+--replace_result www.help.com X www.host.com X www.google.com X
+select REQ_ID, Group_Concat(URL) as URL from t1, t2 where
+t2.URL_ID = t1.URL_ID group by REQ_ID;
+# check min/max function
+--replace_result www.help.com X www.host.com X www.google.com X
+select REQ_ID, Group_Concat(URL) as URL, Min(t1.URL_ID) urll,
+Max(t1.URL_ID) urlg from t1, t2 where t2.URL_ID = t1.URL_ID group by REQ_ID;
+
+drop table t1;
+drop table t2;
+
+create table t1 (id int, name varchar(16));
+insert into t1 values (1,'longername'),(1,'evenlongername');
+select ifnull(group_concat(concat(t1.id, ':', t1.name)), 'shortname') as 'without distinct: how it should be' from t1;
+select distinct ifnull(group_concat(concat(t1.id, ':', t1.name)), 'shortname') as 'with distinct: cutoff at length of shortname' from t1;
+drop table t1;
+
+# check zero rows
+create table t1(id int);
+create table t2(id int);
+insert into t1 values(0),(1);
+select group_concat(t1.id) FROM t1,t2;
+drop table t1;
+drop table t2;
+
+# check having
+create table t1 (bar varchar(32));
+insert into t1 values('test1'),('test2');
+select group_concat(bar order by concat(bar,bar)) from t1;
+select group_concat(bar order by concat(bar,bar) desc) from t1;
+select bar from t1 having group_concat(bar)='';
+select bar from t1 having instr(group_concat(bar), "test") > 0;
+select bar from t1 having instr(group_concat(bar order by concat(bar,bar) desc), "test2,test1") > 0;
+drop table t1;
+
+# ORDER BY fix_fields()
+create table t1 (a int, a1 varchar(10));
+create table t2 (a0 int);
+insert into t1 values (0,"a"),(0,"b"),(1,"c");
+insert into t2 values (1),(2),(3);
+select group_concat(a1 order by (t1.a IN (select a0 from t2))) from t1;
+select group_concat(a1 order by (t1.a)) from t1;
+drop table t1, t2;
+
+#
+# Problem with GROUP BY (Bug #2695)
+#
+
+CREATE TABLE t1 (id1 tinyint(4) NOT NULL, id2 tinyint(4) NOT NULL);
+INSERT INTO t1 VALUES (1, 1),(1, 2),(1, 3),(1, 4),(1, 5),(2, 1),(2, 2),(2, 3);
+CREATE TABLE t2 (id1 tinyint(4) NOT NULL);
+INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
+SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 AND t1.id1=1 GROUP BY t1.id1;
+SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1;
+SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY t1.id2 DESC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1;
+SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY 6-t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1;
+
+# The following failed when it was run twice:
+SELECT t1.id1, GROUP_CONCAT(t1.id2,6-t1.id2 ORDER BY 6-t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1;
+SELECT t1.id1, GROUP_CONCAT(t1.id2,6-t1.id2 ORDER BY 6-t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1;
+
+SELECT t1.id1, GROUP_CONCAT(t1.id2,"/",6-t1.id2 ORDER BY 1+0,6-t1.id2,t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1;
+drop table t1,t2;
+
+#
+# Problem with distinct (Bug #3381)
+#
+
+create table t1 (s1 char(10), s2 int not null);
+insert into t1 values ('a',2),('b',2),('c',1),('a',3),('b',4),('c',4);
+select distinct s1 from t1 order by s2,s1;
+select group_concat(distinct s1) from t1;
+select group_concat(distinct s1 order by s2) from t1 where s2 < 4;
+# The following is wrong and needs to be fixed ASAP
+select group_concat(distinct s1 order by s2) from t1;
+drop table t1;
+
+#
+# Test with subqueries (Bug #3319)
+#
+
+create table t1 (a int, c int);
+insert into t1 values (1, 2), (2, 3), (2, 4), (3, 5);
+create table t2 (a int, c int);
+insert into t2 values (1, 5), (2, 4), (3, 3), (3,3);
+select group_concat(c) from t1;
+select group_concat(c order by (select c from t2 where t2.a=t1.a limit 1)) as grp from t1;
+select group_concat(c order by (select mid(group_concat(c order by a),1,5) from t2 where t2.a=t1.a)) as grp from t1;
+select group_concat(c order by (select mid(group_concat(c order by a),1,5) from t2 where t2.a=t1.a) desc) as grp from t1;
+select t1.a, group_concat(c order by (select c from t2 where t2.a=t1.a limit 1)) as grp from t1 group by 1;
+select t1.a, group_concat(c order by (select mid(group_concat(c order by a),1,5) from t2 where t2.a=t1.a)) as grp from t1 group by 1;
+select t1.a, group_concat(c order by (select mid(group_concat(c order by a),1,5) from t2 where t2.a=t1.a) desc) as grp from t1 group by 1;
+
+# The following returns random results as we are sorting on blob addresses
+# select group_concat(c order by (select group_concat(c order by a) from t2 where t2.a=t1.a)) as grp from t1;
+# select group_concat(c order by (select group_concat(c) from t2 where a=t1.a)) as grp from t1;
+
+select a,c,(select group_concat(c order by a) from t2 where a=t1.a) as grp from t1 order by grp;
+drop table t1,t2;
+
+#
+# group_concat of expression with GROUP BY and external GROUP BY
+#
+CREATE TABLE t1 ( a int );
+CREATE TABLE t2 ( a int );
+INSERT INTO t1 VALUES (1), (2);
+INSERT INTO t2 VALUES (1), (2);
+SELECT GROUP_CONCAT(t1.a*t2.a ORDER BY t2.a) FROM t1, t2 GROUP BY t1.a;
+DROP TABLE t1, t2;
+
+#
+# Bug #4035: group_concat() and HAVING
+#
+
+CREATE TABLE t1 (a char(4));
+INSERT INTO t1 VALUES ('John'), ('Anna'), ('Bill');
+SELECT GROUP_CONCAT(a SEPARATOR '||') AS names FROM t1
+ HAVING names LIKE '%An%';
+SELECT GROUP_CONCAT(a SEPARATOR '###') AS names FROM t1
+ HAVING LEFT(names, 1) ='J';
+DROP TABLE t1;
+
+#
+# check blobs
+#
+
+CREATE TABLE t1 ( a int, b TEXT );
+INSERT INTO t1 VALUES (1,'First Row'), (2,'Second Row');
+SELECT GROUP_CONCAT(b ORDER BY b) FROM t1 GROUP BY a;
+DROP TABLE t1;
+
+#
+# check null values #1
+#
+
+--disable_warnings
+CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES (1),(2),(3);
+CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a),
+ CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+--enable_warnings
+INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2);
+SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz;
+DROP TABLE t2;
+DROP TABLE t1;
+
+#
+# check null values #2
+#
+
+CREATE TABLE t1 (A_ID INT NOT NULL,A_DESC CHAR(3) NOT NULL,PRIMARY KEY (A_ID));
+INSERT INTO t1 VALUES (1,'ABC'), (2,'EFG'), (3,'HIJ');
+CREATE TABLE t2 (A_ID INT NOT NULL,B_DESC CHAR(3) NOT NULL,PRIMARY KEY (A_ID,B_DESC));
+INSERT INTO t2 VALUES (1,'A'),(1,'B'),(3,'F');
+SELECT t1.A_ID, GROUP_CONCAT(t2.B_DESC) AS B_DESC FROM t1 LEFT JOIN t2 ON t1.A_ID=t2.A_ID GROUP BY t1.A_ID ORDER BY t1.A_DESC;
+DROP TABLE t1;
+DROP TABLE t2;
+
+#
+# blobs
+#
+
+create table t1 (a int, b text);
+insert into t1 values (1, 'bb'), (1, 'ccc'), (1, 'a'), (1, 'bb'), (1, 'ccc');
+insert into t1 values (2, 'BB'), (2, 'CCC'), (2, 'A'), (2, 'BB'), (2, 'CCC');
+select group_concat(b) from t1 group by a;
+select group_concat(distinct b) from t1 group by a;
+select group_concat(b order by b) from t1 group by a;
+select group_concat(distinct b order by b) from t1 group by a;
+set local group_concat_max_len=4;
+select group_concat(b) from t1 group by a;
+select group_concat(distinct b) from t1 group by a;
+select group_concat(b order by b) from t1 group by a;
+select group_concat(distinct b order by b) from t1 group by a;
+
+#
+# long blobs
+#
+
+insert into t1 values (1, concat(repeat('1', 300), '2')),
+(1, concat(repeat('1', 300), '2')), (1, concat(repeat('0', 300), '1')),
+(2, concat(repeat('1', 300), '2')), (2, concat(repeat('1', 300), '2')),
+(2, concat(repeat('0', 300), '1'));
+set local group_concat_max_len=1024;
+select group_concat(b) from t1 group by a;
+select group_concat(distinct b) from t1 group by a;
+select group_concat(b order by b) from t1 group by a;
+select group_concat(distinct b order by b) from t1 group by a;
+set local group_concat_max_len=400;
+select group_concat(b) from t1 group by a;
+select group_concat(distinct b) from t1 group by a;
+select group_concat(b order by b) from t1 group by a;
+select group_concat(distinct b order by b) from t1 group by a;
+
+drop table t1;
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index c03c39bec4a..79d6112e6de 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -2,7 +2,10 @@
# simple test of all group functions
#
+--disable_warnings
drop table if exists t1,t2;
+--enable_warnings
+
create table t1 (grp int, a bigint unsigned, c char(10) not null);
insert into t1 values (1,1,"a");
insert into t1 values (2,2,"b");
@@ -21,13 +24,17 @@ select count(distinct a),count(distinct grp) from t1;
insert into t1 values (null,null,'');
select count(distinct a),count(distinct grp) from t1;
-select sum(all a),count(all a),avg(all a),std(all a),bit_or(all a),bit_and(all a),min(all a),max(all a),min(all c),max(all c) from t1;
-select grp, sum(a),count(a),avg(a),std(a),bit_or(a),bit_and(a),min(a),max(a),min(c),max(c) from t1 group by grp;
-select grp, sum(a)+count(a)+avg(a)+std(a)+bit_or(a)+bit_and(a)+min(a)+max(a)+min(c)+max(c) as sum from t1 group by grp;
+select sum(all a),count(all a),avg(all a),std(all a),variance(all a),bit_or(all a),bit_and(all a),min(all a),max(all a),min(all c),max(all c) from t1;
+select grp, sum(a),count(a),avg(a),std(a),variance(a),bit_or(a),bit_and(a),min(a),max(a),min(c),max(c) from t1 group by grp;
+select grp, sum(a)+count(a)+avg(a)+std(a)+variance(a)+bit_or(a)+bit_and(a)+min(a)+max(a)+min(c)+max(c) as sum from t1 group by grp;
create table t2 (grp int, a bigint unsigned, c char(10));
insert into t2 select grp,max(a)+max(grp),max(c) from t1 group by grp;
+
+# REPLACE ... SELECT doesn't yet work with PS
+--disable_ps_protocol
replace into t2 select grp, a, c from t1 limit 2,1;
+--enable_ps_protocol
select * from t2;
drop table t1,t2;
@@ -40,8 +47,8 @@ CREATE TABLE t1 (id int(11),value1 float(10,2));
INSERT INTO t1 VALUES (1,0.00),(1,1.00), (1,2.00), (2,10.00), (2,11.00), (2,12.00);
CREATE TABLE t2 (id int(11),name char(20));
INSERT INTO t2 VALUES (1,'Set One'),(2,'Set Two');
-select id, avg(value1), std(value1) from t1 group by id;
-select name, avg(value1), std(value1) from t1, t2 where t1.id = t2.id group by t1.id;
+select id, avg(value1), std(value1), variance(value1) from t1 group by id;
+select name, avg(value1), std(value1), variance(value1) from t1, t2 where t1.id = t2.id group by t1.id;
drop table t1,t2;
#
@@ -118,13 +125,17 @@ explain select min(a2) from t1;
explain select max(t1.a1), max(t2.a2) from t1, t2;
insert into t2 values('AAA', 10, 0.5);
+insert into t2 values('BBB', 20, 1.0);
+select t1.a1, t1.a2, t2.a1, t2.a2 from t1,t2;
+
select max(t1.a1), max(t2.a1) from t1, t2 where t2.a2=9;
select max(t2.a1), max(t1.a1) from t1, t2 where t2.a2=9;
select t1.a1, t1.a2, t2.a1, t2.a2 from t1 left outer join t2 on t1.a1=10;
select max(t1.a2) from t1 left outer join t2 on t1.a1=10;
-select max(t1.a2) from t1 left outer join t2 on t1.a1=10 where t1.a1=20;
-select max(t1.a2) from t1 left outer join t2 on t1.a1=10 where t1.a1=10;
+select max(t2.a1) from t2 left outer join t1 on t2.a2=10 where t2.a2=20;
+select max(t2.a1) from t2 left outer join t1 on t2.a2=10 where t2.a2=10;
select max(t2.a1) from t1 left outer join t2 on t1.a2=t2.a1 and 1=0 where t2.a1='AAA';
+select max(t1.a2),max(t2.a1) from t1 left outer join t2 on t1.a1=10;
drop table t1,t2;
#
@@ -145,8 +156,10 @@ select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b)
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
insert into t1 values (3,1);
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
-select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
+select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
+explain extended select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
drop table t1;
+
#
# Bug #1972: test for bit_and(), bit_or() and negative values
#
@@ -163,3 +176,300 @@ drop table t1;
create table t1 (a int);
select avg(2) from t1;
drop table t1;
+
+#
+# Tests to check MIN/MAX query optimization
+#
+
+# Create database schema
+create table t1(
+ a1 char(3) primary key,
+ a2 smallint,
+ a3 char(3),
+ a4 real,
+ a5 date,
+ key k1(a2,a3),
+ key k2(a4 desc,a1),
+ key k3(a5,a1)
+);
+create table t2(
+ a1 char(3) primary key,
+ a2 char(17),
+ a3 char(2),
+ a4 char(3),
+ key k1(a3, a2),
+ key k2(a4)
+);
+
+# Populate table t1
+insert into t1 values('AME',0,'SEA',0.100,date'1942-02-19');
+insert into t1 values('HBR',1,'SEA',0.085,date'1948-03-05');
+insert into t1 values('BOT',2,'SEA',0.085,date'1951-11-29');
+insert into t1 values('BMC',3,'SEA',0.085,date'1958-09-08');
+insert into t1 values('TWU',0,'LAX',0.080,date'1969-10-05');
+insert into t1 values('BDL',0,'DEN',0.080,date'1960-11-27');
+insert into t1 values('DTX',1,'NYC',0.080,date'1961-05-04');
+insert into t1 values('PLS',1,'WDC',0.075,date'1949-01-02');
+insert into t1 values('ZAJ',2,'CHI',0.075,date'1960-06-15');
+insert into t1 values('VVV',2,'MIN',0.075,date'1959-06-28');
+insert into t1 values('GTM',3,'DAL',0.070,date'1977-09-23');
+insert into t1 values('SSJ',null,'CHI',null,date'1974-03-19');
+insert into t1 values('KKK',3,'ATL',null,null);
+insert into t1 values('XXX',null,'MIN',null,null);
+
+# Populate table t2
+insert into t2 values('TKF','Seattle','WA','AME');
+insert into t2 values('LCC','Los Angeles','CA','TWU');
+insert into t2 values('DEN','Denver','CO','BDL');
+insert into t2 values('SDC','San Diego','CA','TWU');
+insert into t2 values('NOL','New Orleans','LA','GTM');
+insert into t2 values('LAK','Los Angeles','CA','TWU');
+
+# Show the table contents
+select * from t1;
+select * from t2;
+
+# Queries with min/max functions
+# which regular min/max optimization are applied to
+
+explain
+select min(a1) from t1;
+select min(a1) from t1;
+explain
+select max(a4) from t1;
+select max(a4) from t1;
+explain
+select min(a5), max(a5) from t1;
+select min(a5), max(a5) from t1;
+explain
+select min(a3) from t1 where a2 = 2;
+select min(a3) from t1 where a2 = 2;
+explain
+select min(a1), max(a1) from t1 where a4 = 0.080;
+select min(a1), max(a1) from t1 where a4 = 0.080;
+
+explain
+select min(t1.a5), max(t2.a3) from t1, t2;
+select min(t1.a5), max(t2.a3) from t1, t2;
+explain
+select min(t1.a3), max(t2.a2) from t1, t2 where t1.a2 = 0 and t2.a3 = 'CA';
+select min(t1.a3), max(t2.a2) from t1, t2 where t1.a2 = 0 and t2.a3 = 'CA';
+
+# Queries with min/max functions
+# which extended min/max optimization are applied to
+
+explain
+select min(a1) from t1 where a1 > 'KKK';
+select min(a1) from t1 where a1 > 'KKK';
+explain
+select min(a1) from t1 where a1 >= 'KKK';
+select min(a1) from t1 where a1 >= 'KKK';
+explain
+select max(a3) from t1 where a2 = 2 and a3 < 'SEA';
+select max(a3) from t1 where a2 = 2 and a3 < 'SEA';
+explain
+select max(a5) from t1 where a5 < date'1970-01-01';
+select max(a5) from t1 where a5 < date'1970-01-01';
+explain
+select max(a3) from t1 where a2 is null;
+select max(a3) from t1 where a2 is null;
+explain
+select max(a3) from t1 where a2 = 0 and a3 between 'K' and 'Q';
+select max(a3) from t1 where a2 = 0 and a3 between 'K' and 'Q';
+explain
+select min(a1), max(a1) from t1 where a1 between 'A' and 'P';
+select min(a1), max(a1) from t1 where a1 between 'A' and 'P';
+explain
+select max(a3) from t1 where a3 < 'SEA' and a2 = 2 and a3 <= 'MIN';
+select max(a3) from t1 where a3 < 'SEA' and a2 = 2 and a3 <= 'MIN';
+explain
+select max(a3) from t1 where a3 = 'MIN' and a2 = 2;
+select max(a3) from t1 where a3 = 'MIN' and a2 = 2;
+explain
+select max(a3) from t1 where a3 = 'DEN' and a2 = 2;
+select max(a3) from t1 where a3 = 'DEN' and a2 = 2;
+
+explain
+select max(t1.a3), min(t2.a2) from t1, t2 where t1.a2 = 2 and t1.a3 < 'MIN' and t2.a3 = 'CA';
+select max(t1.a3), min(t2.a2) from t1, t2 where t1.a2 = 2 and t1.a3 < 'MIN' and t2.a3 = 'CA';
+
+explain
+select max(a3) from t1 where a2 is null and a2 = 2;
+select max(a3) from t1 where a2 is null and a2 = 2;
+
+explain
+select max(a2) from t1 where a2 >= 1;
+select max(a2) from t1 where a2 >= 1;
+explain
+select min(a3) from t1 where a2 = 2 and a3 < 'SEA';
+select min(a3) from t1 where a2 = 2 and a3 < 'SEA';
+
+explain
+select min(a3) from t1 where a2 = 4;
+select min(a3) from t1 where a2 = 4;
+explain
+select min(a3) from t1 where a2 = 2 and a3 > 'SEA';
+select min(a3) from t1 where a2 = 2 and a3 > 'SEA';
+explain
+select (min(a4)+max(a4))/2 from t1;
+select (min(a4)+max(a4))/2 from t1;
+explain
+select min(a3) from t1 where 2 = a2;
+select min(a3) from t1 where 2 = a2;
+explain
+select max(a3) from t1 where a2 = 2 and 'SEA' > a3;
+select max(a3) from t1 where a2 = 2 and 'SEA' > a3;
+explain
+select max(a3) from t1 where a2 = 2 and 'SEA' < a3;
+select max(a3) from t1 where a2 = 2 and 'SEA' < a3;
+explain
+select min(a3) from t1 where a2 = 2 and a3 >= 'CHI';
+select min(a3) from t1 where a2 = 2 and a3 >= 'CHI';
+explain
+select min(a3) from t1 where a2 = 2 and a3 >= 'CHI' and a3 < 'SEA';
+select min(a3) from t1 where a2 = 2 and a3 >= 'CHI' and a3 < 'SEA';
+explain
+select min(a3) from t1 where a2 = 2 and a3 >= 'CHI' and a3 = 'MIN';
+select min(a3) from t1 where a2 = 2 and a3 >= 'CHI' and a3 = 'MIN';
+explain
+select min(a3) from t1 where a2 = 2 and a3 >= 'SEA' and a3 = 'MIN';
+select min(a3) from t1 where a2 = 2 and a3 >= 'SEA' and a3 = 'MIN';
+
+explain
+select min(t1.a1), min(t2.a4) from t1,t2 where t1.a1 < 'KKK' and t2.a4 < 'KKK';
+select min(t1.a1), min(t2.a4) from t1,t2 where t1.a1 < 'KKK' and t2.a4 < 'KKK';
+
+# Queries to which max/min optimization is not applied
+
+explain
+select min(a1) from t1 where a1 > 'KKK' or a1 < 'XXX';
+explain
+select min(a1) from t1 where a1 != 'KKK';
+explain
+select max(a3) from t1 where a2 < 2 and a3 < 'SEA';
+explain
+select max(t1.a3), min(t2.a2) from t1, t2 where t1.a2 = 2 and t1.a3 < 'MIN' and t2.a3 > 'CA';
+
+explain
+select min(a4 - 0.01) from t1;
+explain
+select max(a4 + 0.01) from t1;
+explain
+select min(a3) from t1 where (a2 +1 ) is null;
+explain
+select min(a3) from t1 where (a2 + 1) = 2;
+explain
+select min(a3) from t1 where 2 = (a2 + 1);
+explain
+select min(a2) from t1 where a2 < 2 * a2 - 8;
+explain
+select min(a1) from t1 where a1 between a3 and 'KKK';
+explain
+select min(a4) from t1 where (a4 + 0.01) between 0.07 and 0.08;
+explain
+select concat(min(t1.a1),min(t2.a4)) from t1, t2 where t2.a4 <> 'AME';
+drop table t1, t2;
+
+--disable_warnings
+create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB;
+--enable_warnings
+insert into t1 values (1, 3);
+select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ from t1 group by MAX_REQ;
+select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = 1 group by MAX_REQ;
+drop table t1;
+
+create table t1 (a char(10));
+insert into t1 values ('a'),('b'),('c');
+select coercibility(max(a)) from t1;
+drop table t1;
+
+#
+# Bug #6658 MAX(column) returns incorrect coercibility
+#
+create table t1 (a char character set latin2);
+insert into t1 values ('a'),('b');
+select charset(max(a)), coercibility(max(a)),
+ charset(min(a)), coercibility(min(a)) from t1;
+create table t2 select max(a),min(a) from t1;
+show create table t2;
+drop table t2,t1;
+
+#
+# aggregate functions on static tables
+#
+create table t1 (a int);
+insert into t1 values (1);
+select max(a) as b from t1 having b=1;
+select a from t1 having a=1;
+drop table t1;
+
+#
+# Bug #3435: variance(const), stddev(const) and an empty table
+#
+
+create table t1 (a int);
+select variance(2) from t1;
+select stddev(2) from t1;
+drop table t1;
+
+
+#
+# cleunup() of optimized away count(*) and max/min
+#
+create table t1 (a int);
+insert into t1 values (1),(2);
+prepare stmt1 from 'SELECT COUNT(*) FROM t1';
+execute stmt1;
+execute stmt1;
+execute stmt1;
+deallocate prepare stmt1;
+drop table t1;
+
+create table t1 (a int, primary key(a));
+insert into t1 values (1),(2);
+prepare stmt1 from 'SELECT max(a) FROM t1';
+execute stmt1;
+execute stmt1;
+execute stmt1;
+deallocate prepare stmt1;
+drop table t1;
+
+#
+# Bug #5406 min/max optimization for empty set
+#
+
+CREATE TABLE t1 (a int primary key);
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+
+SELECT MAX(a) FROM t1 WHERE a > 5;
+SELECT MIN(a) FROM t1 WHERE a < 0;
+
+DROP TABLE t1;
+
+#
+# Bug #5555 GROUP BY enum_field" returns incorrect results
+#
+
+CREATE TABLE t1 (
+ id int(10) unsigned NOT NULL auto_increment,
+ val enum('one','two','three') NOT NULL default 'one',
+ PRIMARY KEY (id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+INSERT INTO t1 VALUES
+(1,'one'),(2,'two'),(3,'three'),(4,'one'),(5,'two');
+
+select val, count(*) from t1 group by val;
+drop table t1;
+
+CREATE TABLE t1 (
+ id int(10) unsigned NOT NULL auto_increment,
+ val set('one','two','three') NOT NULL default 'one',
+ PRIMARY KEY (id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+INSERT INTO t1 VALUES
+(1,'one'),(2,'two'),(3,'three'),(4,'one'),(5,'two');
+
+select val, count(*) from t1 group by val;
+drop table t1;
diff --git a/mysql-test/t/func_if.test b/mysql-test/t/func_if.test
index f78cb5ade55..693773b18c8 100644
--- a/mysql-test/t/func_if.test
+++ b/mysql-test/t/func_if.test
@@ -1,7 +1,9 @@
#
# Init section
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
#
# Simple IF tests
@@ -12,12 +14,19 @@ select IF(0,"ERROR","this"),IF(1,"is","ERROR"),IF(NULL,"ERROR","a"),IF(1,2,3)|0,
#
# Test of IF and case-sensitiveness
#
-CREATE TABLE t1 (st varchar(255) NOT NULL, u int(11) NOT NULL) TYPE=MyISAM;
+CREATE TABLE t1 (st varchar(255) NOT NULL, u int(11) NOT NULL) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('a',1),('A',1),('aa',1),('AA',1),('a',1),('aaa',0),('BBB',0);
select if(1,st,st) s from t1 order by s;
select if(u=1,st,st) s from t1 order by s;
select if(u=1,binary st,st) s from t1 order by s;
select if(u=1,st,binary st) s from t1 where st like "%a%" order by s;
+explain extended select if(u=1,st,binary st) s from t1 where st like "%a%" order by s;
+
+#
+# NULLIF test
+#
+select nullif(u=0, 'test') from t1;
+explain extended select nullif(u=0, 'test') from t1;
drop table t1;
#
diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test
index e5d42ec25c4..3cd8c064817 100644
--- a/mysql-test/t/func_in.test
+++ b/mysql-test/t/func_in.test
@@ -1,8 +1,44 @@
+# Initialise
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
#
# test of IN (NULL)
#
-drop table if exists t1;
+select 1 in (1,2,3);
+select 10 in (1,2,3);
+select NULL in (1,2,3);
+select 1 in (1,NULL,3);
+select 3 in (1,NULL,3);
+select 10 in (1,NULL,3);
+select 1.5 in (1.5,2.5,3.5);
+select 10.5 in (1.5,2.5,3.5);
+select NULL in (1.5,2.5,3.5);
+select 1.5 in (1.5,NULL,3.5);
+select 3.5 in (1.5,NULL,3.5);
+select 10.5 in (1.5,NULL,3.5);
+
+CREATE TABLE t1 (a int, b int, c int);
+insert into t1 values (1,2,3), (1,NULL,3);
+select 1 in (a,b,c) from t1;
+select 3 in (a,b,c) from t1;
+select 10 in (a,b,c) from t1;
+select NULL in (a,b,c) from t1;
+drop table t1;
+CREATE TABLE t1 (a float, b float, c float);
+insert into t1 values (1.5,2.5,3.5), (1.5,NULL,3.5);
+select 1.5 in (a,b,c) from t1;
+select 3.5 in (a,b,c) from t1;
+select 10.5 in (a,b,c) from t1;
+drop table t1;
+CREATE TABLE t1 (a varchar(10), b varchar(10), c varchar(10));
+insert into t1 values ('A','BC','EFD'), ('A',NULL,'EFD');
+select 'A' in (a,b,c) from t1;
+select 'EFD' in (a,b,c) from t1;
+select 'XSFGGHF' in (a,b,c) from t1;
+drop table t1;
+
CREATE TABLE t1 (field char(1));
INSERT INTO t1 VALUES ('A'),(NULL);
SELECT * from t1 WHERE field IN (NULL);
@@ -18,3 +54,45 @@ insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9);
select * from t1 where id in (2,5,9);
drop table t1;
+create table t1 (
+a char(1) character set latin1 collate latin1_general_ci,
+b char(1) character set latin1 collate latin1_swedish_ci,
+c char(1) character set latin1 collate latin1_danish_ci
+);
+insert into t1 values ('A','B','C');
+insert into t1 values ('a','c','c');
+--error 1267
+select * from t1 where a in (b);
+--error 1270
+select * from t1 where a in (b,c);
+--error 1271
+select * from t1 where 'a' in (a,b,c);
+select * from t1 where 'a' in (a);
+select * from t1 where a in ('a');
+select * from t1 where 'a' collate latin1_general_ci in (a,b,c);
+select * from t1 where 'a' collate latin1_bin in (a,b,c);
+select * from t1 where 'a' in (a,b,c collate latin1_bin);
+explain extended select * from t1 where 'a' in (a,b,c collate latin1_bin);
+drop table t1;
+
+set names utf8;
+create table t1 (a char(10) character set utf8 not null);
+insert into t1 values ('bbbb'),(_koi8r'ÃÃÃÃ'),(_latin1'ÄÄÄÄ');
+select a from t1 where a in ('bbbb',_koi8r'ÃÃÃÃ',_latin1'ÄÄÄÄ') order by a;
+drop table t1;
+set names latin1;
+
+select '1.0' in (1,2);
+select 1 in ('1.0',2);
+select 1 in (1,'2.0');
+select 1 in ('1.0',2.0);
+select 1 in (1.0,'2.0');
+select 1 in ('1.1',2);
+select 1 in ('1.1',2.0);
+
+# Test case for bug #6365
+
+create table t1 (a char(20) character set binary);
+insert into t1 values ('aa'), ('bb');
+select * from t1 where a in (NULL, 'aa');
+drop table t1;
diff --git a/mysql-test/t/func_isnull.test b/mysql-test/t/func_isnull.test
index bd3bcd8d04c..506efada0eb 100644
--- a/mysql-test/t/func_isnull.test
+++ b/mysql-test/t/func_isnull.test
@@ -2,7 +2,10 @@
# test of ISNULL()
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+
create table t1 (id int auto_increment primary key not null, mydate date not null);
insert into t1 values (0,"2002-05-01"),(0,"2002-05-01"),(0,"2002-05-01");
flush tables;
diff --git a/mysql-test/t/func_like.test b/mysql-test/t/func_like.test
index 6d6ee8f86a3..4ca2f28fa6e 100644
--- a/mysql-test/t/func_like.test
+++ b/mysql-test/t/func_like.test
@@ -2,7 +2,10 @@
# Test of like
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+
create table t1 (a varchar(10), key(a));
insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
explain select * from t1 where a like 'abc%';
@@ -22,12 +25,74 @@ select * from t1 where a like "%abc\d%";
drop table t1;
+create table t1 (a varchar(10), key(a));
+
#
# Bug #2231
#
-
-create table t1 (a varchar(10), key(a));
insert into t1 values ('a'), ('a\\b');
select * from t1 where a like 'a\\%' escape '#';
select * from t1 where a like 'a\\%' escape '#' and a like 'a\\\\b';
+
+#
+# Bug #4200: Prepared statement parameter as argument to ESCAPE
+#
+prepare stmt1 from 'select * from t1 where a like \'a\\%\' escape ?';
+set @esc='#';
+execute stmt1 using @esc;
+deallocate prepare stmt1;
+
drop table t1;
+
+#
+# Bug #2885: like and datetime
+#
+
+create table t1 (a datetime);
+insert into t1 values ('2004-03-11 12:00:21');
+select * from t1 where a like '2004-03-11 12:00:21';
+drop table t1;
+
+#
+# Test like with non-default character set
+#
+
+SET NAMES koi8r;
+
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET koi8r);
+
+INSERT INTO t1 VALUES ('ÆÙ×Á'),('æÙ×Á'),('Æù×Á'),('ÆÙ÷Á'),('ÆÙ×á'),('æù÷á');
+INSERT INTO t1 VALUES ('ÆÙ×ÁÐÒÏÌÄÖ'),('æÙ×ÁÐÒÏÌÄÖ'),('Æù×ÁÐÒÏÌÄÖ'),('ÆÙ÷ÁÐÒÏÌÄÖ');
+INSERT INTO t1 VALUES ('ÆÙ×áÐÒÏÌÄÖ'),('ÆÙ×ÁðÒÏÌÄÖ'),('ÆÙ×ÁÐòÏÌÄÖ'),('ÆÙ×ÁÐÒïÌÄÖ');
+INSERT INTO t1 VALUES ('ÆÙ×ÁÐÒÏìÄÖ'),('ÆÙ×ÁÐÒÏÌäÖ'),('ÆÙ×ÁÐÒÏÌÄö'),('æù÷áðòïìäö');
+
+SELECT * FROM t1 WHERE a LIKE '%Æù×Á%';
+SELECT * FROM t1 WHERE a LIKE '%Æù×%';
+SELECT * FROM t1 WHERE a LIKE 'Æù×Á%';
+
+DROP TABLE t1;
+
+# Bug #2547 Strange "like" behaviour in tables with default charset=cp1250
+# Test like with non-default character set using TurboBM
+#
+SET NAMES cp1250;
+CREATE TABLE t1 (a varchar(250) NOT NULL) DEFAULT CHARACTER SET=cp1250;
+INSERT INTO t1 VALUES
+('Techni Tapes Sp. z o.o.'),
+('Pojazdy Szynowe PESA Bydgoszcz SA Holding'),
+('AKAPESTER 1 P.P.H.U.'),
+('Pojazdy Szynowe PESA Bydgoszcz S A Holding'),
+('PPUH PESKA-I Maria Struniarska');
+
+select * from t1 where a like '%PESA%';
+select * from t1 where a like '%PESA %';
+select * from t1 where a like '%PES%';
+select * from t1 where a like '%PESKA%';
+select * from t1 where a like '%ESKA%';
+DROP TABLE t1;
+
+#
+# LIKE crashed for binary collations in some cases
+#
+select _cp866'aaaaaaaaa' like _cp866'%aaaa%' collate cp866_bin;
+
diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test
index e745c7738ac..668aefc2d8d 100644
--- a/mysql-test/t/func_math.test
+++ b/mysql-test/t/func_math.test
@@ -3,19 +3,31 @@
#
select floor(5.5),floor(-5.5);
+explain extended select floor(5.5),floor(-5.5);
select ceiling(5.5),ceiling(-5.5);
+explain extended select ceiling(5.5),ceiling(-5.5);
select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1);
+explain extended select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1);
select round(5.5),round(-5.5);
+explain extended select round(5.5),round(-5.5);
select round(5.64,1),round(5.64,2),round(5.64,-1),round(5.64,-2);
select abs(-10), sign(-5), sign(5), sign(0);
+explain extended select abs(-10), sign(-5), sign(5), sign(0);
select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
+explain extended select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
+explain extended select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
+explain extended select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
+explain extended select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
select pow(10,log10(10)),power(2,4);
+explain extended select pow(10,log10(10)),power(2,4);
set @@rand_seed1=10000000,@@rand_seed2=1000000;
select rand(999999),rand();
+explain extended select rand(999999),rand();
select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(abs(tan(pi())),6),format(cot(1),6),format(asin(1),6),format(acos(0),6),format(atan(1),6);
+explain extended select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(abs(tan(pi())),6),format(cot(1),6),format(asin(1),6),format(acos(0),6),format(atan(1),6);
select degrees(pi()),radians(360);
#
@@ -37,3 +49,12 @@ SELECT ASIN(1.2-0.2);
#select floor(log(4)/log(2));
#select floor(log(8)/log(2));
#select floor(log(16)/log(2));
+
+explain extended select degrees(pi()),radians(360);
+
+#
+# Bug #7281: problem with rand()
+#
+
+--error 1054
+select rand(rand);
diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test
index d15c26279ec..e73f2a1b26c 100644
--- a/mysql-test/t/func_misc.test
+++ b/mysql-test/t/func_misc.test
@@ -2,12 +2,18 @@
# Testing of misc functions
#
-select format(1.5555,0),format(123.5555,1),format(1234.5555,2),format(12345.5555,3),format(123456.5555,4),format(1234567.5555,5),format("12345.2399",2);
+select format(1.5555,0),format(123.5555,1),format(1234.5555,2),format(12345.55555,3),format(123456.5555,4),format(1234567.5555,5),format("12345.2399",2);
select inet_ntoa(inet_aton("255.255.255.255.255.255.255.255"));
select inet_aton("255.255.255.255.255"),inet_aton("255.255.1.255"),inet_aton("0.1.255");
select inet_ntoa(1099511627775),inet_ntoa(4294902271),inet_ntoa(511);
+select hex(inet_aton('127'));
+select hex(inet_aton('127.1'));
+select hex(inet_aton('127.1.1'));
+
+select length(uuid()), charset(uuid()), length(unhex(replace(uuid(),_utf8'-',_utf8'')));
+
#
# Test for core dump with nan
#
diff --git a/mysql-test/t/func_op.test b/mysql-test/t/func_op.test
index a312d6ac8c0..33a2884b424 100644
--- a/mysql-test/t/func_op.test
+++ b/mysql-test/t/func_op.test
@@ -3,7 +3,9 @@
# Simple operands and arithmetic grouping
select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2;
+explain extended select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2;
select 1 | (1+1),5 & 3,bit_count(7) ;
+explain extended select 1 | (1+1),5 & 3,bit_count(7) ;
select 1 << 32,1 << 63, 1 << 64, 4 >> 2, 4 >> 63, 1<< 63 >> 60;
#
# bug #1993: bit functions must be unsigned
diff --git a/mysql-test/t/func_regexp.test b/mysql-test/t/func_regexp.test
index 7fbe4000cfc..1a771d466fa 100644
--- a/mysql-test/t/func_regexp.test
+++ b/mysql-test/t/func_regexp.test
@@ -2,7 +2,10 @@
# Some regexp tests
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+
create table t1 (s1 char(64),s2 char(64));
insert into t1 values('aaa','aaa');
@@ -33,6 +36,7 @@ drop table t1;
create table t1 (xxx char(128));
insert into t1 (xxx) values('this is a test of some long text to see what happens');
select * from t1 where xxx regexp('is a test of some long text to');
+explain extended select * from t1 where xxx regexp('is a test of some long text to');
select * from t1 where xxx regexp('is a test of some long text to ');
select * from t1 where xxx regexp('is a test of some long text to s');
select * from t1 where xxx regexp('is a test of some long text to se');
@@ -42,3 +46,30 @@ create table t1 (xxx char(128));
insert into t1 (xxx) values('this is some text: to test - out.reg exp (22/45)');
select * from t1 where xxx REGEXP '^this is some text: to test - out\\.reg exp [[(][0-9]+[/\\][0-9]+[])][ ]*$';
drop table t1;
+
+#
+# Check with different character sets and collations
+#
+select _latin1 0xFF regexp _latin1 '[[:lower:]]' COLLATE latin1_bin;
+select _koi8r 0xFF regexp _koi8r '[[:lower:]]' COLLATE koi8r_bin;
+select _latin1 0xFF regexp _latin1 '[[:upper:]]' COLLATE latin1_bin;
+select _koi8r 0xFF regexp _koi8r '[[:upper:]]' COLLATE koi8r_bin;
+
+select _latin1 0xF7 regexp _latin1 '[[:alpha:]]';
+select _koi8r 0xF7 regexp _koi8r '[[:alpha:]]';
+
+select _latin1'a' regexp _latin1'A' collate latin1_general_ci;
+select _latin1'a' regexp _latin1'A' collate latin1_bin;
+
+#
+# regexp cleanup()
+#
+create table t1 (a varchar(40));
+insert into t1 values ('C1'),('C2'),('R1'),('C3'),('R2'),('R3');
+prepare stmt1 from 'select a from t1 where a rlike ? order by a';
+set @a="^C.*";
+execute stmt1 using @a;
+set @a="^R.*";
+execute stmt1 using @a;
+deallocate prepare stmt1;
+drop table t1;
diff --git a/mysql-test/t/func_sapdb.test b/mysql-test/t/func_sapdb.test
new file mode 100644
index 00000000000..2ae3c438243
--- /dev/null
+++ b/mysql-test/t/func_sapdb.test
@@ -0,0 +1,121 @@
+--disable_warnings
+drop table if exists t1, test;
+--enable_warnings
+
+
+#
+# time functions
+#
+select extract(DAY_MICROSECOND FROM "1999-01-02 10:11:12.000123");
+select extract(HOUR_MICROSECOND FROM "1999-01-02 10:11:12.000123");
+select extract(MINUTE_MICROSECOND FROM "1999-01-02 10:11:12.000123");
+select extract(SECOND_MICROSECOND FROM "1999-01-02 10:11:12.000123");
+select extract(MICROSECOND FROM "1999-01-02 10:11:12.000123");
+select date_format("1997-12-31 23:59:59.000002", "%f");
+
+select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000 99:99:99.999999" DAY_MICROSECOND);
+select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99:99.999999" HOUR_MICROSECOND);
+select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99.999999" MINUTE_MICROSECOND);
+select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000.999999" SECOND_MICROSECOND);
+select date_add("1997-12-31 23:59:59.000002",INTERVAL "999999" MICROSECOND);
+
+select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1 1:1:1.000002" DAY_MICROSECOND);
+select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1:1.000002" HOUR_MICROSECOND);
+select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1.000002" MINUTE_MICROSECOND);
+select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1.000002" SECOND_MICROSECOND);
+select date_sub("1998-01-01 00:00:00.000001",INTERVAL "000002" MICROSECOND);
+
+#Date functions
+select adddate("1997-12-31 23:59:59.000001", 10);
+select subdate("1997-12-31 23:59:59.000001", 10);
+
+select datediff("1997-12-31 23:59:59.000001","1997-12-30");
+select datediff("1997-11-31 23:59:59.000001","1997-12-31");
+select datediff("1997-11-31 23:59:59.000001",null);
+
+select weekofyear("1997-11-31 23:59:59.000001");
+
+select makedate(1997,1);
+select makedate(1997,0);
+
+#Time functions
+
+select addtime("1997-12-31 23:59:59.999999", "1 1:1:1.000002");
+select subtime("1997-12-31 23:59:59.000001", "1 1:1:1.000002");
+select addtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999");
+select subtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999");
+select subtime("01:00:00.999999", "02:00:00.999998");
+select subtime("02:01:01.999999", "01:01:01.999999");
+
+# PS doesn't support fractional seconds
+--disable_ps_protocol
+select timediff("1997-01-01 23:59:59.000001","1995-12-31 23:59:59.000002");
+select timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002");
+select timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002");
+select timediff("1997-12-31 23:59:59.000001","23:59:59.000001");
+select timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001");
+--enable_ps_protocol
+
+select maketime(10,11,12);
+select maketime(25,11,12);
+select maketime(-25,11,12);
+
+# Extraction functions
+
+# PS doesn't support fractional seconds
+--disable_ps_protocol
+select timestamp("2001-12-01", "01:01:01.999999");
+select timestamp("2001-13-01", "01:01:01.000001");
+select timestamp("2001-12-01", "25:01:01");
+select timestamp("2001-12-01 01:01:01.000100");
+select timestamp("2001-12-01");
+select day("1997-12-31 23:59:59.000001");
+select date("1997-12-31 23:59:59.000001");
+select date("1997-13-31 23:59:59.000001");
+select time("1997-12-31 23:59:59.000001");
+select time("1997-12-31 25:59:59.000001");
+select microsecond("1997-12-31 23:59:59.000001");
+--enable_ps_protocol
+
+create table t1
+select makedate(1997,1) as f1,
+ addtime(cast("1997-12-31 23:59:59.000001" as datetime), "1 1:1:1.000002") as f2,
+ addtime(cast("23:59:59.999999" as time) , "1 1:1:1.000002") as f3,
+ timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002") as f4,
+ timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002") as f5,
+ maketime(10,11,12) as f6,
+ timestamp(cast("2001-12-01" as date), "01:01:01") as f7,
+ date("1997-12-31 23:59:59.000001") as f8,
+ time("1997-12-31 23:59:59.000001") as f9;
+describe t1;
+# PS doesn't support fractional seconds
+--disable_ps_protocol
+select * from t1;
+--enable_ps_protocol
+
+create table test(t1 datetime, t2 time, t3 time, t4 datetime);
+insert into test values
+('2001-01-01 01:01:01', '01:01:01', null, '2001-02-01 01:01:01'),
+('2001-01-01 01:01:01', '-01:01:01', '-23:59:59', "1997-12-31 23:59:59.000001"),
+('1997-12-31 23:59:59.000001', '-23:59:59', '-01:01:01', '2001-01-01 01:01:01'),
+('2001-01-01 01:01:01', '01:01:01', '-1 01:01:01', null),
+('2001-01-01 01:01:01', null, '-1 01:01:01', null),
+(null, null, null, null),
+('2001-01-01 01:01:01', '01:01:01', '1 01:01:01', '2001-01-01 01:01:01');
+
+SELECT ADDTIME(t1,t2) As ttt, ADDTIME(t2, t3) As qqq from test;
+# PS doesn't support fractional seconds
+--disable_ps_protocol
+SELECT TIMEDIFF(t1,t4) As ttt, TIMEDIFF(t2, t3) As qqq from test;
+--enable_ps_protocol
+
+drop table t1, test;
+
+select addtime("-01:01:01.01", "-23:59:59.1") as a;
+select microsecond("1997-12-31 23:59:59.01") as a;
+select microsecond(19971231235959.01) as a;
+select date_add("1997-12-31",INTERVAL "10.09" SECOND_MICROSECOND) as a;
+# PS doesn't support fractional seconds
+--disable_ps_protocol
+select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f");
+--enable_ps_protocol
diff --git a/mysql-test/t/func_set.test b/mysql-test/t/func_set.test
index a1ee293ae05..98ef1e07bfe 100644
--- a/mysql-test/t/func_set.test
+++ b/mysql-test/t/func_set.test
@@ -3,6 +3,11 @@
#
select interval(55,10,20,30,40,50,60,70,80,90,100),interval(3,1,1+1,1+1+1+1),field("IBM","NCA","ICL","SUN","IBM","DIGITAL"),field("A","B","C"),elt(2,"ONE","TWO","THREE"),interval(0,1,2,3,4),elt(1,1,2,3)|0,elt(1,1.1,1.2,1.3)+0;
+explain extended select INTERVAL(55,10,20,30,40,50,60,70,80,90,100),interval(3,1,1+1,1+1+1+1),field("IBM","NCA","ICL","SUN","IBM","DIGITAL"),field("A","B","C"),elt(2,"ONE","TWO","THREE"),interval(0,1,2,3,4),elt(1,1,2,3)|0,elt(1,1.1,1.2,1.3)+0;
+# Test 8 and 9 values (Bug #1561)
+SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56);
+SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56, 77);
+
select find_in_set("b","a,b,c"),find_in_set("c","a,b,c"),find_in_set("dd","a,bbb,dd"),find_in_set("bbb","a,bbb,dd");
select find_in_set("d","a,b,c"),find_in_set("dd","a,bbb,d"),find_in_set("bb","a,bbb,dd");
select make_set(0,'a','b','c'),make_set(-1,'a','b','c'),make_set(1,'a','b','c'),make_set(2,'a','b','c'),make_set(1+2,concat('a','b'),'c');
@@ -18,9 +23,32 @@ select find_in_set("abc","abc"),find_in_set("ab","abc"),find_in_set("abcd","abc"
select interval(null, 1, 10, 100);
#
+# test for a bug with elt()
+#
+
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
+create table t1 (id int(10) not null unique);
+create table t2 (id int(10) not null primary key, val int(10) not null);
+insert into t1 values (1),(2),(4);
+insert into t2 values (1,1),(2,1),(3,1),(4,2);
+
+select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id;
+select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id;
+drop table t1,t2;
+
+#
# Bug4340: find_in_set is case insensitive even on binary operators
#
select find_in_set(binary 'a',binary 'A,B,C');
select find_in_set('a',binary 'A,B,C');
select find_in_set(binary 'a', 'A,B,C');
+
+#
+# Bug5513:FIND_IN_SET fails if set ends with a comma
+#
+select find_in_set('1','3,1,');
+
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index 1ae4db3a42a..4404429cf7e 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -1,16 +1,20 @@
-# Version: 3.23.29
-#
# Description
# -----------
# Testing string functions
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+
+set names latin1;
select 'hello',"'hello'",'""hello""','''h''e''l''l''o''',"hel""lo",'hel\'lo';
select 'hello' 'monty';
select length('\n\t\r\b\0\_\%\\');
select bit_length('\n\t\r\b\0\_\%\\');
-select concat('monty',' was here ','again'),length('hello'),char(ascii('h'));
+select char_length('\n\t\r\b\0\_\%\\');
+select length(_latin1'\n\t\n\b\0\\_\\%\\');
+select concat('monty',' was here ','again'),length('hello'),char(ascii('h')),ord('h');
select locate('he','hello'),locate('he','hello',2),locate('lo','hello',2) ;
select instr('hello','HE'), instr('hello',binary 'HE'), instr(binary 'hello','HE');
select position(binary 'll' in 'hello'),position('a' in binary 'hello');
@@ -36,7 +40,13 @@ select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
select replace('aaaa','a','b'),replace('aaaa','aa','b'),replace('aaaa','a','bb'),replace('aaaa','','b'),replace('bbbb','a','c');
select replace(concat(lcase(concat('THIS',' ','IS',' ','A',' ')),ucase('false'),' ','test'),'FALSE','REAL') ;
select soundex(''),soundex('he'),soundex('hello all folks'),soundex('#3556 in bugdb');
+select 'mood' sounds like 'mud';
+select 'Glazgo' sounds like 'Liverpool';
+select null sounds like 'null';
+select 'null' sounds like null;
+select null sounds like null;
select md5('hello');
+select crc32("123");
select sha('abc');
select sha1('abc');
select aes_decrypt(aes_encrypt('abc','1'),'1');
@@ -68,6 +78,9 @@ select quote(concat('abc\'', '\\cba'));
select quote(1/0), quote('\0\Z');
select length(quote(concat(char(0),"test")));
select hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235))));
+select unhex(hex("foobar")), hex(unhex("1234567890ABCDEF")), unhex("345678"), unhex(NULL);
+select hex(unhex("1")), hex(unhex("12")), hex(unhex("123")), hex(unhex("1234")), hex(unhex("12345")), hex(unhex("123456"));
+select length(unhex(md5("abrakadabra")));
#
# Bug #6564: QUOTE(NULL
@@ -117,12 +130,12 @@ CREATE TABLE t1 (
modified timestamp(14) NOT NULL,
bugstatus int(10) unsigned default NULL,
submitter int(10) unsigned default NULL
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,'Link',1,1,1,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa','2001-02-28 08:40:16',20010228084016,0,4);
-SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified,bugstatus,submitter), '"') FROM t1;
+SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter), '"') FROM t1;
SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugstatus,submitter), '"') FROM t1;
-SELECT CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified,bugstatus,submitter) FROM t1;
+SELECT CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter) FROM t1;
SELECT bugdesc, REPLACE(bugdesc, 'xxxxxxxxxxxxxxxxxxxx', 'bbbbbbbbbbbbbbbbbbbb') from t1 group by bugdesc;
drop table t1;
@@ -130,7 +143,7 @@ drop table t1;
# Test bug in AES_DECRYPT() when called with wrong argument
#
-CREATE TABLE t1 (id int(11) NOT NULL auto_increment, tmp text NOT NULL, KEY id (id)) TYPE=MyISAM;
+CREATE TABLE t1 (id int(11) NOT NULL auto_increment, tmp text NOT NULL, KEY id (id)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1, 'a545f661efdd1fb66fdee3aab79945bf');
SELECT 1 FROM t1 WHERE tmp=AES_DECRYPT(tmp,"password");
DROP TABLE t1;
@@ -150,15 +163,10 @@ DROP TABLE t1;
#
# test for #739
-CREATE TABLE t1 (
- title text
-) TYPE=MyISAM;
-
+CREATE TABLE t1 (title text) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('Congress reconvenes in September to debate welfare and adult education');
INSERT INTO t1 VALUES ('House passes the CAREERS bill');
-
SELECT CONCAT("</a>",RPAD("",(55 - LENGTH(title)),".")) from t1;
-
DROP TABLE t1;
#
@@ -185,3 +193,239 @@ drop table t1;
select trim(trailing 'foo' from 'foo');
select trim(leading 'foo' from 'foo');
+
+#
+# Test collation and coercibility
+#
+
+select 1=_latin1'1';
+select _latin1'1'=1;
+select _latin2'1'=1;
+select 1=_latin2'1';
+--error 1267
+select _latin1'1'=_latin2'1';
+select row('a','b','c') = row('a','b','c');
+select row('A','b','c') = row('a','b','c');
+select row('A' COLLATE latin1_bin,'b','c') = row('a','b','c');
+select row('A','b','c') = row('a' COLLATE latin1_bin,'b','c');
+--error 1267
+select row('A' COLLATE latin1_general_ci,'b','c') = row('a' COLLATE latin1_bin,'b','c');
+
+--error 1267
+select concat(_latin1'a',_latin2'a');
+--error 1270
+select concat(_latin1'a',_latin2'a',_latin5'a');
+--error 1271
+select concat(_latin1'a',_latin2'a',_latin5'a',_latin7'a');
+--error 1267
+select concat_ws(_latin1'a',_latin2'a');
+
+#
+# Test FIELD() and collations
+#
+select FIELD('b','A','B');
+select FIELD('B','A','B');
+select FIELD('b' COLLATE latin1_bin,'A','B');
+select FIELD('b','A' COLLATE latin1_bin,'B');
+--error 1270
+select FIELD(_latin2'b','A','B');
+--error 1270
+select FIELD('b',_latin2'A','B');
+select FIELD('b',_latin2'A','B',1);
+
+select POSITION(_latin1'B' IN _latin1'abcd');
+select POSITION(_latin1'B' IN _latin1'abcd' COLLATE latin1_bin);
+select POSITION(_latin1'B' COLLATE latin1_bin IN _latin1'abcd');
+--error 1267
+select POSITION(_latin1'B' COLLATE latin1_general_ci IN _latin1'abcd' COLLATE latin1_bin);
+--error 1267
+select POSITION(_latin1'B' IN _latin2'abcd');
+
+select FIND_IN_SET(_latin1'B',_latin1'a,b,c,d');
+--fix this:
+--select FIND_IN_SET(_latin1'B',_latin1'a,b,c,d' COLLATE latin1_bin);
+--select FIND_IN_SET(_latin1'B' COLLATE latin1_bin,_latin1'a,b,c,d');
+--error 1267
+select FIND_IN_SET(_latin1'B' COLLATE latin1_general_ci,_latin1'a,b,c,d' COLLATE latin1_bin);
+--error 1267
+select FIND_IN_SET(_latin1'B',_latin2'a,b,c,d');
+
+select SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin1'd',2);
+--fix this:
+--select SUBSTRING_INDEX(_latin1'abcdabcdabcd' COLLATE latin1_bin,_latin1'd',2);
+--select SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin1'd' COLLATE latin1_bin,2);
+--error 1267
+select SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin2'd',2);
+--error 1267
+select SUBSTRING_INDEX(_latin1'abcdabcdabcd' COLLATE latin1_general_ci,_latin1'd' COLLATE latin1_bin,2);
+
+select _latin1'B' between _latin1'a' and _latin1'c';
+select _latin1'B' collate latin1_bin between _latin1'a' and _latin1'c';
+select _latin1'B' between _latin1'a' collate latin1_bin and _latin1'c';
+select _latin1'B' between _latin1'a' and _latin1'c' collate latin1_bin;
+--error 1270
+select _latin2'B' between _latin1'a' and _latin1'b';
+--error 1270
+select _latin1'B' between _latin2'a' and _latin1'b';
+--error 1270
+select _latin1'B' between _latin1'a' and _latin2'b';
+--error 1270
+select _latin1'B' collate latin1_general_ci between _latin1'a' collate latin1_bin and _latin1'b';
+
+select _latin1'B' in (_latin1'a',_latin1'b');
+select _latin1'B' collate latin1_bin in (_latin1'a',_latin1'b');
+select _latin1'B' in (_latin1'a' collate latin1_bin,_latin1'b');
+select _latin1'B' in (_latin1'a',_latin1'b' collate latin1_bin);
+--error 1270
+select _latin2'B' in (_latin1'a',_latin1'b');
+--error 1270
+select _latin1'B' in (_latin2'a',_latin1'b');
+--error 1270
+select _latin1'B' in (_latin1'a',_latin2'b');
+--error 1270
+select _latin1'B' COLLATE latin1_general_ci in (_latin1'a' COLLATE latin1_bin,_latin1'b');
+--error 1270
+select _latin1'B' COLLATE latin1_general_ci in (_latin1'a',_latin1'b' COLLATE latin1_bin);
+
+select collation(bin(130)), coercibility(bin(130));
+select collation(oct(130)), coercibility(oct(130));
+select collation(conv(130,16,10)), coercibility(conv(130,16,10));
+select collation(hex(130)), coercibility(hex(130));
+select collation(char(130)), coercibility(hex(130));
+select collation(format(130,10)), coercibility(format(130,10));
+select collation(lcase(_latin2'a')), coercibility(lcase(_latin2'a'));
+select collation(ucase(_latin2'a')), coercibility(ucase(_latin2'a'));
+select collation(left(_latin2'a',1)), coercibility(left(_latin2'a',1));
+select collation(right(_latin2'a',1)), coercibility(right(_latin2'a',1));
+select collation(substring(_latin2'a',1,1)), coercibility(substring(_latin2'a',1,1));
+select collation(concat(_latin2'a',_latin2'b')), coercibility(concat(_latin2'a',_latin2'b'));
+select collation(lpad(_latin2'a',4,_latin2'b')), coercibility(lpad(_latin2'a',4,_latin2'b'));
+select collation(rpad(_latin2'a',4,_latin2'b')), coercibility(rpad(_latin2'a',4,_latin2'b'));
+select collation(concat_ws(_latin2'a',_latin2'b')), coercibility(concat_ws(_latin2'a',_latin2'b'));
+select collation(make_set(255,_latin2'a',_latin2'b',_latin2'c')), coercibility(make_set(255,_latin2'a',_latin2'b',_latin2'c'));
+select collation(export_set(255,_latin2'y',_latin2'n',_latin2' ')), coercibility(export_set(255,_latin2'y',_latin2'n',_latin2' '));
+select collation(trim(_latin2' a ')), coercibility(trim(_latin2' a '));
+select collation(ltrim(_latin2' a ')), coercibility(ltrim(_latin2' a '));
+select collation(rtrim(_latin2' a ')), coercibility(rtrim(_latin2' a '));
+select collation(trim(LEADING _latin2' ' FROM _latin2'a')), coercibility(trim(LEADING _latin2'a' FROM _latin2'a'));
+select collation(trim(TRAILING _latin2' ' FROM _latin2'a')), coercibility(trim(TRAILING _latin2'a' FROM _latin2'a'));
+select collation(trim(BOTH _latin2' ' FROM _latin2'a')), coercibility(trim(BOTH _latin2'a' FROM _latin2'a'));
+select collation(repeat(_latin2'a',10)), coercibility(repeat(_latin2'a',10));
+select collation(reverse(_latin2'ab')), coercibility(reverse(_latin2'ab'));
+select collation(quote(_latin2'ab')), coercibility(quote(_latin2'ab'));
+select collation(soundex(_latin2'ab')), coercibility(soundex(_latin2'ab'));
+select collation(substring(_latin2'ab',1)), coercibility(substring(_latin2'ab',1));
+select collation(insert(_latin2'abcd',2,3,_latin2'ef')), coercibility(insert(_latin2'abcd',2,3,_latin2'ef'));
+select collation(replace(_latin2'abcd',_latin2'b',_latin2'B')), coercibility(replace(_latin2'abcd',_latin2'b',_latin2'B'));
+select collation(encode('abcd','ab')), coercibility(encode('abcd','ab'));
+
+create table t1
+select
+ bin(130),
+ oct(130),
+ conv(130,16,10),
+ hex(130),
+ char(130),
+ format(130,10),
+ left(_latin2'a',1),
+ right(_latin2'a',1),
+ lcase(_latin2'a'),
+ ucase(_latin2'a'),
+ substring(_latin2'a',1,1),
+ concat(_latin2'a',_latin2'b'),
+ lpad(_latin2'a',4,_latin2'b'),
+ rpad(_latin2'a',4,_latin2'b'),
+ concat_ws(_latin2'a',_latin2'b'),
+ make_set(255,_latin2'a',_latin2'b',_latin2'c'),
+ export_set(255,_latin2'y',_latin2'n',_latin2' '),
+ trim(_latin2' a '),
+ ltrim(_latin2' a '),
+ rtrim(_latin2' a '),
+ trim(LEADING _latin2' ' FROM _latin2' a '),
+ trim(TRAILING _latin2' ' FROM _latin2' a '),
+ trim(BOTH _latin2' ' FROM _latin2' a '),
+ repeat(_latin2'a',10),
+ reverse(_latin2'ab'),
+ quote(_latin2'ab'),
+ soundex(_latin2'ab'),
+ substring(_latin2'ab',1),
+ insert(_latin2'abcd',2,3,_latin2'ef'),
+ replace(_latin2'abcd',_latin2'b',_latin2'B'),
+ encode('abcd','ab')
+;
+show create table t1;
+drop table t1;
+
+#
+# test for SUBSTR
+#
+select SUBSTR('abcdefg',3,2);
+select SUBSTRING('abcdefg',3,2);
+select SUBSTR('abcdefg',-3,2) FROM DUAL;
+select SUBSTR('abcdefg',-1,5) FROM DUAL;
+select SUBSTR('abcdefg',0,0) FROM DUAL;
+select SUBSTR('abcdefg',-1,-1) FROM DUAL;
+select SUBSTR('abcdefg',1,-1) FROM DUAL;
+
+#
+# Test that fix_fields doesn't follow to upper level (to comparison)
+# when an error on a lower level (in concat) has accured:
+#
+create table t7 (s1 char);
+--error 1267
+select * from t7
+where concat(s1 collate latin1_general_ci,s1 collate latin1_swedish_ci) = 'AA';
+drop table t7;
+
+select substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2),substring_index("1abcd;2abcd;3abcd;4abcd", ';', -2);
+
+explain extended select md5('hello'), sha('abc'), sha1('abc'), soundex(''), 'mood' sounds like 'mud', aes_decrypt(aes_encrypt('abc','1'),'1'),concat('*',space(5),'*'), reverse('abc'), rpad('a',4,'1'), lpad('a',4,'1'), concat_ws(',','',NULL,'a'),make_set(255,_latin2'a',_latin2'b',_latin2'c'),elt(2,1),locate("a","b",2),format(130,10),char(0),conv(130,16,10),hex(130),binary 'HE', export_set(255,_latin2'y',_latin2'n',_latin2' '),FIELD('b' COLLATE latin1_bin,'A','B'),FIND_IN_SET(_latin1'B',_latin1'a,b,c,d'),collation(conv(130,16,10)), coercibility(conv(130,16,10)),length('\n\t\r\b\0\_\%\\'),bit_length('\n\t\r\b\0\_\%\\'),bit_length('\n\t\r\b\0\_\%\\'),concat('monty',' was here ','again'),length('hello'),char(ascii('h')),ord('h'),quote(1/0),crc32("123"),replace('aaaa','a','b'),insert('txs',2,1,'hi'),left(_latin2'a',1),right(_latin2'a',1),lcase(_latin2'a'),ucase(_latin2'a'),SUBSTR('abcdefg',3,2),substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2),trim(_latin2' a '),ltrim(_latin2' a '),rtrim(_latin2' a '), decode(encode(repeat("a",100000),"monty"),"monty");
+
+#
+# lpad returns incorrect result (Bug #2182)
+#
+
+SELECT lpad(12345, 5, "#");
+
+#
+# Problem the the CONV() function (Bug #2972)
+#
+
+SELECT conv(71, 10, 36), conv('1Z', 36, 10);
+
+#
+# Bug in SUBSTRING when mixed with CONCAT and ORDER BY (Bug #3089)
+#
+
+create table t1 (id int(1), str varchar(10)) DEFAULT CHARSET=utf8;
+insert into t1 values (1,'aaaaaaaaaa'), (2,'bbbbbbbbbb');
+create table t2 (id int(1), str varchar(10)) DEFAULT CHARSET=utf8;
+insert into t2 values (1,'cccccccccc'), (2,'dddddddddd');
+select substring(concat(t1.str, t2.str), 1, 15) "name" from t1, t2
+where t2.id=t1.id order by name;
+drop table t1, t2;
+
+#
+# Test case for conversion of long string value to integer (Bug #3472)
+#
+
+create table t1 (c1 INT, c2 INT UNSIGNED);
+insert into t1 values ('21474836461','21474836461');
+insert into t1 values ('-21474836461','-21474836461');
+show warnings;
+select * from t1;
+drop table t1;
+
+#
+# Bug #4878: LEFT() in integer/float context
+#
+
+select left(1234, 3) + 0;
+
+#
+# Bug #7101: bug with LEFT() when used as a field in GROUP BY aggregation
+#
+create table t1 (a int not null primary key, b varchar(40), c datetime);
+insert into t1 (a,b,c) values (1,'Tom','2004-12-10 12:13:14'),(2,'ball games','2004-12-10 12:13:14'), (3,'Basil','2004-12-10 12:13:14'), (4,'Dean','2004-12-10 12:13:14'),(5,'Ellis','2004-12-10 12:13:14'), (6,'Serg','2004-12-10 12:13:14'), (7,'Sergei','2004-12-10 12:13:14'),(8,'Georg','2004-12-10 12:13:14'),(9,'Salle','2004-12-10 12:13:14'),(10,'Sinisa','2004-12-10 12:13:14');
+select count(*) as total, left(c,10) as reg from t1 group by reg order by reg desc limit 0,12;
+drop table t1;
diff --git a/mysql-test/t/func_system.test b/mysql-test/t/func_system.test
index 052e0530cf6..a05b80ca56b 100644
--- a/mysql-test/t/func_system.test
+++ b/mysql-test/t/func_system.test
@@ -2,5 +2,31 @@
# system functions
#
-select database(),user() like "%@%";
+select database();
+select charset(database());
+select database() = "test";
+select database() = _utf8"test";
+select database() = _latin1"test";
+
+select user() like "%@%";
+select user() like _utf8"%@%";
+select user() like _latin1"%@%";
+select charset(user());
+
select version()>="3.23.29";
+select version()>=_utf8"3.23.29";
+select version()>=_latin1"3.23.29";
+select charset(version());
+explain extended select database(), user();
+
+create table t1 (version char(40)) select database(), user(), version() as 'version';
+show create table t1;
+drop table t1;
+
+select charset(charset(_utf8'a')), charset(collation(_utf8'a'));
+select collation(charset(_utf8'a')), collation(collation(_utf8'a'));
+create table t1 select charset(_utf8'a'), collation(_utf8'a');
+show create table t1;
+drop table t1;
+
+select TRUE,FALSE,NULL;
diff --git a/mysql-test/t/func_test.test b/mysql-test/t/func_test.test
index 795479a21a9..eb506a58870 100644
--- a/mysql-test/t/func_test.test
+++ b/mysql-test/t/func_test.test
@@ -1,3 +1,6 @@
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
#
# Testing of comparison functions
#
@@ -16,12 +19,20 @@ select 'b' between 'a' and 'c', 'B' between 'a' and 'c';
select 2 in (3,2,5,9,5,1),"monty" in ("david","monty","allan"), 1.2 in (1.4,1.2,1.0);
select -1.49 or -1.49,0.6 or 0.6;
select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
+explain extended select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL;
select 1 like 2 xor 2 like 1;
+select 10 % 7, 10 mod 7, 10 div 3;
+explain extended select 10 % 7, 10 mod 7, 10 div 3;
+select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2;
+explain extended select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2;
create table t1 (a int);
insert t1 values (1);
select * from t1 where 1 xor 1;
+explain extended select * from t1 where 1 xor 1;
+select - a from t1;
+explain extended select - a from t1;
drop table t1;
#
@@ -31,10 +42,68 @@ drop table t1;
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
select 1 and 2 between 2 and 10, 2 between 2 and 10 and 1;
select 1 and 0 or 2, 2 or 1 and 0;
-DROP TABLE IF EXISTS t1,t2;
-CREATE TABLE t1 ( faq_group_id int(11) NOT NULL default '0', faq_id int(11) NOT NULL default '0', title varchar(240) default NULL, keywords text, description longblob, solution longblob, status tinyint(4) NOT NULL default '0', access_id smallint(6) default NULL, lang_id smallint(6) NOT NULL default '0', created datetime NOT NULL default '0000-00-00 00:00:00', updated datetime default NULL, last_access datetime default NULL, last_notify datetime default NULL, solved_count int(11) NOT NULL default '0', static_solved int(11) default NULL, solved_1 int(11) default NULL, solved_2 int(11) default NULL, solved_3 int(11) default NULL, solved_4 int(11) default NULL, solved_5 int(11) default NULL, expires datetime default NULL, notes text, assigned_to smallint(6) default NULL, assigned_group smallint(6) default NULL, last_edited_by smallint(6) default NULL, orig_ref_no varchar(15) binary default NULL, c$fundstate smallint(6) default NULL, c$contributor smallint(6) default NULL, UNIQUE KEY t1$faq_id (faq_id), KEY t1$group_id$faq_id (faq_group_id,faq_id), KEY t1$c$fundstate (c$fundstate) ) TYPE=MyISAM;
+
+#
+# Coercibility
+#
+select _koi8r'a' = _koi8r'A';
+select _koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci;
+explain extended select _koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci;
+select _koi8r'a' = _koi8r'A' COLLATE koi8r_bin;
+select _koi8r'a' COLLATE koi8r_general_ci = _koi8r'A';
+select _koi8r'a' COLLATE koi8r_bin = _koi8r'A';
+--error 1267
+select _koi8r'a' COLLATE koi8r_bin = _koi8r'A' COLLATE koi8r_general_ci;
+--error 1267
+select _koi8r'a' = _latin1'A';
+
+select strcmp(_koi8r'a', _koi8r'A');
+select strcmp(_koi8r'a', _koi8r'A' COLLATE koi8r_general_ci);
+select strcmp(_koi8r'a', _koi8r'A' COLLATE koi8r_bin);
+select strcmp(_koi8r'a' COLLATE koi8r_general_ci, _koi8r'A');
+select strcmp(_koi8r'a' COLLATE koi8r_bin, _koi8r'A');
+--error 1267
+select strcmp(_koi8r'a' COLLATE koi8r_general_ci, _koi8r'A' COLLATE koi8r_bin);
+--error 1267
+select strcmp(_koi8r'a', _latin1'A');
+
+select _koi8r'a' LIKE _koi8r'A';
+select _koi8r'a' LIKE _koi8r'A' COLLATE koi8r_general_ci;
+select _koi8r'a' LIKE _koi8r'A' COLLATE koi8r_bin;
+select _koi8r'a' COLLATE koi8r_general_ci LIKE _koi8r'A';
+select _koi8r'a' COLLATE koi8r_bin LIKE _koi8r'A';
+--error 1267
+select _koi8r'a' COLLATE koi8r_general_ci LIKE _koi8r'A' COLLATE koi8r_bin;
+--error 1267
+select _koi8r'a' LIKE _latin1'A';
+
+#
+# Test for LEAST() BUG in LEFT JOIN
+#
+CREATE TABLE t1 ( faq_group_id int(11) NOT NULL default '0', faq_id int(11) NOT NULL default '0', title varchar(240) default NULL, keywords text, description longblob, solution longblob, status tinyint(4) NOT NULL default '0', access_id smallint(6) default NULL, lang_id smallint(6) NOT NULL default '0', created datetime NOT NULL default '0000-00-00 00:00:00', updated datetime default NULL, last_access datetime default NULL, last_notify datetime default NULL, solved_count int(11) NOT NULL default '0', static_solved int(11) default NULL, solved_1 int(11) default NULL, solved_2 int(11) default NULL, solved_3 int(11) default NULL, solved_4 int(11) default NULL, solved_5 int(11) default NULL, expires datetime default NULL, notes text, assigned_to smallint(6) default NULL, assigned_group smallint(6) default NULL, last_edited_by smallint(6) default NULL, orig_ref_no varchar(15) binary default NULL, c$fundstate smallint(6) default NULL, c$contributor smallint(6) default NULL, UNIQUE KEY t1$faq_id (faq_id), KEY t1$group_id$faq_id (faq_group_id,faq_id), KEY t1$c$fundstate (c$fundstate) ) ENGINE=MyISAM;
INSERT INTO t1 VALUES (82,82,'How to use the DynaVox Usage Counts Feature','usages count, number, corner, white, box, button','<as-html>\r\n<table width=\"100%\" border=\"0\">\r\n <tr>\r\n <td width=\"3%\"> </td>\r\n <td width=\"97%\">\r\n <h3><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"#000000\">How \r\n To</font><!-- #BeginEditable \"CS_troubleshoot_question\" --><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"#000099\"><font color=\"#000000\">: \r\n Display or Hide the Usage Counts to find out how many times each button is being selected. </font></font><!-- #EndEditable --></h3>\r\n </td>\r\n </tr>\r\n</table>','<as-html>\r\n <table width=\"100%\" border=\"0\">\r\n <tr>\r\n <td width=\"3%\"> </td>\r\n \r\n<td width=\"97%\"><!-- #BeginEditable \"CS_troubleshoot_answer\" --> \r\n \r\n<p><font color=\"#000000\" face=\"Verdana, Arial, Helvetica, sans-serif\">1. Select \r\n the <i>On/Setup</i> button to access the DynaVox Setup Menu.<br>\r\n 2. Select <b>Button Features.</b><br>\r\n 3. Below the <b>OK</b> button is the <b>Usage Counts</b> button.<br>\r\n a. If it says \"Hidden\" then the Usage Counts will not be displayed.<br>\r\n b. If it says \"Displayed\" then the Usage Counts will be shown.<br>\r\n c. Select the <b>Usage Counts</b> Option Ring once and it will toggle \r\n to the alternative option.<br>\r\n 4. Once the correct setting has been chosen, select <b>OK</b> to leave the <i>Button \r\n Features</i> menu.<br>\r\n 5. Select <b>OK</b> out of the <i>Setup</i> menu and return to the communication \r\n page.</font></p>\r\n <p><font color=\"#000000\" face=\"Verdana, Arial, Helvetica, sans-serif\">For \r\n further information on <i>Usage Counts,</i> see the <i>Button Features \r\n Menu Entry</i> in the DynaVox/DynaMyte Reference Manual.</font></p>\r\n<!-- #EndEditable --></td>\r\n </tr>\r\n</table>',4,1,1,'2001-11-16 16:43:34','2002-11-25 12:09:43','2003-07-24 01:04:48',NULL,11,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,11,NULL,NULL,NULL);
-CREATE TABLE t2 ( access_id smallint(6) NOT NULL default '0', name varchar(20) binary default NULL, rank smallint(6) NOT NULL default '0', KEY t2$access_id (access_id) ) TYPE=MyISAM;
+CREATE TABLE t2 ( access_id smallint(6) NOT NULL default '0', name varchar(20) binary default NULL, rank smallint(6) NOT NULL default '0', KEY t2$access_id (access_id) ) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,'Everyone',2),(2,'Help',3),(3,'Customer Support',1);
SELECT f_acc.rank, a1.rank, a2.rank FROM t1 LEFT JOIN t1 f1 ON (f1.access_id=1 AND f1.faq_group_id = t1.faq_group_id) LEFT JOIN t2 a1 ON (a1.access_id = f1.access_id) LEFT JOIN t1 f2 ON (f2.access_id=3 AND f2.faq_group_id = t1.faq_group_id) LEFT JOIN t2 a2 ON (a2.access_id = f2.access_id), t2 f_acc WHERE LEAST(a1.rank,a2.rank) = f_acc.rank;
DROP TABLE t1,t2;
+
+#
+# Test for GREATEST() and LEAST() bug, which segfaulted 4.1.1 server
+#
+CREATE TABLE t1 (d varchar(6), k int);
+INSERT INTO t1 VALUES (NULL, 2);
+SELECT GREATEST(d,d) FROM t1 WHERE k=2;
+DROP TABLE t1;
+
+#
+# Bug #6138: mod and doubles
+#
+
+select 1197.90 mod 50;
+select 5.1 mod 3, 5.1 mod -3, -5.1 mod 3, -5.1 mod -3;
+
+#
+# Test for mod and signed integers
+#
+
+select 5 mod 3, 5 mod -3, -5 mod 3, -5 mod -3;
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index da18269cf6a..b9e592fc5d9 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -1,10 +1,13 @@
#
# time functions
#
+--disable_warnings
drop table if exists t1,t2,t3;
+--enable_warnings
select from_days(to_days("960101")),to_days(960201)-to_days("19960101"),to_days(date_add(curdate(), interval 1 day))-to_days(curdate()),weekday("1997-11-29");
select period_add("9602",-12),period_diff(199505,"9404") ;
+
select now()-now(),weekday(curdate())-weekday(now()),unix_timestamp()-unix_timestamp(now());
select from_unixtime(unix_timestamp("1994-03-02 10:11:12")),from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s"),from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0;
select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22"),
@@ -177,7 +180,7 @@ drop table t1,t2;
#
# Test bug with month() and year() on text fields with wrong information
-CREATE TABLE t1 (updated text) TYPE=MyISAM;
+CREATE TABLE t1 (updated text) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('');
SELECT month(updated) from t1;
SELECT year(updated) from t1;
@@ -232,3 +235,71 @@ select unix_timestamp('1969-12-01 19:00:01');
#
select from_unixtime(0);
select from_unixtime(2145916800);
+
+#
+# Test types from + INTERVAL
+#
+
+CREATE TABLE t1 (datetime datetime, timestamp timestamp, date date, time time);
+INSERT INTO t1 values ("2001-01-02 03:04:05", "2002-01-02 03:04:05", "2003-01-02", "06:07:08");
+SELECT * from t1;
+select date_add("1997-12-31",INTERVAL 1 SECOND);
+select date_add("1997-12-31",INTERVAL "1 1" YEAR_MONTH);
+
+select date_add(datetime, INTERVAL 1 SECOND) from t1;
+select date_add(datetime, INTERVAL 1 YEAR) from t1;
+
+select date_add(date,INTERVAL 1 SECOND) from t1;
+select date_add(date,INTERVAL 1 MINUTE) from t1;
+select date_add(date,INTERVAL 1 HOUR) from t1;
+select date_add(date,INTERVAL 1 DAY) from t1;
+select date_add(date,INTERVAL 1 MONTH) from t1;
+select date_add(date,INTERVAL 1 YEAR) from t1;
+select date_add(date,INTERVAL "1:1" MINUTE_SECOND) from t1;
+select date_add(date,INTERVAL "1:1" HOUR_MINUTE) from t1;
+select date_add(date,INTERVAL "1:1" DAY_HOUR) from t1;
+select date_add(date,INTERVAL "1 1" YEAR_MONTH) from t1;
+select date_add(date,INTERVAL "1:1:1" HOUR_SECOND) from t1;
+select date_add(date,INTERVAL "1 1:1" DAY_MINUTE) from t1;
+select date_add(date,INTERVAL "1 1:1:1" DAY_SECOND) from t1;
+select date_add(time,INTERVAL 1 SECOND) from t1;
+drop table t1;
+
+# test for last_day
+select last_day('2000-02-05') as f1, last_day('2002-12-31') as f2,
+ last_day('2003-03-32') as f3, last_day('2003-04-01') as f4,
+ last_day('2001-01-01 01:01:01') as f5, last_day(NULL),
+ last_day('2001-02-12');
+
+create table t1 select last_day('2000-02-05') as a,
+ from_days(to_days("960101")) as b;
+describe t1;
+select * from t1;
+drop table t1;
+select last_day('2000-02-05') as a,
+ from_days(to_days("960101")) as b;
+
+select date_add(last_day("1997-12-1"), INTERVAL 1 DAY);
+select length(last_day("1997-12-1"));
+select last_day("1997-12-1")+0;
+select last_day("1997-12-1")+0.0;
+
+# Test SAPDB UTC_% functions. This part is TZ dependant (It is supposed that
+# TZ variable set to GMT-3
+select strcmp(date_sub(localtimestamp(), interval 3 hour), utc_timestamp())=0;
+select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%T"), utc_time())=0;
+select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%Y-%m-%d"), utc_date())=0;
+select strcmp(date_format(utc_timestamp(),"%T"), utc_time())=0;
+select strcmp(date_format(utc_timestamp(),"%Y-%m-%d"), utc_date())=0;
+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();
+CREATE TABLE t1 (d DATETIME);
+INSERT INTO t1 VALUES (NOW());
+INSERT INTO t1 VALUES (NOW());
+INSERT INTO t1 VALUES (NOW());
+SELECT count(*) FROM t1 WHERE d>FROM_DAYS(TO_DAYS(@TMP)) AND d<=FROM_DAYS(TO_DAYS(@TMP)+1);
+DROP TABLE t1;
+
diff --git a/mysql-test/t/func_timestamp.test b/mysql-test/t/func_timestamp.test
index 74e541f782d..8583c16073d 100644
--- a/mysql-test/t/func_timestamp.test
+++ b/mysql-test/t/func_timestamp.test
@@ -2,7 +2,10 @@
# Tests that depend on the timestamp and the TZ variable
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+
create table t1 (Zeit time, Tag tinyint not null, Monat tinyint not null,
Jahr smallint not null, index(Tag), index(Monat), index(Jahr) );
insert into t1 values ("09:26:00",16,9,1998),("09:26:00",16,9,1998);
diff --git a/mysql-test/t/gcc296.test b/mysql-test/t/gcc296.test
index 7c72b57ca54..ebca4dbc897 100644
--- a/mysql-test/t/gcc296.test
+++ b/mysql-test/t/gcc296.test
@@ -1,6 +1,9 @@
#try to crash gcc 2.96
-drop table if exists obory;
-CREATE TABLE obory (
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+CREATE TABLE t1 (
kodoboru varchar(10) default NULL,
obor tinytext,
aobor tinytext,
@@ -8,10 +11,10 @@ CREATE TABLE obory (
FULLTEXT KEY obor (obor),
FULLTEXT KEY aobor (aobor)
);
-INSERT INTO obory VALUES ('0101000000','aaa','AAA');
-INSERT INTO obory VALUES ('0102000000','bbb','BBB');
-INSERT INTO obory VALUES ('0103000000','ccc','CCC');
-INSERT INTO obory VALUES ('0104000000','xxx','XXX');
+INSERT INTO t1 VALUES ('0101000000','aaa','AAA');
+INSERT INTO t1 VALUES ('0102000000','bbb','BBB');
+INSERT INTO t1 VALUES ('0103000000','ccc','CCC');
+INSERT INTO t1 VALUES ('0104000000','xxx','XXX');
-select * from obory;
-drop table obory;
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/gis-rtree.test b/mysql-test/t/gis-rtree.test
new file mode 100644
index 00000000000..716dd38a119
--- /dev/null
+++ b/mysql-test/t/gis-rtree.test
@@ -0,0 +1,174 @@
+-- source include/have_geometry.inc
+
+#
+# test of rtree (using with spatial data)
+#
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+CREATE TABLE t1 (
+ fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ g GEOMETRY NOT NULL,
+ SPATIAL KEY(g)
+) ENGINE=MyISAM;
+
+SHOW CREATE TABLE t1;
+
+let $1=150;
+let $2=150;
+while ($1)
+{
+ eval INSERT INTO t1 (g) VALUES (GeomFromText('LineString($1 $1, $2 $2)'));
+ dec $1;
+ inc $2;
+}
+
+SELECT count(*) FROM t1;
+EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
+SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
+
+DROP TABLE t1;
+
+CREATE TABLE t2 (
+ fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ g GEOMETRY NOT NULL
+) ENGINE=MyISAM;
+
+let $1=10;
+while ($1)
+{
+ let $2=10;
+ while ($2)
+ {
+ eval INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point($1 * 10 - 9, $2 * 10 - 9), Point($1 * 10, $2 * 10))));
+ dec $2;
+ }
+ dec $1;
+}
+
+ALTER TABLE t2 ADD SPATIAL KEY(g);
+SHOW CREATE TABLE t2;
+SELECT count(*) FROM t2;
+EXPLAIN SELECT fid, AsText(g) FROM t2 WHERE Within(g,
+ GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
+SELECT fid, AsText(g) FROM t2 WHERE Within(g,
+ GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
+
+let $1=10;
+while ($1)
+{
+ let $2=10;
+ while ($2)
+ {
+ eval DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point($1 * 10 - 9, $2 * 10 - 9), Point($1 * 10, $2 * 10)))));
+ SELECT count(*) FROM t2;
+ dec $2;
+ }
+ dec $1;
+}
+
+DROP TABLE t2;
+
+drop table if exists t1;
+CREATE TABLE t1 (a geometry NOT NULL, SPATIAL (a));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
+check table t1;
+analyze table t1;
+drop table t1;
+
+#
+# The following crashed gis
+#
+
+CREATE TABLE t1 (
+ fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ g GEOMETRY NOT NULL,
+ SPATIAL KEY(g)
+) ENGINE=MyISAM;
+
+INSERT INTO t1 (g) VALUES (GeomFromText('LineString(1 2, 2 3)')),(GeomFromText('LineString(1 2, 2 4)'));
+#select * from t1 where g<GeomFromText('LineString(1 2, 2 3)');
+drop table t1;
+
+CREATE TABLE t1 (
+ geoobjid INT NOT NULL,
+ line LINESTRING NOT NULL,
+ kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po',
+ name VARCHAR(32),
+
+ SPATIAL KEY (line)
+
+
+) engine=myisam;
+
+ALTER TABLE t1 DISABLE KEYS;
+INSERT INTO t1 (name, kind, line) VALUES
+ ("Aadaouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
+ ("Aadassiye", "pp", GeomFromText("POINT(35.816667 36.216667)")),
+ ("Aadbel", "pp", GeomFromText("POINT(34.533333 36.100000)")),
+ ("Aadchit", "pp", GeomFromText("POINT(33.347222 35.423611)")),
+ ("Aadchite", "pp", GeomFromText("POINT(33.347222 35.423611)")),
+ ("Aadchit el Qoussair", "pp", GeomFromText("POINT(33.283333 35.483333)")),
+ ("Aaddaye", "pp", GeomFromText("POINT(36.716667 40.833333)")),
+ ("'Aadeissa", "pp", GeomFromText("POINT(32.823889 35.698889)")),
+ ("Aaderup", "pp", GeomFromText("POINT(55.216667 11.766667)")),
+ ("Qalaat Aades", "pp", GeomFromText("POINT(33.503333 35.377500)")),
+ ("A ad'ino", "pp", GeomFromText("POINT(54.812222 38.209167)")),
+ ("Aadi Noia", "pp", GeomFromText("POINT(13.800000 39.833333)")),
+ ("Aad La Macta", "pp", GeomFromText("POINT(35.779444 -0.129167)")),
+ ("Aadland", "pp", GeomFromText("POINT(60.366667 5.483333)")),
+ ("Aadliye", "pp", GeomFromText("POINT(33.366667 36.333333)")),
+ ("Aadloun", "pp", GeomFromText("POINT(33.403889 35.273889)")),
+ ("Aadma", "pp", GeomFromText("POINT(58.798333 22.663889)")),
+ ("Aadma Asundus", "pp", GeomFromText("POINT(58.798333 22.663889)")),
+ ("Aadmoun", "pp", GeomFromText("POINT(34.150000 35.650000)")),
+ ("Aadneram", "pp", GeomFromText("POINT(59.016667 6.933333)")),
+ ("Aadneskaar", "pp", GeomFromText("POINT(58.083333 6.983333)")),
+ ("Aadorf", "pp", GeomFromText("POINT(47.483333 8.900000)")),
+ ("Aadorp", "pp", GeomFromText("POINT(52.366667 6.633333)")),
+ ("Aadouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
+ ("Aadoui", "pp", GeomFromText("POINT(34.450000 35.983333)")),
+ ("Aadouiye", "pp", GeomFromText("POINT(34.583333 36.183333)")),
+ ("Aadouss", "pp", GeomFromText("POINT(33.512500 35.601389)")),
+ ("Aadra", "pp", GeomFromText("POINT(33.616667 36.500000)")),
+ ("Aadzi", "pp", GeomFromText("POINT(38.100000 64.850000)"));
+
+ALTER TABLE t1 ENABLE KEYS;
+INSERT INTO t1 (name, kind, line) VALUES ("austria", "pp", GeomFromText('LINESTRING(14.9906 48.9887,14.9946 48.9904,14.9947 48.9916)'));
+drop table t1;
+
+CREATE TABLE t1 (st varchar(100));
+INSERT INTO t1 VALUES ("Fake string");
+CREATE TABLE t2 (geom GEOMETRY NOT NULL, SPATIAL KEY gk(geom));
+--error 1105
+INSERT INTO t2 SELECT GeomFromText(st) FROM t1;
+drop table t1, t2;
diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test
new file mode 100644
index 00000000000..86c34eacbc5
--- /dev/null
+++ b/mysql-test/t/gis.test
@@ -0,0 +1,361 @@
+-- source include/have_geometry.inc
+
+#
+# Spatial objects
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
+--enable_warnings
+
+CREATE TABLE gis_point (fid INTEGER NOT NULL PRIMARY KEY, g POINT);
+CREATE TABLE gis_line (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING);
+CREATE TABLE gis_polygon (fid INTEGER NOT NULL PRIMARY KEY, g POLYGON);
+CREATE TABLE gis_multi_point (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOINT);
+CREATE TABLE gis_multi_line (fid INTEGER NOT NULL PRIMARY KEY, g MULTILINESTRING);
+CREATE TABLE gis_multi_polygon (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOLYGON);
+CREATE TABLE gis_geometrycollection (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRYCOLLECTION);
+CREATE TABLE gis_geometry (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY);
+
+SHOW FIELDS FROM gis_point;
+SHOW FIELDS FROM gis_line;
+SHOW FIELDS FROM gis_polygon;
+SHOW FIELDS FROM gis_multi_point;
+SHOW FIELDS FROM gis_multi_line;
+SHOW FIELDS FROM gis_multi_polygon;
+SHOW FIELDS FROM gis_geometrycollection;
+SHOW FIELDS FROM gis_geometry;
+
+
+INSERT INTO gis_point VALUES
+(101, PointFromText('POINT(10 10)')),
+(102, PointFromText('POINT(20 10)')),
+(103, PointFromText('POINT(20 20)')),
+(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
+
+INSERT INTO gis_line VALUES
+(105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
+(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
+(107, LineStringFromWKB(LineString(Point(10, 10), Point(40, 10))));
+
+INSERT INTO gis_polygon VALUES
+(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
+(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
+(110, PolyFromWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)))));
+
+INSERT INTO gis_multi_point VALUES
+(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
+(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
+(113, MPointFromWKB(MultiPoint(Point(3, 6), Point(4, 10))));
+
+INSERT INTO gis_multi_line VALUES
+(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
+(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
+(116, MLineFromWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)))));
+
+
+INSERT INTO gis_multi_polygon VALUES
+(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+(119, MPolyFromWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))));
+
+INSERT INTO gis_geometrycollection VALUES
+(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
+(121, GeometryFromWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))));
+
+INSERT into gis_geometry SELECT * FROM gis_point;
+INSERT into gis_geometry SELECT * FROM gis_line;
+INSERT into gis_geometry SELECT * FROM gis_polygon;
+INSERT into gis_geometry SELECT * FROM gis_multi_point;
+INSERT into gis_geometry SELECT * FROM gis_multi_line;
+INSERT into gis_geometry SELECT * FROM gis_multi_polygon;
+INSERT into gis_geometry SELECT * FROM gis_geometrycollection;
+
+SELECT fid, AsText(g) FROM gis_point;
+SELECT fid, AsText(g) FROM gis_line;
+SELECT fid, AsText(g) FROM gis_polygon;
+SELECT fid, AsText(g) FROM gis_multi_point;
+SELECT fid, AsText(g) FROM gis_multi_line;
+SELECT fid, AsText(g) FROM gis_multi_polygon;
+SELECT fid, AsText(g) FROM gis_geometrycollection;
+SELECT fid, AsText(g) FROM gis_geometry;
+
+SELECT fid, Dimension(g) FROM gis_geometry;
+SELECT fid, GeometryType(g) FROM gis_geometry;
+SELECT fid, IsEmpty(g) FROM gis_geometry;
+SELECT fid, AsText(Envelope(g)) FROM gis_geometry;
+explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from gis_geometry;
+
+SELECT fid, X(g) FROM gis_point;
+SELECT fid, Y(g) FROM gis_point;
+explain extended select X(g),Y(g) FROM gis_point;
+
+SELECT fid, AsText(StartPoint(g)) FROM gis_line;
+SELECT fid, AsText(EndPoint(g)) FROM gis_line;
+SELECT fid, GLength(g) FROM gis_line;
+SELECT fid, NumPoints(g) FROM gis_line;
+SELECT fid, AsText(PointN(g, 2)) FROM gis_line;
+SELECT fid, IsClosed(g) FROM gis_line;
+explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),IsClosed(g) FROM gis_line;
+
+SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
+SELECT fid, Area(g) FROM gis_polygon;
+SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon;
+SELECT fid, NumInteriorRings(g) FROM gis_polygon;
+SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon;
+explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumInteriorRings(g),AsText(InteriorRingN(g, 1)) FROM gis_polygon;
+
+SELECT fid, IsClosed(g) FROM gis_multi_line;
+
+SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
+SELECT fid, Area(g) FROM gis_multi_polygon;
+
+SELECT fid, NumGeometries(g) from gis_multi_point;
+SELECT fid, NumGeometries(g) from gis_multi_line;
+SELECT fid, NumGeometries(g) from gis_multi_polygon;
+SELECT fid, NumGeometries(g) from gis_geometrycollection;
+explain extended SELECT fid, NumGeometries(g) from gis_multi_point;
+
+SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
+SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line;
+SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon;
+SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection;
+SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection;
+explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
+
+SELECT g1.fid as first, g2.fid as second,
+Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
+Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
+Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
+FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
+explain extended SELECT g1.fid as first, g2.fid as second,
+Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
+Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
+Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
+FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
+
+DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
+
+#
+# Check that ALTER TABLE doesn't loose geometry type
+#
+CREATE TABLE t1 (
+ gp point,
+ ln linestring,
+ pg polygon,
+ mp multipoint,
+ mln multilinestring,
+ mpg multipolygon,
+ gc geometrycollection,
+ gm geometry
+);
+
+SHOW FIELDS FROM t1;
+ALTER TABLE t1 ADD fid INT NOT NULL;
+SHOW FIELDS FROM t1;
+DROP TABLE t1;
+
+SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
+explain extended SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
+explain extended SELECT AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))));
+SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
+explain extended SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
+#select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6)),issimple(PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),issimple(GeometryFromText('POINT(1 4)')), issimple(AsWKB(GeometryFromText('POINT(1 4)')));
+explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6));
+
+create table t1 (a geometry not null);
+insert into t1 values (GeomFromText('Point(1 2)'));
+-- error 1105
+insert into t1 values ('Garbage');
+-- error 1105
+insert IGNORE into t1 values ('Garbage');
+alter table t1 add spatial index(a);
+
+drop table t1;
+
+#
+# Bug #5219: problem with range optimizer
+#
+
+create table t1(a geometry not null, spatial index(a));
+insert into t1 values
+(GeomFromText('POINT(1 1)')), (GeomFromText('POINT(3 3)')),
+(GeomFromText('POINT(4 4)')), (GeomFromText('POINT(6 6)'));
+select AsText(a) from t1 where
+ MBRContains(GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a)
+ or
+ MBRContains(GeomFromText('Polygon((2 2, 2 5, 5 5, 5 2, 2 2))'), a);
+select AsText(a) from t1 where
+ MBRContains(GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a)
+ and
+ MBRContains(GeomFromText('Polygon((0 0, 0 7, 7 7, 7 0, 0 0))'), a);
+drop table t1;
+
+CREATE TABLE t1 (Coordinates POINT NOT NULL, SPATIAL INDEX(Coordinates));
+INSERT INTO t1 VALUES(GeomFromText('POINT(383293632 1754448)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(564952612 157516260)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(903994614 180726515)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(98128178 141127631)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(862547902 799334546)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(341989013 850270906)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(803302376 93039099)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(857439153 817431356)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(319757546 343162742)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(826341972 717484432)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(305066789 201736238)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(626068992 616241497)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(55789424 755830108)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(802874458 312435220)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(153795660 551723671)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(242207428 537089292)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(553478119 807160039)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(694605552 457472733)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(987886554 792733729)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(598600363 850434457)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(592068275 940589376)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(700705362 395370650)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(33628474 558144514)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(212802006 353386020)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(901307256 39143977)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(70870451 206374045)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(240880214 696939443)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(822615542 296669638)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(452769551 625489999)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(609104858 606565210)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(177213669 851312285)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(143654501 730691787)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(658472325 838260052)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(188164520 646358878)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(630993781 786764883)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(496793334 223062055)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(727354258 197498696)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(618432704 760982731)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(755643210 831234710)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(114368751 656950466)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(870378686 185239202)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(863324511 111258900)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(882178645 685940052)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(407928538 334948195)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(311430051 17033395)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(941513405 488643719)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(868345680 85167906)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(219335507 526818004)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(923427958 407500026)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(173176882 554421738)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(194264908 669970217)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(777483793 921619165)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(867468912 395916497)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(682601897 623112122)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(227151206 796970647)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(280062588 97529892)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(982209849 143387099)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(208788792 864388493)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(829327151 616717329)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(199336688 140757201)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(633750724 140850093)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(629400920 502096404)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(226017998 848736426)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(28914408 149445955)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(256236452 202091290)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(703867693 450501360)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(872061506 481351486)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(372120524 739530418)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(877267982 54722420)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(362642540 104419188)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(851693067 642705127)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(201949080 833902916)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(786092225 410737872)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(698291409 615419376)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(27455201 897628096)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(756176576 661205925)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(38478189 385577496)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(163302328 264496186)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(234313922 192216735)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(413942141 490550373)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(394308025 117809834)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(941051732 266369530)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(599161319 313172256)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(5899948 476429301)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(367894677 368542487)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(580848489 219587743)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(11247614 782797569)'));
+drop table t1;
+
+create table t1 select POINT(1,3);
+show create table t1;
+drop table t1;
+
+CREATE TABLE `t1` (`object_id` bigint(20) unsigned NOT NULL default '0', `geo`
+geometry NOT NULL default '') ENGINE=MyISAM ;
+
+insert into t1 values ('85984',GeomFromText('MULTIPOLYGON(((-115.006363
+36.305435,-114.992394 36.305202,-114.991219 36.305975,-114.991163
+36.306845,-114.989432 36.309452,-114.978275 36.312642,-114.977363
+36.311978,-114.975327 36.312344,-114.96502 36.31597,-114.963364
+36.313629,-114.961723 36.313721,-114.956398 36.316057,-114.951882
+36.320979,-114.947073 36.323475,-114.945207 36.326451,-114.945207
+36.326451,-114.944132 36.326061,-114.94003 36.326588,-114.924017
+36.334484,-114.923281 36.334146,-114.92564 36.331504,-114.94072
+36.319282,-114.945348 36.314812,-114.948091 36.314762,-114.951755
+36.316211,-114.952446 36.313883,-114.952644 36.309488,-114.944725
+36.313083,-114.93706 36.32043,-114.932478 36.323497,-114.924556
+36.327708,-114.922608 36.329715,-114.92009 36.328695,-114.912105
+36.323566,-114.901647 36.317952,-114.897436 36.313968,-114.895344
+36.309573,-114.891699 36.304398,-114.890569 36.303551,-114.886356
+36.302702,-114.885141 36.301351,-114.885709 36.297391,-114.892499
+36.290893,-114.902142 36.288974,-114.904941 36.288838,-114.905308
+36.289845,-114.906325 36.290395,-114.909916 36.289549,-114.914527
+36.287535,-114.918797 36.284423,-114.922982 36.279731,-114.924113
+36.277282,-114.924057 36.275817,-114.927733 36.27053,-114.929354
+36.269029,-114.929354 36.269029,-114.950856 36.268715,-114.950768
+36.264324,-114.960206 36.264293,-114.960301 36.268943,-115.006662
+36.268929,-115.008583 36.265619,-115.00665 36.264247,-115.006659
+36.246873,-115.006659 36.246873,-115.006838 36.247697,-115.010764
+36.247774,-115.015609 36.25113,-115.015765 36.254505,-115.029517
+36.254619,-115.038573 36.249317,-115.038573 36.249317,-115.023403
+36.25841,-115.023873 36.258994,-115.031845 36.259829,-115.03183
+36.261053,-115.025561 36.261095,-115.036417 36.274632,-115.033729
+36.276041,-115.032217 36.274851,-115.029845 36.273959,-115.029934
+36.274966,-115.025763 36.274896,-115.025406 36.281044,-115.028731
+36.284471,-115.036497 36.290377,-115.042071 36.291039,-115.026759
+36.298478,-115.008995 36.301966,-115.006363 36.305435),(-115.079835
+36.244369,-115.079735 36.260186,-115.076435 36.262369,-115.069758
+36.265,-115.070235 36.268757,-115.064542 36.268655,-115.061843
+36.269857,-115.062676 36.270693,-115.06305 36.272344,-115.059051
+36.281023,-115.05918 36.283008,-115.060591 36.285246,-115.061913
+36.290022,-115.062499 36.306353,-115.062499 36.306353,-115.060918
+36.30642,-115.06112 36.289779,-115.05713 36.2825,-115.057314
+36.279446,-115.060779 36.274659,-115.061366 36.27209,-115.057858
+36.26557,-115.055805 36.262883,-115.054688 36.262874,-115.047335
+36.25037,-115.044234 36.24637,-115.052434 36.24047,-115.061734
+36.23507,-115.061934 36.22677,-115.061934 36.22677,-115.061491
+36.225267,-115.062024 36.218194,-115.060134 36.218278,-115.060133
+36.210771,-115.057833 36.210771,-115.057433 36.196271,-115.062233
+36.196271,-115.062233 36.190371,-115.062233 36.190371,-115.065533
+36.190371,-115.071333 36.188571,-115.098331 36.188275,-115.098331
+36.188275,-115.098435 36.237569,-115.097535 36.240369,-115.097535
+36.240369,-115.093235 36.240369,-115.089135 36.240469,-115.083135
+36.240569,-115.083135 36.240569,-115.079835
+36.244369)))')),('85998',GeomFromText('MULTIPOLYGON(((-115.333107
+36.264587,-115.333168 36.280638,-115.333168 36.280638,-115.32226
+36.280643,-115.322538 36.274311,-115.327222 36.274258,-115.32733
+36.263026,-115.330675 36.262984,-115.332132 36.264673,-115.333107
+36.264587),(-115.247239 36.247066,-115.247438 36.218267,-115.247438
+36.218267,-115.278525 36.219263,-115.278525 36.219263,-115.301545
+36.219559,-115.332748 36.219197,-115.332757 36.220041,-115.332757
+36.220041,-115.332895 36.233514,-115.349023 36.233479,-115.351489
+36.234475,-115.353681 36.237021,-115.357106 36.239789,-115.36519
+36.243331,-115.368156 36.243487,-115.367389 36.244902,-115.364553
+36.246014,-115.359219 36.24616,-115.356186 36.248025,-115.353347
+36.248004,-115.350813 36.249507,-115.339673 36.25387,-115.333069
+36.255018,-115.333069 36.255018,-115.333042 36.247767,-115.279039
+36.248666,-115.263639 36.247466,-115.263839 36.252766,-115.261439
+36.252666,-115.261439 36.247366,-115.247239 36.247066)))'));
+
+select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
+t1 where object_id=85998;
+
+select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
+t1 where object_id=85984;
+
+drop table t1;
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index 960c55065fe..ca9ca9a5f97 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -1,9 +1,14 @@
+# Test of GRANT commands
+
+# Cleanup
--disable_warnings
drop table if exists t1;
--enable_warnings
connect (master,localhost,root,,);
connection master;
+SET NAMES binary;
+
#
# Test that SSL options works properly
#
@@ -69,6 +74,8 @@ delete from mysql.db where user='mysqltest_1';
delete from mysql.tables_priv where user='mysqltest_1';
delete from mysql.columns_priv where user='mysqltest_1';
flush privileges;
+--error 1141
+show grants for mysqltest_1@localhost;
#
# Test what happens when you have same table and colum level grants
@@ -109,7 +116,6 @@ drop table t1;
GRANT FILE on mysqltest.* to mysqltest_1@localhost;
select 1; -- To test that the previous command didn't cause problems
-
#
# Bug #4898: User privileges depending on ORDER BY Settings of table db
#
@@ -128,11 +134,171 @@ delete from mysql.db where user='test11';
#
# Bug#6123: GRANT USAGE inserts useless Db row
#
-create database db6123;
-grant usage on db6123.* to test6123 identified by 'magic123';
-select host,db,user,select_priv,insert_priv from mysql.db where db="db6123";
+create database mysqltest1;
+grant usage on mysqltest1.* to test6123 identified by 'magic123';
+select host,db,user,select_priv,insert_priv from mysql.db where db="mysqltest1";
delete from mysql.user where user='test6123';
-drop database db6123;
+drop database mysqltest1;
+
+#
+# Test for 'drop user', 'revoke privileges, grant'
+#
+
+create table t1 (a int);
+grant ALL PRIVILEGES on *.* to drop_user2@localhost with GRANT OPTION;
+show grants for drop_user2@localhost;
+revoke all privileges, grant option from drop_user2@localhost;
+drop user drop_user2@localhost;
+
+grant ALL PRIVILEGES on *.* to drop_user@localhost with GRANT OPTION;
+grant ALL PRIVILEGES on test.* to drop_user@localhost with GRANT OPTION;
+grant select(a) on test.t1 to drop_user@localhost;
+show grants for drop_user@localhost;
+
+#
+# Bug3086
+#
+set sql_mode=ansi_quotes;
+show grants for drop_user@localhost;
+set sql_mode=default;
+
+set sql_quote_show_create=0;
+show grants for drop_user@localhost;
+set sql_mode="ansi_quotes";
+show grants for drop_user@localhost;
+set sql_quote_show_create=1;
+show grants for drop_user@localhost;
+set sql_mode="";
+show grants for drop_user@localhost;
+
+revoke all privileges, grant option from drop_user@localhost;
+show grants for drop_user@localhost;
+drop user drop_user@localhost;
+--error 1269
+revoke all privileges, grant option from drop_user@localhost;
+
+grant select(a) on test.t1 to drop_user1@localhost;
+grant select on test.t1 to drop_user2@localhost;
+grant select on test.* to drop_user3@localhost;
+grant select on *.* to drop_user4@localhost;
+--error 1268
+drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
+drop_user4@localhost;
+revoke all privileges, grant option from drop_user1@localhost, drop_user2@localhost,
+drop_user3@localhost, drop_user4@localhost;
+drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
+drop_user4@localhost;
+drop table t1;
+grant usage on *.* to mysqltest_1@localhost identified by "password";
+grant select, update, insert on test.* to mysqltest@localhost;
+show grants for mysqltest_1@localhost;
+drop user mysqltest_1@localhost;
+
+#
+# Bug #3403 Wrong encodin in SHOW GRANTS output
+#
+SET NAMES koi8r;
+CREATE DATABASE ÂÄ;
+USE ÂÄ;
+CREATE TABLE ÔÁÂ (ËÏÌ int);
+
+GRANT SELECT ON ÂÄ.* TO ÀÚÅÒ@localhost;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+REVOKE SELECT ON ÂÄ.* FROM ÀÚÅÒ@localhost;
+
+GRANT SELECT ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+REVOKE SELECT ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
+
+GRANT SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+REVOKE SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
+
+DROP DATABASE ÂÄ;
+SET NAMES latin1;
+
+#
+# Bug #5831: REVOKE ALL PRIVILEGES, GRANT OPTION does not revoke everything
+#
+USE test;
+CREATE TABLE t1 (a int );
+CREATE TABLE t2 LIKE t1;
+CREATE TABLE t3 LIKE t1;
+CREATE TABLE t4 LIKE t1;
+CREATE TABLE t5 LIKE t1;
+CREATE TABLE t6 LIKE t1;
+CREATE TABLE t7 LIKE t1;
+CREATE TABLE t8 LIKE t1;
+CREATE TABLE t9 LIKE t1;
+CREATE TABLE t10 LIKE t1;
+CREATE DATABASE testdb1;
+CREATE DATABASE testdb2;
+CREATE DATABASE testdb3;
+CREATE DATABASE testdb4;
+CREATE DATABASE testdb5;
+CREATE DATABASE testdb6;
+CREATE DATABASE testdb7;
+CREATE DATABASE testdb8;
+CREATE DATABASE testdb9;
+CREATE DATABASE testdb10;
+GRANT ALL ON testdb1.* TO testuser@localhost;
+GRANT ALL ON testdb2.* TO testuser@localhost;
+GRANT ALL ON testdb3.* TO testuser@localhost;
+GRANT ALL ON testdb4.* TO testuser@localhost;
+GRANT ALL ON testdb5.* TO testuser@localhost;
+GRANT ALL ON testdb6.* TO testuser@localhost;
+GRANT ALL ON testdb7.* TO testuser@localhost;
+GRANT ALL ON testdb8.* TO testuser@localhost;
+GRANT ALL ON testdb9.* TO testuser@localhost;
+GRANT ALL ON testdb10.* TO testuser@localhost;
+GRANT SELECT ON test.t1 TO testuser@localhost;
+GRANT SELECT ON test.t2 TO testuser@localhost;
+GRANT SELECT ON test.t3 TO testuser@localhost;
+GRANT SELECT ON test.t4 TO testuser@localhost;
+GRANT SELECT ON test.t5 TO testuser@localhost;
+GRANT SELECT ON test.t6 TO testuser@localhost;
+GRANT SELECT ON test.t7 TO testuser@localhost;
+GRANT SELECT ON test.t8 TO testuser@localhost;
+GRANT SELECT ON test.t9 TO testuser@localhost;
+GRANT SELECT ON test.t10 TO testuser@localhost;
+GRANT SELECT (a) ON test.t1 TO testuser@localhost;
+GRANT SELECT (a) ON test.t2 TO testuser@localhost;
+GRANT SELECT (a) ON test.t3 TO testuser@localhost;
+GRANT SELECT (a) ON test.t4 TO testuser@localhost;
+GRANT SELECT (a) ON test.t5 TO testuser@localhost;
+GRANT SELECT (a) ON test.t6 TO testuser@localhost;
+GRANT SELECT (a) ON test.t7 TO testuser@localhost;
+GRANT SELECT (a) ON test.t8 TO testuser@localhost;
+GRANT SELECT (a) ON test.t9 TO testuser@localhost;
+GRANT SELECT (a) ON test.t10 TO testuser@localhost;
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM testuser@localhost;
+SHOW GRANTS FOR testuser@localhost;
+DROP USER testuser@localhost;
+DROP TABLE t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+DROP DATABASE testdb1;
+DROP DATABASE testdb2;
+DROP DATABASE testdb3;
+DROP DATABASE testdb4;
+DROP DATABASE testdb5;
+DROP DATABASE testdb6;
+DROP DATABASE testdb7;
+DROP DATABASE testdb8;
+DROP DATABASE testdb9;
+DROP DATABASE testdb10;
+
+#
+# Bug #6932: a problem with 'revoke ALL PRIVILEGES'
+#
+
+create table t1(a int, b int, c int, d int);
+grant insert(b), insert(c), insert(d), insert(a) on t1 to grant_user@localhost;
+show grants for grant_user@localhost;
+select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv;
+revoke ALL PRIVILEGES on t1 from grant_user@localhost;
+show grants for grant_user@localhost;
+select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv;
+drop user grant_user@localhost;
+drop table t1;
#
# Bug#7391: Cross-database multi-table UPDATE security problem
@@ -154,7 +320,7 @@ connection conn1;
show grants for mysqltest_3@localhost;
--error 1143
update mysqltest_1.t1, mysqltest_1.t2 set q=10 where b=1;
---error 1142
+--error 1143
update mysqltest_1.t1, mysqltest_2.t2 set d=20 where d=1;
--error 1143
update mysqltest_2.t1, mysqltest_1.t2 set c=20 where b=1;
diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test
new file mode 100644
index 00000000000..f86be0c95b9
--- /dev/null
+++ b/mysql-test/t/grant2.test
@@ -0,0 +1,71 @@
+SET NAMES binary;
+
+#
+# GRANT tests that require several connections
+# (usually it's GRANT, reconnect as another user, try something)
+#
+
+
+# prepare playground before tests
+--disable_warnings
+drop database if exists mysqltest;
+--enable_warnings
+delete from mysql.user where user like 'mysqltest\_%';
+delete from mysql.db where user like 'mysqltest\_%';
+delete from mysql.tables_priv where user like 'mysqltest\_%';
+delete from mysql.columns_priv where user like 'mysqltest\_%';
+flush privileges;
+
+
+#
+# wild_compare fun
+#
+
+grant all privileges on `my\_%`.* to mysqltest_1@localhost with grant option;
+connect (user1,localhost,mysqltest_1,,);
+connection user1;
+select current_user();
+select current_user;
+grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option;
+--error 1044
+grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option;
+disconnect user1;
+connection default;
+show grants for mysqltest_1@localhost;
+show grants for mysqltest_2@localhost;
+--error 1141
+show grants for mysqltest_3@localhost;
+delete from mysql.user where user like 'mysqltest\_%';
+delete from mysql.db where user like 'mysqltest\_%';
+flush privileges;
+
+
+#
+# Bug #6173: One can circumvent missing UPDATE privilege if he has SELECT
+# and INSERT privilege for table with primary key
+#
+create database mysqltest;
+grant INSERT, SELECT on mysqltest.* to mysqltest_1@localhost;
+flush privileges;
+use mysqltest;
+create table t1 (id int primary key, data varchar(255));
+
+connect (mrbad, localhost, mysqltest_1,,);
+connection mrbad;
+show grants for current_user();
+use mysqltest;
+insert into t1 values (1, 'I can''t change it!');
+--error 1044
+update t1 set data='I can change it!' where id = 1;
+# This should not be allowed since it too require UPDATE privilege.
+--error 1044
+insert into t1 values (1, 'XXX') on duplicate key update data= 'I can change it!';
+select * from t1;
+
+connection default;
+drop table t1;
+drop database mysqltest;
+use test;
+delete from mysql.user where user like 'mysqltest\_%';
+delete from mysql.db where user like 'mysqltest\_%';
+flush privileges;
diff --git a/mysql-test/t/grant_cache.test b/mysql-test/t/grant_cache.test
index f85584c3875..e5bde977bb7 100644
--- a/mysql-test/t/grant_cache.test
+++ b/mysql-test/t/grant_cache.test
@@ -1,17 +1,22 @@
-- source include/have_query_cache.inc
-drop table if exists test.t1,mysqltest.t1,mysqltest.t2;
-drop database if exists mysqltest;
-
#
# Test grants with query cache
#
+--disable_warnings
+drop table if exists test.t1,mysqltest.t1,mysqltest.t2;
+drop database if exists mysqltest;
+--enable_warnings
reset query cache;
flush status;
connect (root,localhost,root,,test,$MASTER_MYPORT,master.sock);
connection root;
+show grants for current_user;
+show grants;
+--disable_warnings
create database if not exists mysqltest;
+--enable_warnings
create table mysqltest.t1 (a int,b int,c int);
create table mysqltest.t2 (a int,b int,c int);
@@ -40,6 +45,7 @@ grant SELECT(a) on mysqltest.t1 to mysqltest_3@localhost;
# The following queries should be fetched from cache
connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,master.sock);
connection user1;
+show grants for current_user();
show status like "Qcache_queries_in_cache";
show status like "Qcache_hits";
show status like "Qcache_not_cached";
@@ -61,6 +67,11 @@ show status like "Qcache_queries_in_cache";
show status like "Qcache_hits";
show status like "Qcache_not_cached";
+# Don't use '' as user because it will pick Unix login
+connect (unkuser,localhost,unkuser,,,$MASTER_MYPORT,master.sock);
+connection unkuser;
+show grants for current_user();
+
# The following queries should be fetched from cache
connect (user2,localhost,mysqltest_2,,mysqltest,$MASTER_MYPORT,master.sock);
connection user2;
@@ -101,6 +112,7 @@ show status like "Qcache_not_cached";
connect (user4,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,master.sock);
connection user4;
select "user4";
+show grants;
--error 1046
select a from t1;
# The following query is not cached before (different database)
@@ -115,6 +127,15 @@ show status like "Qcache_not_cached";
# Cleanup
connection root;
+#
+# A temporary 4.1 workaround to make this test pass if
+# mysql was compiled with other than latin1 --with-charset=XXX.
+# Without "set names binary" the below queries fail with
+# "Illegal mix of collations" error.
+# In 5.0 we will change grant tables to use NCHAR(N) instead
+# of "CHAR(N) BINARY", and use cast-to-nchar: N'mysqltest_1'.
+#
+set names binary;
delete from mysql.user where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
delete from mysql.db where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
delete from mysql.tables_priv where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 5af78b924f8..c0447b06303 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -1,8 +1,18 @@
+# Initialise
+--disable_warnings
+drop table if exists t1,t2,t3;
+--enable_warnings
+
+#
+# Simple test without tables
+
+-- error 1111
+SELECT 1 FROM (SELECT 1) as a GROUP BY SUM(1);
+
#
# Test of group (Failed for Lars Hoss <lh@pbm.de>)
#
-drop table if exists t1,t2,t3;
CREATE TABLE t1 (
spID int(10) unsigned,
userID int(10) unsigned,
@@ -43,7 +53,7 @@ SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spI
SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid;
SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid ORDER BY NULL;
EXPLAIN SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid ORDER BY NULL;
-drop table test.t1,test.t2;
+drop table t1,t2;
#
# Bug in GROUP BY, by Nikki Chumakov <nikki@saddam.cityline.ru>
@@ -122,7 +132,7 @@ CREATE TABLE t1 (
assigned_to mediumint(9) DEFAULT '0' NOT NULL,
bug_file_loc text,
bug_severity enum('blocker','critical','major','normal','minor','trivial','enhancement') DEFAULT 'blocker' NOT NULL,
- bug_status enum('NEW','ASSIGNED','REOPENED','RESOLVED','VERIFIED','CLOSED') DEFAULT 'NEW' NOT NULL,
+ bug_status enum('','NEW','ASSIGNED','REOPENED','RESOLVED','VERIFIED','CLOSED') DEFAULT 'NEW' NOT NULL,
creation_ts datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
delta_ts timestamp(14),
short_desc mediumtext,
@@ -250,7 +260,7 @@ explain select spid,count(*) from t1 where spid between 1 and 2 group by spid;
explain select spid,count(*) from t1 where spid between 1 and 2 group by spid order by null;
select spid,count(*) from t1 where spid between 1 and 2 group by spid;
select spid,count(*) from t1 where spid between 1 and 2 group by spid desc;
-explain select sql_big_result spid,sum(userid) from t1 group by spid desc;
+explain extended select sql_big_result spid,sum(userid) from t1 group by spid desc;
explain select sql_big_result spid,sum(userid) from t1 group by spid desc order by null;
select sql_big_result spid,sum(userid) from t1 group by spid desc;
explain select sql_big_result score,count(*) from t1 group by score desc;
@@ -302,7 +312,6 @@ SELECT 1 FROM t1 GROUP BY CONCAT(a, b);
INSERT INTO t1 values ('hij','klm');
SELECT CONCAT(a, b),count(*) FROM t1 GROUP BY 1;
DROP TABLE t1;
-drop table if exists t1;
#
# Test problem with ORDER BY on a SUM() column
@@ -343,7 +352,7 @@ CREATE TABLE t1 (
value int(11) unsigned NOT NULL default '0',
UNIQUE KEY pid2 (pid,c1id,c2id),
UNIQUE KEY pid (pid,value)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1, 1, NULL, 1),(1, 2, NULL, 2),(1, NULL, 3, 3),(1, 4, NULL, 4),(1, 5, NULL, 5);
@@ -351,7 +360,7 @@ CREATE TABLE t2 (
id int(11) unsigned NOT NULL default '0',
active enum('Yes','No') NOT NULL default 'Yes',
PRIMARY KEY (id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1, 'Yes'),(2, 'No'),(4, 'Yes'),(5, 'No');
@@ -448,6 +457,15 @@ SELECT i, COUNT(DISTINCT(i)) FROM t1 GROUP BY j ORDER BY NULL;
explain SELECT i, COUNT(DISTINCT(i)) FROM t1 GROUP BY j ORDER BY NULL;
DROP TABLE t1;
+# Test for BUG#5400: GROUP_CONCAT returns everything twice.
+create table t1 ( col1 int, col2 int );
+insert into t1 values (1,1),(1,2),(1,3),(2,1),(2,2);
+select group_concat( distinct col1 ) as alias from t1
+ group by col2 having alias like '%';
+
+drop table t1;
+
+
#Test for BUG#6976: Aggregate functions have incorrect NULL-ness
create table t1 (a int);
insert into t1 values(null);
diff --git a/mysql-test/t/handler.test b/mysql-test/t/handler.test
index 53fe8c0a059..3de8e8ae784 100644
--- a/mysql-test/t/handler.test
+++ b/mysql-test/t/handler.test
@@ -2,13 +2,18 @@
# test of HANDLER ...
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+
create table t1 (a int, b char(10), key a(a), key b(a,b));
insert into t1 values
(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"),
(14,"aaa"),(15,"bbb"),(16,"ccc"),(16,"xxx"),
(20,"ggg"),(21,"hhh"),(22,"iii");
handler t1 open as t2;
+-- error 1064
+handler t2 read a=(SELECT 1);
handler t2 read a first;
handler t2 read a next;
handler t2 read a next;
@@ -81,9 +86,8 @@ handler t2 read first;
drop table t1;
#
-# test case for the bug #787
+# Test case for the bug #787
#
-
create table t1 (a int);
insert into t1 values (1),(2),(3),(4),(5),(6);
delete from t1 limit 2;
@@ -96,7 +100,7 @@ handler t1 read first;
drop table t1;
#
-#test for #751
+# Test for #751
#
create table t1(a int, index(a));
insert into t1 values (1), (2), (3);
@@ -106,7 +110,6 @@ handler t1 read a=(W);
--error 1210
handler t1 read a=(a);
drop table t1;
-
#
# BUG#2304
#
@@ -171,30 +174,34 @@ handler t1 open;
# Check accesibility of all the tables.
#
use test;
---error 1109;
+--error 1064
handler test.t1 read first limit 9;
+--error 1064
handler test_test.t1 read first limit 9;
handler t1 read first limit 9;
+--error 1064
handler test_test.t2 read first limit 9;
handler t2 read first limit 9;
+
#
# Cleanup.
#
+--error 1064
handler test_test.t1 close;
---error 1109;
handler t1 close;
drop table test_test.t1;
+--error 1064
handler test_test.t2 close;
---error 1109;
handler t2 close;
drop table test_test.t2;
drop database test_test;
+
#
use test;
---error 1109;
+--error 1064
handler test.t1 close;
---error 1109;
+--error 1109
handler t1 close;
drop table test.t1;
@@ -231,7 +238,7 @@ handler t2 open t1;
--error 1066
handler t3 open t1;
handler t1 read first limit 9;
---error 1109
+--error 1064
handler test.t1 close;
--error 1066
handler test.t1 open h1;
@@ -243,11 +250,11 @@ handler t1 read first limit 9;
handler h1 read first limit 9;
handler h2 read first limit 9;
handler h3 read first limit 9;
-handler test.h2 read first limit 9;
---error 1109
+handler h2 read first limit 9;
+--error 1064
handler test.h1 close;
-handler test_test.t1 close;
-handler test_test.h1 close;
+handler t1 close;
+handler h1 close;
handler h2 close;
--error 1109
handler t1 read first limit 9;
@@ -256,12 +263,12 @@ handler h1 read first limit 9;
--error 1109
handler h2 read first limit 9;
handler h3 read first limit 9;
-handler test_test.h3 read first limit 9;
+handler h3 read first limit 9;
use test_test;
handler h3 read first limit 9;
---error 1109
+--error 1064
handler test.h3 read first limit 9;
-handler test_test.h3 close;
+handler h3 close;
use test;
drop table t3;
drop table t2;
diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test
index c8835bf1613..12a44fd75dc 100644
--- a/mysql-test/t/having.test
+++ b/mysql-test/t/having.test
@@ -1,12 +1,16 @@
# test of problems with having (Reported by Mark Rogers)
#
+--disable_warnings
drop table if exists t1,t2;
+--enable_warnings
+
create table t1 (a int);
select count(a) as b from t1 where a=0 having b > 0;
insert into t1 values (null);
select count(a) as b from t1 where a=0 having b > 0;
select count(a) as b from t1 where a=0 having b >=0;
+explain extended select count(a) as b from t1 where a=0 having b >=0;
drop table t1;
#
@@ -59,7 +63,12 @@ select Fld1, max(Fld2) as q from t1 group by Fld1 having q is not null;
select Fld1, max(Fld2) from t1 group by Fld1 having max(Fld2) is not null;
select Fld1, max(Fld2) from t1 group by Fld1 having avg(Fld2) is not null;
select Fld1, max(Fld2) from t1 group by Fld1 having std(Fld2) is not null;
+select Fld1, max(Fld2) from t1 group by Fld1 having variance(Fld2) is not null;
drop table t1;
+
+#
+# Test problem with count(distinct) in having
+#
create table t1 (id int not null, qty int not null);
insert into t1 values (1,2),(1,3),(2,4),(2,5);
select id, sum(qty) as sqty from t1 group by id having sqty>2;
@@ -75,12 +84,12 @@ drop table t1;
CREATE TABLE t1 (
`id` bigint(20) NOT NULL default '0',
`description` text
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
CREATE TABLE t2 (
`id` bigint(20) NOT NULL default '0',
`description` varchar(20)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1, 'test');
INSERT INTO t2 VALUES (1, 'test');
@@ -88,7 +97,7 @@ INSERT INTO t2 VALUES (1, 'test');
CREATE TABLE t3 (
`id` bigint(20) NOT NULL default '0',
`order_id` bigint(20) NOT NULL default '0'
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
select
a.id, a.description,
@@ -112,3 +121,4 @@ select
from t1 a left join t3 b on a.id=b.order_id
group by a.id, a.description
having (a.description is not null) and (c=0);
+drop table t1,t2,t3;
diff --git a/mysql-test/t/heap.test b/mysql-test/t/heap.test
index 943910b7872..bc0b28370ec 100644
--- a/mysql-test/t/heap.test
+++ b/mysql-test/t/heap.test
@@ -2,8 +2,11 @@
# Test of heap tables.
#
+--disable_warnings
drop table if exists t1;
-create table t1 (a int not null,b int not null, primary key (a)) type=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100;
+--enable_warnings
+
+create table t1 (a int not null,b int not null, primary key (a)) engine=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100;
insert into t1 values(1,1),(2,2),(3,3),(4,4);
delete from t1 where a=1 or a=0;
#show table status like "t1";
@@ -17,20 +20,20 @@ select * from t1;
alter table t1 add c int not null, add key (c,a);
drop table t1;
-create table t1 (a int not null,b int not null, primary key (a)) type=memory comment="testing heaps";
+create table t1 (a int not null,b int not null, primary key (a)) engine=memory comment="testing heaps";
insert into t1 values(1,1),(2,2),(3,3),(4,4);
delete from t1 where a > 0;
select * from t1;
drop table t1;
-create table t1 (a int not null,b int not null, primary key (a)) type=heap comment="testing heaps";
+create table t1 (a int not null,b int not null, primary key (a)) engine=heap comment="testing heaps";
insert into t1 values(1,1),(2,2),(3,3),(4,4);
-alter table t1 modify a int not null auto_increment, type=myisam, comment="new myisam table";
+alter table t1 modify a int not null auto_increment, engine=myisam, comment="new myisam table";
#show table status like "t1";
select * from t1;
drop table t1;
-create table t1 (a int not null) type=heap;
+create table t1 (a int not null) engine=heap;
insert into t1 values (869751),(736494),(226312),(802616);
select * from t1 where a > 736494;
alter table t1 add unique uniq_id(a);
@@ -38,31 +41,31 @@ select * from t1 where a > 736494;
select * from t1 where a = 736494;
select * from t1 where a=869751 or a=736494;
select * from t1 where a in (869751,736494,226312,802616);
-alter table t1 type=myisam;
+alter table t1 engine=myisam;
explain select * from t1 where a in (869751,736494,226312,802616);
drop table t1;
-create table t1 (x int not null, y int not null, key x(x), unique y(y))
-type=heap;
+create table t1 (x int not null, y int not null, key x (x), unique y (y))
+engine=heap;
insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6);
select * from t1 where x=1;
select * from t1,t1 as t2 where t1.x=t2.y;
explain select * from t1,t1 as t2 where t1.x=t2.y;
drop table t1;
-create table t1 (a int) type=heap;
+create table t1 (a int) engine=heap;
insert into t1 values(1);
select max(a) from t1;
drop table t1;
-CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key(a), key(b) ) TYPE=HEAP;
+CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key(a), key(b) ) ENGINE=HEAP;
insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
select * from t1 where a=1;
insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
select * from t1 where a=1;
drop table t1;
-create table t1 (id int unsigned not null, primary key (id)) type=HEAP;
+create table t1 (id int unsigned not null, primary key (id)) engine=HEAP;
insert into t1 values(1);
select max(id) from t1;
insert into t1 values(2);
@@ -70,16 +73,16 @@ select max(id) from t1;
replace into t1 values(1);
drop table t1;
-create table t1 (n int) type=heap;
+create table t1 (n int) engine=heap;
drop table t1;
-create table t1 (n int) type=heap;
+create table t1 (n int) engine=heap;
drop table if exists t1;
# Test of non unique index
CREATE table t1(f1 int not null,f2 char(20) not
-null,index(f2)) type=heap;
+null,index(f2)) engine=heap;
INSERT into t1 set f1=12,f2="bill";
INSERT into t1 set f1=13,f2="bill";
INSERT into t1 set f1=14,f2="bill";
@@ -97,12 +100,12 @@ drop table t1;
# Test when using part key searches
#
-create table t1 (btn char(10) not null, key(btn)) type=heap;
+create table t1 (btn char(10) not null, key(btn)) engine=heap;
insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
explain select * from t1 where btn like "q%";
select * from t1 where btn like "q%";
alter table t1 add column new_col char(1) not null, add key (btn,new_col), drop key btn;
-update t1 set new_col=btn;
+update t1 set new_col=left(btn,1);
explain select * from t1 where btn="a";
explain select * from t1 where btn="a" and new_col="a";
drop table t1;
@@ -116,7 +119,7 @@ CREATE TABLE t1 (
b int default NULL,
KEY a (a),
UNIQUE b (b)
-) type=heap;
+) engine=heap;
INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3);
SELECT * FROM t1 WHERE a=NULL;
explain SELECT * FROM t1 WHERE a IS NULL;
@@ -132,7 +135,7 @@ DROP TABLE t1;
CREATE TABLE t1 (
a int default NULL,
key a (a)
-) TYPE=HEAP;
+) ENGINE=HEAP;
INSERT INTO t1 VALUES (10), (10), (10);
EXPLAIN SELECT * FROM t1 WHERE a=10;
SELECT * FROM t1 WHERE a=10;
@@ -142,7 +145,7 @@ DROP TABLE t1;
# Test when deleting all rows
#
-CREATE TABLE t1 (a int not null, primary key(a)) type=heap;
+CREATE TABLE t1 (a int not null, primary key(a)) engine=heap;
INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11);
DELETE from t1 where a < 100;
SELECT * from t1;
@@ -156,17 +159,37 @@ CREATE TABLE `job_titles` (
`job_title` char(18) NOT NULL default '',
PRIMARY KEY (`job_title_id`),
UNIQUE KEY `job_title_id` (`job_title_id`,`job_title`)
-) TYPE=HEAP;
+) ENGINE=HEAP;
SELECT MAX(job_title_id) FROM job_titles;
DROP TABLE job_titles;
#
+# Test of delete with NOT NULL
+# (Bug #6082)
+#
+
+CREATE TABLE t1 (a INT NOT NULL, B INT, KEY(B)) ENGINE=HEAP;
+INSERT INTO t1 VALUES(1,1), (1,NULL);
+SELECT * FROM t1 WHERE B is not null;
+DROP TABLE t1;
+
+#
+# Bug #6748
+# heap_rfirst() doesn't work (and never did!)
+#
+CREATE TABLE t1 (pseudo char(35) PRIMARY KEY, date int(10) unsigned NOT NULL) ENGINE=HEAP;
+INSERT INTO t1 VALUES ('massecot',1101106491),('altec',1101106492),('stitch+',1101106304),('Seb Corgan',1101106305),('beerfilou',1101106263),('flaker',1101106529),('joce8',5),('M4vrick',1101106418),('gabay008',1101106525),('Vamp irX',1101106291),('ZoomZip',1101106546),('rip666',1101106502),('CBP ',1101106397),('guezpard',1101106496);
+DELETE FROM t1 WHERE date<1101106546;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+#
# Bug #6878: a problem with small length records
#
-create table t1(a char(2)) type=heap;
+create table t1(a char(2)) engine=memory;
insert into t1 values (NULL), (NULL);
delete from t1 where a is null;
insert into t1 values ('2'), ('3');
diff --git a/mysql-test/t/heap_auto_increment.test b/mysql-test/t/heap_auto_increment.test
new file mode 100644
index 00000000000..9d0fefa4d52
--- /dev/null
+++ b/mysql-test/t/heap_auto_increment.test
@@ -0,0 +1,33 @@
+#
+# Test of auto_increment; The test for BDB tables is in bdb.test
+#
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+create table t1 (a int not null auto_increment,b int, primary key (a)) engine=heap auto_increment=3;
+insert into t1 values (1,1),(NULL,3),(NULL,4);
+delete from t1 where a=4;
+insert into t1 values (NULL,5),(NULL,6);
+select * from t1;
+delete from t1 where a=6;
+#show table status like "t1";
+replace t1 values (3,1);
+ALTER TABLE t1 add c int;
+replace t1 values (3,3,3);
+insert into t1 values (NULL,7,7);
+update t1 set a=8,b=b+1,c=c+1 where a=7;
+insert into t1 values (NULL,9,9);
+select * from t1;
+drop table t1;
+
+create table t1 (
+ skey tinyint unsigned NOT NULL auto_increment PRIMARY KEY,
+ sval char(20)
+) engine=heap;
+insert into t1 values (NULL, "hello");
+insert into t1 values (NULL, "hey");
+select * from t1;
+select _rowid,t1._rowid,skey,sval from t1;
+drop table t1;
diff --git a/mysql-test/t/heap_btree.test b/mysql-test/t/heap_btree.test
new file mode 100644
index 00000000000..d156d059634
--- /dev/null
+++ b/mysql-test/t/heap_btree.test
@@ -0,0 +1,165 @@
+#
+# Test of heap tables.
+#
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+create table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100;
+insert into t1 values(1,1),(2,2),(3,3),(4,4);
+delete from t1 where a=1 or a=0;
+#show table status like "t1";
+show keys from t1;
+select * from t1;
+select * from t1 where a=4;
+update t1 set b=5 where a=4;
+update t1 set b=b+1 where a>=3;
+replace t1 values (3,3);
+select * from t1;
+alter table t1 add c int not null, add key using BTREE (c,a);
+drop table t1;
+
+create table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps";
+insert into t1 values(-2,-2),(-1,-1),(0,0),(1,1),(2,2),(3,3),(4,4);
+delete from t1 where a > -3;
+select * from t1;
+drop table t1;
+
+create table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps";
+insert into t1 values(1,1),(2,2),(3,3),(4,4);
+alter table t1 modify a int not null auto_increment, engine=myisam, comment="new myisam table";
+#show table status like "t1";
+select * from t1;
+drop table t1;
+
+create table t1 (a int not null) engine=heap;
+insert into t1 values (869751),(736494),(226312),(802616);
+select * from t1 where a > 736494;
+alter table t1 add unique uniq_id using BTREE (a);
+select * from t1 where a > 736494;
+select * from t1 where a = 736494;
+select * from t1 where a=869751 or a=736494;
+select * from t1 where a in (869751,736494,226312,802616);
+alter table t1 engine=myisam;
+explain select * from t1 where a in (869751,736494,226312,802616);
+drop table t1;
+
+create table t1 (x int not null, y int not null, key x using BTREE (x,y), unique y using BTREE (y))
+engine=heap;
+insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6);
+explain select * from t1 where x=1;
+select * from t1 where x=1;
+select * from t1,t1 as t2 where t1.x=t2.y;
+explain select * from t1,t1 as t2 where t1.x=t2.y;
+drop table t1;
+
+create table t1 (a int) engine=heap;
+insert into t1 values(1);
+select max(a) from t1;
+drop table t1;
+
+CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key using BTREE (a,b), key using BTREE (b) ) ENGINE=HEAP;
+insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
+select * from t1 where a=1;
+insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
+select * from t1 where a=1;
+--replace_result 0 x 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x 11 x 12 x 13 x 14 x
+explain select * from t1 where a=1 order by a,b;
+--replace_result 0 x 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x 11 x 12 x 13 x 14 x
+explain select * from t1 where a=1 order by b;
+select * from t1 where b=1;
+--replace_result 0 x 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x 11 x 12 x 13 x 14 x
+explain select * from t1 where b=1;
+drop table t1;
+
+create table t1 (id int unsigned not null, primary key using BTREE (id)) engine=HEAP;
+insert into t1 values(1);
+select max(id) from t1;
+insert into t1 values(2);
+select max(id) from t1;
+replace into t1 values(1);
+drop table t1;
+
+create table t1 (n int) engine=heap;
+drop table t1;
+
+create table t1 (n int) engine=heap;
+drop table if exists t1;
+
+# Test of non unique index
+
+CREATE table t1(f1 int not null,f2 char(20) not
+null,index(f2)) engine=heap;
+INSERT into t1 set f1=12,f2="bill";
+INSERT into t1 set f1=13,f2="bill";
+INSERT into t1 set f1=14,f2="bill";
+INSERT into t1 set f1=15,f2="bill";
+INSERT into t1 set f1=16,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+delete from t1 where f2="bill";
+select * from t1;
+drop table t1;
+
+#
+# Test when using part key searches
+#
+
+create table t1 (btn char(10) not null, key using BTREE (btn)) engine=heap;
+insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
+explain select * from t1 where btn like "i%";
+--replace_column 9 #
+explain select * from t1 where btn like "h%";
+explain select * from t1 where btn like "a%";
+explain select * from t1 where btn like "b%";
+# For the following the BTREE MAY notice that there is no possible matches
+select * from t1 where btn like "ff%";
+select * from t1 where btn like " %";
+select * from t1 where btn like "q%";
+alter table t1 add column new_col char(1) not null, add key using BTREE (btn,new_col), drop key btn;
+update t1 set new_col=left(btn,1);
+explain select * from t1 where btn="a";
+explain select * from t1 where btn="a" and new_col="a";
+drop table t1;
+
+#
+# Test of NULL keys
+#
+
+CREATE TABLE t1 (
+ a int default NULL,
+ b int default NULL,
+ KEY a using BTREE (a),
+ UNIQUE b using BTREE (b)
+) engine=heap;
+INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3);
+SELECT * FROM t1 WHERE a=NULL;
+explain SELECT * FROM t1 WHERE a IS NULL;
+SELECT * FROM t1 WHERE a<=>NULL;
+SELECT * FROM t1 WHERE b=NULL;
+explain SELECT * FROM t1 WHERE b IS NULL;
+SELECT * FROM t1 WHERE b<=>NULL;
+
+--error 1062
+INSERT INTO t1 VALUES (1,3);
+DROP TABLE t1;
+
+CREATE TABLE t1 (a int, b int, c int, key using BTREE (a, b, c)) engine=heap;
+INSERT INTO t1 VALUES (1, NULL, NULL), (1, 1, NULL), (1, NULL, 1);
+SELECT * FROM t1 WHERE a=1 and b IS NULL;
+SELECT * FROM t1 WHERE a=1 and c IS NULL;
+SELECT * FROM t1 WHERE a=1 and b IS NULL and c IS NULL;
+DROP TABLE t1;
+
+#
+# Test when deleting all rows
+#
+
+CREATE TABLE t1 (a int not null, primary key using BTREE (a)) engine=heap;
+INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11);
+DELETE from t1 where a < 100;
+SELECT * from t1;
+DROP TABLE t1;
diff --git a/mysql-test/t/heap_hash.test b/mysql-test/t/heap_hash.test
new file mode 100644
index 00000000000..6d8fdec4b9e
--- /dev/null
+++ b/mysql-test/t/heap_hash.test
@@ -0,0 +1,253 @@
+#
+# Test of heap tables.
+#
+
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
+create table t1 (a int not null,b int not null, primary key using HASH (a)) engine=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100;
+insert into t1 values(1,1),(2,2),(3,3),(4,4);
+delete from t1 where a=1 or a=0;
+#show table status like "t1";
+show keys from t1;
+select * from t1;
+select * from t1 where a=4;
+update t1 set b=5 where a=4;
+update t1 set b=b+1 where a>=3;
+replace t1 values (3,3);
+select * from t1;
+alter table t1 add c int not null, add key using HASH (c,a);
+drop table t1;
+
+create table t1 (a int not null,b int not null, primary key using HASH (a)) engine=heap comment="testing heaps";
+insert into t1 values(1,1),(2,2),(3,3),(4,4);
+delete from t1 where a > 0;
+select * from t1;
+drop table t1;
+
+create table t1 (a int not null,b int not null, primary key using HASH (a)) engine=heap comment="testing heaps";
+insert into t1 values(1,1),(2,2),(3,3),(4,4);
+alter table t1 modify a int not null auto_increment, engine=myisam, comment="new myisam table";
+#show table status like "t1";
+select * from t1;
+drop table t1;
+
+create table t1 (a int not null) engine=heap;
+insert into t1 values (869751),(736494),(226312),(802616);
+select * from t1 where a > 736494;
+alter table t1 add unique uniq_id using HASH (a);
+select * from t1 where a > 736494;
+select * from t1 where a = 736494;
+select * from t1 where a=869751 or a=736494;
+select * from t1 where a in (869751,736494,226312,802616);
+alter table t1 engine=myisam;
+explain select * from t1 where a in (869751,736494,226312,802616);
+drop table t1;
+
+create table t1 (x int not null, y int not null, key x using HASH (x), unique y using HASH (y))
+engine=heap;
+insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6);
+select * from t1 where x=1;
+select * from t1,t1 as t2 where t1.x=t2.y;
+explain select * from t1,t1 as t2 where t1.x=t2.y;
+drop table t1;
+
+create table t1 (a int) engine=heap;
+insert into t1 values(1);
+select max(a) from t1;
+drop table t1;
+
+CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key using HASH (a), key using HASH (b) ) ENGINE=HEAP;
+insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
+select * from t1 where a=1;
+insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
+select * from t1 where a=1;
+drop table t1;
+
+create table t1 (id int unsigned not null, primary key using HASH (id)) engine=HEAP;
+insert into t1 values(1);
+select max(id) from t1;
+insert into t1 values(2);
+select max(id) from t1;
+replace into t1 values(1);
+drop table t1;
+
+create table t1 (n int) engine=heap;
+drop table t1;
+
+create table t1 (n int) engine=heap;
+drop table if exists t1;
+
+# Test of non unique index
+
+CREATE table t1(f1 int not null,f2 char(20) not
+null,index(f2)) engine=heap;
+INSERT into t1 set f1=12,f2="bill";
+INSERT into t1 set f1=13,f2="bill";
+INSERT into t1 set f1=14,f2="bill";
+INSERT into t1 set f1=15,f2="bill";
+INSERT into t1 set f1=16,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+delete from t1 where f2="bill";
+select * from t1;
+drop table t1;
+
+#
+# Test when using part key searches
+#
+
+create table t1 (btn char(10) not null, key using HASH (btn)) engine=heap;
+insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
+explain select * from t1 where btn like "q%";
+select * from t1 where btn like "q%";
+alter table t1 add column new_col char(1) not null, add key using HASH (btn,new_col), drop key btn;
+update t1 set new_col=left(btn,1);
+explain select * from t1 where btn="a";
+explain select * from t1 where btn="a" and new_col="a";
+drop table t1;
+
+#
+# Test of NULL keys
+#
+
+CREATE TABLE t1 (
+ a int default NULL,
+ b int default NULL,
+ KEY a using HASH (a),
+ UNIQUE b using HASH (b)
+) engine=heap;
+INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3);
+SELECT * FROM t1 WHERE a=NULL;
+explain SELECT * FROM t1 WHERE a IS NULL;
+SELECT * FROM t1 WHERE a<=>NULL;
+SELECT * FROM t1 WHERE b=NULL;
+explain SELECT * FROM t1 WHERE b IS NULL;
+SELECT * FROM t1 WHERE b<=>NULL;
+
+--error 1062
+INSERT INTO t1 VALUES (1,3);
+DROP TABLE t1;
+
+#
+# Test when deleting all rows
+#
+
+CREATE TABLE t1 (a int not null, primary key using HASH (a)) engine=heap;
+INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11);
+DELETE from t1 where a < 100;
+SELECT * from t1;
+DROP TABLE t1;
+
+
+#
+# Hash index # records estimate test
+#
+create table t1
+(
+ a char(8) not null,
+ b char(20) not null,
+ c int not null,
+ key (a)
+) engine=heap;
+
+insert into t1 values ('aaaa', 'prefill-hash=5',0);
+insert into t1 values ('aaab', 'prefill-hash=0',0);
+insert into t1 values ('aaac', 'prefill-hash=7',0);
+insert into t1 values ('aaad', 'prefill-hash=2',0);
+insert into t1 values ('aaae', 'prefill-hash=1',0);
+insert into t1 values ('aaaf', 'prefill-hash=4',0);
+insert into t1 values ('aaag', 'prefill-hash=3',0);
+insert into t1 values ('aaah', 'prefill-hash=6',0);
+
+explain select * from t1 where a='aaaa';
+explain select * from t1 where a='aaab';
+explain select * from t1 where a='aaac';
+explain select * from t1 where a='aaad';
+insert into t1 select * from t1;
+
+explain select * from t1 where a='aaaa';
+explain select * from t1 where a='aaab';
+explain select * from t1 where a='aaac';
+explain select * from t1 where a='aaad';
+
+# a known effect: table reload causes statistics to be updated:
+flush tables;
+explain select * from t1 where a='aaaa';
+explain select * from t1 where a='aaab';
+explain select * from t1 where a='aaac';
+explain select * from t1 where a='aaad';
+
+# Check if delete_all_rows() updates #hash_buckets
+create table t2 as select * from t1;
+delete from t1;
+insert into t1 select * from t2;
+explain select * from t1 where a='aaaa';
+explain select * from t1 where a='aaab';
+explain select * from t1 where a='aaac';
+explain select * from t1 where a='aaad';
+drop table t1, t2;
+
+
+# Btree and hash index use costs.
+create table t1 (
+ id int unsigned not null primary key auto_increment,
+ name varchar(20) not null,
+ index heap_idx(name),
+ index btree_idx using btree(name)
+) engine=heap;
+
+create table t2 (
+ id int unsigned not null primary key auto_increment,
+ name varchar(20) not null,
+ index btree_idx using btree(name),
+ index heap_idx(name)
+) engine=heap;
+
+insert into t1 (name) values ('Matt'), ('Lilu'), ('Corbin'), ('Carly'),
+ ('Suzy'), ('Hoppy'), ('Burrito'), ('Mimi'), ('Sherry'), ('Ben'), ('Phil'),
+ ('Emily'), ('Mike');
+insert into t2 select * from t1;
+explain select * from t1 where name='matt';
+explain select * from t2 where name='matt';
+
+explain select * from t1 where name='Lilu';
+explain select * from t2 where name='Lilu';
+
+explain select * from t1 where name='Phil';
+explain select * from t2 where name='Phil';
+
+explain select * from t1 where name='Lilu';
+explain select * from t2 where name='Lilu';
+
+insert into t1 (name) select name from t2;
+insert into t1 (name) select name from t2;
+insert into t1 (name) select name from t2;
+insert into t1 (name) select name from t2;
+insert into t1 (name) select name from t2;
+insert into t1 (name) select name from t2;
+flush tables;
+select count(*) from t1 where name='Matt';
+explain select * from t1 ignore index (btree_idx) where name='matt';
+show index from t1;
+
+show index from t1;
+
+create table t3
+(
+ a varchar(20) not null,
+ b varchar(20) not null,
+ key (a,b)
+) engine=heap;
+insert into t3 select name, name from t1;
+show index from t3;
+show index from t3;
+
+# test rec_per_key use for joins.
+explain select * from t1 ignore key(btree_idx), t3 where t1.name='matt' and t3.a = concat('',t1.name) and t3.b=t1.name;
+
+drop table t1, t2, t3;
+
diff --git a/mysql-test/t/help.test b/mysql-test/t/help.test
new file mode 100644
index 00000000000..3f3e99e1556
--- /dev/null
+++ b/mysql-test/t/help.test
@@ -0,0 +1,115 @@
+# category: topic: keyword:
+#
+# impossible_category_1
+# impossible_function_1
+# impossible_function_5
+# impossible_function_2
+# impossible_function_1
+# impossible_category_2
+# impossible_function_3
+# impossible_function_6
+# impossible_function_4
+# impossible_function_6
+# impossible_category_3
+# impossible_function_7
+
+insert into mysql.help_category(help_category_id,name)values(1,'impossible_category_1');
+select @category1_id:= 1;
+insert into mysql.help_category(help_category_id,name)values(2,'impossible_category_2');
+select @category2_id:= 2;
+insert into mysql.help_category(help_category_id,name,parent_category_id)values(3,'impossible_category_3',@category2_id);
+select @category3_id:= 3;
+
+insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(1,'impossible_function_1',@category1_id,'description of \n impossible_function1\n','example of \n impossible_function1');
+select @topic1_id:= 1;
+insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(2,'impossible_function_2',@category1_id,'description of \n impossible_function2\n','example of \n impossible_function2');
+select @topic2_id:= 2;
+insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(3,'impossible_function_3',@category2_id,'description of \n impossible_function3\n','example of \n impossible_function3');
+select @topic3_id:= 3;
+insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(4,'impossible_function_4',@category2_id,'description of \n impossible_function4\n','example of \n impossible_function4');
+select @topic4_id:= 4;
+insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(5,'impossible_function_7',@category3_id,'description of \n impossible_function5\n','example of \n impossible_function7');
+select @topic5_id:= 5;
+
+insert into mysql.help_keyword(help_keyword_id,name)values(1,'impossible_function_1');
+select @keyword1_id:= 1;
+insert into mysql.help_keyword(help_keyword_id,name)values(2,'impossible_function_5');
+select @keyword2_id:= 2;
+insert into mysql.help_keyword(help_keyword_id,name)values(3,'impossible_function_6');
+select @keyword3_id:= 3;
+
+insert into mysql.help_relation(help_keyword_id,help_topic_id)values(@keyword1_id,@topic2_id);
+insert into mysql.help_relation(help_keyword_id,help_topic_id)values(@keyword2_id,@topic1_id);
+insert into mysql.help_relation(help_keyword_id,help_topic_id)values(@keyword3_id,@topic3_id);
+insert into mysql.help_relation(help_keyword_id,help_topic_id)values(@keyword3_id,@topic4_id);
+
+##############
+help 'function_of_my_dream';
+help '%possible_f%';
+help 'impossible_func%';
+help 'impossible_category%';
+help 'impossible_%';
+
+help '%function_1';
+help '%function_2';
+help '%function_3';
+help '%function_4';
+help '%function_5';
+help '%function_6';
+help '%function_7';
+
+help '%category_2';
+help 'impossible_function_1';
+help 'impossible_category_1';
+##############
+
+--disable_warnings
+alter table mysql.help_relation engine=innodb;
+alter table mysql.help_keyword engine=innodb;
+alter table mysql.help_topic engine=innodb;
+alter table mysql.help_category engine=innodb;
+--enable_warnings
+
+##############
+help 'function_of_my_dream';
+help '%possible_f%';
+help 'impossible_func%';
+help 'impossible_category%';
+help 'impossible_%';
+
+help '%function_1';
+help '%function_2';
+help '%function_3';
+help '%function_4';
+help '%function_5';
+help '%function_6';
+help '%function_7';
+
+help '%category_2';
+help 'impossible_function_1';
+help 'impossible_category_1';
+##############
+
+alter table mysql.help_relation engine=myisam;
+alter table mysql.help_keyword engine=myisam;
+alter table mysql.help_topic engine=myisam;
+alter table mysql.help_category engine=myisam;
+
+delete from mysql.help_topic where help_topic_id=@topic1_id;
+delete from mysql.help_topic where help_topic_id=@topic2_id;
+delete from mysql.help_topic where help_topic_id=@topic3_id;
+delete from mysql.help_topic where help_topic_id=@topic4_id;
+delete from mysql.help_topic where help_topic_id=@topic5_id;
+
+delete from mysql.help_category where help_category_id=@category3_id;
+delete from mysql.help_category where help_category_id=@category2_id;
+delete from mysql.help_category where help_category_id=@category1_id;
+
+delete from mysql.help_keyword where help_keyword_id=@keyword1_id;
+delete from mysql.help_keyword where help_keyword_id=@keyword2_id;
+delete from mysql.help_keyword where help_keyword_id=@keyword3_id;
+
+delete from mysql.help_relation where help_keyword_id=@keyword1_id and help_topic_id=@topic2_id;
+delete from mysql.help_relation where help_keyword_id=@keyword2_id and help_topic_id=@topic1_id;
+delete from mysql.help_relation where help_keyword_id=@keyword3_id and help_topic_id=@topic3_id;
+delete from mysql.help_relation where help_keyword_id=@keyword3_id and help_topic_id=@topic4_id;
diff --git a/mysql-test/t/init_connect-master.opt b/mysql-test/t/init_connect-master.opt
new file mode 100644
index 00000000000..108a8687aa2
--- /dev/null
+++ b/mysql-test/t/init_connect-master.opt
@@ -0,0 +1 @@
+--set-variable=init_connect="set @a='a\\0c'"
diff --git a/mysql-test/t/init_connect.test b/mysql-test/t/init_connect.test
new file mode 100644
index 00000000000..29962abc04d
--- /dev/null
+++ b/mysql-test/t/init_connect.test
@@ -0,0 +1,34 @@
+#
+# Test of init_connect variable
+#
+
+connect (con0,localhost,root,,);
+connection con0;
+select hex(@a);
+connect (con1,localhost,user_1,,);
+connection con1;
+select hex(@a);
+connection con0;
+set global init_connect="set @a=2;set @b=3";
+connect (con2,localhost,user_1,,);
+connection con2;
+select @a, @b;
+connection con0;
+set GLOBAL init_connect=DEFAULT;
+connect (con3,localhost,user_1,,);
+connection con3;
+select @a;
+connection con0;
+set global init_connect="create table t1(a char(10));\
+insert into t1 values ('\0');insert into t1 values('abc')";
+connect (con4,localhost,user_1,,);
+connection con4;
+select hex(a) from t1;
+connection con0;
+set GLOBAL init_connect="adsfsdfsdfs";
+connect (con5,localhost,user_1,,);
+connection con5;
+--error 2013,2006
+select @a;
+connection con0;
+drop table t1;
diff --git a/mysql-test/t/innodb-deadlock.test b/mysql-test/t/innodb-deadlock.test
index bc2839bfb3a..8a36982b0c1 100644
--- a/mysql-test/t/innodb-deadlock.test
+++ b/mysql-test/t/innodb-deadlock.test
@@ -2,14 +2,17 @@
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
-drop table if exists t1;
+
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
#
# Testing of FOR UPDATE
#
connection con1;
-create table t1 (id integer, x integer) type=INNODB;
+create table t1 (id integer, x integer) engine=INNODB;
insert into t1 values(0, 0);
set autocommit=0;
SELECT * from t1 where id = 0 FOR UPDATE;
@@ -36,3 +39,75 @@ select * from t1;
commit;
drop table t1;
+#
+# Testing of FOR UPDATE
+#
+
+connection con1;
+create table t1 (id integer, x integer) engine=INNODB;
+create table t2 (b integer, a integer) engine=INNODB;
+insert into t1 values(0, 0), (300, 300);
+insert into t2 values(0, 10), (1, 20), (2, 30);
+commit;
+set autocommit=0;
+select * from t2;
+update t2 set a=100 where b=(SELECT x from t1 where id = b FOR UPDATE);
+select * from t2;
+select * from t1;
+
+connection con2;
+set autocommit=0;
+
+# The following query should hang because con1 is locking the page
+--send
+update t1 set x=2 where id = 0;
+--sleep 2;
+
+connection con1;
+update t1 set x=1 where id = 0;
+select * from t1;
+commit;
+
+connection con2;
+reap;
+commit;
+
+connection con1;
+select * from t1;
+commit;
+
+drop table t1, t2;
+create table t1 (id integer, x integer) engine=INNODB;
+create table t2 (b integer, a integer) engine=INNODB;
+insert into t1 values(0, 0), (300, 300);
+insert into t2 values(0, 0), (1, 20), (2, 30);
+commit;
+
+connection con1;
+select a,b from t2 UNION SELECT id, x from t1 FOR UPDATE;
+select * from t2;
+select * from t1;
+
+connection con2;
+
+# The following query should hang because con1 is locking the page
+update t2 set a=2 where b = 0;
+select * from t2;
+--send
+update t1 set x=2 where id = 0;
+--sleep 2;
+
+connection con1;
+update t1 set x=1 where id = 0;
+select * from t1;
+commit;
+
+connection con2;
+reap;
+commit;
+
+connection con1;
+select * from t1;
+commit;
+
+drop table t1, t2;
diff --git a/mysql-test/t/innodb-master.opt b/mysql-test/t/innodb-master.opt
new file mode 100644
index 00000000000..4cb927540bf
--- /dev/null
+++ b/mysql-test/t/innodb-master.opt
@@ -0,0 +1 @@
+--binlog_cache_size=32768
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index 34eabcc22df..cf7be4f882c 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -4,10 +4,12 @@
# Small basic test with ignore
#
-drop table if exists t1,t2,t3;
+--disable_warnings
+drop table if exists t1,t2,t3,t4;
drop database if exists mysqltest;
+--enable_warnings
-create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=innodb;
+create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb;
insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt');
select id, code, name from t1 order by id;
@@ -21,6 +23,8 @@ drop table t1;
#
# A bit bigger test
+# The 'replace_column' statements are needed because the cardinality calculated
+# by innodb is not always the same between runs
#
CREATE TABLE t1 (
@@ -30,7 +34,7 @@ CREATE TABLE t1 (
PRIMARY KEY (id),
KEY parent_id (parent_id),
KEY level (level)
-) type=innodb;
+) engine=innodb;
INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2);
update t1 set parent_id=parent_id+100;
select * from t1 where parent_id=102;
@@ -42,12 +46,17 @@ update ignore t1 set id=id+1; # This will change all rows
select * from t1;
update ignore t1 set id=1023 where id=1010;
select * from t1 where parent_id=102;
-# explain select level from t1 where level=1;
-# explain select level,id from t1 where level=1;
-# explain select level,id,parent_id from t1 where level=1;
+--replace_column 9 #
+explain select level from t1 where level=1;
+--replace_column 9 #
+explain select level,id from t1 where level=1;
+--replace_column 9 #
+explain select level,id,parent_id from t1 where level=1;
select level,id from t1 where level=1;
select level,id,parent_id from t1 where level=1;
optimize table t1;
+--replace_column 7 #
+show keys from t1;
drop table t1;
#
@@ -58,7 +67,7 @@ CREATE TABLE t1 (
gesuchnr int(11) DEFAULT '0' NOT NULL,
benutzer_id int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (gesuchnr,benutzer_id)
-) type=innodb;
+) engine=innodb;
replace into t1 (gesuchnr,benutzer_id) values (2,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
@@ -70,7 +79,7 @@ drop table t1;
# test delete using hidden_primary_key
#
-create table t1 (a int) type=innodb;
+create table t1 (a int) engine=innodb;
insert into t1 values (1), (2);
optimize table t1;
delete from t1 where a = 1;
@@ -78,19 +87,21 @@ select * from t1;
check table t1;
drop table t1;
-create table t1 (a int,b varchar(20)) type=innodb;
+create table t1 (a int,b varchar(20)) engine=innodb;
insert into t1 values (1,""), (2,"testing");
delete from t1 where a = 1;
select * from t1;
create index skr on t1 (a);
insert into t1 values (3,""), (4,"testing");
analyze table t1;
+--replace_column 7 #
+show keys from t1;
drop table t1;
# Test of reading on secondary key with may be null
-create table t1 (a int,b varchar(20),key(a)) type=innodb;
+create table t1 (a int,b varchar(20),key(a)) engine=innodb;
insert into t1 values (1,""), (2,"testing");
select * from t1 where a = 1;
drop table t1;
@@ -99,7 +110,7 @@ drop table t1;
# Test rollback
#
-create table t1 (n int not null primary key) type=innodb;
+create table t1 (n int not null primary key) engine=innodb;
set autocommit=0;
insert into t1 values (4);
rollback;
@@ -123,10 +134,27 @@ rollback;
drop table t1;
#
+# Test for commit and FLUSH TABLES WITH READ LOCK
+#
+
+create table t1 (n int not null primary key) engine=innodb;
+start transaction;
+insert into t1 values (4);
+flush tables with read lock;
+#
+# Current code can't handle a read lock in middle of transaction
+#--error 1223;
+commit;
+unlock tables;
+commit;
+select * from t1;
+drop table t1;
+
+#
# Testing transactions
#
-create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) type=innodb;
+create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) engine=innodb;
begin;
insert into t1 values(1,'hamdouni');
select id as afterbegin_id,nom as afterbegin_nom from t1;
@@ -144,7 +172,7 @@ drop table t1;
# Simple not autocommit test
#
-CREATE TABLE t1 (id char(8) not null primary key, val int not null) type=innodb;
+CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=innodb;
insert into t1 values ('pippo', 12);
-- error 1062
insert into t1 values ('pippo', 12); # Gives error
@@ -166,10 +194,10 @@ drop table t1;
# Test of active transactions
#
-create table t1 (a integer) type=innodb;
+create table t1 (a integer) engine=innodb;
start transaction;
rename table t1 to t2;
-create table t1 (b integer) type=innodb;
+create table t1 (b integer) engine=innodb;
insert into t1 values (1);
rollback;
drop table t1;
@@ -181,12 +209,12 @@ set autocommit=1;
# The following simple tests failed at some point
#
-CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) TYPE=innodb;
+CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) ENGINE=innodb;
INSERT INTO t1 VALUES (1, 'Jochen');
select * from t1;
drop table t1;
-CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) TYPE=innodb;
+CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) ENGINE=innodb;
set autocommit=0;
INSERT INTO t1 SET _userid='marc@anyware.co.uk';
COMMIT;
@@ -205,7 +233,7 @@ CREATE TABLE t1 (
ref_email varchar(100) DEFAULT '' NOT NULL,
detail varchar(200),
PRIMARY KEY (user_id,ref_email)
-)type=innodb;
+)engine=innodb;
INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar');
select * from t1 where user_id=10292;
@@ -222,6 +250,8 @@ drop table t1;
CREATE TABLE t1 (a int not null, b int not null,c int not null,
key(a),primary key(a,b), unique(c),key(a),unique(b));
+--replace_column 7 #
+show index from t1;
drop table t1;
#
@@ -229,7 +259,7 @@ drop table t1;
#
create table t1 (col1 int not null, col2 char(4) not null, primary key(col1));
-alter table t1 type=innodb;
+alter table t1 engine=innodb;
insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4');
select * from t1;
update t1 set col2='7' where col1='4';
@@ -244,8 +274,8 @@ drop table t1;
# INSERT INTO innodb tables
#
-create table t1 (a int not null , b int, primary key (a)) type = innodb;
-create table t2 (a int not null , b int, primary key (a)) type = myisam;
+create table t1 (a int not null , b int, primary key (a)) engine = innodb;
+create table t2 (a int not null , b int, primary key (a)) engine = myisam;
insert into t1 VALUES (1,3) , (2,3), (3,3);
select * from t1;
insert into t2 select * from t1;
@@ -268,7 +298,7 @@ CREATE TABLE t1 (
passwd varchar(32) binary DEFAULT '' NOT NULL,
PRIMARY KEY (id),
UNIQUE ggid (ggid)
-) TYPE=innodb;
+) ENGINE=innodb;
insert into t1 (ggid,passwd) values ('test1','xxx');
insert into t1 (ggid,passwd) values ('test2','yyy');
@@ -306,7 +336,7 @@ CREATE TABLE t1 (
approved datetime,
dummy_primary_key int(11) NOT NULL auto_increment,
PRIMARY KEY (dummy_primary_key)
-) TYPE=innodb;
+) ENGINE=innodb;
INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1);
INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2);
INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3);
@@ -326,7 +356,7 @@ CREATE TABLE t1 (
KEY (id),
KEY parent_id (parent_id),
KEY level (level)
-) type=innodb;
+) engine=innodb;
INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1);
INSERT INTO t1 values (179,5,2);
update t1 set parent_id=parent_id+100;
@@ -338,7 +368,8 @@ update ignore t1 set id=id+1; # This will change all rows
select * from t1;
update ignore t1 set id=1023 where id=1010;
select * from t1 where parent_id=102;
-# explain select level from t1 where level=1;
+--replace_column 9 #
+explain select level from t1 where level=1;
select level,id from t1 where level=1;
select level,id,parent_id from t1 where level=1;
select level,id from t1 where level=1 order by id;
@@ -359,7 +390,7 @@ CREATE TABLE t1 (
sca_sch_desc varchar(16),
PRIMARY KEY (sca_code, cat_code, lan_code),
INDEX sca_pic (sca_pic)
-) type = innodb ;
+) engine = innodb ;
INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
select count(*) from t1 where sca_code = 'PD';
@@ -381,7 +412,7 @@ drop table t1;
# Test of opening table twice and timestamps
#
set @a:=now();
-CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) type=innodb;
+CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=innodb;
insert into t1 (a) values(1),(2),(3);
select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a;
update t1 set a=5 where a=1;
@@ -391,16 +422,18 @@ drop table t1;
#
# Test with variable length primary key
#
-create table t1 (a varchar(100) not null, primary key(a), b int not null) type=innodb;
+create table t1 (a varchar(100) not null, primary key(a), b int not null) engine=innodb;
insert into t1 values("hello",1),("world",2);
select * from t1 order by b desc;
optimize table t1;
+--replace_column 7 #
+show keys from t1;
drop table t1;
#
# Test of create index with NULL columns
#
-create table t1 (i int, j int ) TYPE=innodb;
+create table t1 (i int, j int ) ENGINE=innodb;
insert into t1 values (1,2);
select * from t1 where i=1 and j=2;
create index ax1 on t1 (i,j);
@@ -415,7 +448,7 @@ CREATE TABLE t1 (
a int3 unsigned NOT NULL,
b int1 unsigned NOT NULL,
UNIQUE (a, b)
-) TYPE = innodb;
+) ENGINE = innodb;
INSERT INTO t1 VALUES (1, 1);
SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1;
@@ -425,7 +458,7 @@ drop table t1;
# Test INSERT DELAYED
#
-CREATE TABLE t1 (a int unsigned NOT NULL) type=innodb;
+CREATE TABLE t1 (a int unsigned NOT NULL) engine=innodb;
# Can't test this in 3.23
# INSERT DELAYED INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
@@ -437,15 +470,17 @@ DROP TABLE t1;
# Crash when using many tables (Test case by Jeremy D Zawodny)
#
-create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) type = innodb;
+create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) engine = innodb;
insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
+--replace_column 9 #
+explain select * from t1 where a > 0 and a < 50;
drop table t1;
#
# Test lock tables
#
-create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=innodb;
+create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb;
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
LOCK TABLES t1 WRITE;
--error 1062
@@ -455,7 +490,7 @@ select id from t1;
UNLOCK TABLES;
DROP TABLE t1;
-create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=innodb;
+create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb;
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
LOCK TABLES t1 WRITE;
begin;
@@ -469,10 +504,19 @@ UNLOCK TABLES;
DROP TABLE t1;
#
+# Test prefix key
+#
+create table t1 (a char(20), unique (a(5))) engine=innodb;
+drop table t1;
+create table t1 (a char(20), index (a(5))) engine=innodb;
+show create table t1;
+drop table t1;
+
+#
# Test using temporary table and auto_increment
#
-create temporary table t1 (a int not null auto_increment, primary key(a)) type=innodb;
+create temporary table t1 (a int not null auto_increment, primary key(a)) engine=innodb;
insert into t1 values (NULL),(NULL),(NULL);
delete from t1 where a=3;
insert into t1 values (NULL);
@@ -489,7 +533,7 @@ create table t1
value text not null,
uid int not null,
unique key(name,uid)
- ) type=innodb;
+ ) engine=innodb;
insert into t1 values (1,'one','one value',101),
(2,'two','two value',102),(3,'three','three value',103);
set insert_id=5;
@@ -507,22 +551,24 @@ drop table t1;
#
create database mysqltest;
-create table mysqltest.t1 (a int not null) type= innodb;
+create table mysqltest.t1 (a int not null) engine= innodb;
insert into mysqltest.t1 values(1);
-create table mysqltest.t2 (a int not null) type= myisam;
+create table mysqltest.t2 (a int not null) engine= myisam;
insert into mysqltest.t2 values(1);
-create table mysqltest.t3 (a int not null) type= heap;
+create table mysqltest.t3 (a int not null) engine= heap;
insert into mysqltest.t3 values(1);
commit;
drop database mysqltest;
# Don't check error message
+--error 12,12
+show tables from mysqltest;
#
# Test truncate table with and without auto_commit
#
set autocommit=0;
-create table t1 (a int not null) type= innodb;
+create table t1 (a int not null) engine= innodb;
insert into t1 values(1),(2);
--error 1192
truncate table t1;
@@ -536,7 +582,7 @@ commit;
drop table t1;
set autocommit=1;
-create table t1 (a int not null) type= innodb;
+create table t1 (a int not null) engine= innodb;
insert into t1 values(1),(2);
truncate table t1;
insert into t1 values(1),(2);
@@ -551,15 +597,31 @@ drop table t1;
# Test of how ORDER BY works when doing it on the whole table
#
-create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) type=innodb;
+create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=innodb;
insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
+--replace_column 9 #
+explain select * from t1 order by a;
+--replace_column 9 #
+explain select * from t1 order by b;
+--replace_column 9 #
+explain select * from t1 order by c;
+--replace_column 9 #
+explain select a from t1 order by a;
+--replace_column 9 #
+explain select b from t1 order by b;
+--replace_column 9 #
+explain select a,b from t1 order by b;
+--replace_column 9 #
+explain select a,b from t1;
+--replace_column 9 #
+explain select a,b,c from t1;
drop table t1;
#
# Check describe
#
-create table t1 (t int not null default 1, key (t)) type=innodb;
+create table t1 (t int not null default 1, key (t)) engine=innodb;
desc t1;
drop table t1;
@@ -579,7 +641,7 @@ CREATE TABLE t1 (
version smallint(6) NOT NULL default '0',
assigned_scps int(11) default '0',
status tinyint(4) default '0'
-) TYPE=InnoDB;
+) ENGINE=InnoDB;
INSERT INTO t1 VALUES (4077711111,'SeanWheeler',90,2,20020111112846,500,00000000000000,-1,2,3,1);
INSERT INTO t1 VALUES (9197722223,'berry',90,3,20020111112809,500,20020102114532,501,4,10,0);
INSERT INTO t1 VALUES (650,'San Francisco',0,0,20011227111336,342,00000000000000,-1,1,24,1);
@@ -598,7 +660,7 @@ CREATE TABLE t2 (
version smallint(6) NOT NULL default '0',
assigned_scps int(11) default '0',
status tinyint(4) default '0'
-) TYPE=InnoDB;
+) ENGINE=InnoDB;
INSERT INTO t2 VALUES (4077711111,'SeanWheeler',0,2,20020111112853,500,00000000000000,-1,2,3,1);
INSERT INTO t2 VALUES (9197722223,'berry',90,3,20020111112818,500,20020102114532,501,4,10,0);
INSERT INTO t2 VALUES (650,'San Francisco',90,0,20020109113158,342,00000000000000,-1,1,24,1);
@@ -617,7 +679,7 @@ drop table t1,t2;
# this works.
#
-create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=innodb;
+create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb;
BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
@@ -642,9 +704,8 @@ DROP TABLE t1;
#
# Test of multi-table-update
#
-drop table if exists t1,t2;
-create table t1 (n int(10), d int(10)) type=innodb;
-create table t2 (n int(10), d int(10)) type=innodb;
+create table t1 (n int(10), d int(10)) engine=innodb;
+create table t2 (n int(10), d int(10)) engine=innodb;
insert into t1 values(1,1),(1,2);
insert into t2 values(1,10),(2,20);
UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
@@ -655,7 +716,7 @@ drop table t1,t2;
#
# Testing of IFNULL
#
-create table t1 (a int, b int) type=innodb;
+create table t1 (a int, b int) engine=innodb;
insert into t1 values(20,null);
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
t2.b=t3.a;
@@ -670,12 +731,12 @@ drop table t1;
# Test of read_through not existing const_table
#
-create table t1 (a varchar(10) not null) type=myisam;
-create table t2 (b varchar(10) not null unique) type=innodb;
+create table t1 (a varchar(10) not null) engine=myisam;
+create table t2 (b varchar(10) not null unique) engine=innodb;
select t1.a from t1,t2 where t1.a=t2.b;
drop table t1,t2;
-create table t1 (a int not null, b int, primary key (a)) type = innodb;
-create table t2 (a int not null, b int, primary key (a)) type = innodb;
+create table t1 (a int not null, b int, primary key (a)) engine = innodb;
+create table t2 (a int not null, b int, primary key (a)) engine = innodb;
insert into t1 values (10, 20);
insert into t2 values (10, 20);
update t1, t2 set t1.b = 150, t2.b = t1.b where t2.a = t1.a and t1.a = 10;
@@ -685,17 +746,16 @@ drop table t1,t2;
# Test of multi-table-delete with foreign key constraints
#
-CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) TYPE=INNODB;
-CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE ) TYPE=INNODB;
+CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
+CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE ) ENGINE=INNODB;
insert into t1 set id=1;
insert into t2 set id=1, t1_id=1;
delete t1,t2 from t1,t2 where t1.id=t2.t1_id;
select * from t1;
select * from t2;
drop table t2,t1;
-DROP TABLE IF EXISTS t1,t2;
-CREATE TABLE t1(id INT NOT NULL, PRIMARY KEY (id)) TYPE=INNODB;
-CREATE TABLE t2(id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id) ) TYPE=INNODB;
+CREATE TABLE t1(id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
+CREATE TABLE t2(id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id) ) ENGINE=INNODB;
INSERT INTO t1 VALUES(1);
INSERT INTO t2 VALUES(1, 1);
SELECT * from t1;
@@ -711,11 +771,11 @@ DROP TABLE t1,t2;
set autocommit=0;
-CREATE TABLE t1 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) TYPE=InnoDB;
+CREATE TABLE t1 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB;
-CREATE TABLE t2 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) TYPE=InnoDB;
+CREATE TABLE t2 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB;
-CREATE TABLE t3 (id1 CHAR(15) NOT NULL, id2 CHAR(15) NOT NULL, PRIMARY KEY(id1, id2)) TYPE=InnoDB;
+CREATE TABLE t3 (id1 CHAR(15) NOT NULL, id2 CHAR(15) NOT NULL, PRIMARY KEY(id1, id2)) ENGINE=InnoDB;
INSERT INTO t3 VALUES("my-test-1", "my-test-2");
COMMIT;
@@ -741,7 +801,7 @@ DROP TABLE t1,t2,t3;
# Check update with conflicting key
#
-CREATE TABLE t1 (a int not null primary key, b int not null, unique (b)) type=innodb;
+CREATE TABLE t1 (a int not null primary key, b int not null, unique (b)) engine=innodb;
INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
# We need the a < 1000 test here to quard against the halloween problems
UPDATE t1 set a=a+100 where b between 2 and 3 and a < 1000;
@@ -752,8 +812,8 @@ drop table t1;
# Test multi update with different join methods
#
-CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) type=innodb;
-CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) type=innodb;
+CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) engine=innodb;
+CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) engine=innodb;
INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12);
INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
@@ -775,16 +835,15 @@ select * from t1;
select * from t2;
drop table t1,t2;
-CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) TYPE=MyISAM;
-CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) TYPE=InnoDB;
+CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) ENGINE=MyISAM;
+CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
SET AUTOCOMMIT=0;
INSERT INTO t1 ( B_ID ) VALUES ( 1 );
INSERT INTO t2 ( NEXT_T ) VALUES ( 1 );
--- error 1196
ROLLBACK;
SELECT * FROM t1;
drop table t1,t2;
-create table t1 ( pk int primary key, parent int not null, child int not null, index (parent) ) type = innodb;
+create table t1 ( pk int primary key, parent int not null, child int not null, index (parent) ) engine = innodb;
insert into t1 values (1,0,4), (2,1,3), (3,2,1), (4,1,2);
select distinct parent,child from t1 order by parent;
drop table t1;
@@ -792,8 +851,7 @@ drop table t1;
#
# Test that MySQL priorities clustered indexes
#
-
-create table t1 (a int not null auto_increment primary key, b int, c int, key(c)) type=innodb;
+create table t1 (a int not null auto_increment primary key, b int, c int, key(c)) engine=innodb;
create table t2 (a int not null auto_increment primary key, b int);
insert into t1 (b) values (null),(null),(null),(null),(null),(null),(null);
insert into t2 (a) select b from t1;
@@ -815,14 +873,18 @@ insert into t1 (a) select b from t2;
insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
select count(*) from t1;
+--replace_column 9 #
+explain select * from t1 where c between 1 and 10000;
update t1 set c=a;
+--replace_column 9 #
+explain select * from t1 where c between 1 and 10000;
drop table t1,t2;
#
# Test of UPDATE ... ORDER BY
#
-create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) type=innodb;
+create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=innodb;
insert into t1 (id) values (null),(null),(null),(null),(null);
update t1 set fk=69 where fk is null order by id limit 1;
@@ -843,7 +905,7 @@ drop table t1;
# Test of multi-table-updates (bug #1980).
#
-create table t1 ( c char(8) not null ) type=innodb;
+create table t1 ( c char(8) not null ) engine=innodb;
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
@@ -852,7 +914,7 @@ alter table t1 add a char(8) not null;
alter table t1 add primary key (a,b,c);
update t1 set a=c, b=c;
-create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) type=innodb;
+create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=innodb;
insert into t2 select * from t1;
delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
@@ -863,7 +925,7 @@ drop table t1,t2;
#
SET AUTOCOMMIT=1;
-create table t1 (a integer auto_increment primary key) type=innodb;
+create table t1 (a integer auto_increment primary key) engine=innodb;
insert into t1 (a) values (NULL),(NULL);
truncate table t1;
insert into t1 (a) values (NULL),(NULL);
@@ -874,8 +936,8 @@ drop table t1;
# Test dictionary handling with spaceand quoting
#
-CREATE TABLE t1 (`id 1` INT NOT NULL, PRIMARY KEY (`id 1`)) TYPE=INNODB;
-CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (`t1_id`) REFERENCES `t1`(`id 1`) ON DELETE CASCADE ) TYPE=INNODB;
+CREATE TABLE t1 (`id 1` INT NOT NULL, PRIMARY KEY (`id 1`)) ENGINE=INNODB;
+CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (`t1_id`) REFERENCES `t1`(`id 1`) ON DELETE CASCADE ) ENGINE=INNODB;
#show create table t2;
drop table t2,t1;
@@ -883,11 +945,11 @@ drop table t2,t1;
# Test of multi updated and foreign keys
#
-create table `t1` (`id` int( 11 ) not null ,primary key ( `id` )) type = innodb;
+create table `t1` (`id` int( 11 ) not null ,primary key ( `id` )) engine = innodb;
insert into `t1`values ( 1 ) ;
-create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` ) ,constraint `t1_id_fk` foreign key ( `id` ) references `t1` (`id` )) type = innodb;
+create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` ) ,constraint `t1_id_fk` foreign key ( `id` ) references `t1` (`id` )) engine = innodb;
insert into `t2`values ( 1 ) ;
-create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) type = innodb;
+create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) engine = innodb;
insert into `t3`values ( 1 ) ;
--error 1217
delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
@@ -897,11 +959,14 @@ update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id
update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
drop table t3,t2,t1;
+#
+# test for recursion depth limit
+#
create table t1(
id int primary key,
pid int,
index(pid),
- foreign key(pid) references t1(id) on delete cascade) type=innodb;
+ foreign key(pid) references t1(id) on delete cascade) engine=innodb;
insert into t1 values(0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6),
(8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14);
-- error 1217
@@ -910,3 +975,208 @@ delete from t1 where id=15;
delete from t1 where id=0;
drop table t1;
+
+#
+# Test timestamps
+#
+
+CREATE TABLE t1 (col1 int(1))ENGINE=InnoDB;
+CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP,INDEX stamp_idx
+(stamp))ENGINE=InnoDB;
+insert into t1 values (1),(2),(3);
+# Note that timestamp 3 is wrong
+insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 ),(5,20020204230000);
+SELECT col1 FROM t1 UNION SELECT col1 FROM t2 WHERE stamp <
+'20020204120000' GROUP BY col1;
+drop table t1,t2;
+
+#
+# Test by Francois MASUREL
+#
+
+CREATE TABLE t1 (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `id_object` int(10) unsigned default '0',
+ `id_version` int(10) unsigned NOT NULL default '1',
+ label varchar(100) NOT NULL default '',
+ `description` text,
+ PRIMARY KEY (`id`),
+ KEY `id_object` (`id_object`),
+ KEY `id_version` (`id_version`)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES("6", "3382", "9", "Test", NULL), ("7", "102", "5", "Le Pekin (Test)", NULL),("584", "1794", "4", "Test de resto", NULL),("837", "1822", "6", "Test 3", NULL),("1119", "3524", "1", "Societe Test", NULL),("1122", "3525", "1", "Fournisseur Test", NULL);
+
+CREATE TABLE t2 (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `id_version` int(10) unsigned NOT NULL default '1',
+ PRIMARY KEY (`id`),
+ KEY `id_version` (`id_version`)
+) ENGINE=InnoDB;
+
+INSERT INTO t2 VALUES("3524", "1"),("3525", "1"),("1794", "4"),("102", "5"),("1822", "6"),("3382", "9");
+
+SELECT t2.id, t1.label FROM t2 INNER JOIN
+(SELECT t1.id_object as id_object FROM t1 WHERE t1.label LIKE '%test%') AS lbl
+ON (t2.id = lbl.id_object) INNER JOIN t1 ON (t2.id = t1.id_object);
+drop table t1,t2;
+
+#
+# Bug #1078
+#
+create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=innodb;
+select * from t1;
+--error 1031
+replace delayed into t1 (c1, c2) values ( "text1","11"),( "text2","12");
+select * from t1;
+--error 1031
+replace delayed into t1 (c1, c2) values ( "text1","12"),( "text2","13"),( "text3","14", "a" ),( "text4","15", "b" );
+select * from t1;
+drop table t1;
+
+create table t1 (a int, b varchar(200), c text not null) checksum=1 engine=myisam;
+create table t2 (a int, b varchar(200), c text not null) checksum=0 engine=innodb;
+create table t3 (a int, b varchar(200), c text not null) checksum=1 engine=innodb;
+insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
+insert t2 select * from t1;
+insert t3 select * from t1;
+checksum table t1, t2, t3, t4 quick;
+checksum table t1, t2, t3, t4;
+checksum table t1, t2, t3, t4 extended;
+#show table status;
+drop table t1,t2,t3;
+
+#
+# Test problem with refering to different fields in same table in UNION
+# (Bug #2552)
+#
+create table t1 (id int, name char(10) not null, name2 char(10) not null) engine=innodb;
+insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt');
+select name2 from t1 union all select name from t1 union all select id from t1;
+drop table t1;
+
+#
+# Bug2160
+#
+create table t1 (a int) engine=innodb;
+create table t2 like t1;
+drop table t1,t2;
+
+#
+# Test of automaticly created foreign keys
+#
+
+create table t1 (id int(11) not null, id2 int(11) not null, unique (id,id2)) engine=innodb;
+create table t2 (id int(11) not null, constraint t1_id_fk foreign key ( id ) references t1 (id)) engine = innodb;
+show create table t1;
+show create table t2;
+create index id on t2 (id);
+show create table t2;
+create index id2 on t2 (id);
+show create table t2;
+drop index id2 on t2;
+--error 1025,1025
+drop index id on t2;
+show create table t2;
+drop table t2;
+
+create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id,id2) references t1 (id,id2)) engine = innodb;
+show create table t2;
+create unique index id on t2 (id,id2);
+show create table t2;
+drop table t2;
+
+# Check foreign key columns created in different order than key columns
+create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;
+show create table t2;
+drop table t2;
+
+create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2), constraint t1_id_fk foreign key (id) references t1 (id)) engine = innodb;
+show create table t2;
+drop table t2;
+
+create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;
+show create table t2;
+drop table t2;
+
+create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id), primary key (id), index (id,id2)) engine = innodb;
+show create table t2;
+drop table t2;
+
+create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id)) engine= innodb;
+show create table t2;
+alter table t2 add index id_test (id), add index id_test2 (id,id2);
+show create table t2;
+drop table t2;
+
+# Test error handling
+--replace_result \\ /
+--error 1005
+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
+
+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;
+drop table t2;
+create table t2 (a int auto_increment primary key, b int, foreign key (b) references t1(id), foreign key (b) references t1(id), unique(b)) engine=innodb;
+show create table t2;
+drop table t2, t1;
+
+
+#
+# Let us test binlog_cache_use and binlog_cache_disk_use status vars.
+# Actually this test has nothing to do with innodb per se, it just requires
+# transactional table.
+#
+show status like "binlog_cache_use";
+show status like "binlog_cache_disk_use";
+
+create table t1 (a int) engine=innodb;
+
+# Now we are going to create transaction which is long enough so its
+# transaction binlog will be flushed to disk...
+let $1=2000;
+disable_query_log;
+begin;
+while ($1)
+{
+ eval insert into t1 values( $1 );
+ dec $1;
+}
+commit;
+enable_query_log;
+show status like "binlog_cache_use";
+show status like "binlog_cache_disk_use";
+
+# Transaction which should not be flushed to disk and so should not
+# increase binlog_cache_disk_use.
+begin;
+delete from t1;
+commit;
+show status like "binlog_cache_use";
+show status like "binlog_cache_disk_use";
+
+drop table t1;
+
+#
+# Bug #6126: Duplicate columns in keys gives misleading error message
+#
+--error 1060
+create table t1 (c char(10), index (c,c)) engine=innodb;
+--error 1060
+create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;
+--error 1060
+create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb;
+--error 1060
+create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb;
+create table t1 (c1 char(10), c2 char(10)) engine=innodb;
+--error 1060
+alter table t1 add key (c1,c1);
+--error 1060
+alter table t1 add key (c2,c1,c1);
+--error 1060
+alter table t1 add key (c1,c2,c1);
+--error 1060
+alter table t1 add key (c1,c1,c2);
+drop table t1;
diff --git a/mysql-test/t/innodb_cache.test b/mysql-test/t/innodb_cache.test
index da9fc494d5b..101dde37f89 100644
--- a/mysql-test/t/innodb_cache.test
+++ b/mysql-test/t/innodb_cache.test
@@ -1,13 +1,17 @@
-- source include/have_innodb.inc
-- source include/have_query_cache.inc
+# Initialise
+--disable_warnings
+drop table if exists t1,t2,t3;
+--enable_warnings
+
#
# Without auto_commit.
#
-drop table if exists t1, t2, t3;
flush status;
set autocommit=0;
-create table t1 (a int not null) type=innodb;
+create table t1 (a int not null) engine=innodb;
insert into t1 values (1),(2),(3);
select * from t1;
show status like "Qcache_queries_in_cache";
@@ -15,15 +19,15 @@ drop table t1;
commit;
set autocommit=1;
begin;
-create table t1 (a int not null) type=innodb;
+create table t1 (a int not null) engine=innodb;
insert into t1 values (1),(2),(3);
select * from t1;
show status like "Qcache_queries_in_cache";
drop table t1;
commit;
-create table t1 (a int not null) type=innodb;
-create table t2 (a int not null) type=innodb;
-create table t3 (a int not null) type=innodb;
+create table t1 (a int not null) engine=innodb;
+create table t2 (a int not null) engine=innodb;
+create table t3 (a int not null) engine=innodb;
insert into t1 values (1),(2);
insert into t2 values (1),(2);
insert into t3 values (1),(2);
@@ -50,7 +54,7 @@ commit;
show status like "Qcache_queries_in_cache";
drop table t3,t2,t1;
-CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) TYPE=InnoDB;
+CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) ENGINE=InnoDB;
select count(*) from t1;
insert into t1 (id) values (0);
select count(*) from t1;
@@ -60,9 +64,9 @@ drop table t1;
# one statement roll back inside transation
#
set GLOBAL query_cache_size=1355776;
-CREATE TABLE t1 ( id int(10) NOT NULL auto_increment, a varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY a (a)) TYPE=innodb;
-CREATE TABLE t2 ( id int(10) NOT NULL auto_increment, b varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY b (b)) TYPE=innodb;
-CREATE TABLE t3 ( id int(10) NOT NULL auto_increment, t1_id int(10) NOT NULL default '0', t2_id int(10) NOT NULL default '0', state int(11) default NULL, PRIMARY KEY (id), UNIQUE KEY t1_id (t1_id,t2_id), KEY t2_id (t2_id,t1_id), CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`), CONSTRAINT `t3_ibfk_2` FOREIGN KEY (`t2_id`) REFERENCES `t2` (`id`)) TYPE=innodb;
+CREATE TABLE t1 ( id int(10) NOT NULL auto_increment, a varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY a (a)) ENGINE=innodb;
+CREATE TABLE t2 ( id int(10) NOT NULL auto_increment, b varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY b (b)) ENGINE=innodb;
+CREATE TABLE t3 ( id int(10) NOT NULL auto_increment, t1_id int(10) NOT NULL default '0', t2_id int(10) NOT NULL default '0', state int(11) default NULL, PRIMARY KEY (id), UNIQUE KEY t1_id (t1_id,t2_id), KEY t2_id (t2_id,t1_id), CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`), CONSTRAINT `t3_ibfk_2` FOREIGN KEY (`t2_id`) REFERENCES `t2` (`id`)) ENGINE=innodb;
INSERT INTO t1 VALUES (1,'me');
INSERT INTO t2 VALUES (1,'you');
INSERT INTO t3 VALUES (2,1,1,2);
diff --git a/mysql-test/t/innodb_handler.test b/mysql-test/t/innodb_handler.test
index 6777e4f49bd..e8c486caf66 100644
--- a/mysql-test/t/innodb_handler.test
+++ b/mysql-test/t/innodb_handler.test
@@ -4,8 +4,11 @@
# test of HANDLER ...
#
-drop table if exists t1;
-create table t1 (a int, b char(10), key a(a), key b(a,b)) type=innodb;
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
+create table t1 (a int, b char(10), key a(a), key b(a,b)) engine=innodb;
insert into t1 values
(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"),
(14,"aaa"),(15,"bbb"),(16,"ccc"),(16,"xxx"),
@@ -68,12 +71,12 @@ handler t2 close;
handler t1 open as t2;
handler t2 read first;
-alter table t1 type=innodb;
+alter table t1 engine=innodb;
--error 1109
handler t2 read first;
drop table t1;
-CREATE TABLE t1 ( no1 smallint(5) NOT NULL default '0', no2 int(10) NOT NULL default '0', PRIMARY KEY (no1,no2)) TYPE=InnoDB;
+CREATE TABLE t1 ( no1 smallint(5) NOT NULL default '0', no2 int(10) NOT NULL default '0', PRIMARY KEY (no1,no2)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,274),(1,275),(2,6),(2,8),(4,1),(4,2);
HANDLER t1 OPEN;
HANDLER t1 READ `primary` = (1, 1000);
diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test
index 12dfe6e50a9..f5acab05108 100644
--- a/mysql-test/t/insert.test
+++ b/mysql-test/t/insert.test
@@ -2,7 +2,10 @@
# Test of refering to old values
#
+--disable_warnings
drop table if exists t1,t2;
+--enable_warnings
+
create table t1 (a int not null);
insert into t1 values (1);
insert into t1 values (a+2);
@@ -84,3 +87,70 @@ use mysqltest;
create table t1 (c int);
insert into mysqltest.t1 set mysqltest.t1.c = '1';
drop database mysqltest;
+
+#
+# Test of wrong values for float data (bug #2082)
+#
+
+# PS gives sligthly different numbers for max-float/max-double
+--disable_ps_protocol
+use test;
+create table t1(number int auto_increment primary key, original_value varchar(50), f_double double, f_float float, f_double_7_2 double(7,2), f_float_4_3 float (4,3), f_double_u double unsigned, f_float_u float unsigned, f_double_15_1_u double(15,1) unsigned, f_float_3_1_u float (3,1) unsigned);
+
+set @value= "aa";
+insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
+--query_vertical select * from t1 where number =last_insert_id()
+
+set @value= "1aa";
+insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
+--query_vertical select * from t1 where number =last_insert_id()
+
+set @value= "aa1";
+insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
+--query_vertical select * from t1 where number =last_insert_id()
+
+set @value= "1e+1111111111a";
+insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
+--query_vertical select * from t1 where number =last_insert_id()
+
+set @value= "-1e+1111111111a";
+insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
+--query_vertical select * from t1 where number =last_insert_id()
+
+set @value= 1e+1111111111;
+insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
+--query_vertical select * from t1 where number =last_insert_id()
+
+set @value= -1e+1111111111;
+insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
+--query_vertical select * from t1 where number =last_insert_id()
+
+set @value= 1e+111;
+insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
+--query_vertical select * from t1 where number =last_insert_id()
+
+set @value= -1e+111;
+insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
+--query_vertical select * from t1 where number =last_insert_id()
+
+set @value= 1;
+insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
+--query_vertical select * from t1 where number =last_insert_id()
+
+set @value= -1;
+insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
+--query_vertical select * from t1 where number =last_insert_id()
+
+drop table t1;
+--enable_ps_protocol
diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test
index deb80dbcdbf..e1459310bb9 100644
--- a/mysql-test/t/insert_select.test
+++ b/mysql-test/t/insert_select.test
@@ -2,7 +2,10 @@
# Problem with INSERT ... SELECT
#
+--disable_warnings
drop table if exists t1,t2;
+--enable_warnings
+
create table t1 (bandID MEDIUMINT UNSIGNED NOT NULL PRIMARY KEY, payoutID SMALLINT UNSIGNED NOT NULL);
insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7,12),(8,12);
create table t2 (payoutID SMALLINT UNSIGNED NOT NULL PRIMARY KEY);
@@ -32,7 +35,7 @@ CREATE TABLE `t1` (
KEY `date` (`date`),
KEY `pseudo` (`pseudo`),
KEY `numreponse` (`numreponse`)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
CREATE TABLE `t2` (
`numeropost` bigint(20) unsigned NOT NULL default '0',
@@ -48,7 +51,7 @@ CREATE TABLE `t2` (
KEY `date` (`date`),
KEY `pseudo` (`pseudo`),
KEY `numreponse` (`numreponse`)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t2
(numeropost,icone,numreponse,contenu,pseudo,date,ip,signature) VALUES
@@ -83,8 +86,8 @@ insert into t1 select * from t2;
let $VERSION=`select version()`;
--replace_result $VERSION VERSION
show binlog events;
+select * from t1;
drop table t1, t2;
-drop table if exists t1, t2;
# Verify that a partly-completed CREATE TABLE .. SELECT does not
# get into the binlog (Bug #6682)
@@ -132,7 +135,10 @@ insert into t2 values (2,"t2:2"), (3,"t2:3");
--error 1062
insert into t1 select * from t2;
select * from t1;
+# REPLACE .. SELECT is not yet supported by PS
+--disable_ps_protocol
replace into t1 select * from t2;
+--enable_ps_protocol
select * from t1;
drop table t1,t2;
diff --git a/mysql-test/t/insert_update.test b/mysql-test/t/insert_update.test
new file mode 100644
index 00000000000..182baa641da
--- /dev/null
+++ b/mysql-test/t/insert_update.test
@@ -0,0 +1,81 @@
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (a INT, b INT, c INT, UNIQUE (A), UNIQUE(B));
+INSERT t1 VALUES (1,2,10), (3,4,20);
+INSERT t1 VALUES (5,6,30) ON DUPLICATE KEY UPDATE c=c+100;
+SELECT * FROM t1;
+INSERT t1 VALUES (5,7,40) ON DUPLICATE KEY UPDATE c=c+100;
+SELECT * FROM t1;
+INSERT t1 VALUES (8,4,50) ON DUPLICATE KEY UPDATE c=c+1000;
+SELECT * FROM t1;
+INSERT t1 VALUES (1,4,60) ON DUPLICATE KEY UPDATE c=c+10000;
+SELECT * FROM t1;
+-- error 1062
+INSERT t1 VALUES (1,9,70) ON DUPLICATE KEY UPDATE c=c+100000, b=4;
+SELECT * FROM t1;
+TRUNCATE TABLE t1;
+INSERT t1 VALUES (1,2,10), (3,4,20);
+INSERT t1 VALUES (5,6,30), (7,4,40), (8,9,60) ON DUPLICATE KEY UPDATE c=c+100;
+SELECT * FROM t1;
+INSERT t1 SET a=5 ON DUPLICATE KEY UPDATE b=0;
+SELECT * FROM t1;
+INSERT t1 VALUES (2,1,11), (7,4,40) ON DUPLICATE KEY UPDATE c=c+VALUES(a);
+SELECT *, VALUES(a) FROM t1;
+explain extended SELECT *, VALUES(a) FROM t1;
+explain extended select * from t1 where values(a);
+DROP TABLE t1;
+
+#
+# test for Bug #2709 "Affected Rows for ON DUPL.KEY undocumented,
+# perhaps illogical"
+#
+create table t1(a int primary key, b int);
+insert into t1 values(1,1),(2,2),(3,3),(4,4),(5,5);
+select * from t1;
+
+--enable_info
+insert into t1 values(4,14),(5,15),(6,16),(7,17),(8,18)
+ on duplicate key update b=b+10;
+--disable_info
+
+select * from t1;
+
+enable_info;
+replace into t1 values(5,25),(6,26),(7,27),(8,28),(9,29);
+disable_info;
+
+select * from t1;
+drop table t1;
+
+# WorkLog #2274 - enable INSERT .. SELECT .. UPDATE syntax
+# Same tests as beginning of this test except that insert source
+# is a result from a select statement
+#
+CREATE TABLE t1 (a INT, b INT, c INT, UNIQUE (A), UNIQUE(B));
+INSERT t1 VALUES (1,2,10), (3,4,20);
+INSERT t1 SELECT 5,6,30 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100;
+SELECT * FROM t1;
+INSERT t1 SELECT 5,7,40 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100;
+SELECT * FROM t1;
+INSERT t1 SELECT 8,4,50 FROM DUAL ON DUPLICATE KEY UPDATE c=c+1000;
+SELECT * FROM t1;
+INSERT t1 SELECT 1,4,60 FROM DUAL ON DUPLICATE KEY UPDATE c=c+10000;
+SELECT * FROM t1;
+-- error 1062
+INSERT t1 SELECT 1,9,70 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100000, b=4;
+SELECT * FROM t1;
+TRUNCATE TABLE t1;
+INSERT t1 VALUES (1,2,10), (3,4,20);
+CREATE TABLE t2 (x INT, y INT, z INT, d INT);
+INSERT t2 VALUES (5,6,30,1), (7,4,40,1), (8,9,60,1);
+INSERT t2 VALUES (2,1,11,2), (7,4,40,2);
+INSERT t1 SELECT x,y,z FROM t2 WHERE d=1 ON DUPLICATE KEY UPDATE c=c+100;
+SELECT * FROM t1;
+INSERT t1 SET a=5 ON DUPLICATE KEY UPDATE b=0;
+SELECT * FROM t1;
+INSERT t1 SELECT x,y,z FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a);
+SELECT *, VALUES(a) FROM t1;
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/t/isam.test b/mysql-test/t/isam.test
index e807112dab4..f77d29fd20f 100644
--- a/mysql-test/t/isam.test
+++ b/mysql-test/t/isam.test
@@ -1,21 +1,25 @@
-- source include/have_isam.inc
+--disable_warnings
drop table if exists t1,t2;
+--enable_warnings
#
# Test possible problem with rows that are about 65535 bytes long
#
-create table t1 (a tinyint not null auto_increment, b blob not null, primary key (a)) type=isam;
+create table t1 (a tinyint not null auto_increment, b blob not null, primary key (a)) engine=isam;
let $1=100;
disable_query_log;
+--disable_warnings
while ($1)
{
eval insert into t1 (b) values(repeat(char(65+$1),65540-$1));
dec $1;
}
enable_query_log;
+--enable_warnings
delete from t1 where (a & 1);
select sum(length(b)) from t1;
drop table t1;
@@ -24,7 +28,7 @@ drop table t1;
# Test of auto_increment; The test for BDB tables is in bdb.test
#
-create table t1 (a int not null auto_increment,b int, primary key (a)) type=isam;
+create table t1 (a int not null auto_increment,b int, primary key (a)) engine=isam;
insert into t1 values (1,1),(NULL,2),(3,3),(NULL,4);
delete from t1 where a=4 or a=2;
insert into t1 values (NULL,4),(NULL,5),(6,6);
@@ -41,10 +45,14 @@ drop table t1;
#
# Test of some CREATE TABLE's that should fail
#
-!$1121 create table t1 (a int,b text, index(a)) type=isam;
-!$1073 create table t1 (a int,b text, index(b)) type=isam;
-!$1075 create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=isam;
-!$1121 create table t1 (ordid int(8), unique (ordid)) type=isam;
+--error 1121
+create table t1 (a int,b text, index(a)) engine=isam;
+--error 1073
+create table t1 (a int,b text, index(b)) engine=isam;
+--error 1075
+create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) engine=isam;
+--error 1121
+create table t1 (ordid int(8), unique (ordid)) engine=isam;
drop table if exists t1;
#
@@ -53,7 +61,7 @@ drop table if exists t1;
create table t1 (a int not null primary key, b int not null,c int not null, key(b,c));
insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4);
-create table t2 type=isam select * from t1;
+create table t2 engine=isam select * from t1;
optimize table t1;
check table t1,t2;
repair table t1,t2;
diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test
index 19e04d2aa7e..1d18e020543 100644
--- a/mysql-test/t/join.test
+++ b/mysql-test/t/join.test
@@ -1,6 +1,8 @@
#
# Initialization
+--disable_warnings
drop table if exists t1,t2,t3;
+--enable_warnings
#
# Test different join syntaxes
@@ -25,7 +27,6 @@ drop table t1,t2;
# This failed for lia Perminov
#
-
create table t1 (id int primary key);
create table t2 (id int);
insert into t1 values (75);
@@ -111,7 +112,7 @@ drop table t1, t2;
create table t1 (a int primary key);
insert into t1 values(1),(2);
select t1.a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a);
---replace_result "31 tables" "XX tables" "63 tables" "XX tables"
+--replace_result "31 tables" "XX tables" "61 tables" "XX tables"
--error 1116
select t1.a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a) left join t1 as t32 using (a) left join t1 as t33 using (a) left join t1 as t34 using (a) left join t1 as t35 using (a) left join t1 as t36 using (a) left join t1 as t37 using (a) left join t1 as t38 using (a) left join t1 as t39 using (a) left join t1 as t40 using (a) left join t1 as t41 using (a) left join t1 as t42 using (a) left join t1 as t43 using (a) left join t1 as t44 using (a) left join t1 as t45 using (a) left join t1 as t46 using (a) left join t1 as t47 using (a) left join t1 as t48 using (a) left join t1 as t49 using (a) left join t1 as t50 using (a) left join t1 as t51 using (a) left join t1 as t52 using (a) left join t1 as t53 using (a) left join t1 as t54 using (a) left join t1 as t55 using (a) left join t1 as t56 using (a) left join t1 as t57 using (a) left join t1 as t58 using (a) left join t1 as t59 using (a) left join t1 as t60 using (a) left join t1 as t61 using (a) left join t1 as t62 using (a) left join t1 as t63 using (a) left join t1 as t64 using (a) left join t1 as t65 using (a);
drop table t1;
@@ -125,13 +126,13 @@ CREATE TABLE t1 (
a int(11) NOT NULL,
b int(11) NOT NULL,
PRIMARY KEY (a,b)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(2,3);
CREATE TABLE t2 (
a int(11) default NULL
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t2 VALUES (2),(3);
SELECT t1.a,t2.a,b FROM t1,t2 WHERE t1.a=t2.a AND (t1.a=1 OR t1.a=2) AND b>=1 AND b<=3;
DROP TABLE t1, t2;
@@ -234,13 +235,13 @@ CREATE TABLE t1 (
max_value double default NULL,
t3_id int(11) default NULL,
item_id int(11) default NULL
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (12,5,'Percent','Cost',-1,0,-1,-1),(14,4,'Percent','Cost',-1,0,-1,-1),(18,5,'Percent','Cost',-1,0,-1,-1),(19,4,'Percent','Cost',-1,0,-1,-1),(20,5,'Percent','Cost',100,-1,22,291),(21,5,'Percent','Cost',100,-1,18,291),(22,1,'Percent','Cost',100,-1,6,291),(23,1,'Percent','Cost',100,-1,21,291),(24,1,'Percent','Cost',100,-1,9,291),(25,1,'Percent','Cost',100,-1,4,291),(26,1,'Percent','Cost',100,-1,20,291),(27,4,'Percent','Cost',100,-1,7,202),(28,1,'Percent','Cost',50,-1,-1,137),(29,2,'Percent','Cost',100,-1,4,354),(30,2,'Percent','Cost',100,-1,9,137),(93,2,'Cost','Cost',-1,10000000,-1,-1);
CREATE TABLE t2 (
id int(10) unsigned NOT NULL auto_increment,
name varchar(255) default NULL,
PRIMARY KEY (id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,'s1'),(2,'s2'),(3,'s3'),(4,'s4'),(5,'s5');
select t1.*, t2.* from t1, t2 where t2.id=t1.t2_id limit 2;
drop table t1,t2;
@@ -255,7 +256,7 @@ CREATE TABLE t1 (
rate_code varchar(10) default NULL,
UNIQUE KEY site_emp (siteid,emp_id),
KEY siteid (siteid)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('rivercats','psmith','cust'), ('rivercats','KWalker','cust');
CREATE TABLE t2 (
siteid varchar(25) NOT NULL default '',
@@ -263,7 +264,7 @@ CREATE TABLE t2 (
base_rate float NOT NULL default '0',
PRIMARY KEY (siteid,rate_code),
FULLTEXT KEY rate_code (rate_code)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t2 VALUES ('rivercats','cust',20);
SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE emp.emp_id = 'psmith' AND lr.siteid = 'rivercats';
SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE lr.siteid = 'rivercats' AND emp.emp_id = 'psmith';
@@ -284,6 +285,16 @@ SELECT * FROM t1 NATURAL JOIN t2 WHERE (Value1 = 'A' AND Value2 <> 'B') AND 1;
drop table t1,t2;
#
+# dummy natural join (no common columns) Bug #4807
+#
+
+CREATE TABLE t1 (a int);
+CREATE TABLE t2 (b int);
+CREATE TABLE t3 (c int);
+SELECT * FROM t1 NATURAL JOIN t2 NATURAL JOIN t3;
+DROP TABLE t1, t2, t3;
+
+#
# Test combination of join methods
#
diff --git a/mysql-test/t/join_crash.test b/mysql-test/t/join_crash.test
index 4606b23f726..2d2222ad67a 100644
--- a/mysql-test/t/join_crash.test
+++ b/mysql-test/t/join_crash.test
@@ -2,7 +2,10 @@
# This test gave a core dump
#
+--disable_warnings
DROP TABLE IF EXISTS t1,t2,t3,t4;
+--enable_warnings
+
CREATE TABLE t1 (
project_id int(11) NOT NULL auto_increment,
project_row_lock int(11) NOT NULL default '0',
@@ -14,7 +17,7 @@ CREATE TABLE t1 (
comments mediumtext,
PRIMARY KEY (project_id),
UNIQUE KEY project (client_ptr,project_name)
-) TYPE=MyISAM PACK_KEYS=1;
+) ENGINE=MyISAM PACK_KEYS=1;
INSERT INTO t1 VALUES (1,0,'Rejected Time',1,NULL,NULL,NULL,NULL);
INSERT INTO t1 VALUES (209,0,'MDGRAD Proposal/Investigation',97,NULL,NULL,NULL,'');
@@ -37,7 +40,7 @@ CREATE TABLE t2 (
PRIMARY KEY (period_id),
KEY period_index (period_type,period_key),
KEY date_index (start_date,end_date)
-) TYPE=MyISAM PACK_KEYS=1;
+) ENGINE=MyISAM PACK_KEYS=1;
INSERT INTO t2 VALUES (1,'user_table',98,'2000-01-01 00:00:00',NULL,NULL);
INSERT INTO t2 VALUES (2,'user_table',99,'2000-01-01 00:00:00',NULL,NULL);
@@ -65,7 +68,7 @@ CREATE TABLE t3 (
adjustment float(10,2) default NULL,
PRIMARY KEY (budget_id),
UNIQUE KEY po (project_ptr,po_number)
-) TYPE=MyISAM PACK_KEYS=1;
+) ENGINE=MyISAM PACK_KEYS=1;
CREATE TABLE t4 (
client_id int(11) NOT NULL auto_increment,
@@ -75,7 +78,7 @@ CREATE TABLE t4 (
comments mediumtext,
PRIMARY KEY (client_id),
UNIQUE KEY client_name (client_name)
-) TYPE=MyISAM PACK_KEYS=1;
+) ENGINE=MyISAM PACK_KEYS=1;
INSERT INTO t4 VALUES (1,0,'CPS',NULL,NULL);
diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test
index bed4d4b033b..d177a68e685 100644
--- a/mysql-test/t/join_outer.test
+++ b/mysql-test/t/join_outer.test
@@ -2,13 +2,15 @@
# test of left outer join
#
+--disable_warnings
drop table if exists t1,t2,t3,t4,t5;
+--enable_warnings
CREATE TABLE t1 (
grp int(11) default NULL,
a bigint(20) unsigned default NULL,
c char(10) NOT NULL default ''
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1,'a'),(2,2,'b'),(2,3,'c'),(3,4,'E'),(3,5,'C'),(3,6,'D'),(NULL,NULL,'');
create table t2 (id int, a bigint unsigned not null, c char(10), d int, primary key (a));
insert into t2 values (1,1,"a",1),(3,4,"A",4),(3,5,"B",5),(3,6,"C",6),(4,7,"D",7);
@@ -32,11 +34,14 @@ explain select t1.*,t2.* from t1 left join t2 on t1.a=t2.a where isnull(t2.a)=1;
select t1.*,t2.*,t3.a from t1 left join t2 on (t1.a=t2.a) left join t1 as t3 on (t2.a=t3.a);
# The next query should rearange the left joins to get this to work
-!$1120 explain select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t1.a=t3.a);
-!$1120 select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t1.a=t3.a);
+--error 1120
+explain select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t1.a=t3.a);
+--error 1120
+select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t1.a=t3.a);
# The next query should give an error in MySQL
-!$1120 select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t2.a=t3.a);
+--error 1120
+select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t2.a=t3.a);
# Test of inner join
select t1.*,t2.* from t1 inner join t2 using (a);
@@ -92,7 +97,8 @@ WHERE t1.uniq_id = 4
ORDER BY t2.c_amount;
INSERT INTO t2 VALUES (2,3,3000,6000,0,0,746584,837484,'yes');
-!$1062 INSERT INTO t2 VALUES (2,3,3000,6000,0,0,746584,837484,'yes');
+--error 1062
+INSERT INTO t2 VALUES (2,3,3000,6000,0,0,746584,837484,'yes');
INSERT INTO t2 VALUES (7,3,1000,2000,0,0,746294,937484,'yes');
#3rd select should show that one record is returned with null entries for the
@@ -109,7 +115,6 @@ drop table t1,t2;
# Test of LEFT JOIN with const tables (failed for frankie@etsetb.upc.es)
#
-drop table if exists t1,t2,t3,t4;
CREATE TABLE t1 (
cod_asig int(11) DEFAULT '0' NOT NULL,
desc_larga_cat varchar(80) DEFAULT '' NOT NULL,
@@ -287,7 +292,8 @@ insert into t3 values (1);
insert into t4 values (1,1);
insert into t5 values (1,1);
-!$1120 explain select * from t3 left join t4 on t4.seq_1_id = t2.t2_id left join t1 on t1.t1_id = t4.seq_0_id left join t5 on t5.seq_0_id = t1.t1_id left join t2 on t2.t2_id = t5.seq_1_id where t3.t3_id = 23;
+--error 1120
+explain select * from t3 left join t4 on t4.seq_1_id = t2.t2_id left join t1 on t1.t1_id = t4.seq_0_id left join t5 on t5.seq_0_id = t1.t1_id left join t2 on t2.t2_id = t5.seq_1_id where t3.t3_id = 23;
drop table t1,t2,t3,t4,t5;
@@ -416,7 +422,7 @@ explain select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30;
select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30;
select * from t2 left join t1 ignore index(primary) on t1.fooID = t2.fooID and t1.fooID = 30;
drop table t1,t2;
-drop table if exists t3;
+
create table t1 (i int);
create table t2 (i int);
create table t3 (i int);
@@ -450,3 +456,129 @@ select * from t1 left join t2 on b1 = a1 left join t3 on c1 = a1 and b1 is
explain select * from t1 left join t2 on b1 = a1 left join t3 on c1 = a1 and b1 is null;
drop table t1, t2, t3;
+
+# Test for BUG#5088
+
+create table t1 (
+ match_id tinyint(3) unsigned not null auto_increment,
+ home tinyint(3) unsigned default '0',
+ unique key match_id (match_id),
+ key match_id_2 (match_id)
+);
+
+insert into t1 values("1", "2");
+
+create table t2 (
+ player_id tinyint(3) unsigned default '0',
+ match_1_h tinyint(3) unsigned default '0',
+ key player_id (player_id)
+);
+
+insert into t2 values("1", "5");
+insert into t2 values("2", "9");
+insert into t2 values("3", "3");
+insert into t2 values("4", "7");
+insert into t2 values("5", "6");
+insert into t2 values("6", "8");
+insert into t2 values("7", "4");
+insert into t2 values("8", "12");
+insert into t2 values("9", "11");
+insert into t2 values("10", "10");
+
+explain select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
+ (t2 s left join t1 m on m.match_id = 1)
+ order by m.match_id desc;
+
+explain select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
+ (t2 s left join t1 m on m.match_id = 1)
+ order by UUX desc;
+
+select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
+ (t2 s left join t1 m on m.match_id = 1)
+ order by UUX desc;
+
+explain select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
+ t2 s straight_join t1 m where m.match_id = 1
+ order by UUX desc;
+
+select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
+ t2 s straight_join t1 m where m.match_id = 1
+ order by UUX desc;
+
+drop table t1, t2;
+
+# Tests for bugs #6307 and 6460
+
+create table t1 (a int, b int, unique index idx (a, b));
+create table t2 (a int, b int, c int, unique index idx (a, b));
+
+insert into t1 values (1, 10), (1,11), (2,10), (2,11);
+insert into t2 values (1,10,3);
+
+select t1.a, t1.b, t2.c from t1 left join t2
+ on t1.a=t2.a and t1.b=t2.b and t2.c=3
+ where t1.a=1 and t2.c is null;
+
+drop table t1, t2;
+
+CREATE TABLE t1 (
+ ts_id bigint(20) default NULL,
+ inst_id tinyint(4) default NULL,
+ flag_name varchar(64) default NULL,
+ flag_value text,
+ UNIQUE KEY ts_id (ts_id,inst_id,flag_name)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+CREATE TABLE t2 (
+ ts_id bigint(20) default NULL,
+ inst_id tinyint(4) default NULL,
+ flag_name varchar(64) default NULL,
+ flag_value text,
+ UNIQUE KEY ts_id (ts_id,inst_id,flag_name)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+INSERT INTO t1 VALUES
+ (111056548820001, 0, 'flag1', NULL),
+ (111056548820001, 0, 'flag2', NULL),
+ (2, 0, 'other_flag', NULL);
+
+INSERT INTO t2 VALUES
+ (111056548820001, 3, 'flag1', 'sss');
+
+SELECT t1.flag_name,t2.flag_value
+ FROM t1 LEFT JOIN t2
+ ON (t1.ts_id = t2.ts_id AND t1.flag_name = t2.flag_name AND
+ t2.inst_id = 3)
+ WHERE t1.inst_id = 0 AND t1.ts_id=111056548820001 AND
+ t2.flag_value IS NULL;
+
+DROP TABLE t1,t2;
+
+CREATE TABLE invoice (
+ id int(11) unsigned NOT NULL auto_increment,
+ text_id int(10) unsigned default NULL,
+ PRIMARY KEY (id)
+);
+
+INSERT INTO invoice VALUES("1", "0");
+INSERT INTO invoice VALUES("2", "10");
+
+CREATE TABLE text_table (
+ text_id char(3) NOT NULL default '',
+ language_id char(3) NOT NULL default '',
+ text_data text,
+ PRIMARY KEY (text_id,language_id)
+);
+
+INSERT INTO text_table VALUES("0", "EN", "0-EN");
+INSERT INTO text_table VALUES("0", "SV", "0-SV");
+INSERT INTO text_table VALUES("10", "EN", "10-EN");
+INSERT INTO text_table VALUES("10", "SV", "10-SV");
+
+SELECT invoice.id, invoice.text_id, text_table.text_data
+ FROM invoice LEFT JOIN text_table
+ ON invoice.text_id = text_table.text_id
+ AND text_table.language_id = 'SV'
+ WHERE (invoice.id LIKE '%' OR text_table.text_data LIKE '%');
+
+DROP TABLE invoice, text_table;
diff --git a/mysql-test/t/key.test b/mysql-test/t/key.test
index cb80d88aee8..a0a291fdf3c 100644
--- a/mysql-test/t/key.test
+++ b/mysql-test/t/key.test
@@ -1,8 +1,12 @@
+--disable_warnings
+drop table if exists t1,t2,t3;
+--enable_warnings
+SET SQL_WARNINGS=1;
+
#
# This failed for Elizabeth Mattijsen
#
-drop table if exists t1,t2,t3;
CREATE TABLE t1 (
ID CHAR(32) NOT NULL,
name CHAR(32) NOT NULL,
@@ -93,7 +97,7 @@ CREATE TABLE t1 (
PRIMARY KEY (name,author,category)
);
INSERT INTO t1 VALUES
-('patnom','patauteur',0,'p.favre@cryo-networks.fr',NULL,NULL,'#p2sndnq6ae5g1u6t','essai\nsalut','scol://195.242.78.119:patauteur.patnom',NULL,NULL,NULL,950036174,-882087474,NULL,3,0,3,'1','Pub/patnom/futur_divers.scs',NULL,'pat','CC1');
+('patnom','patauteur',0,'p.favre@cryo-networks.fr',NULL,NULL,'#p2sndnq6ae5g1u6t','essai salut','scol://195.242.78.119:patauteur.patnom',NULL,NULL,NULL,950036174,-882087474,NULL,3,0,3,'1','Pub/patnom/futur_divers.scs',NULL,'pat','CC1');
INSERT INTO t1 VALUES
('LeNomDeMonSite','Marc',0,'m.barilley@cryo-networks.fr',NULL,NULL,NULL,NULL,'scol://195.242.78.119:Marc.LeNomDeMonSite',NULL,NULL,NULL,950560434,-881563214,NULL,3,0,3,'1','Pub/LeNomDeMonSite/domus_hibere.scs',NULL,'Marq','CC1');
select * from t1 where name='patnom' and author='patauteur' and category=0;
@@ -142,7 +146,8 @@ create table t1
);
INSERT INTO t1 VALUES (1, 1, 1, 1, 'a');
INSERT INTO t1 VALUES (1, 1, 1, 1, 'b');
-!$1062 INSERT INTO t1 VALUES (1, 1, 1, 1, 'a');
+--error 1062
+INSERT INTO t1 VALUES (1, 1, 1, 1, 'a');
drop table t1;
#
@@ -154,7 +159,7 @@ CREATE TABLE t1 (
a tinytext NOT NULL,
b tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (a(32),b)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('a',1),('a',2);
SELECT * FROM t1 WHERE a='a' AND b=2;
SELECT * FROM t1 WHERE a='a' AND b in (2);
@@ -173,7 +178,6 @@ drop table t1;
# Problem with UNIQUE() with NULL parts and auto increment
#
-DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c CHAR(10) NOT NULL,i INT NOT NULL AUTO_INCREMENT,
UNIQUE (c,i));
INSERT INTO t1 (c) VALUES (NULL),(NULL);
@@ -188,3 +192,131 @@ SELECT * FROM t1;
INSERT INTO t1 (c) VALUES ('a'),('a');
SELECT * FROM t1;
drop table t1;
+
+#
+# longer keys
+#
+create table t1 (i int, a char(200), b text, unique (a), unique (b(300))) charset utf8;
+insert t1 values (1, repeat('a',210), repeat('b', 310));
+insert t1 values (2, repeat(0xD0B1,215), repeat(0xD0B1, 310));
+select i, length(a), length(b), char_length(a), char_length(b) from t1;
+select i from t1 where a=repeat(_utf8 'a',200);
+select i from t1 where a=repeat(_utf8 0xD0B1,200);
+select i from t1 where b=repeat(_utf8 'b',310);
+drop table t1;
+
+#
+# Test of key read with primary key (Bug #3497)
+#
+
+CREATE TABLE t1 (id int unsigned auto_increment, name char(50), primary key (id)) engine=myisam;
+insert into t1 (name) values ('a'), ('b'),('c'),('d'),('e'),('f'),('g');
+explain select 1 from t1 where id =2;
+explain select 1 from t1 where id =2 or id=3;
+explain select name from t1 where id =2;
+ALTER TABLE t1 DROP PRIMARY KEY, ADD INDEX (id);
+explain select 1 from t1 where id =2;
+drop table t1;
+
+#
+# Test of problem with key read (Bug #3666)
+#
+
+CREATE TABLE t1 (numeropost mediumint(8) unsigned NOT NULL default '0', numreponse int(10) unsigned NOT NULL auto_increment, PRIMARY KEY (numeropost,numreponse), UNIQUE KEY numreponse (numreponse));
+INSERT INTO t1 (numeropost,numreponse) VALUES ('1','1'),('1','2'),('2','3'),('2','4');
+SELECT numeropost FROM t1 WHERE numreponse='1';
+EXPLAIN SELECT numeropost FROM t1 WHERE numreponse='1';
+FLUSH TABLES;
+SELECT numeropost FROM t1 WHERE numreponse='1';
+drop table t1;
+
+#
+# UNIQUE prefix keys and multi-byte charsets
+#
+
+create table t1 (c varchar(30) character set utf8, t text character set utf8, unique (c(2)), unique (t(3))) engine=myisam;
+show create table t1;
+insert t1 values ('cccc', 'tttt'),
+ (0xD0B1212223D0B1D0B1D0B1D0B1D0B1, 0xD0B1D0B1212223D0B1D0B1D0B1D0B1),
+ (0xD0B1222123D0B1D0B1D0B1D0B1D0B1, 0xD0B1D0B1222123D0B1D0B1D0B1D0B1);
+--error 1062
+insert t1 (c) values ('cc22');
+--error 1062
+insert t1 (t) values ('ttt22');
+--error 1062
+insert t1 (c) values (0xD0B1212322D0B1D0B1D0B1D0B1D0B1);
+--error 1062
+insert t1 (t) values (0xD0B1D0B1212322D0B1D0B1D0B1D0B1);
+select c from t1 where c='cccc';
+select t from t1 where t='tttt';
+select c from t1 where c=0xD0B1212223D0B1D0B1D0B1D0B1D0B1;
+select t from t1 where t=0xD0B1D0B1212223D0B1D0B1D0B1D0B1;
+drop table t1;
+
+#
+# BUG#6151 - myisam index corruption
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+ c1 int,
+ c2 varbinary(240),
+ UNIQUE KEY (c1),
+ KEY (c2)
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,'\Z\Z\Z\Z');
+INSERT INTO t1 VALUES (2,'\Z\Z\Z\Z\Z\Z');
+INSERT INTO t1 VALUES (3,'\Z\Z\Z\Z');
+select c1 from t1 where c2='\Z\Z\Z\Z';
+DELETE FROM t1 WHERE (c1 = 1);
+check table t1;
+select c1 from t1 where c2='\Z\Z\Z\Z';
+DELETE FROM t1 WHERE (c1 = 3);
+check table t1;
+select c1 from t1 where c2='\Z\Z\Z\Z';
+
+#
+# test delete of keys in a different order
+#
+truncate table t1;
+insert into t1 values(1,"aaaa"),(2,"aaab"),(3,"aaac"),(4,"aaccc");
+delete from t1 where c1=3;
+delete from t1 where c1=1;
+delete from t1 where c1=4;
+check table t1;
+
+drop table t1;
+
+#
+# Bug 6166: index prefix length of 0 not rejected
+#
+# this test should fail in 5.0
+# to fix it, remove #ifdef in
+# file sql_yacc.yy(key_part)
+# create dedicated error code for this and
+# and change my_printf_error() to my_error
+
+--error 1105
+create table t1 (c char(10), index (c(0)));
+
+#
+# Bug #6126: Duplicate columns in keys should fail
+# Bug #6252: (dup)
+#
+--error 1060
+create table t1 (c char(10), index (c,c));
+--error 1060
+create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1));
+--error 1060
+create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2));
+--error 1060
+create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1));
+create table t1 (c1 char(10), c2 char(10));
+--error 1060
+alter table t1 add key (c1,c1);
+--error 1060
+alter table t1 add key (c2,c1,c1);
+--error 1060
+alter table t1 add key (c1,c2,c1);
+--error 1060
+alter table t1 add key (c1,c1,c2);
+drop table t1;
diff --git a/mysql-test/t/key_cache-master.opt b/mysql-test/t/key_cache-master.opt
new file mode 100644
index 00000000000..66e19c18a8a
--- /dev/null
+++ b/mysql-test/t/key_cache-master.opt
@@ -0,0 +1 @@
+--key_buffer_size=2M --small.key_buffer_size=256K --small.key_buffer_size=128K
diff --git a/mysql-test/t/key_cache.test b/mysql-test/t/key_cache.test
new file mode 100644
index 00000000000..5ff26b315e2
--- /dev/null
+++ b/mysql-test/t/key_cache.test
@@ -0,0 +1,169 @@
+#
+# Test of multiple key caches
+#
+--disable_warnings
+drop table if exists t1, t2, t3;
+--enable_warnings
+
+SET @save_key_buffer=@@key_buffer_size;
+
+SELECT @@key_buffer_size, @@small.key_buffer_size;
+
+# Change default key cache size
+SET @@global.key_buffer_size=16*1024*1024;
+SET @@global.default.key_buffer_size=16*1024*1024;
+SET @@global.default.key_buffer_size=16*1024*1024;
+
+SET @@global.small.key_buffer_size=1*1024*1024;
+SET @@global.medium.key_buffer_size=4*1024*1024;
+# Drop buffer
+SET @@global.medium.key_buffer_size=0;
+# Test double drop
+SET @@global.medium.key_buffer_size=0;
+
+# Print key buffer with different syntaxes
+SHOW VARIABLES like "key_buffer_size";
+SELECT @@key_buffer_size;
+SELECT @@global.key_buffer_size;
+SELECT @@global.default.key_buffer_size;
+SELECT @@global.default.`key_buffer_size`;
+SELECT @@global.`default`.`key_buffer_size`;
+SELECT @@`default`.key_buffer_size;
+
+SELECT @@small.key_buffer_size;
+SELECT @@medium.key_buffer_size;
+
+SET @@global.key_buffer_size=@save_key_buffer;
+
+#
+# Errors
+#
+
+--error 1064
+SELECT @@default.key_buffer_size;
+--error 1272
+SELECT @@skr.storage_engine="test";
+
+select @@keycache1.key_cache_block_size;
+select @@keycache1.key_buffer_size;
+set global keycache1.key_cache_block_size=2048;
+select @@keycache1.key_buffer_size;
+select @@keycache1.key_cache_block_size;
+set global keycache1.key_buffer_size=1*1024*1024;
+select @@keycache1.key_buffer_size;
+select @@keycache1.key_cache_block_size;
+set global keycache2.key_buffer_size=4*1024*1024;
+select @@keycache2.key_buffer_size;
+select @@keycache2.key_cache_block_size;
+set global keycache1.key_buffer_size=0;
+select @@keycache1.key_buffer_size;
+select @@keycache1.key_cache_block_size;
+select @@key_buffer_size;
+select @@key_cache_block_size;
+
+set global keycache1.key_buffer_size=1024*1024;
+
+create table t1 (p int primary key, a char(10)) delay_key_write=1;
+create table t2 (p int primary key, i int, a char(10), key k1(i), key k2(a));
+
+show status like 'key_blocks_used';
+
+# Following results differs on 64 and 32 bit systems because of different
+# pointer sizes, which takes up different amount of space in key cache
+
+--replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED 1674 KEY_BLOCKS_UNUSED 1818 KEY_BLOCKS_UNUSED 1824 KEY_BLOCKS_UNUSED
+show status like 'key_blocks_unused';
+
+insert into t1 values (1, 'qqqq'), (11, 'yyyy');
+insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'),
+ (3, 1, 'yyyy'), (4, 3, 'zzzz');
+select * from t1;
+select * from t2;
+
+update t1 set p=2 where p=1;
+update t2 set i=2 where i=1;
+
+show status like 'key_blocks_used';
+--replace_result 1808 KEY_BLOCKS_UNUSED 1789 KEY_BLOCKS_UNUSED 1670 KEY_BLOCKS_UNUSED 1814 KEY_BLOCKS_UNUSED 1820 KEY_BLOCKS_UNUSED
+show status like 'key_blocks_unused';
+
+cache index t1 key (`primary`) in keycache1;
+
+explain select p from t1;
+select p from t1;
+explain select i from t2;
+select i from t2;
+explain select count(*) from t1, t2 where t1.p = t2.i;
+select count(*) from t1, t2 where t1.p = t2.i;
+
+cache index t2 in keycache1;
+update t2 set p=p+1000, i=2 where a='qqqq';
+cache index t2 in keycache2;
+insert into t2 values (2000, 3, 'yyyy');
+cache index t2 in keycache1;
+update t2 set p=3000 where a='zzzz';
+select * from t2;
+explain select p from t2;
+select p from t2;
+explain select i from t2;
+select i from t2;
+explain select a from t2;
+select a from t2;
+
+# Test some error conditions
+--error 1284
+cache index t1 in unknown_key_cache;
+cache index t1 key (unknown_key) in keycache1;
+
+select @@keycache2.key_buffer_size;
+select @@keycache2.key_cache_block_size;
+set global keycache2.key_buffer_size=0;
+select @@keycache2.key_buffer_size;
+select @@keycache2.key_cache_block_size;
+set global keycache2.key_buffer_size=1024*1024;
+select @@keycache2.key_buffer_size;
+
+update t2 set p=4000 where a='zzzz';
+update t1 set p=p+1;
+
+set global keycache1.key_buffer_size=0;
+select * from t2;
+select p from t2;
+explain select i from t2;
+select i from t2;
+explain select a from t2;
+select a from t2;
+
+select * from t1;
+select p from t1;
+
+# Use the 'small' key cache
+create table t3 (like t1);
+cache index t3 in small;
+insert into t3 select * from t1;
+cache index t3 in keycache2;
+cache index t1,t2 in default;
+drop table t1,t2,t3;
+
+show status like 'key_blocks_used';
+--replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED 1674 KEY_BLOCKS_UNUSED 1818 KEY_BLOCKS_UNUSED 1824 KEY_BLOCKS_UNUSED
+show status like 'key_blocks_unused';
+
+# Cleanup
+# We don't reset keycache2 as we want to ensure that mysqld will reset it
+set global keycache2.key_buffer_size=0;
+
+# Test to set up a too small size for a key cache (bug #2064)
+set global keycache3.key_buffer_size=100;
+set global keycache3.key_buffer_size=0;
+
+# Test case for buf 6447
+
+create table t1 (mytext text, FULLTEXT (mytext));
+insert t1 values ('aaabbb');
+
+check table t1;
+set GLOBAL key_cache_block_size=2048;
+check table t1;
+
+drop table t1;
diff --git a/mysql-test/t/key_diff.test b/mysql-test/t/key_diff.test
index 60afb5f81a4..b4e4339ae33 100644
--- a/mysql-test/t/key_diff.test
+++ b/mysql-test/t/key_diff.test
@@ -1,7 +1,10 @@
#
# Check on condition on different length keys.
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+
CREATE TABLE t1 (
a char(5) NOT NULL,
b char(4) NOT NULL,
diff --git a/mysql-test/t/key_primary.test b/mysql-test/t/key_primary.test
index 2cdb117128f..816365c517c 100644
--- a/mysql-test/t/key_primary.test
+++ b/mysql-test/t/key_primary.test
@@ -2,7 +2,10 @@
# test of primary key conversions
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+
create table t1 (t1 char(3) primary key);
insert into t1 values("ABC");
insert into t1 values("ABA");
diff --git a/mysql-test/t/keywords.test b/mysql-test/t/keywords.test
index 3bd757aa069..e7ec63afe54 100644
--- a/mysql-test/t/keywords.test
+++ b/mysql-test/t/keywords.test
@@ -2,7 +2,10 @@
# Test keywords as fields
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+
create table t1 (time time, date date, timestamp timestamp);
insert into t1 values ("12:22:22","97:02:03","1997-01-02");
select * from t1;
diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test
index 6bcc43ac916..65d4f27059f 100644
--- a/mysql-test/t/kill.test
+++ b/mysql-test/t/kill.test
@@ -11,7 +11,10 @@ connect (con2, localhost, root,,);
#remember id of con1
connection con1;
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+
create table t1 (kill_id int);
insert into t1 values(connection_id());
diff --git a/mysql-test/t/limit.test b/mysql-test/t/limit.test
index 32962073eee..61c57c9b468 100644
--- a/mysql-test/t/limit.test
+++ b/mysql-test/t/limit.test
@@ -2,7 +2,10 @@
# Test of update and delete with limit
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+
create table t1 (a int primary key, b int not null);
insert into t1 () values (); -- Testing default values
insert into t1 values (1,1),(2,1),(3,1);
diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test
index 9269eb19b05..aa0ea0a2f55 100644
--- a/mysql-test/t/loaddata.test
+++ b/mysql-test/t/loaddata.test
@@ -2,7 +2,9 @@
# Some simple test of load data
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
create table t1 (a date, b date, c date not null, d date);
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',';
diff --git a/mysql-test/t/lock.test b/mysql-test/t/lock.test
index 9015ce12fde..26fc4e32bda 100644
--- a/mysql-test/t/lock.test
+++ b/mysql-test/t/lock.test
@@ -2,8 +2,10 @@
# Testing of table locking
#
+--disable_warnings
drop table if exists t1,t2;
-CREATE TABLE t1 ( `id` int(11) NOT NULL default '0', `id2` int(11) NOT NULL default '0', `id3` int(11) NOT NULL default '0', `dummy1` char(30) default NULL, PRIMARY KEY (`id`,`id2`), KEY `index_id3` (`id3`)) TYPE=MyISAM;
+--enable_warnings
+CREATE TABLE t1 ( `id` int(11) NOT NULL default '0', `id2` int(11) NOT NULL default '0', `id3` int(11) NOT NULL default '0', `dummy1` char(30) default NULL, PRIMARY KEY (`id`,`id2`), KEY `index_id3` (`id3`)) ENGINE=MyISAM;
insert into t1 (id,id2) values (1,1),(1,2),(1,3);
LOCK TABLE t1 WRITE;
select dummy1,count(distinct id) from t1 group by dummy1;
@@ -31,12 +33,12 @@ CREATE TABLE t1 (
index1 smallint(6) default NULL,
nr smallint(6) default NULL,
KEY index1(index1)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
CREATE TABLE t2 (
nr smallint(6) default NULL,
name varchar(20) default NULL
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,'item1');
INSERT INTO t2 VALUES (2,'item2');
diff --git a/mysql-test/t/lock_multi.test b/mysql-test/t/lock_multi.test
index e20f8163751..cbda47ac864 100644
--- a/mysql-test/t/lock_multi.test
+++ b/mysql-test/t/lock_multi.test
@@ -6,9 +6,11 @@
#
-- source include/not_embedded.inc
+--disable_warnings
drop table if exists t1,t2;
+--enable_warnings
-# test to see if select will get the lock ahead of low priority update
+# Test to see if select will get the lock ahead of low priority update
connect (locker,localhost,root,,);
connect (reader,localhost,root,,);
diff --git a/mysql-test/t/lock_tables_lost_commit.test b/mysql-test/t/lock_tables_lost_commit.test
index f05f813b06f..8c1ad97c0cc 100644
--- a/mysql-test/t/lock_tables_lost_commit.test
+++ b/mysql-test/t/lock_tables_lost_commit.test
@@ -6,8 +6,10 @@ connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
+--disable_warnings
drop table if exists t1;
-create table t1(a int) type=innodb;
+create table t1(a int) engine=innodb;
+--enable_warnings
lock tables t1 write;
insert into t1 values(10);
disconnect con1;
diff --git a/mysql-test/t/lowercase_table.test b/mysql-test/t/lowercase_table.test
index 1b431a9d920..a9c0c976afc 100644
--- a/mysql-test/t/lowercase_table.test
+++ b/mysql-test/t/lowercase_table.test
@@ -2,8 +2,13 @@
# Test of --lower-case-table-names
#
-drop table if exists t1,t2,t3,t4,T1;
+--disable_warnings
+drop table if exists t1,t2,t3,t4;
+# Clear up from other tests (to ensure that SHOW TABLES below is right)
+drop table if exists t0,t5,t6,t7,t8,t9;
drop database if exists mysqltest;
+--enable_warnings
+
create table T1 (id int primary key, Word varchar(40) not null, Index(Word));
create table t4 (id int primary key, Word varchar(40) not null);
INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c');
@@ -12,23 +17,20 @@ SELECT * FROM t1;
SELECT T1.id from T1 LIMIT 1;
SELECT T2.id from t1 as T2 LIMIT 1;
SELECT * from t1 left join t4 on (test.t1.id= TEST.t4.id) where TEST.t1.id >= test.t4.id;
---error 1109
+# This gave an error in 4.0, but it's fixed in 4.1
SELECT T2.id from t1 as t2 LIMIT 1;
RENAME TABLE T1 TO T2;
ALTER TABLE T2 ADD new_col int not null;
ALTER TABLE T2 RENAME T3;
show tables like 't_';
drop table t3,t4;
-
#
# Test alias
#
create table t1 (a int);
select count(*) from T1;
select count(*) from t1;
---error 1109
select count(T1.a) from t1;
---error 1109
select count(bags.a) from t1 as Bags;
drop table t1;
@@ -39,7 +41,6 @@ create database mysqltest;
use MYSQLTEST;
create table t1 (a int);
select T1.a from MYSQLTEST.T1;
---error 1109
select t1.a from MYSQLTEST.T1;
select mysqltest.t1.* from MYSQLTEST.t1;
select MYSQLTEST.t1.* from MYSQLTEST.t1;
@@ -48,3 +49,28 @@ select MYSQLTEST.T1.* from T1;
alter table t1 rename to T1;
select MYSQLTEST.t1.* from MYSQLTEST.t1;
drop database mysqltest;
+use test;
+
+#
+# multiupdate/delete & --lower-case-table-names
+#
+create table t1 (a int);
+create table t2 (a int);
+delete p1.*,P2.* from t1 as p1, t2 as p2 where p1.a=P2.a;
+delete P1.*,p2.* from t1 as P1, t2 as P2 where P1.a=p2.a;
+update t1 as p1, t2 as p2 SET p1.a=1,P2.a=1 where p1.a=P2.a;
+update t1 as P1, t2 as P2 SET P1.a=1,p2.a=1 where P1.a=p2.a;
+drop table t1,t2;
+
+#
+# aliases case insensitive
+#
+create table t1 (a int);
+create table t2 (a int);
+-- error 1066
+select * from t1 c, t2 C;
+-- error 1066
+select C.a, c.a from t1 c, t2 C;
+drop table t1, t2;
+
+show tables;
diff --git a/mysql-test/t/lowercase_table2.test b/mysql-test/t/lowercase_table2.test
index 4a56b16a441..a4eaeac4ef4 100644
--- a/mysql-test/t/lowercase_table2.test
+++ b/mysql-test/t/lowercase_table2.test
@@ -1,6 +1,6 @@
#
# Test of --lower-case-table-names=2
-# (User has case insensitive file system and want's to preserve case of
+# (User has case insensitive file system and wants to preserve case of
# table names)
#
--source include/have_innodb.inc
diff --git a/mysql-test/t/lowercase_table3.test b/mysql-test/t/lowercase_table3.test
index 735a0b390f9..a394cde7237 100644
--- a/mysql-test/t/lowercase_table3.test
+++ b/mysql-test/t/lowercase_table3.test
@@ -1,6 +1,6 @@
#
# Test of force of lower-case-table-names=0
-# (User has case insensitive file system and want's to preserve case of
+# (User has case insensitive file system and wants to preserve case of
# table names)
#
@@ -9,7 +9,7 @@
disable_query_log;
show variables like "lower_case_%";
--require r/true.require
-select @@version_compile_os NOT IN ("NT","WIN2000","Win95/Win98","XP") as "TRUE";
+select convert(@@version_compile_os using latin1) NOT IN ("NT","WIN2000","Win95/Win98","XP") as "TRUE";
enable_query_log;
--disable_warnings
@@ -31,7 +31,7 @@ flush tables;
# storing things in lower case.
#
-CREATE TABLE t1 (a int) type=INNODB;
+CREATE TABLE t1 (a int) ENGINE=INNODB;
--error 1016
SELECT * from T1;
drop table t1;
diff --git a/mysql-test/t/lowercase_table_qcache-master.opt b/mysql-test/t/lowercase_table_qcache-master.opt
new file mode 100644
index 00000000000..c718e2feb1b
--- /dev/null
+++ b/mysql-test/t/lowercase_table_qcache-master.opt
@@ -0,0 +1 @@
+--lower_case_table_names
diff --git a/mysql-test/t/lowercase_table_qcache.test b/mysql-test/t/lowercase_table_qcache.test
new file mode 100644
index 00000000000..5077a41402a
--- /dev/null
+++ b/mysql-test/t/lowercase_table_qcache.test
@@ -0,0 +1,29 @@
+-- source include/have_query_cache.inc
+#
+# Test of query cache with --lower-case-table-names
+#
+set GLOBAL query_cache_size=1355776;
+
+--disable_warnings
+drop database if exists MySQLtesT;
+--enable_warnings
+
+create database MySQLtesT;
+create table MySQLtesT.t1 (a int);
+select * from MySQLtesT.t1;
+show status like "Qcache_queries_in_cache";
+drop database mysqltest;
+show status like "Qcache_queries_in_cache";
+
+use MySQL;
+disable_result_log;
+select * from db;
+enable_result_log;
+show status like "Qcache_queries_in_cache";
+use test;
+disable_result_log;
+select * from MySQL.db;
+enable_result_log;
+show status like "Qcache_queries_in_cache";
+
+set GLOBAL query_cache_size=0;
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
index 57770dc0a0b..b628cb07f7b 100644
--- a/mysql-test/t/merge.test
+++ b/mysql-test/t/merge.test
@@ -2,12 +2,16 @@
# test of MERGE TABLES
#
+--disable_warnings
drop table if exists t1,t2,t3,t4,t5,t6;
+drop database if exists mysqltest;
+--enable_warnings
+
create table t1 (a int not null primary key auto_increment, message char(20));
create table t2 (a int not null primary key auto_increment, message char(20));
INSERT INTO t1 (message) VALUES ("Testing"),("table"),("t1");
INSERT INTO t2 (message) VALUES ("Testing"),("table"),("t2");
-create table t3 (a int not null, b char(20), key(a)) type=MERGE UNION=(t1,t2);
+create table t3 (a int not null, b char(20), key(a)) engine=MERGE UNION=(t1,t2);
select * from t3;
select * from t3 order by a desc;
drop table t3;
@@ -22,7 +26,7 @@ insert into t2 select NULL,message from t1;
insert into t1 select NULL,message from t2;
insert into t2 select NULL,message from t1;
insert into t1 select NULL,message from t2;
-create table t3 (a int not null, b char(20), key(a)) type=MERGE UNION=(test.t1,test.t2);
+create table t3 (a int not null, b char(20), key(a)) engine=MERGE UNION=(test.t1,test.t2);
explain select * from t3 where a < 10;
explain select * from t3 where a > 10 and a < 20;
select * from t3 where a = 10;
@@ -42,18 +46,29 @@ select * from t3 where a < 10;
show create table t3;
# The following should give errors
-create table t4 (a int not null, b char(10), key(a)) type=MERGE UNION=(t1,t2);
+create table t4 (a int not null, b char(10), key(a)) engine=MERGE UNION=(t1,t2);
--error 1016
select * from t4;
---error 1212
-create table t5 (a int not null, b char(10), key(a)) type=MERGE UNION=(test.t1,test_2.t2);
+--error 1016
+alter table t4 add column c int;
-# Because of windows, it's important that we drop the merge tables first!
-drop table if exists t5,t4,t3,t1,t2;
+#
+# Test tables in different databases
+#
+create database mysqltest;
+create table mysqltest.t6 (a int not null primary key auto_increment, message char(20));
+create table t5 (a int not null, b char(20), key(a)) engine=MERGE UNION=(test.t1,mysqltest.t6);
+show create table t5;
+alter table t5 engine=myisam;
+drop table t5, mysqltest.t6;
+drop database mysqltest;
-create table t1 (c char(10)) type=myisam;
-create table t2 (c char(10)) type=myisam;
-create table t3 (c char(10)) union=(t1,t2) type=merge;
+# Because of windows, it's important that we drop the merge tables first!
+drop table t4,t3,t1,t2;
+
+create table t1 (c char(10)) engine=myisam;
+create table t2 (c char(10)) engine=myisam;
+create table t3 (c char(10)) union=(t1,t2) engine=merge;
insert into t1 (c) values ('test1');
insert into t1 (c) values ('test1');
insert into t1 (c) values ('test1');
@@ -74,7 +89,7 @@ drop table t3,t2,t1;
CREATE TABLE t1 (incr int not null, othr int not null, primary key(incr));
CREATE TABLE t2 (incr int not null, othr int not null, primary key(incr));
CREATE TABLE t3 (incr int not null, othr int not null, primary key(incr))
-TYPE=MERGE UNION=(t1,t2);
+ENGINE=MERGE UNION=(t1,t2);
SELECT * from t3;
@@ -88,14 +103,14 @@ alter table t3 UNION=(t1);
select count(*) from t3;
alter table t3 UNION=(t1,t2);
select count(*) from t3;
-alter table t3 TYPE=MYISAM;
+alter table t3 ENGINE=MYISAM;
select count(*) from t3;
# Test that ALTER TABLE rembers the old UNION
drop table t3;
CREATE TABLE t3 (incr int not null, othr int not null, primary key(incr))
-TYPE=MERGE UNION=(t1,t2);
+ENGINE=MERGE UNION=(t1,t2);
show create table t3;
alter table t3 drop primary key;
show create table t3;
@@ -105,18 +120,17 @@ drop table t3,t2,t1;
#
# Test table without unions
#
-create table t1 (a int not null, key(a)) type=merge;
+create table t1 (a int not null, key(a)) engine=merge;
select * from t1;
drop table t1;
#
-# Bug found by Monty.
+# Bug in flush tables combined with MERGE tables
#
-drop table if exists t3, t2, t1;
create table t1 (a int not null, b int not null, key(a,b));
create table t2 (a int not null, b int not null, key(a,b));
-create table t3 (a int not null, b int not null, key(a,b)) TYPE=MERGE UNION=(t1,t2);
+create table t3 (a int not null, b int not null, key(a,b)) ENGINE=MERGE UNION=(t1,t2);
insert into t1 values (1,2),(2,1),(0,0),(4,4),(5,5),(6,6);
insert into t2 values (1,1),(2,2),(0,0),(4,4),(5,5),(6,6);
flush tables;
@@ -127,14 +141,13 @@ drop table t3,t1,t2;
# [phi] testing INSERT_METHOD stuff
#
-drop table if exists t6, t5, t4, t3, t2, t1;
# first testing of common stuff with new parameters
create table t1 (a int not null, b int not null auto_increment, primary key(a,b));
create table t2 (a int not null, b int not null auto_increment, primary key(a,b));
create table t3 (a int not null, b int not null, key(a,b)) UNION=(t1,t2) INSERT_METHOD=NO;
-create table t4 (a int not null, b int not null, key(a,b)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=NO;
-create table t5 (a int not null, b int not null auto_increment, primary key(a,b)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST;
-create table t6 (a int not null, b int not null auto_increment, primary key(a,b)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST;
+create table t4 (a int not null, b int not null, key(a,b)) ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=NO;
+create table t5 (a int not null, b int not null auto_increment, primary key(a,b)) ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST;
+create table t6 (a int not null, b int not null auto_increment, primary key(a,b)) ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST;
show create table t3;
show create table t4;
show create table t5;
@@ -175,47 +188,55 @@ select * from t1 order by a,b;
select * from t2 order by a,b;
select * from t5 order by a,b;
select * from t6 order by a,b;
-drop table if exists t6, t5, t4, t3, t2, t1;
+insert into t1 values (99,NULL);
+select * from t4 where a+0 > 90;
+# bug#4008 - cannot determine a unique key that caused "dupl. key error"
+--error 1062
+insert t5 values (1,1);
+--error 1062
+insert t6 values (2,1);
+insert t5 values (1,1) on duplicate key update b=b+10;
+insert t6 values (2,1) on duplicate key update b=b+20;
+select * from t5 where a < 3;
+drop table t6, t5, t4, t3, t2, t1;
-CREATE TABLE t1 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) TYPE=MyISAM;
+CREATE TABLE t1 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1), (2,1);
-CREATE TABLE t2 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) TYPE=MyISAM;
+CREATE TABLE t2 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,2), (2,2);
-CREATE TABLE t ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', KEY a (a,b)) TYPE=MRG_MyISAM UNION=(t1,t2);
-select max(b) from t where a = 2;
+CREATE TABLE t3 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', KEY a (a,b)) ENGINE=MRG_MyISAM UNION=(t1,t2);
+select max(b) from t3 where a = 2;
select max(b) from t1 where a = 2;
-drop table if exists t,t1,t2;
+drop table t3,t1,t2;
#
# temporary merge tables
#
-drop table if exists t1, t2, t3, t4, t5, t6;
create table t1 (a int not null);
create table t2 (a int not null);
insert into t1 values (1);
insert into t2 values (2);
-create temporary table t3 (a int not null) TYPE=MERGE UNION=(t1,t2);
+create temporary table t3 (a int not null) ENGINE=MERGE UNION=(t1,t2);
select * from t3;
create temporary table t4 (a int not null);
create temporary table t5 (a int not null);
insert into t4 values (1);
insert into t5 values (2);
-create temporary table t6 (a int not null) TYPE=MERGE UNION=(t4,t5);
+create temporary table t6 (a int not null) ENGINE=MERGE UNION=(t4,t5);
select * from t6;
-drop table if exists t6, t5, t4, t3, t2, t1;
+drop table t6, t3, t1, t2, t4, t5;
#
# testing merge::records_in_range and optimizer
#
-DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (
fileset_id tinyint(3) unsigned NOT NULL default '0',
file_code varchar(32) NOT NULL default '',
fileset_root_id tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (fileset_id,file_code),
KEY files (fileset_id,fileset_root_id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (2, '0000000111', 1), (2, '0000000112', 1), (2, '0000000113', 1),
(2, '0000000114', 1), (2, '0000000115', 1), (2, '0000000116', 1), (2, '0000000117', 1),
(2, '0000000118', 1), (2, '0000000119', 1), (2, '0000000120', 1);
@@ -225,7 +246,7 @@ CREATE TABLE t2 (
fileset_root_id tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (fileset_id,file_code),
KEY files (fileset_id,fileset_root_id)
-) TYPE=MRG_MyISAM UNION=(t1);
+) ENGINE=MRG_MyISAM UNION=(t1);
EXPLAIN SELECT * FROM t2 IGNORE INDEX (files) WHERE fileset_id = 2
AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1;
@@ -235,7 +256,7 @@ EXPLAIN SELECT * FROM t1 WHERE fileset_id = 2
AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1;
EXPLAIN SELECT * FROM t2 WHERE fileset_id = 2
AND file_code = '0000000115' LIMIT 1;
-DROP TABLE IF EXISTS t1, t2;
+DROP TABLE t2, t1;
#
# Test of ORDER BY DESC on key (Bug #515)
@@ -243,7 +264,7 @@ DROP TABLE IF EXISTS t1, t2;
create table t1 (x int, y int, index xy(x, y));
create table t2 (x int, y int, index xy(x, y));
-create table t3 (x int, y int, index xy(x, y)) type=merge union=(t1,t2);
+create table t3 (x int, y int, index xy(x, y)) engine=merge union=(t1,t2);
insert into t1 values(1, 2);
insert into t2 values(1, 3);
select * from t3 where x = 1 and y < 5 order by y;
@@ -264,3 +285,21 @@ create table t3 engine=merge union=(t1, t2) select * from t1;
--error 1093
create table t3 engine=merge union=(t1, t2) select * from t2;
drop table t1, t2;
+
+# BUG#6699 : no sorting on 'ref' retrieval
+create table t1 (a int,b int,c int, index (a,b,c));
+create table t2 (a int,b int,c int, index (a,b,c));
+create table t3 (a int,b int,c int, index (a,b,c))
+ engine=merge union=(t1 ,t2);
+insert into t1 (a,b,c) values (1,1,0),(1,2,0);
+insert into t2 (a,b,c) values (1,1,1),(1,2,1);
+
+explain select a,b,c from t3 force index (a) where a=1 order by a,b,c;
+select a,b,c from t3 force index (a) where a=1 order by a,b,c;
+
+# this actually wasn't affected:
+explain select a,b,c from t3 force index (a) where a=1 order by a desc, b desc, c desc;
+select a,b,c from t3 force index (a) where a=1 order by a desc, b desc, c desc;
+
+drop table t1, t2, t3;
+
diff --git a/mysql-test/t/metadata.test b/mysql-test/t/metadata.test
new file mode 100644
index 00000000000..d11cb62b04e
--- /dev/null
+++ b/mysql-test/t/metadata.test
@@ -0,0 +1,37 @@
+#
+# Test metadata
+#
+
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+--enable_metadata
+# PS protocol gives slightly different metadata
+--disable_ps_protocol
+
+#
+# First some simple tests
+#
+
+select 1, 1.0, -1, "hello", NULL;
+
+create table t1 (a tinyint, b smallint, c mediumint, d int, e bigint, f float(3,2), g double(4,3), h decimal(5,4), i year, j date, k timestamp, l datetime, m enum('a','b'), n set('a','b'), o char(10));
+select * from t1;
+select a b, b c from t1 as t2;
+drop table t1;
+
+#
+# Test metadata from ORDER BY (Bug #2654)
+#
+
+CREATE TABLE t1 (id tinyint(3) default NULL, data varchar(255) default NULL);
+INSERT INTO t1 VALUES (1,'male'),(2,'female');
+CREATE TABLE t2 (id tinyint(3) unsigned default NULL, data char(3) default '0');
+INSERT INTO t2 VALUES (1,'yes'),(2,'no');
+
+select t1.id, t1.data, t2.data from t1, t2 where t1.id = t2.id;
+select t1.id, t1.data, t2.data from t1, t2 where t1.id = t2.id order by t1.id;
+select t1.id from t1 union select t2.id from t2;
+drop table t1,t2;
+
+--disable_metadata
diff --git a/mysql-test/t/mix_innodb_myisam_binlog.test b/mysql-test/t/mix_innodb_myisam_binlog.test
index 5f3b778c61a..89a7f8f3036 100644
--- a/mysql-test/t/mix_innodb_myisam_binlog.test
+++ b/mysql-test/t/mix_innodb_myisam_binlog.test
@@ -3,7 +3,7 @@
# It would be nice to make this a replication test, but in 4.0 the
# slave is always with --skip-innodb in the testsuite. I (Guilhem) however
# did some tests manually on a slave; tables are replicated fine and
-# Exec_master_log_pos advances as expected.
+# Exec_Master_Log_Pos advances as expected.
-- source include/have_innodb.inc
@@ -15,8 +15,8 @@ connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
-create table t1 (a int) type=innodb;
-create table t2 (a int) type=myisam;
+create table t1 (a int) engine=innodb;
+create table t2 (a int) engine=myisam;
reset master;
@@ -35,7 +35,6 @@ begin;
insert into t1 values(2);
insert into t2 select * from t1;
# should say some changes to non-transact1onal tables couldn't be rolled back
---error 1196
rollback;
show binlog events from 79;
@@ -49,7 +48,6 @@ insert into t1 values(3);
savepoint my_savepoint;
insert into t1 values(4);
insert into t2 select * from t1;
---error 1196
rollback to savepoint my_savepoint;
commit;
@@ -64,7 +62,6 @@ insert into t1 values(5);
savepoint my_savepoint;
insert into t1 values(6);
insert into t2 select * from t1;
---error 1196
rollback to savepoint my_savepoint;
insert into t1 values(7);
commit;
@@ -121,7 +118,7 @@ show binlog events from 79;
# Check that things work like before this BEGIN/ROLLBACK code was added,
# when t2 is INNODB
-alter table t2 type=INNODB;
+alter table t2 engine=INNODB;
delete from t1;
delete from t2;
diff --git a/mysql-test/t/multi_statement.test b/mysql-test/t/multi_statement.test
new file mode 100644
index 00000000000..862f2294641
--- /dev/null
+++ b/mysql-test/t/multi_statement.test
@@ -0,0 +1,16 @@
+# PS doesn't support multi-statements
+--disable_ps_protocol
+
+select 1;
+delimiter ||||;
+select 2;
+select 3;
+select 4||||
+delimiter 'abcd'||||
+select 5;
+select 6;
+select 50, 'abc';'abcd'
+select "abcd'";'abcd'select "'abcd";'abcd'
+select 5'abcd'
+delimiter ;'abcd'
+select 'finish';
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index 2d6770f77ed..e90de399500 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -2,7 +2,16 @@
# Test of update statement that uses many tables.
#
+--disable_warnings
drop table if exists t1,t2,t3;
+drop database if exists mysqltest;
+--error 0,1141
+revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
+--error 0,1141
+revoke all privileges on mysqltest.* from mysqltest_1@localhost;
+delete from mysql.user where user=_binary'mysqltest_1';
+--enable_warnings
+
create table t1(id1 int not null auto_increment primary key, t char(12));
create table t2(id2 int not null, t char(12));
create table t3(id3 int not null, t char(12), index(id3));
@@ -57,8 +66,8 @@ delete from t1, t2, t3 using t1,t2,t3 where t1.id1 = t2.id2 and t2.id2 = t3.id3
select count(*) from t1 where id1;
select count(*) from t2 where id2;
select count(*) from t3 where id3;
-
drop table t1,t2,t3;
+
create table t1(id1 int not null primary key, t varchar(100)) pack_keys = 1;
create table t2(id2 int not null, t varchar(100), index(id2)) pack_keys = 1;
disable_query_log;
@@ -82,31 +91,31 @@ CREATE TABLE t1 (
id int(11) NOT NULL default '0',
name varchar(10) default NULL,
PRIMARY KEY (id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,'aaa'),(2,'aaa'),(3,'aaa');
CREATE TABLE t2 (
id int(11) NOT NULL default '0',
name varchar(10) default NULL,
PRIMARY KEY (id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t2 VALUES (2,'bbb'),(3,'bbb'),(4,'bbb');
CREATE TABLE t3 (
id int(11) NOT NULL default '0',
mydate datetime default NULL,
PRIMARY KEY (id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t3 VALUES (1,'2002-02-04 00:00:00'),(3,'2002-05-12 00:00:00'),(5,'2002-05-12 00:00:00'),(6,'2002-06-22
00:00:00'),(7,'2002-07-22 00:00:00');
delete t1,t2,t3 from t1,t2,t3 where to_days(now())-to_days(t3.mydate)>=30 and t3.id=t1.id and t3.id=t2.id;
select * from t3;
-DROP TABLE IF EXISTS t1,t2,t3;
+DROP TABLE t1,t2,t3;
CREATE TABLE IF NOT EXISTS `t1` (
`id` int(11) NOT NULL auto_increment,
`tst` text,
`tst1` text,
PRIMARY KEY (`id`)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
CREATE TABLE IF NOT EXISTS `t2` (
`ID` int(11) NOT NULL auto_increment,
@@ -116,7 +125,7 @@ CREATE TABLE IF NOT EXISTS `t2` (
PRIMARY KEY (`ID`),
KEY `IX_ParId_t2` (`ParId`),
FOREIGN KEY (`ParId`) REFERENCES `t1` (`id`)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1(tst,tst1) VALUES("MySQL","MySQL AB"), ("MSSQL","Microsoft"), ("ORACLE","ORACLE");
@@ -127,8 +136,7 @@ select * from t2;
UPDATE t2, t1 SET t2.tst = t1.tst, t2.tst1 = t1.tst1 WHERE t2.ParId = t1.Id;
select * from t2;
-
-drop table if exists t1, t2 ;
+drop table t1, t2 ;
create table t1 (n numeric(10));
create table t2 (n numeric(10));
@@ -211,17 +219,23 @@ insert into t2 values(1,10),(1,20);
UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
select * from t1;
select * from t2;
+UPDATE t1 a ,t2 b SET a.d=b.d,b.d=30 WHERE a.n=b.n;
+select * from t1;
+select * from t2;
+DELETE a, b FROM t1 a,t2 b where a.n=b.n;
+select * from t1;
+select * from t2;
drop table t1,t2;
-drop table if exists t1,t2,t3;
-CREATE TABLE t1 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM;
+
+CREATE TABLE t1 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a'),(10,''),(11,''),(12,''),(13,'');
-CREATE TABLE t2 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM;
+CREATE TABLE t2 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a');
-CREATE TABLE t3 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM;
+CREATE TABLE t3 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) ENGINE=MyISAM;
INSERT INTO t3 VALUES (1,'jedan'),(2,'dva');
update t1,t2 set t1.naziv="aaaa" where t1.broj=t2.broj;
update t1,t2,t3 set t1.naziv="bbbb", t2.naziv="aaaa" where t1.broj=t2.broj and t2.broj=t3.broj;
-drop table if exists t1,t2,t3;
+drop table t1,t2,t3;
#
# Test multi update with different join methods
@@ -249,8 +263,12 @@ update t1,t2 set t1.b=t1.b+2,t2.b=t1.b+10 where t1.b between 3 and 5 and t2.a=t1
select * from t1;
select * from t2;
+# test for non-updating table which is also used in sub-select
+
+update t1,t2 set t1.b=t2.b, t1.a=t2.a where t1.a=t2.a and not exists (select * from t2 where t2.a > 10);
+
drop table t1,t2;
-CREATE TABLE t3 ( KEY1 varchar(50) NOT NULL default '', PARAM_CORR_DISTANCE_RUSH double default NULL, PARAM_CORR_DISTANCE_GEM double default NULL, PARAM_AVG_TARE double default NULL, PARAM_AVG_NB_DAYS double default NULL, PARAM_DEFAULT_PROP_GEM_SRVC varchar(50) default NULL, PARAM_DEFAULT_PROP_GEM_NO_ETIK varchar(50) default NULL, PARAM_SCENARIO_COSTS varchar(50) default NULL, PARAM_DEFAULT_WAGON_COST double default NULL, tmp int(11) default NULL, PRIMARY KEY (KEY1)) TYPE=MyISAM;
+CREATE TABLE t3 ( KEY1 varchar(50) NOT NULL default '', PARAM_CORR_DISTANCE_RUSH double default NULL, PARAM_CORR_DISTANCE_GEM double default NULL, PARAM_AVG_TARE double default NULL, PARAM_AVG_NB_DAYS double default NULL, PARAM_DEFAULT_PROP_GEM_SRVC varchar(50) default NULL, PARAM_DEFAULT_PROP_GEM_NO_ETIK varchar(50) default NULL, PARAM_SCENARIO_COSTS varchar(50) default NULL, PARAM_DEFAULT_WAGON_COST double default NULL, tmp int(11) default NULL, PRIMARY KEY (KEY1)) ENGINE=MyISAM;
INSERT INTO t3 VALUES ('A',1,1,22,3.2,'R','R','BASE2',0.24,NULL);
create table t1 (A varchar(1));
insert into t1 values ("A") ,("B"),("C"),("D");
@@ -278,7 +296,6 @@ drop table t1;
# Test multi-update and multi-delete with impossible where
-drop table if exists t1, t2;
create table t1(id1 smallint(5), field char(5));
create table t2(id2 smallint(5), field char(5));
@@ -302,17 +319,50 @@ delete t1, t2 from t2,t1
drop table t1,t2;
#
+# Test for bug #1820.
+#
+
+create table t1 ( a int not null, b int not null) ;
+--disable_query_log
+insert into t1 values (1,1),(2,2),(3,3),(4,4);
+let $1=19;
+set @d=4;
+while ($1)
+{
+ eval insert into t1 select a+@d,b+@d from t1;
+ eval set @d=@d*2;
+ dec $1;
+}
+
+--enable_query_log
+alter table t1 add index i1(a);
+delete from t1 where a > 2000000;
+create table t2 like t1;
+insert into t2 select * from t1;
+
+select 't2 rows before small delete', count(*) from t1;
+delete t1,t2 from t1,t2 where t1.b=t2.a and t1.a < 2;
+select 't2 rows after small delete', count(*) from t2;
+select 't1 rows after small delete', count(*) from t1;
+
+## Try deleting many rows
+
+delete t1,t2 from t1,t2 where t1.b=t2.a and t1.a < 100*1000;
+select 't2 rows after big delete', count(*) from t2;
+select 't1 rows after big delete', count(*) from t1;
+
+drop table t1,t2;
+
+#
# Test alias (this is not correct in 4.0)
#
CREATE TABLE t1 ( a int );
CREATE TABLE t2 ( a int );
DELETE t1 FROM t1, t2 AS t3;
---error 1066
DELETE t4 FROM t1, t1 AS t4;
---error 1066
DELETE t3 FROM t1 AS t3, t1 AS t4;
-#--error 1066
+--error 1109
DELETE t1 FROM t1 AS t3, t2 AS t4;
INSERT INTO t1 values (1),(2);
INSERT INTO t2 values (1),(2);
@@ -327,7 +377,6 @@ DROP TABLE t1,t2;
#
# Test update with const tables
#
-
create table `t1` (`p_id` int(10) unsigned NOT NULL auto_increment, `p_code` varchar(20) NOT NULL default '', `p_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`p_id`) );
create table `t2` (`c2_id` int(10) unsigned NULL auto_increment, `c2_p_id` int(10) unsigned NOT NULL default '0', `c2_note` text NOT NULL, `c2_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`c2_id`), KEY `c2_p_id` (`c2_p_id`) );
insert into t1 values (0,'A01-Comp',1);
@@ -338,11 +387,62 @@ select * from t1;
select * from t2;
drop table t1, t2;
+#
+# privilege check for multiupdate with other tables
+#
+
+connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
+connection root;
+--disable_warnings
+create database mysqltest;
+--enable_warnings
+create table mysqltest.t1 (a int, b int, primary key (a));
+create table mysqltest.t2 (a int, b int, primary key (a));
+create table mysqltest.t3 (a int, b int, primary key (a));
+grant select on mysqltest.* to mysqltest_1@localhost;
+grant update on mysqltest.t1 to mysqltest_1@localhost;
+connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
+connection user1;
+update t1, t2 set t1.b=1 where t1.a=t2.a;
+update t1, t2 set t1.b=(select t3.b from t3 where t1.a=t3.a) where t1.a=t2.a;
+connection root;
+revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
+revoke all privileges on mysqltest.* from mysqltest_1@localhost;
+delete from mysql.user where user=_binary'mysqltest_1';
+drop database mysqltest;
+
+#
+# multi delete wrong table check
+#
+create table t1 (a int, primary key (a));
+create table t2 (a int, primary key (a));
+create table t3 (a int, primary key (a));
+-- error 1109
+delete t1,t3 from t1,t2 where t1.a=t2.a and t2.a=(select t3.a from t3 where t1.a=t3.a);
+drop table t1, t2, t3;
+
+#
+# multi* unique updating table check
+#
+create table t1 (col1 int);
+create table t2 (col1 int);
+-- error 1093
+update t1,t2 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1;
+-- error 1093
+delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2.col1;
+drop table t1,t2;
+
# Test for BUG#5837 - delete with outer join and const tables
-drop table if exists t2, t1;
-create table t1(aclid bigint not null primary key, status tinyint(1) not null ) type = innodb;
-create table t2(refid bigint not null primary key, aclid bigint, index idx_acl(aclid) )type = innodb;
+create table t1 (
+ aclid bigint not null primary key,
+ status tinyint(1) not null
+) engine = innodb;
+
+create table t2 (
+ refid bigint not null primary key,
+ aclid bigint, index idx_acl(aclid)
+) engine = innodb;
insert into t2 values(1,null);
-delete t2, t1 from t2 as a left join t1 as b on (a.aclid=b.aclid) where a.refid='1';
+delete t2, t1 from t2 left join t1 on (t2.aclid=t1.aclid) where t2.refid='1';
drop table t1, t2;
diff --git a/mysql-test/t/myisam-blob.test b/mysql-test/t/myisam-blob.test
index d58222ec8bf..7af8c661c02 100644
--- a/mysql-test/t/myisam-blob.test
+++ b/mysql-test/t/myisam-blob.test
@@ -27,4 +27,15 @@ UPDATE t1 set data=repeat('c',17*1024*1024);
check table t1;
delete from t1 where left(data,1)='c';
check table t1;
+
+INSERT INTO t1 set data=repeat('a',18*1024*1024);
+select length(data) from t1;
+alter table t1 modify data blob;
+select length(data) from t1;
+drop table t1;
+
+CREATE TABLE t1 (data BLOB) ENGINE=myisam;
+INSERT INTO t1 (data) VALUES (NULL);
+UPDATE t1 set data=repeat('a',18*1024*1024);
+select length(data) from t1;
drop table t1;
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index 57b64e30bac..c8ed7910b76 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -3,7 +3,10 @@
#
# Initialise
+--disable_warnings
drop table if exists t1,t2;
+--enable_warnings
+SET SQL_WARNINGS=1;
#
# Test problem with CHECK TABLE;
@@ -11,8 +14,8 @@ drop table if exists t1,t2;
CREATE TABLE t1 (
STRING_DATA char(255) default NULL,
- KEY STRING_DATA (STRING_DATA)
-) TYPE=MyISAM;
+ KEY string_data (STRING_DATA)
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA');
INSERT INTO t1 VALUES ('DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD');
@@ -31,11 +34,15 @@ create table t1 (a tinyint not null auto_increment, b blob not null, primary key
let $1=100;
disable_query_log;
+--disable_warnings
+SET SQL_WARNINGS=0;
while ($1)
{
eval insert into t1 (b) values(repeat(char(65+$1),65550-$1));
dec $1;
}
+SET SQL_WARNINGS=1;
+--enable_warnings
enable_query_log;
check table t1;
repair table t1;
@@ -61,7 +68,7 @@ drop table t1;
# Test of how ORDER BY works when doing it on the whole table
#
-create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) type=myisam;
+create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=myisam;
insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
explain select * from t1 order by a;
explain select * from t1 order by b;
@@ -293,6 +300,9 @@ insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
update t1 set b=repeat('a',256);
update t1 set i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0;
check table t1;
+delete from t1 where i8=1;
+select i1,i2 from t1;
+check table t1;
drop table t1;
#
@@ -314,7 +324,7 @@ CREATE TABLE `t1` (
KEY `poster_login` (`poster_login`),
KEY `topic_id` (`topic_id`),
FULLTEXT KEY `post_text` (`post_text`)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 (post_text) VALUES ('ceci est un test'),('ceci est un test'),('ceci est un test'),('ceci est un test'),('ceci est un test');
@@ -327,10 +337,10 @@ drop table t1;
#
--error 1071
-CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255), KEY t1 (a, b, c));
-CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255));
+CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255), d varchar(255), e varchar(255), KEY t1 (a, b, c, d, e));
+CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255), d varchar(255), e varchar(255));
--error 1071
-ALTER TABLE t1 ADD INDEX t1 (a, b, c);
+ALTER TABLE t1 ADD INDEX t1 (a, b, c, d, e);
DROP TABLE t1;
#
@@ -350,6 +360,8 @@ explain select * from t1,t2 where t1.b=t2.b;
explain select * from t1,t2 force index(c) where t1.a=t2.a;
explain select * from t1 where a=0 or a=2;
explain select * from t1 force index (a) where a=0 or a=2;
+explain select * from t1 where c=1;
+explain select * from t1 use index() where c=1;
drop table t1,t2;
#
@@ -411,6 +423,30 @@ select * from t1 where a='807780' and b='477' and c='165';
drop table t1;
#
+# space-stripping in _mi_prefix_search: BUG#5284
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a varchar(150) NOT NULL, KEY (a));
+INSERT t1 VALUES ("can \tcan");
+INSERT t1 VALUES ("can can");
+INSERT t1 VALUES ("can");
+SELECT * FROM t1;
+CHECK TABLE t1;
+DROP TABLE t1;
+
+#
+# Verify blob handling
+#
+create table t1 (a blob);
+insert into t1 values('a '),('a');
+select concat(a,'.') from t1 where a='a';
+select concat(a,'.') from t1 where a='a ';
+alter table t1 add key(a(2));
+select concat(a,'.') from t1 where a='a';
+select concat(a,'.') from t1 where a='a ';
+drop table t1;
+
+#
# Test text and unique
#
create table t1 (a int not null auto_increment primary key, b text not null, unique b (b(20)));
@@ -438,6 +474,48 @@ explain select distinct t1.a from t1,t2 order by t2.a;
drop table t1,t2;
#
+# Test RTREE index
+#
+--error 1235
+CREATE TABLE t1 (`a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', UNIQUE KEY `a` USING RTREE (`a`,`b`)) ENGINE=MyISAM;
+# INSERT INTO t1 VALUES (1,1),(1,1);
+# DELETE FROM rt WHERE a<1;
+# DROP TABLE IF EXISTS t1;
+
+create table t1 (a int, b varchar(200), c text not null) checksum=1;
+create table t2 (a int, b varchar(200), c text not null) checksum=0;
+insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
+insert t2 select * from t1;
+checksum table t1, t2, t3 quick;
+checksum table t1, t2, t3;
+checksum table t1, t2, t3 extended;
+#show table status;
+drop table t1,t2;
+
+create table t1 (a int, key (a));
+show keys from t1;
+alter table t1 disable keys;
+show keys from t1;
+create table t2 (a int);
+let $i=1000;
+set @@rand_seed1=31415926,@@rand_seed2=2718281828;
+--disable_query_log
+while ($i)
+{
+ dec $i;
+ insert t2 values (rand()*100000);
+}
+--enable_query_log
+insert t1 select * from t2;
+show keys from t1;
+alter table t1 enable keys;
+show keys from t1;
+alter table t1 engine=heap;
+alter table t1 disable keys;
+show keys from t1;
+drop table t1,t2;
+
+#
# index search for NULL in blob. Bug #4816
#
create table t1 ( a tinytext, b char(1), index idx (a(1),b) );
diff --git a/mysql-test/t/mysql_protocols.test b/mysql-test/t/mysql_protocols.test
new file mode 100644
index 00000000000..e5158586124
--- /dev/null
+++ b/mysql-test/t/mysql_protocols.test
@@ -0,0 +1,10 @@
+
+# test for Bug #4998 "--protocol doesn't reject bad values"
+
+--exec echo "select ' ok' as '<default>'" | $MYSQL
+--exec echo "select ' ok' as 'TCP'" | $MYSQL --protocol=TCP
+--exec echo "select ' ok' as 'SOCKET'" | $MYSQL --protocol=SOCKET
+--exec echo "select ' ok' as 'PIPE'" | $MYSQL --protocol=PIPE 2>&1 || true
+--exec echo "select ' ok' as 'MEMORY'" | $MYSQL --protocol=MEMORY 2>&1 || true
+--exec echo "select ' ok' as 'NullS'" | $MYSQL --protocol=NullS 2>&1 || true
+
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
index 228233923fe..ea66a44d44e 100644
--- a/mysql-test/t/mysqlbinlog.test
+++ b/mysql-test/t/mysqlbinlog.test
@@ -1,11 +1,12 @@
# We are using .opt file since we need small binlog size
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
# we need this for getting fixed timestamps inside of this test
set timestamp=1000000000;
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
create table t1 (word varchar(20));
create table t2 (id int auto_increment not null primary key);
@@ -39,28 +40,28 @@ select "--- Local --" as "";
#
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ $MYSQL_TEST_DIR/var/log/master-bin.001
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ $MYSQL_TEST_DIR/var/log/master-bin.000001
# this should not fail but shouldn't produce any working statements
--disable_query_log
select "--- Broken LOAD DATA --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ $MYSQL_TEST_DIR/var/log/master-bin.002
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ $MYSQL_TEST_DIR/var/log/master-bin.000002
# this should show almost nothing
--disable_query_log
select "--- --database --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --database=nottest $MYSQL_TEST_DIR/var/log/master-bin.001
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --database=nottest $MYSQL_TEST_DIR/var/log/master-bin.000001
# this test for position option
--disable_query_log
select "--- --position --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --position=27 $MYSQL_TEST_DIR/var/log/master-bin.002
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --position=27 $MYSQL_TEST_DIR/var/log/master-bin.000002
# These are tests for remote binlog.
# They should return the same as previous test.
@@ -70,30 +71,29 @@ select "--- Remote --" as "";
--enable_query_log
# This is broken now
-# By the way it seems that remote version fetches all events with name >= master-bin.001
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.001
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
# This is broken too
--disable_query_log
select "--- Broken LOAD DATA --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.002
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
# And this too ! (altough it is documented)
--disable_query_log
select "--- --database --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --database=nottest master-bin.001
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --database=nottest master-bin.000001
# Strangely but this works
--disable_query_log
select "--- --position --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --position=27 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.002
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --position=27 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
# clean up
-drop table t1;
+drop table t1, t2;
diff --git a/mysql-test/t/mysqlbinlog2.test b/mysql-test/t/mysqlbinlog2.test
new file mode 100644
index 00000000000..c6cff7558d4
--- /dev/null
+++ b/mysql-test/t/mysqlbinlog2.test
@@ -0,0 +1,156 @@
+# Test for the new options --start-datetime, stop-datetime,
+# and a few others.
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+reset master;
+
+# We need this for getting fixed timestamps inside of this test.
+# I use a date in the future to keep a growing timestamp along the
+# binlog (including the Start_log_event). This test will work
+# unchanged everywhere, because mysql-test-run has fixed TZ, which it
+# exports (so mysqlbinlog has same fixed TZ).
+set @a=UNIX_TIMESTAMP("2020-01-21 15:32:22");
+set timestamp=@a;
+create table t1 (a int auto_increment not null primary key, b char(3));
+insert into t1 values(null, "a");
+insert into t1 values(null, "b");
+set timestamp=@a+2;
+insert into t1 values(null, "c");
+set timestamp=@a+4;
+insert into t1 values(null, "d");
+insert into t1 values(null, "e");
+
+flush logs;
+set timestamp=@a+1; # this could happen on a slave
+insert into t1 values(null, "f");
+
+# delimiters are for easier debugging in future
+
+--disable_query_log
+select "--- Local --" as "";
+--enable_query_log
+
+#
+# We should use --short-form everywhere because in other case output will
+# be time dependent (the Start events). Better than nothing.
+#
+
+--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
+
+--disable_query_log
+select "--- offset --" as "";
+--enable_query_log
+--exec $MYSQL_BINLOG --short-form --offset=2 $MYSQL_TEST_DIR/var/log/master-bin.000001
+--disable_query_log
+select "--- start-position --" as "";
+--enable_query_log
+--exec $MYSQL_BINLOG --short-form --start-position=497 $MYSQL_TEST_DIR/var/log/master-bin.000001
+--disable_query_log
+select "--- stop-position --" as "";
+--enable_query_log
+--exec $MYSQL_BINLOG --short-form --stop-position=497 $MYSQL_TEST_DIR/var/log/master-bin.000001
+--disable_query_log
+select "--- start-datetime --" as "";
+--enable_query_log
+--exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" $MYSQL_TEST_DIR/var/log/master-bin.000001
+--disable_query_log
+select "--- stop-datetime --" as "";
+--enable_query_log
+--exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" $MYSQL_TEST_DIR/var/log/master-bin.000001
+
+--disable_query_log
+select "--- Local with 2 binlogs on command line --" as "";
+--enable_query_log
+
+# This is to verify that some options apply only to first, or last binlog
+
+--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001 $MYSQL_TEST_DIR/var/log/master-bin.000002
+
+--disable_query_log
+select "--- offset --" as "";
+--enable_query_log
+--exec $MYSQL_BINLOG --short-form --offset=2 $MYSQL_TEST_DIR/var/log/master-bin.000001 $MYSQL_TEST_DIR/var/log/master-bin.000002
+--disable_query_log
+select "--- start-position --" as "";
+--enable_query_log
+--exec $MYSQL_BINLOG --short-form --start-position=497 $MYSQL_TEST_DIR/var/log/master-bin.000001 $MYSQL_TEST_DIR/var/log/master-bin.000002
+--disable_query_log
+select "--- stop-position --" as "";
+--enable_query_log
+--exec $MYSQL_BINLOG --short-form --stop-position=32 $MYSQL_TEST_DIR/var/log/master-bin.000001 $MYSQL_TEST_DIR/var/log/master-bin.000002
+--disable_query_log
+select "--- start-datetime --" as "";
+--enable_query_log
+--exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" $MYSQL_TEST_DIR/var/log/master-bin.000001 $MYSQL_TEST_DIR/var/log/master-bin.000002
+--disable_query_log
+select "--- stop-datetime --" as "";
+--enable_query_log
+--exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" $MYSQL_TEST_DIR/var/log/master-bin.000001 $MYSQL_TEST_DIR/var/log/master-bin.000002
+
+--disable_query_log
+select "--- Remote --" as "";
+--enable_query_log
+
+--exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
+
+--disable_query_log
+select "--- offset --" as "";
+--enable_query_log
+--exec $MYSQL_BINLOG --short-form --offset=2 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
+--disable_query_log
+select "--- start-position --" as "";
+--enable_query_log
+--exec $MYSQL_BINLOG --short-form --start-position=497 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
+--disable_query_log
+select "--- stop-position --" as "";
+--enable_query_log
+--exec $MYSQL_BINLOG --short-form --stop-position=497 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
+--disable_query_log
+select "--- start-datetime --" as "";
+--enable_query_log
+--exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
+--disable_query_log
+select "--- stop-datetime --" as "";
+--enable_query_log
+--exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
+
+--disable_query_log
+select "--- Remote with 2 binlogs on command line --" as "";
+--enable_query_log
+
+--exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
+
+--disable_query_log
+select "--- offset --" as "";
+--enable_query_log
+--exec $MYSQL_BINLOG --short-form --offset=2 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
+--disable_query_log
+select "--- start-position --" as "";
+--enable_query_log
+--exec $MYSQL_BINLOG --short-form --start-position=497 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
+--disable_query_log
+select "--- stop-position --" as "";
+--enable_query_log
+--exec $MYSQL_BINLOG --short-form --stop-position=32 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
+--disable_query_log
+select "--- start-datetime --" as "";
+--enable_query_log
+--exec $MYSQL_BINLOG --short-form "--start-datetime=20200121153224" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
+--disable_query_log
+select "--- stop-datetime --" as "";
+--enable_query_log
+--exec $MYSQL_BINLOG --short-form "--stop-datetime=2020/01/21 15@32@24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
+
+--disable_query_log
+select "--- to-last-log --" as "";
+--enable_query_log
+
+--exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --to-last-log master-bin.000001
+
+# clean up
+--disable_query_log
+select "--- end of test --" as "";
+--enable_query_log
+drop table t1;
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index d1394e40a49..07b33689196 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -1,12 +1,12 @@
--disable_warnings
-DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t1, `"t"1`;
--enable_warnings
# XML output
CREATE TABLE t1(a int);
INSERT INTO t1 VALUES (1), (2);
---exec $MYSQL_DUMP --skip-comments -X test t1
+--exec $MYSQL_DUMP --skip-create --skip-comments -X test t1
DROP TABLE t1;
#
@@ -16,7 +16,7 @@ DROP TABLE t1;
CREATE TABLE t1 (a decimal(240, 20));
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
("0987654321098765432109876543210987654321");
---exec $MYSQL_DUMP --skip-comments test t1
+--exec $MYSQL_DUMP --compact test t1
DROP TABLE t1;
#
@@ -28,11 +28,11 @@ INSERT INTO t1 VALUES (-9e999999);
# The following replaces is here because some systems replaces the above
# double with '-inf' and others with MAX_DOUBLE
--replace_result (-1.79769313486232e+308) (RES) (NULL) (RES)
---exec $MYSQL_DUMP --skip-comments test t1
+--exec $MYSQL_DUMP --compact test t1
DROP TABLE t1;
#
-# Bug #3361 mysqldum quotes DECIMAL values
+# Bug #3361 mysqldump quotes DECIMAL values inconsistently
#
CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT);
@@ -43,18 +43,113 @@ INSERT INTO t1 VALUES (1.2345, 2.3456);
INSERT INTO t1 VALUES ('1.2345', 2.3456);
INSERT INTO t1 VALUES ("1.2345", 2.3456);
-# The code below should be uncommented in mysql-4.1 to fix
-# behaviour of quoting DECIMAL fields with different
-# values of sql_mode
-########
-#SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI_QUOTES';
-#INSERT INTO t1 VALUES (1.2345, 2.3456);
-#INSERT INTO t1 VALUES ('1.2345', 2.3456);
-#--error 1054
-#INSERT INTO t1 VALUES ("1.2345", 2.3456);
-#SET SQL_MODE=@OLD_SQL_MODE;
-########
+SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI_QUOTES';
+INSERT INTO t1 VALUES (1.2345, 2.3456);
+INSERT INTO t1 VALUES ('1.2345', 2.3456);
+--error 1054
+INSERT INTO t1 VALUES ("1.2345", 2.3456);
+SET SQL_MODE=@OLD_SQL_MODE;
# check how mysqldump make quoting
---exec $MYSQL_DUMP --skip-comments test t1
+--exec $MYSQL_DUMP --compact test t1
+--exec $MYSQL_DUMP --compact --skip-create test t1
+--exec $MYSQL_DUMP --skip-create --skip-comments test t1
+--exec $MYSQL_DUMP --skip-opt --extended-insert --skip-comments test t1
+DROP TABLE t1;
+
+CREATE TABLE t1(a int, b text, c varchar(3));
+INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES");
+--exec $MYSQL_DUMP --skip-create --compact -X test t1
+DROP TABLE t1;
+
+#
+# Bug #1707
+#
+
+CREATE TABLE t1 (`a"b"` char(2));
+INSERT INTO t1 VALUES ("1\""), ("\"2");
+--exec $MYSQL_DUMP --compact --skip-create -X test t1
+DROP TABLE t1;
+
+#
+# Bug #1994
+# Bug #4261
+#
+
+CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
+INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL);
+--exec $MYSQL_DUMP --skip-comments --skip-extended-insert test t1
+DROP TABLE t1;
+
+#
+# Bug #2634
+#
+
+CREATE TABLE t1 (a int) ENGINE=MYISAM;
+INSERT INTO t1 VALUES (1), (2);
+--exec $MYSQL_DUMP --skip-comments --compatible=mysql40 test t1
+--exec $MYSQL_DUMP --skip-comments --compatible=mysql323 test t1
+DROP TABLE t1;
+
+#
+# Bug #2592 'mysqldump doesn't quote "tricky" names correctly'
+#
+
+create table ```a` (i int);
+--exec $MYSQL_DUMP --compact test
+drop table ```a`;
+
+#
+# Bug #2591 "mysqldump quotes names inconsistently"
+#
+
+create table t1(a int);
+--exec $MYSQL_DUMP --comments=0 test
+--exec $MYSQL_DUMP --comments=0 --compatible=ansi test
+set global sql_mode='ANSI_QUOTES';
+--exec $MYSQL_DUMP --comments=0 test
+--exec $MYSQL_DUMP --comments=0 --compatible=ansi test
+set global sql_mode='';
+drop table t1;
+
+#
+# Bug #2705 'mysqldump --tab extra output'
+#
+
+create table t1(a int);
+insert into t1 values (1),(2),(3);
+--exec $MYSQL_DUMP --skip-comments --tab=$MYSQL_TEST_DIR/var/tmp/ test
+--exec cat $MYSQL_TEST_DIR/var/tmp/t1.sql
+--exec cat $MYSQL_TEST_DIR/var/tmp/t1.txt
+--exec rm $MYSQL_TEST_DIR/var/tmp/t1.sql
+--exec rm $MYSQL_TEST_DIR/var/tmp/t1.txt
+--exec $MYSQL_DUMP --tab=$MYSQL_TEST_DIR/var/tmp/ test
+--exec rm $MYSQL_TEST_DIR/var/tmp/t1.sql
+--exec rm $MYSQL_TEST_DIR/var/tmp/t1.txt
+drop table t1;
+
+#
+# Bug #6101: create database problem
+#
+
+--exec $MYSQL_DUMP --skip-comments --databases test
+
+create database mysqldump_test_db character set latin2 collate latin2_bin;
+--exec $MYSQL_DUMP --skip-comments --databases mysqldump_test_db;
+drop database mysqldump_test_db;
+
+#
+# Bug #7020
+# Check that we don't dump in UTF8 in compatible mode by default,
+# but use the default compiled values, or the values given in
+# --default-character-set=xxx. However, we should dump in UTF8
+# if it is explicitely set.
+
+CREATE TABLE t1 (a CHAR(10));
+INSERT INTO t1 VALUES (_latin1 'ÄÖÜß');
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments test t1
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --compatible=mysql323 test t1
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --compatible=mysql323 --default-character-set=cp850 test t1
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=cp850 --compatible=mysql323 test t1
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=utf8 --compatible=mysql323 test t1
DROP TABLE t1;
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
new file mode 100644
index 00000000000..0802c18ed6c
--- /dev/null
+++ b/mysql-test/t/mysqltest.test
@@ -0,0 +1,288 @@
+
+# ============================================================================
+#
+# Test of mysqltest itself
+#
+# ============================================================================
+
+# ----------------------------------------------------------------------------
+# $mysql_errno contains the return code of the last command
+# send to the server.
+# ----------------------------------------------------------------------------
+# get $mysql_errno before the first statement
+# $mysql_errno should be -1
+eval select $mysql_errno as "before_use_test" ;
+
+
+# ----------------------------------------------------------------------------
+# Positive case(statement)
+# ----------------------------------------------------------------------------
+
+select otto from (select 1 as otto) as t1;
+# expectation = response
+--error 0
+select otto from (select 1 as otto) as t1;
+
+# expectation <> response
+-- // --error 1054
+-- // select otto from (select 1 as otto) as t1;
+
+
+# ----------------------------------------------------------------------------
+# Negative case(statement):
+# The dervied table t1 does not contain a column named 'friedrich' .
+# --> ERROR 42S22: Unknown column 'friedrich' in 'field list and
+# --> 1054: Unknown column 'friedrich' in 'field list'
+# ----------------------------------------------------------------------------
+
+# expectation <> response
+#--error 0
+#select friedrich from (select 1 as otto) as t1;
+
+# expectation = response
+--error 1054
+select friedrich from (select 1 as otto) as t1;
+
+# The following unmasked unsuccessful statement must give
+# 1. mysqltest gives a 'failed'
+# 2. does not produce a r/<test case>.reject file !!!
+# PLEASE uncomment it and check it's effect
+#select friedrich from (select 1 as otto) as t1;
+
+
+# ----------------------------------------------------------------------------
+# Tests for the new feature - SQLSTATE error code matching
+# Positive case(statement)
+# ----------------------------------------------------------------------------
+
+# expectation = response
+!S00000 select otto from (select 1 as otto) as t1;
+
+--error S00000
+select otto from (select 1 as otto) as t1;
+
+# expectation <> response
+#!S42S22 select otto from (select 1 as otto) as t1;
+#--error S42S22
+#select otto from (select 1 as otto) as t1;
+
+
+# ----------------------------------------------------------------------------
+# Negative case(statement)
+# ----------------------------------------------------------------------------
+
+# expectation = response
+!S42S22 select friedrich from (select 1 as otto) as t1;
+--error S42S22
+select friedrich from (select 1 as otto) as t1;
+
+# expectation !=response
+#!S00000 select friedrich from (select 1 as otto) as t1;
+#--error S00000
+#select friedrich from (select 1 as otto) as t1;
+
+
+# ----------------------------------------------------------------------------
+# test cases for $mysql_errno
+#
+# $mysql_errno is a builtin variable of mysqltest and contains the return code
+# of the last command send to the server.
+#
+# The following test cases often initialize $mysql_errno to 1064 by
+# a command with wrong syntax.
+# Example: --error 1064 To prevent the abort after the error.
+# garbage ;
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# check mysql_errno = 0 after successful statement
+# ----------------------------------------------------------------------------
+select otto from (select 1 as otto) as t1;
+eval select $mysql_errno as "after_successful_stmt_errno" ;
+
+#----------------------------------------------------------------------------
+# check mysql_errno = 1064 after statement with wrong syntax
+# ----------------------------------------------------------------------------
+--error 1064
+garbage ;
+eval select $mysql_errno as "after_wrong_syntax_errno" ;
+
+# ----------------------------------------------------------------------------
+# check if let $my_var= 'abc' ; affects $mysql_errno
+# ----------------------------------------------------------------------------
+--error 1064
+garbage ;
+let $my_var= 'abc' ;
+eval select $mysql_errno as "after_let_var_equal_value" ;
+
+# ----------------------------------------------------------------------------
+# check if set @my_var= 'abc' ; affects $mysql_errno
+# ----------------------------------------------------------------------------
+--error 1064
+garbage ;
+set @my_var= 'abc' ;
+eval select $mysql_errno as "after_set_var_equal_value" ;
+
+# ----------------------------------------------------------------------------
+# check if the setting of --disable-warnings itself affects $mysql_errno
+# (May be --<whatever> modifies $mysql_errno.)
+# ----------------------------------------------------------------------------
+--error 1064
+garbage ;
+--disable_warnings
+eval select $mysql_errno as "after_disable_warnings_command" ;
+
+# ----------------------------------------------------------------------------
+# check if --disable-warnings + command with warning affects the errno
+# stored within $mysql_errno
+# (May be disabled warnings affect $mysql_errno.)
+# ----------------------------------------------------------------------------
+drop table if exists t1 ;
+--error 1064
+garbage ;
+drop table if exists t1 ;
+eval select $mysql_errno as "after_disable_warnings" ;
+--enable_warnings
+
+# ----------------------------------------------------------------------------
+# check if masked errors affect $mysql_errno
+# ----------------------------------------------------------------------------
+--error 1064
+garbage ;
+--error 1146
+select 3 from t1 ;
+eval select $mysql_errno as "after_minus_masked" ;
+--error 1064
+garbage ;
+--error 1146
+select 3 from t1 ;
+eval select $mysql_errno as "after_!_masked" ;
+
+# ----------------------------------------------------------------------------
+# Will manipulations of $mysql_errno be possible and visible ?
+# ----------------------------------------------------------------------------
+--error 1064
+garbage ;
+let $mysql_errno= -1;
+eval select $mysql_errno as "after_let_errno_equal_value" ;
+
+# ----------------------------------------------------------------------------
+# How affect actions on prepared statements $mysql_errno ?
+# ----------------------------------------------------------------------------
+# failing prepare
+--error 1064
+garbage ;
+--error 1146
+prepare stmt from "select 3 from t1" ;
+eval select $mysql_errno as "after_failing_prepare" ;
+create table t1 ( f1 char(10));
+
+# successful prepare
+--error 1064
+garbage ;
+prepare stmt from "select 3 from t1" ;
+eval select $mysql_errno as "after_successful_prepare" ;
+
+# successful execute
+--error 1064
+garbage ;
+execute stmt;
+eval select $mysql_errno as "after_successful_execute" ;
+
+# failing execute (table dropped)
+drop table t1;
+--error 1064
+garbage ;
+--error 1146
+execute stmt;
+eval select $mysql_errno as "after_failing_execute" ;
+
+# failing execute (unknown statement)
+--error 1064
+garbage ;
+--error 1243
+execute __stmt_;
+eval select $mysql_errno as "after_failing_execute" ;
+
+# successful deallocate
+--error 1064
+garbage ;
+deallocate prepare stmt;
+eval select $mysql_errno as "after_successful_deallocate" ;
+
+# failing deallocate ( statement handle does not exist )
+--error 1064
+garbage ;
+--error 1243
+deallocate prepare __stmt_;
+eval select $mysql_errno as "after_failing_deallocate" ;
+
+
+# ----------------------------------------------------------------------------
+# test cases for "--disable_abort_on_error"
+#
+# "--disable_abort_on_error" switches the abort of mysqltest
+# after "unmasked" failing statements off.
+#
+# The default is "--enable_abort_on_error".
+#
+# "Maskings" are
+# --error <error number> and --error <error number>
+# in the line before the failing statement.
+#
+# There are some additional test case for $mysql_errno
+# because "--disable_abort_on_error" enables a new situation.
+# Example: "unmasked" statement fails + analysis of $mysql_errno
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Switch the abort on error off and check the effect on $mysql_errno
+# ----------------------------------------------------------------------------
+--error 1064
+garbage ;
+--disable_abort_on_error
+eval select $mysql_errno as "after_--disable_abort_on_error" ;
+
+# ----------------------------------------------------------------------------
+# "unmasked" failing statement should not cause an abort
+# ----------------------------------------------------------------------------
+select 3 from t1 ;
+
+# ----------------------------------------------------------------------------
+# masked failing statements
+# ----------------------------------------------------------------------------
+# expected error = response
+--error 1146
+select 3 from t1 ;
+--error 1146
+select 3 from t1 ;
+eval select $mysql_errno as "after_!errno_masked_error" ;
+# expected error <> response
+# --error 1000
+# select 3 from t1 ;
+# --error 1000
+# select 3 from t1 ;
+
+# ----------------------------------------------------------------------------
+# Switch the abort on error on and check the effect on $mysql_errno
+# ----------------------------------------------------------------------------
+--error 1064
+garbage ;
+--enable_abort_on_error
+eval select $mysql_errno as "after_--enable_abort_on_error" ;
+
+# ----------------------------------------------------------------------------
+# masked failing statements
+# ----------------------------------------------------------------------------
+# expected error = response
+--error 1146
+select 3 from t1 ;
+
+# ----------------------------------------------------------------------------
+# check that the old default behaviour is not changed
+# Please remove the '#' to get the abort on error
+# ----------------------------------------------------------------------------
+#--error 1064
+#select 3 from t1 ;
+#
+#select 3 from t1 ;
diff --git a/mysql-test/t/ndb_alter_table.test b/mysql-test/t/ndb_alter_table.test
new file mode 100644
index 00000000000..892443a1407
--- /dev/null
+++ b/mysql-test/t/ndb_alter_table.test
@@ -0,0 +1,157 @@
+-- source include/have_ndb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+drop database if exists mysqltest;
+--enable_warnings
+
+#
+# Basic test to show that the ALTER TABLE
+# is working
+#
+CREATE TABLE t1 (
+ a INT NOT NULL,
+ b INT NOT NULL
+) ENGINE=ndbcluster;
+
+INSERT INTO t1 VALUES (9410,9412);
+
+ALTER TABLE t1 ADD COLUMN c int not null;
+SELECT * FROM t1;
+
+DROP TABLE t1;
+
+#
+# Verfify changing table names between databases
+#
+CREATE DATABASE mysqltest;
+USE mysqltest;
+CREATE TABLE t1 (
+ a INT NOT NULL,
+ b INT NOT NULL
+) ENGINE=ndbcluster;
+RENAME TABLE t1 TO test.t1;
+SHOW TABLES;
+DROP DATABASE mysqltest;
+USE test;
+SHOW TABLES;
+DROP TABLE t1;
+
+#
+# More advanced test
+#
+create table t1 (
+col1 int not null auto_increment primary key,
+col2 varchar(30) not null,
+col3 varchar (20) not null,
+col4 varchar(4) not null,
+col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null,
+col6 int not null, to_be_deleted int) ENGINE=ndbcluster;
+show table status;
+SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
+insert into t1 values
+(0,4,3,5,"PENDING",1,7),(NULL,4,3,5,"PENDING",1,7),(31,4,3,5,"PENDING",1,7), (7,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (100,4,3,5,"PENDING",1,7), (99,4,3,5,"PENDING",1,7), (8,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7);
+show table status;
+select * from t1 order by col1;
+alter table t1
+add column col4_5 varchar(20) not null after col4,
+add column col7 varchar(30) not null after col5,
+add column col8 datetime not null, drop column to_be_deleted,
+change column col2 fourth varchar(30) not null after col3,
+modify column col6 int not null first;
+show table status;
+select * from t1 order by col1;
+insert into t1 values (2, NULL,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
+show table status;
+select * from t1 order by col1;
+delete from t1;
+insert into t1 values (0,0,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
+SET SQL_MODE='';
+insert into t1 values (1,0,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
+select * from t1 order by col1;
+alter table t1 drop column col4_5;
+insert into t1 values (2,0,4,3,5,"PENDING","EXTRA",'2004-01-01 00:00:00');
+select * from t1 order by col1;
+drop table t1;
+
+
+#
+# Check that invalidating dictionary cache works
+#
+
+CREATE TABLE t1 (
+ a INT NOT NULL,
+ b INT NOT NULL
+) ENGINE=ndbcluster;
+
+INSERT INTO t1 VALUES (9410,9412);
+
+connect (con1,localhost,,,test);
+connect (con2,localhost,,,test);
+
+connection con1;
+ALTER TABLE t1 ADD COLUMN c int not null;
+select * from t1 order by a;
+
+connection con2;
+select * from t1 order by a;
+alter table t1 drop c;
+
+connection con1;
+select * from t1 order by a;
+drop table t1;
+
+connection con2;
+--error 1146
+select * from t1 order by a;
+
+CREATE TABLE t1 (
+ a INT NOT NULL PRIMARY KEY,
+ b INT NOT NULL
+) ENGINE=ndbcluster;
+
+INSERT INTO t1 VALUES (0,1),(17,18);
+select * from t1 order by a;
+SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
+alter table t1 modify column a int not null auto_increment;
+SET SQL_MODE='';
+select * from t1 order by a;
+INSERT INTO t1 VALUES (0,19),(20,21);
+select * from t1 order by a;
+drop table t1;
+
+CREATE TABLE t1 (
+ a INT NOT NULL PRIMARY KEY,
+ b INT NOT NULL
+) ENGINE=ndbcluster;
+
+INSERT INTO t1 VALUES (0,1),(17,18);
+select * from t1 order by a;
+alter table t1 add c int not null unique auto_increment;
+select c from t1 order by c;
+INSERT INTO t1 VALUES (1,2,0),(18,19,4),(20,21,0);
+select c from t1 order by c;
+drop table t1;
+
+#--disable_warnings
+#DROP TABLE IF EXISTS t2;
+#--enable_warnings
+
+#create table t2 (a int NOT NULL PRIMARY KEY) engine=myisam;
+#let $1=12001;
+#disable_query_log;
+#while ($1)
+#{
+# eval insert into t2 values($1);
+# dec $1;
+#}
+#enable_query_log;
+#alter table t2 engine=ndbcluster;
+#alter table t2 add c int;
+#--error 1297
+#delete from t2;
+#to make sure we do a full table scan
+#select count(*) from t2 where a+0 > 0;
+#truncate table t2;
+#select count(*) from t2;
+#drop table t2;
diff --git a/mysql-test/t/ndb_autodiscover.test b/mysql-test/t/ndb_autodiscover.test
new file mode 100644
index 00000000000..6551732adba
--- /dev/null
+++ b/mysql-test/t/ndb_autodiscover.test
@@ -0,0 +1,482 @@
+-- source include/have_ndb.inc
+
+--disable_warnings
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+--enable_warnings
+
+################################################
+# Test that a table that does not exist as a
+# frm file on disk can be "discovered" from a
+# connected NDB Cluster
+#
+
+flush status;
+
+#
+# Test discover + SELECT
+#
+
+create table t1(
+ id int not null primary key,
+ name char(20)
+) engine=ndb;
+
+insert into t1 values(1, "Autodiscover");
+flush tables;
+system rm var/master-data/test/t1.frm ;
+select * from t1;
+show status like 'handler_discover%';
+
+#
+# Test discover + INSERT
+#
+
+flush tables;
+system rm var/master-data/test/t1.frm ;
+insert into t1 values (2, "Auto 2");
+show status like 'handler_discover%';
+insert into t1 values (3, "Discover 3");
+show status like 'handler_discover%';
+flush tables;
+system rm var/master-data/test/t1.frm ;
+select * from t1 order by id;
+show status like 'handler_discover%';
+
+#
+# Test discover + UPDATE
+#
+
+flush tables;
+system rm var/master-data/test/t1.frm ;
+update t1 set name="Autodiscover" where id = 2;
+show status like 'handler_discover%';
+select * from t1 order by id;
+show status like 'handler_discover%';
+
+#
+# Test discover + DELETE
+#
+
+flush tables;
+system rm var/master-data/test/t1.frm ;
+delete from t1 where id = 3;
+select * from t1 order by id;
+show status like 'handler_discover%';
+
+drop table t1;
+
+
+
+######################################################
+# Test that a table that is outdated on disk
+# can be "discovered" from a connected NDB Cluster
+#
+
+flush status;
+
+create table t2(
+ id int not null primary key,
+ name char(22)
+) engine=ndb;
+insert into t2 values (1, "Discoverer");
+select * from t2;
+show status like 'handler_discover%';
+flush tables;
+
+# Modify the frm file on disk
+system echo "blaj" >> var/master-data/test/t2.frm ;
+select * from t2;
+
+show status like 'handler_discover%';
+
+drop table t2;
+
+
+##################################################
+# Test that a table that already exists in NDB
+# is only discovered if CREATE TABLE IF NOT EXISTS
+# is used
+#
+
+flush status;
+
+create table t3(
+ id int not null primary key,
+ name char(255)
+) engine=ndb;
+insert into t3 values (1, "Explorer");
+select * from t3;
+show status like 'handler_discover%';
+flush tables;
+
+# Remove the frm file from disk
+system rm var/master-data/test/t3.frm ;
+
+--error 1050
+create table t3(
+ id int not null primary key,
+ name char(20), a int, b float, c char(24)
+) engine=ndb;
+
+# The table shall not have been discovered since
+# IF NOT EXISTS wasn't specified
+
+show status like 'handler_discover%';
+
+# now it should be discovered
+create table IF NOT EXISTS t3(
+ id int not null primary key,
+ id2 int not null,
+ name char(20)
+) engine=ndb;
+
+# NOTE! the table called t3 have now been updated to
+# use the same frm as in NDB, thus it's not certain that
+# the table schema is the same as was stated in the
+# CREATE TABLE statement above
+
+show status like 'handler_discover%';
+
+SHOW CREATE TABLE t3;
+
+select * from t3;
+show status like 'handler_discover%';
+
+drop table t3;
+
+##################################################
+# Test that a table that already exists in NDB
+# is discovered when SHOW TABLES
+# is used
+#
+
+flush status;
+
+create table t7(
+ id int not null primary key,
+ name char(255)
+) engine=ndb;
+create table t6(
+ id int not null primary key,
+ name char(255)
+) engine=MyISAM;
+insert into t7 values (1, "Explorer");
+insert into t6 values (2, "MyISAM table");
+select * from t7;
+show status like 'handler_discover%';
+
+# Remove the frm file from disk
+flush tables;
+system rm var/master-data/test/t7.frm ;
+
+show tables from test;
+show status like 'handler_discover%';
+
+# Remove the frm file from disk again
+flush tables;
+system rm var/master-data/test/t7.frm ;
+
+--replace_column 7 # 8 # 9 # 12 # 13 # 15 #
+show table status;
+show status like 'handler_discover%';
+
+drop table t6, t7;
+
+
+#######################################################
+# Test that a table that has been dropped from NDB
+# but still exists on disk, get a consistent error message
+# saying "No such table existed"
+#
+
+flush status;
+
+create table t4(
+ id int not null primary key,
+ name char(27)
+) engine=ndb;
+insert into t4 values (1, "Automatic");
+select * from t4;
+
+# Remove the table from NDB
+system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 > /dev/null ;
+
+#
+# Test that correct error is returned
+--error 1146
+select * from t4;
+--error 1146
+select * from t4;
+
+show status like 'handler_discover%';
+drop table t4;
+
+
+#######################################################
+# Test that a table that has been dropped from NDB
+# but still exists on disk is deleted from disk
+# when SHOW TABLES is called
+#
+
+flush status;
+
+create table t4(
+ id int not null primary key,
+ id2 int,
+ name char(27)
+) engine=ndb;
+insert into t4 values (1, 76, "Automatic2");
+select * from t4;
+flush tables;
+
+# Remove the table from NDB
+system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 > /dev/null ;
+
+SHOW TABLES;
+
+--error 1146
+select * from t4;
+
+#######################################################
+# Test SHOW TABLES ability to detect new and delete old
+# tables. Test all at once using many tables
+#
+
+flush status;
+
+# Create tables
+create table t1(id int) engine=ndbcluster;
+create table t2(id int, b char(255)) engine=myisam;
+create table t3(id int, c char(255)) engine=ndbcluster;
+create table t4(id int) engine=myisam;
+create table t5(id int, d char(56)) engine=ndbcluster;
+create table t6(id int) engine=ndbcluster;
+create table t7(id int) engine=ndbcluster;
+create table t8(id int, e char(34)) engine=myisam;
+create table t9(id int) engine=myisam;
+
+# Populate tables
+insert into t2 values (2, "myisam table 2");
+insert into t3 values (3, "ndb table 3");
+insert into t5 values (5, "ndb table 5");
+insert into t6 values (6);
+insert into t8 values (8, "myisam table 8");
+insert into t9 values (9);
+
+# Remove t3, t5 from NDB
+system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 > /dev/null ;
+system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 > /dev/null ;
+# Remove t6, t7 from disk
+system rm var/master-data/test/t6.frm > /dev/null ;
+system rm var/master-data/test/t7.frm > /dev/null ;
+
+SHOW TABLES;
+
+select * from t6;
+select * from t7;
+
+show status like 'handler_discover%';
+
+drop table t1, t2, t4, t6, t7, t8, t9;
+
+#######################################################
+# Test SHOW TABLES LIKE ability to detect new and delete old
+# tables. Test all at once using many tables.
+#
+
+flush status;
+
+# Create tables
+create table t1(id int) engine=ndbcluster;
+create table t2(id int, b char(255)) engine=myisam;
+create table t3(id int, c char(255)) engine=ndbcluster;
+create table t4(id int) engine=myisam;
+create table t5(id int, d char(56)) engine=ndbcluster;
+create table t6(id int) engine=ndbcluster;
+create table t7(id int) engine=ndbcluster;
+create table t8(id int, e char(34)) engine=myisam;
+create table t9(id int) engine=myisam;
+
+# Populate tables
+insert into t2 values (2, "myisam table 2");
+insert into t3 values (3, "ndb table 3");
+insert into t5 values (5, "ndb table 5");
+insert into t6 values (6);
+insert into t8 values (8, "myisam table 8");
+insert into t9 values (9);
+
+# Remove t3, t5 from NDB
+system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 > /dev/null ;
+system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 > /dev/null ;
+# Remove t6, t7 from disk
+system rm var/master-data/test/t6.frm > /dev/null ;
+system rm var/master-data/test/t7.frm > /dev/null ;
+
+
+SHOW TABLES LIKE 't6';
+
+show status like 'handler_discover%';
+
+# Check that t3 or t5 can't be created
+# frm files for these tables is stilll on disk
+--error 1050
+create table t3(a int);
+--error 1050
+create table t5(a int);
+
+SHOW TABLES LIKE 't%';
+
+show status like 'handler_discover%';
+
+drop table t1, t2, t4, t6, t7, t8, t9;
+
+
+
+######################################################
+# Test that several tables can be discovered when
+# one statement access several table at once.
+#
+
+flush status;
+
+# Create tables
+create table t1(id int) engine=ndbcluster;
+create table t2(id int, b char(255)) engine=ndbcluster;
+create table t3(id int, c char(255)) engine=ndbcluster;
+create table t4(id int) engine=myisam;
+
+# Populate tables
+insert into t1 values (1);
+insert into t2 values (2, "table 2");
+insert into t3 values (3, "ndb table 3");
+insert into t4 values (4);
+
+# Remove t1, t2, t3 from disk
+system rm var/master-data/test/t1.frm > /dev/null ;
+system rm var/master-data/test/t2.frm > /dev/null ;
+system rm var/master-data/test/t3.frm > /dev/null ;
+flush tables;
+
+# Select from the table which only exists in NDB.
+select * from t1, t2, t3, t4;
+
+# 3 table should have been discovered
+show status like 'handler_discover%';
+
+drop table t1, t2, t3, t4;
+
+
+#########################################################
+# Test that a table that has been changed in NDB
+# since it's been opened will be refreshed and discovered
+# again
+#
+
+flush status;
+
+show status like 'handler_discover%';
+
+create table t5(
+ id int not null primary key,
+ name char(200)
+) engine=ndb;
+insert into t5 values (1, "Magnus");
+select * from t5;
+
+ALTER TABLE t5 ADD COLUMN adress char(255) FIRST;
+
+select * from t5;
+
+insert into t5 values
+ ("Adress for record 2", 2, "Carl-Gustav"),
+ ("Adress for record 3", 3, "Karl-Emil");
+update t5 set name="Bertil" where id = 2;
+select * from t5 order by id;
+
+show status like 'handler_discover%';
+
+drop table t5;
+
+
+################################################################
+# Test that a table that has been changed with ALTER TABLE
+# can be used from the same thread
+#
+
+flush status;
+
+show status like 'handler_discover%';
+
+create table t6(
+ id int not null primary key,
+ name char(20)
+) engine=ndb;
+insert into t6 values (1, "Magnus");
+select * from t6;
+
+ALTER TABLE t6 ADD COLUMN adress char(255) FIRST;
+
+select * from t6;
+insert into t6 values
+ ("Adress for record 2", 2, "Carl-Gustav"),
+ ("Adress for record 3", 3, "Karl-Emil");
+update t6 set name="Bertil" where id = 2;
+select * from t6 order by id;
+
+show status like 'handler_discover%';
+
+drop table t6;
+
+#####################################################
+# Test that only tables in the current database shows
+# up in SHOW TABLES
+#
+
+show tables;
+
+create table t1 (a int,b longblob) engine=ndb;
+show tables;
+create database test2;
+use test2;
+show tables;
+--error 1146
+select * from t1;
+create table t2 (b int,c longblob) engine=ndb;
+use test;
+select * from t1;
+show tables;
+drop table t1;
+use test2;
+drop table t2;
+drop database test2;
+show databases;
+use test;
+
+######################################################
+# Note! This should always be the last step in this
+# file, the table t9 will be used and dropped
+# by ndb_autodiscover2
+#
+
+CREATE TABLE t9 (
+ a int NOT NULL PRIMARY KEY,
+ b int
+) engine=ndb;
+
+insert t9 values(1, 2), (2,3), (3, 4), (4, 5);
+
+#Don't drop the table, instead remove the frm file
+system rm var/master-data/test/t9.frm ;
+
+# Now leave test case, when ndb_autodiscover2 will run, this
+# MySQL Server will have been restarted because it has a
+# ndb_autodiscover2-master.opt file.
+
+create table t10 (
+ a int not null primary key,
+ b blob
+) engine=ndb;
+
+insert into t10 values (1, 'kalle');
+
+--exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test `$NDB_TOOLS_DIR/ndb_show_tables --no-defaults | grep BLOB` > /dev/null 2>&1 || true
diff --git a/mysql-test/t/ndb_autodiscover2-master.opt b/mysql-test/t/ndb_autodiscover2-master.opt
new file mode 100644
index 00000000000..e0d075c3fbd
--- /dev/null
+++ b/mysql-test/t/ndb_autodiscover2-master.opt
@@ -0,0 +1 @@
+--skip-external-locking
diff --git a/mysql-test/t/ndb_autodiscover2.test b/mysql-test/t/ndb_autodiscover2.test
new file mode 100644
index 00000000000..11e1cc204f7
--- /dev/null
+++ b/mysql-test/t/ndb_autodiscover2.test
@@ -0,0 +1,19 @@
+-- source include/have_ndb.inc
+
+#
+# Simple test to show use of discover when the server has been restarted
+# The previous step has simply removed the frm file
+# from disk, but left the table in NDB
+#
+--sleep 3;
+select * from t9 order by a;
+
+# handler_discover should be 1
+show status like 'handler_discover%';
+
+drop table t9;
+
+--error 1296
+select * from t10;
+drop table t10;
+
diff --git a/mysql-test/t/ndb_basic.test b/mysql-test/t/ndb_basic.test
new file mode 100644
index 00000000000..2671223ada8
--- /dev/null
+++ b/mysql-test/t/ndb_basic.test
@@ -0,0 +1,541 @@
+-- source include/have_ndb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
+drop database if exists mysqltest;
+--enable_warnings
+
+#
+# Basic test to show that the NDB
+# table handler is working
+#
+
+#
+# Create a normal table with primary key
+#
+CREATE TABLE t1 (
+ pk1 INT NOT NULL PRIMARY KEY,
+ attr1 INT NOT NULL,
+ attr2 INT,
+ attr3 VARCHAR(10)
+) ENGINE=ndbcluster;
+
+SHOW INDEX FROM t1;
+INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9411,9413, 17, '9413');
+SHOW INDEX FROM t1;
+SELECT pk1 FROM t1 ORDER BY pk1;
+SELECT * FROM t1 ORDER BY pk1;
+SELECT t1.* FROM t1 ORDER BY pk1;
+
+# Update on record by primary key
+UPDATE t1 SET attr1=1 WHERE pk1=9410;
+SELECT * FROM t1 ORDER BY pk1;
+
+# Update primary key
+UPDATE t1 SET pk1=2 WHERE attr1=1;
+SELECT * FROM t1 ORDER BY pk1;
+UPDATE t1 SET pk1=pk1 + 1;
+SELECT * FROM t1 ORDER BY pk1;
+UPDATE t1 SET pk1=4 WHERE pk1 = 3;
+SELECT * FROM t1 ORDER BY pk1;
+
+# Delete the record
+DELETE FROM t1;
+SELECT * FROM t1;
+
+# Insert more records and update them all at once
+INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9408, 8765, NULL, '8765'),
+(7,8, NULL, NULL), (8,9, NULL, NULL), (9,10, NULL, NULL), (10,11, NULL, NULL), (11,12, NULL, NULL), (12,13, NULL, NULL), (13,14, NULL, NULL);
+UPDATE t1 SET attr1 = 9999;
+SELECT * FROM t1 ORDER BY pk1;
+
+UPDATE t1 SET attr1 = 9998 WHERE pk1 < 1000;
+SELECT * FROM t1 ORDER BY pk1;
+
+UPDATE t1 SET attr1 = 9997 WHERE attr1 = 9999;
+SELECT * FROM t1 ORDER BY pk1;
+
+# Delete one record by specifying pk
+DELETE FROM t1 WHERE pk1 = 9410;
+SELECT * FROM t1 ORDER BY pk1;
+
+# Delete all from table
+DELETE FROM t1;
+SELECT * FROM t1;
+
+# Insert three records with attr1=4 and two with attr1=5
+# Delete all with attr1=4
+INSERT INTO t1 values (1, 4, NULL, NULL), (2, 4, NULL, NULL), (3, 5, NULL, NULL), (4, 4, NULL, NULL), (5, 5, NULL, NULL);
+DELETE FROM t1 WHERE attr1=4;
+SELECT * FROM t1 order by pk1;
+DELETE FROM t1;
+
+# Insert two records and delete one
+INSERT INTO t1 VALUES (9410,9412, NULL, NULL), (9411, 9413, NULL, NULL);
+DELETE FROM t1 WHERE pk1 = 9410;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+#
+# Create table without primary key
+# a hidden primary key column is created by handler
+#
+CREATE TABLE t1 (id INT, id2 int) engine=ndbcluster;
+INSERT INTO t1 values(3456, 7890);
+SELECT * FROM t1;
+UPDATE t1 SET id=2 WHERE id2=12;
+SELECT * FROM t1;
+UPDATE t1 SET id=1234 WHERE id2=7890;
+SELECT * FROM t1;
+DELETE FROM t1;
+
+INSERT INTO t1 values(3456, 7890), (3456, 7890), (3456, 7890), (3454, 7890);
+SELECT * FROM t1 ORDER BY id;
+DELETE FROM t1 WHERE id = 3456;
+SELECT * FROM t1 ORDER BY id;
+
+DROP TABLE t1;
+
+# test create with the keyword "engine=NDBCLUSTER"
+CREATE TABLE t1 (
+ pk1 INT NOT NULL PRIMARY KEY,
+ attr1 INT NOT NULL
+) ENGINE=NDBCLUSTER;
+
+INSERT INTO t1 values(1, 9999);
+
+DROP TABLE t1;
+
+# test create with the keyword "engine=NDB"
+CREATE TABLE t1 (
+ pk1 INT NOT NULL PRIMARY KEY,
+ attr1 INT NOT NULL
+) ENGINE=NDB;
+
+INSERT INTO t1 values(1, 9999);
+
+DROP TABLE t1;
+
+
+#
+# A more extensive test with a lot more records
+#
+
+CREATE TABLE t2 (
+ a bigint unsigned NOT NULL PRIMARY KEY,
+ b int unsigned not null,
+ c int unsigned
+) engine=ndbcluster;
+
+CREATE TABLE t3 (
+ a bigint unsigned NOT NULL,
+ b bigint unsigned not null,
+ c bigint unsigned,
+ PRIMARY KEY(a)
+) engine=ndbcluster;
+
+CREATE TABLE t4 (
+ a bigint unsigned NOT NULL,
+ b bigint unsigned not null,
+ c bigint unsigned NOT NULL,
+ d int unsigned,
+ PRIMARY KEY(a, b, c)
+) engine=ndbcluster;
+
+
+#
+# insert more records into tables
+#
+let $1=1000;
+disable_query_log;
+while ($1)
+{
+ eval insert into t2 values($1, $1+9, 5);
+ eval insert into t3 values($1, $1+9, 5);
+ eval insert into t4 values($1, $1+9, 5, $1+26000);
+ dec $1;
+}
+enable_query_log;
+
+
+#
+# delete every other record in the tables
+#
+let $1=1000;
+disable_query_log;
+while ($1)
+{
+ eval delete from t2 where a=$1;
+ eval delete from t3 where a=$1;
+ eval delete from t4 where a=$1 and b=$1+9 and c=5;
+ dec $1;
+ dec $1;
+}
+enable_query_log;
+
+
+select * from t2 where a = 7 order by b;
+select * from t2 where a = 7 order by a;
+select * from t2 where a = 7 order by 2;
+select * from t2 where a = 7 order by c;
+
+select * from t2 where a = 7 and b = 16 order by b;
+select * from t2 where a = 7 and b = 16 order by a;
+select * from t2 where a = 7 and b = 17 order by a;
+select * from t2 where a = 7 and b != 16 order by b;
+
+select * from t2 where a = 7 and b = 16 and c = 5 order by b;
+select * from t2 where a = 7 and b = 16 and c = 5 order by a;
+select * from t2 where a = 7 and b = 16 and c = 6 order by a;
+select * from t2 where a = 7 and b != 16 and c = 5 order by b;
+
+select * from t3 where a = 7 order by b;
+select * from t3 where a = 7 order by a;
+select * from t3 where a = 7 order by 2;
+select * from t3 where a = 7 order by c;
+
+select * from t3 where a = 7 and b = 16 order by b;
+select * from t3 where a = 7 and b = 16 order by a;
+select * from t3 where a = 7 and b = 17 order by a;
+select * from t3 where a = 7 and b != 16 order by b;
+
+select * from t4 where a = 7 order by b;
+select * from t4 where a = 7 order by a;
+select * from t4 where a = 7 order by 2;
+select * from t4 where a = 7 order by c;
+
+select * from t4 where a = 7 and b = 16 order by b;
+select * from t4 where a = 7 and b = 16 order by a;
+select * from t4 where a = 7 and b = 17 order by a;
+select * from t4 where a = 7 and b != 16 order by b;
+
+#
+# update records
+#
+let $1=1000;
+disable_query_log;
+while ($1)
+{
+ eval update t2 set c=$1 where a=$1;
+ eval update t3 set c=7 where a=$1 and b=$1+9 and c=5;
+ eval update t4 set d=$1+21987 where a=$1 and b=$1+9 and c=5;
+ dec $1;
+ dec $1;
+}
+enable_query_log;
+
+delete from t2 where a > 5;
+select x1.a, x1.b from t2 x1, t2 x2 where x1.b = x2.b order by x1.a;
+select a, b FROM t2 outer_table where
+a = (select a from t2 where b = outer_table.b ) order by a;
+
+
+delete from t2;
+delete from t3;
+delete from t4;
+
+drop table t2;
+drop table t3;
+drop table t4;
+
+#
+# Test delete and update from table with 3 keys
+#
+
+CREATE TABLE t5 (
+ a bigint unsigned NOT NULL,
+ b bigint unsigned not null,
+ c bigint unsigned NOT NULL,
+ d int unsigned,
+ PRIMARY KEY(a, b, c)
+) engine=ndbcluster;
+
+insert into t5 values(10, 19, 5, 26010);
+
+delete from t5 where a=10 and b=19 and c=5;
+
+select * from t5;
+
+insert into t5 values(10, 19, 5, 26010);
+
+update t5 set d=21997 where a=10 and b=19 and c=5;
+
+select * from t5;
+
+delete from t5;
+
+drop table t5;
+
+#
+# Test using table with a char(255) column first in table
+#
+
+CREATE TABLE t6 (
+ adress char(255),
+ a int NOT NULL PRIMARY KEY,
+ b int
+) engine = NDB;
+
+insert into t6 values
+ ("Nice road 3456", 1, 23),
+ ("Street Road 78", 3, 92),
+ ("Road street 89C", 5, 71),
+ (NULL, 7, NULL);
+select * from t6 order by a;
+select a, b from t6 order by a;
+
+update t6 set adress="End of road 09" where a=3;
+update t6 set b=181, adress="Street 76" where a=7;
+select * from t6 order by a;
+select * from t6 where a=1;
+delete from t6 where a=1;
+select * from t6 order by a;
+delete from t6 where b=71;
+select * from t6 order by a;
+
+drop table t6;
+
+#
+# Test using table with a char(255) column first in table and a
+# primary key consisting of two columns
+#
+
+CREATE TABLE t7 (
+ adress char(255),
+ a int NOT NULL,
+ b int,
+ c int NOT NULL,
+ PRIMARY KEY(a, c)
+) engine = NDB;
+
+insert into t7 values
+ ("Highway 3456", 1, 23, 2),
+ ("Street Road 78", 3, 92, 3),
+ ("Main street 89C", 5, 71, 4),
+ (NULL, 8, NULL, 12);
+select * from t7 order by a;
+select a, b from t7 order by a;
+
+update t7 set adress="End of road 09" where a=3;
+update t7 set adress="GatuvÀgen 90C" where a=5 and c=4;
+update t7 set adress="No adress" where adress is NULL;
+select * from t7 order by a;
+select * from t7 where a=1 and c=2;
+delete from t7 where a=1;
+delete from t7 where a=3 and c=3;
+delete from t7 where a=5 and c=4;
+select * from t7;
+delete from t7 where b=23;
+select * from t7;
+
+drop table t7;
+
+#
+# Test multiple databases in one statement
+#
+
+CREATE TABLE t1 (
+ pk1 INT NOT NULL PRIMARY KEY,
+ attr1 INT NOT NULL,
+ attr2 INT,
+ attr3 VARCHAR(10)
+) ENGINE=ndbcluster;
+
+INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9411,9413, 17, '9413');
+
+create database mysqltest;
+use mysqltest;
+
+CREATE TABLE t2 (
+ a bigint unsigned NOT NULL PRIMARY KEY,
+ b int unsigned not null,
+ c int unsigned
+) engine=ndbcluster;
+
+insert into t2 select pk1,attr1,attr2 from test.t1;
+select * from t2 order by a;
+select b from test.t1, t2 where c = test.t1.attr2;
+select b,test.t1.attr1 from test.t1, t2 where test.t1.pk1 < a;
+
+drop table test.t1, t2;
+drop database mysqltest;
+
+#
+# BUG#6031 - DROP DATABASE doesn't drop database on first try
+#
+
+--disable_warnings
+drop database if exists ndbtest1;
+--enable_warnings
+
+create database ndbtest1;
+use ndbtest1;
+create table t1(id int) engine=ndbcluster;
+drop database ndbtest1;
+--error 1008
+drop database ndbtest1;
+
+#
+# test support of char(0)
+#
+
+use test;
+create table t1 (a int primary key, b char(0));
+insert into t1 values (1,"");
+insert into t1 values (2,NULL);
+select * from t1 order by a;
+select * from t1 order by b;
+select * from t1 where b IS NULL;
+select * from t1 where b IS NOT NULL;
+drop table t1;
+
+#
+# test the limit of no of attributes in one table
+#
+
+create table t1 (
+c1 int,
+c2 int,
+c3 int,
+c4 int,
+c5 int,
+c6 int,
+c7 int,
+c8 int,
+c9 int,
+c10 int,
+c11 int,
+c12 int,
+c13 int,
+c14 int,
+c15 int,
+c16 int,
+c17 int,
+c18 int,
+c19 int,
+c20 int,
+c21 int,
+c22 int,
+c23 int,
+c24 int,
+c25 int,
+c26 int,
+c27 int,
+c28 int,
+c29 int,
+c30 int,
+c31 int,
+c32 int,
+c33 int,
+c34 int,
+c35 int,
+c36 int,
+c37 int,
+c38 int,
+c39 int,
+c40 int,
+c41 int,
+c42 int,
+c43 int,
+c44 int,
+c45 int,
+c46 int,
+c47 int,
+c48 int,
+c49 int,
+c50 int,
+c51 int,
+c52 int,
+c53 int,
+c54 int,
+c55 int,
+c56 int,
+c57 int,
+c58 int,
+c59 int,
+c60 int,
+c61 int,
+c62 int,
+c63 int,
+c64 int,
+c65 int,
+c66 int,
+c67 int,
+c68 int,
+c69 int,
+c70 int,
+c71 int,
+c72 int,
+c73 int,
+c74 int,
+c75 int,
+c76 int,
+c77 int,
+c78 int,
+c79 int,
+c80 int,
+c81 int,
+c82 int,
+c83 int,
+c84 int,
+c85 int,
+c86 int,
+c87 int,
+c88 int,
+c89 int,
+c90 int,
+c91 int,
+c92 int,
+c93 int,
+c94 int,
+c95 int,
+c96 int,
+c97 int,
+c98 int,
+c99 int,
+c100 int,
+c101 int,
+c102 int,
+c103 int,
+c104 int,
+c105 int,
+c106 int,
+c107 int,
+c108 int,
+c109 int,
+c110 int,
+c111 int,
+c112 int,
+c113 int,
+c114 int,
+c115 int,
+c116 int,
+c117 int,
+c118 int,
+c119 int,
+c120 int,
+c121 int,
+c122 int,
+c123 int,
+c124 int,
+c125 int,
+c126 int,
+c127 int,
+c128 int,
+primary key(c1)) engine=ndb;
+drop table t1;
+
+#
+# test max size of attribute name and truncation
+#
+
+create table t1 (
+a1234567890123456789012345678901234567890 int primary key,
+a12345678901234567890123456789a1234567890 int,
+index(a12345678901234567890123456789a1234567890)
+) engine=ndb;
+show tables;
+insert into t1 values (1,1),(2,1),(3,1),(4,1),(5,2),(6,1),(7,1);
+explain select * from t1 where a12345678901234567890123456789a1234567890=2;
+select * from t1 where a12345678901234567890123456789a1234567890=2;
+drop table t1;
diff --git a/mysql-test/t/ndb_blob.test b/mysql-test/t/ndb_blob.test
new file mode 100644
index 00000000000..96e38bfb58e
--- /dev/null
+++ b/mysql-test/t/ndb_blob.test
@@ -0,0 +1,405 @@
+--source include/have_ndb.inc
+
+--disable_warnings
+drop table if exists t1;
+drop database if exists test2;
+--enable_warnings
+
+#
+# Minimal NDB blobs test.
+#
+# On NDB API level there is an extensive test program "testBlobs".
+# A prerequisite for this handler test is that "testBlobs" succeeds.
+#
+
+# -- general test starts --
+
+# make test harder with autocommit off
+set autocommit=0;
+
+create table t1 (
+ a int not null primary key,
+ b text not null,
+ c int not null,
+ d longblob,
+ key (c)
+) engine=ndbcluster;
+
+# -- values --
+
+# x0 size 256 (current inline size)
+set @x0 = '01234567012345670123456701234567';
+set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0);
+
+# b1 length 2000+256 (blob part aligned)
+set @b1 = 'b1';
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@x0);
+# d1 length 3000
+set @d1 = 'dd1';
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+
+# b2 length 20000
+set @b2 = 'b2';
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+# d2 length 30000
+set @d2 = 'dd2';
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+
+select length(@x0),length(@b1),length(@d1) from dual;
+select length(@x0),length(@b2),length(@d2) from dual;
+
+# -- pk ops --
+
+insert into t1 values(1,@b1,111,@d1);
+insert into t1 values(2,@b2,222,@d2);
+commit;
+explain select * from t1 where a = 1;
+
+# pk read
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 where a=1;
+select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
+from t1 where a=2;
+
+# pk update
+update t1 set b=@b2,d=@d2 where a=1;
+update t1 set b=@b1,d=@d1 where a=2;
+commit;
+select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
+from t1 where a=1;
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 where a=2;
+
+# pk update
+update t1 set b=concat(b,b),d=concat(d,d) where a=1;
+update t1 set b=concat(b,b),d=concat(d,d) where a=2;
+commit;
+select a,length(b),substr(b,1+4*9000,2),length(d),substr(d,1+6*9000,3)
+from t1 where a=1;
+select a,length(b),substr(b,1+4*900,2),length(d),substr(d,1+6*900,3)
+from t1 where a=2;
+
+# pk update to null
+update t1 set d=null where a=1;
+commit;
+select a from t1 where d is null;
+
+# pk delete
+delete from t1 where a=1;
+delete from t1 where a=2;
+commit;
+select count(*) from t1;
+
+# -- replace ( bug-6018 ) --
+
+# insert
+replace t1 set a=1,b=@b1,c=111,d=@d1;
+replace t1 set a=2,b=@b2,c=222,d=@d2;
+commit;
+explain select * from t1 where a = 1;
+
+# pk read
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 where a=1;
+select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
+from t1 where a=2;
+
+# update
+replace t1 set a=1,b=@b2,c=111,d=@d2;
+replace t1 set a=2,b=@b1,c=222,d=@d1;
+commit;
+select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
+from t1 where a=1;
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 where a=2;
+
+# update
+replace t1 set a=1,b=concat(@b2,@b2),c=111,d=concat(@d2,@d2);
+replace t1 set a=2,b=concat(@b1,@b1),c=222,d=concat(@d1,@d1);
+commit;
+select a,length(b),substr(b,1+4*9000,2),length(d),substr(d,1+6*9000,3)
+from t1 where a=1;
+select a,length(b),substr(b,1+4*900,2),length(d),substr(d,1+6*900,3)
+from t1 where a=2;
+
+# update to null
+replace t1 set a=1,b='xyz',c=111,d=null;
+commit;
+select a,b from t1 where d is null;
+
+# pk delete
+delete from t1 where a=1;
+delete from t1 where a=2;
+commit;
+select count(*) from t1;
+
+# -- hash index ops --
+
+insert into t1 values(1,@b1,111,@d1);
+insert into t1 values(2,@b2,222,@d2);
+commit;
+explain select * from t1 where c = 111;
+
+# hash key read
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 where c=111;
+select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
+from t1 where c=222;
+
+# hash key update
+update t1 set b=@b2,d=@d2 where c=111;
+update t1 set b=@b1,d=@d1 where c=222;
+commit;
+select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
+from t1 where c=111;
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 where c=222;
+
+# hash key update to null
+update t1 set d=null where c=111;
+commit;
+select a from t1 where d is null;
+
+# hash key delete
+delete from t1 where c=111;
+delete from t1 where c=222;
+commit;
+select count(*) from t1;
+
+# -- table scan ops, short values --
+
+insert into t1 values(1,'b1',111,'dd1');
+insert into t1 values(2,'b2',222,'dd2');
+insert into t1 values(3,'b3',333,'dd3');
+insert into t1 values(4,'b4',444,'dd4');
+insert into t1 values(5,'b5',555,'dd5');
+insert into t1 values(6,'b6',666,'dd6');
+insert into t1 values(7,'b7',777,'dd7');
+insert into t1 values(8,'b8',888,'dd8');
+insert into t1 values(9,'b9',999,'dd9');
+commit;
+explain select * from t1;
+
+# table scan read
+select * from t1 order by a;
+
+# table scan update
+update t1 set b=concat(a,'x',b),d=concat(a,'x',d);
+commit;
+select * from t1 order by a;
+
+# table scan delete
+delete from t1;
+commit;
+select count(*) from t1;
+
+# -- table scan ops, long values --
+
+insert into t1 values(1,@b1,111,@d1);
+insert into t1 values(2,@b2,222,@d2);
+commit;
+explain select * from t1;
+
+# table scan read
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 order by a;
+
+# table scan update
+update t1 set b=concat(b,b),d=concat(d,d);
+commit;
+select a,length(b),substr(b,1+4*9000,2),length(d),substr(d,1+6*9000,3)
+from t1 order by a;
+
+# table scan delete
+delete from t1;
+commit;
+select count(*) from t1;
+
+# -- range scan ops, short values --
+
+insert into t1 values(1,'b1',111,'dd1');
+insert into t1 values(2,'b2',222,'dd2');
+insert into t1 values(3,'b3',333,'dd3');
+insert into t1 values(4,'b4',444,'dd4');
+insert into t1 values(5,'b5',555,'dd5');
+insert into t1 values(6,'b6',666,'dd6');
+insert into t1 values(7,'b7',777,'dd7');
+insert into t1 values(8,'b8',888,'dd8');
+insert into t1 values(9,'b9',999,'dd9');
+commit;
+explain select * from t1 where c >= 100 order by a;
+
+# range scan read
+select * from t1 where c >= 100 order by a;
+
+# range scan update
+update t1 set b=concat(a,'x',b),d=concat(a,'x',d)
+where c >= 100;
+commit;
+select * from t1 where c >= 100 order by a;
+
+# range scan delete
+delete from t1 where c >= 100;
+commit;
+select count(*) from t1;
+
+# -- range scan ops, long values --
+
+insert into t1 values(1,@b1,111,@d1);
+insert into t1 values(2,@b2,222,@d2);
+commit;
+explain select * from t1 where c >= 100 order by a;
+
+# range scan read
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 where c >= 100 order by a;
+
+# range scan update
+update t1 set b=concat(b,b),d=concat(d,d);
+commit;
+select a,length(b),substr(b,1+4*9000,2),length(d),substr(d,1+6*9000,3)
+from t1 where c >= 100 order by a;
+
+# range scan delete
+delete from t1 where c >= 100;
+commit;
+select count(*) from t1;
+
+# -- rollback --
+
+insert into t1 values(1,@b1,111,@d1);
+insert into t1 values(2,@b2,222,@d2);
+# 626
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 where a = 0;
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 where a = 1;
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 where a = 2;
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 order by a;
+rollback;
+select count(*) from t1;
+
+# -- alter table and multi db --
+
+insert into t1 values(1,'b1',111,'dd1');
+insert into t1 values(2,'b2',222,'dd2');
+insert into t1 values(3,'b3',333,'dd3');
+insert into t1 values(4,'b4',444,'dd4');
+insert into t1 values(5,'b5',555,'dd5');
+insert into t1 values(6,'b6',666,'dd6');
+insert into t1 values(7,'b7',777,'dd7');
+insert into t1 values(8,'b8',888,'dd8');
+insert into t1 values(9,'b9',999,'dd9');
+commit;
+
+select * from t1 order by a;
+alter table t1 add x int;
+select * from t1 order by a;
+alter table t1 drop x;
+select * from t1 order by a;
+
+create database test2;
+use test2;
+
+CREATE TABLE t2 (
+ a bigint unsigned NOT NULL PRIMARY KEY,
+ b int unsigned not null,
+ c int unsigned
+) engine=ndbcluster;
+
+insert into t2 values (1,1,1),(2,2,2);
+select * from test.t1,t2 where test.t1.a = t2.a order by test.t1.a;
+
+drop table t2;
+use test;
+
+select * from t1 order by a;
+alter table t1 add x int;
+select * from t1 order by a;
+alter table t1 drop x;
+select * from t1 order by a;
+
+# -- end general test --
+
+drop table t1;
+drop database test2;
+
+# -- bug-5252 tinytext crashes plus no-commit result --
+
+set autocommit=0;
+create table t1 (
+ a int not null primary key,
+ b tinytext
+) engine=ndbcluster;
+
+insert into t1 values(1, 'x');
+update t1 set b = 'y';
+select * from t1;
+delete from t1;
+select * from t1;
+commit;
+drop table t1;
+
+# -- bug-5013 insert empty string to text --
+
+set autocommit=0;
+create table t1 (
+ a int not null primary key,
+ b text not null
+) engine=ndbcluster;
+
+insert into t1 values(1, '');
+select * from t1;
+commit;
+drop table t1;
+
+# -- bug #5349 --
+set autocommit=1;
+use test;
+CREATE TABLE t1 (
+ a int,
+ b text,
+ PRIMARY KEY (a)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+INSERT INTO t1 VALUES
+(1,'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA');
+INSERT INTO t1 VALUES
+(2,'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB');
+
+select * from t1 order by a;
+alter table t1 engine=ndb;
+select * from t1 order by a;
+
+# -- bug #5872 --
+set autocommit=1;
+alter table t1 engine=myisam;
+select * from t1 order by a;
+drop table t1;
+
+# -- bug #7340 --
+create table t1 (
+ id int(11) unsigned primary key NOT NULL auto_increment,
+ msg text NOT NULL
+) engine=ndbcluster default charset=utf8;
+insert into t1 (msg) values(
+'Tries to validate (8 byte length + inline bytes) as UTF8 :(
+Fast fix: removed validation for Text. It is not yet indexable
+so bad data will not crash kernel.
+Proper fix: Set inline bytes to multiple of mbmaxlen and
+validate it (after the 8 byte length).');
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/ndb_cache.test b/mysql-test/t/ndb_cache.test
new file mode 100644
index 00000000000..abd09424f64
--- /dev/null
+++ b/mysql-test/t/ndb_cache.test
@@ -0,0 +1,31 @@
+-- source include/have_query_cache.inc
+-- source include/have_ndb.inc
+
+set GLOBAL query_cache_size=1355776;
+reset query cache;
+flush status;
+
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
+CREATE TABLE t1 (a int) ENGINE=ndbcluster;
+CREATE TABLE t2 (a int);
+
+select * from t1;
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+select * from t2;
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+select * from t1;
+select * from t2;
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_inserts";
+show status like "Qcache_hits";
+
+drop table t1, t2;
+
+SET GLOBAL query_cache_size=0;
diff --git a/mysql-test/t/ndb_charset.test b/mysql-test/t/ndb_charset.test
new file mode 100644
index 00000000000..1b9e7e8bfcc
--- /dev/null
+++ b/mysql-test/t/ndb_charset.test
@@ -0,0 +1,169 @@
+--source include/have_ndb.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Minimal NDB charset test.
+#
+
+# pk - binary
+
+create table t1 (
+ a char(3) character set latin1 collate latin1_bin primary key
+) engine=ndb;
+# ok
+insert into t1 values('aAa');
+insert into t1 values('aaa');
+insert into t1 values('AAA');
+# 3
+select * from t1 order by a;
+# 1
+select * from t1 where a = 'aAa';
+# 1
+select * from t1 where a = 'aaa';
+# 0
+select * from t1 where a = 'AaA';
+# 1
+select * from t1 where a = 'AAA';
+drop table t1;
+
+# pk - case insensitive
+
+create table t1 (
+ a char(3) character set latin1 collate latin1_swedish_ci primary key
+) engine=ndb;
+# ok
+insert into t1 values('aAa');
+# fail
+--error 1062
+insert into t1 values('aaa');
+--error 1062
+insert into t1 values('AAA');
+# 1
+select * from t1 order by a;
+# 1
+select * from t1 where a = 'aAa';
+# 1
+select * from t1 where a = 'aaa';
+# 1
+select * from t1 where a = 'AaA';
+# 1
+select * from t1 where a = 'AAA';
+drop table t1;
+
+# unique hash index - binary
+
+create table t1 (
+ p int primary key,
+ a char(3) character set latin1 collate latin1_bin not null,
+ unique key(a)
+) engine=ndb;
+# ok
+insert into t1 values(1, 'aAa');
+insert into t1 values(2, 'aaa');
+insert into t1 values(3, 'AAA');
+# 3
+select * from t1 order by p;
+# 1
+select * from t1 where a = 'aAa';
+# 1
+select * from t1 where a = 'aaa';
+# 0
+select * from t1 where a = 'AaA';
+# 1
+select * from t1 where a = 'AAA';
+drop table t1;
+
+# unique hash index - case insensitive
+
+create table t1 (
+ p int primary key,
+ a char(3) character set latin1 collate latin1_swedish_ci not null,
+ unique key(a)
+) engine=ndb;
+# ok
+insert into t1 values(1, 'aAa');
+# fail
+--error 1062
+insert into t1 values(2, 'aaa');
+--error 1062
+insert into t1 values(3, 'AAA');
+# 1
+select * from t1 order by p;
+# 1
+select * from t1 where a = 'aAa';
+# 1
+select * from t1 where a = 'aaa';
+# 1
+select * from t1 where a = 'AaA';
+# 1
+select * from t1 where a = 'AAA';
+drop table t1;
+
+# ordered index - binary
+
+create table t1 (
+ p int primary key,
+ a char(3) character set latin1 collate latin1_bin not null,
+ index(a)
+) engine=ndb;
+# ok
+insert into t1 values(1, 'aAa');
+insert into t1 values(2, 'aaa');
+insert into t1 values(3, 'AAA');
+insert into t1 values(4, 'aAa');
+insert into t1 values(5, 'aaa');
+insert into t1 values(6, 'AAA');
+# 6
+select * from t1 order by p;
+# plan
+explain select * from t1 where a = 'zZz' order by p;
+# 2
+select * from t1 where a = 'aAa' order by p;
+# 2
+select * from t1 where a = 'aaa' order by p;
+# 0
+select * from t1 where a = 'AaA' order by p;
+# 2
+select * from t1 where a = 'AAA' order by p;
+drop table t1;
+
+# ordered index - case insensitive
+
+create table t1 (
+ p int primary key,
+ a char(3) character set latin1 collate latin1_swedish_ci not null,
+ index(a)
+) engine=ndb;
+# ok
+insert into t1 values(1, 'aAa');
+insert into t1 values(2, 'aaa');
+insert into t1 values(3, 'AAA');
+insert into t1 values(4, 'aAa');
+insert into t1 values(5, 'aaa');
+insert into t1 values(6, 'AAA');
+# 6
+select * from t1 order by p;
+# plan
+explain select * from t1 where a = 'zZz' order by p;
+# 6
+select * from t1 where a = 'aAa' order by p;
+# 6
+select * from t1 where a = 'aaa' order by p;
+# 6
+select * from t1 where a = 'AaA' order by p;
+# 6
+select * from t1 where a = 'AAA' order by p;
+drop table t1;
+
+# bug
+create table t1 (
+ a varchar(10) primary key
+) engine=ndb;
+insert into t1 values ('jonas % ');
+replace into t1 values ('jonas % ');
+replace into t1 values ('jonas % ');
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/ndb_grant.later b/mysql-test/t/ndb_grant.later
new file mode 100644
index 00000000000..d3899d9972f
--- /dev/null
+++ b/mysql-test/t/ndb_grant.later
@@ -0,0 +1,374 @@
+-- source include/have_ndb.inc
+# Test of GRANT commands
+
+# Cleanup
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+SET NAMES binary;
+
+#
+# Alter mysql system tables to ndb
+# make sure you alter all back in the end
+#
+use mysql;
+alter table columns_priv engine=ndb;
+alter table db engine=ndb;
+alter table func engine=ndb;
+alter table help_category engine=ndb;
+alter table help_keyword engine=ndb;
+alter table help_relation engine=ndb;
+alter table help_topic engine=ndb;
+alter table host engine=ndb;
+alter table tables_priv engine=ndb;
+alter table time_zone engine=ndb;
+alter table time_zone_leap_second engine=ndb;
+alter table time_zone_name engine=ndb;
+alter table time_zone_transition engine=ndb;
+alter table time_zone_transition_type engine=ndb;
+alter table user engine=ndb;
+use test;
+
+#
+# Test that SSL options works properly
+#
+delete from mysql.user where user='mysqltest_1';
+delete from mysql.db where user='mysqltest_1';
+flush privileges;
+begin;
+grant select on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA";
+commit;
+show grants for mysqltest_1@localhost;
+begin;
+grant delete on mysqltest.* to mysqltest_1@localhost;
+commit;
+select * from mysql.user where user="mysqltest_1";
+show grants for mysqltest_1@localhost;
+begin;
+revoke delete on mysqltest.* from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+begin;
+grant select on mysqltest.* to mysqltest_1@localhost require NONE;
+commit;
+show grants for mysqltest_1@localhost;
+begin;
+grant USAGE on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "testsubject" ISSUER "MySQL AB";
+commit;
+show grants for mysqltest_1@localhost;
+begin;
+revoke all privileges on mysqltest.* from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+delete from mysql.user where user='mysqltest_1';
+flush privileges;
+
+#
+# Test that the new db privileges are stored/retrieved correctly
+#
+
+begin;
+grant CREATE TEMPORARY TABLES, LOCK TABLES on mysqltest.* to mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+flush privileges;
+show grants for mysqltest_1@localhost;
+begin;
+revoke CREATE TEMPORARY TABLES on mysqltest.* from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+begin;
+grant ALL PRIVILEGES on mysqltest.* to mysqltest_1@localhost with GRANT OPTION;
+commit;
+flush privileges;
+show grants for mysqltest_1@localhost;
+begin;
+revoke LOCK TABLES, ALTER on mysqltest.* from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+begin;
+revoke all privileges on mysqltest.* from mysqltest_1@localhost;
+commit;
+delete from mysql.user where user='mysqltest_1';
+flush privileges;
+begin;
+grant usage on test.* to mysqltest_1@localhost with grant option;
+commit;
+show grants for mysqltest_1@localhost;
+delete from mysql.user where user='mysqltest_1';
+delete from mysql.db where user='mysqltest_1';
+delete from mysql.tables_priv where user='mysqltest_1';
+delete from mysql.columns_priv where user='mysqltest_1';
+flush privileges;
+--error 1141
+show grants for mysqltest_1@localhost;
+
+#
+# Test what happens when you have same table and colum level grants
+#
+
+create table t1 (a int);
+begin;
+GRANT select,update,insert on t1 to mysqltest_1@localhost;
+GRANT select (a), update (a),insert(a), references(a) on t1 to mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1";
+begin;
+REVOKE select (a), update on t1 from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+begin;
+REVOKE select,update,insert,insert (a) on t1 from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+begin;
+GRANT select,references on t1 to mysqltest_1@localhost;
+commit;
+select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1";
+begin;
+grant all on test.* to mysqltest_3@localhost with grant option;
+revoke all on test.* from mysqltest_3@localhost;
+commit;
+show grants for mysqltest_3@localhost;
+begin;
+revoke grant option on test.* from mysqltest_3@localhost;
+commit;
+show grants for mysqltest_3@localhost;
+begin;
+grant all on test.t1 to mysqltest_2@localhost with grant option;
+revoke all on test.t1 from mysqltest_2@localhost;
+commit;
+show grants for mysqltest_2@localhost;
+begin;
+revoke grant option on test.t1 from mysqltest_2@localhost;
+commit;
+show grants for mysqltest_2@localhost;
+delete from mysql.user where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
+delete from mysql.db where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
+delete from mysql.tables_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
+delete from mysql.columns_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
+flush privileges;
+drop table t1;
+
+#
+# Test some error conditions
+#
+begin;
+--error 1221
+GRANT FILE on mysqltest.* to mysqltest_1@localhost;
+commit;
+select 1; -- To test that the previous command didn't cause problems
+
+#
+# Bug#6123: GRANT USAGE inserts useless Db row
+#
+create database mysqltest1;
+begin;
+grant usage on mysqltest1.* to test6123 identified by 'magic123';
+commit;
+select host,db,user,select_priv,insert_priv from mysql.db where db="mysqltest1";
+delete from mysql.user where user='test6123';
+drop database mysqltest1;
+
+#
+# Test for 'drop user', 'revoke privileges, grant'
+#
+
+create table t1 (a int);
+begin;
+grant ALL PRIVILEGES on *.* to drop_user2@localhost with GRANT OPTION;
+commit;
+show grants for drop_user2@localhost;
+begin;
+revoke all privileges, grant option from drop_user2@localhost;
+commit;
+drop user drop_user2@localhost;
+
+begin;
+grant ALL PRIVILEGES on *.* to drop_user@localhost with GRANT OPTION;
+grant ALL PRIVILEGES on test.* to drop_user@localhost with GRANT OPTION;
+grant select(a) on test.t1 to drop_user@localhost;
+commit;
+show grants for drop_user@localhost;
+
+#
+# Bug3086
+#
+set sql_mode=ansi_quotes;
+show grants for drop_user@localhost;
+set sql_mode=default;
+
+set sql_quote_show_create=0;
+show grants for drop_user@localhost;
+set sql_mode="ansi_quotes";
+show grants for drop_user@localhost;
+set sql_quote_show_create=1;
+show grants for drop_user@localhost;
+set sql_mode="";
+show grants for drop_user@localhost;
+
+revoke all privileges, grant option from drop_user@localhost;
+show grants for drop_user@localhost;
+drop user drop_user@localhost;
+begin;
+--error 1269
+revoke all privileges, grant option from drop_user@localhost;
+commit;
+
+begin;
+grant select(a) on test.t1 to drop_user1@localhost;
+commit;
+flush privileges;
+begin;
+grant select on test.t1 to drop_user2@localhost;
+grant select on test.* to drop_user3@localhost;
+grant select on *.* to drop_user4@localhost;
+commit;
+--error 1268
+drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
+drop_user4@localhost;
+begin;
+revoke all privileges, grant option from drop_user1@localhost, drop_user2@localhost,
+drop_user3@localhost, drop_user4@localhost;
+commit;
+drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
+drop_user4@localhost;
+drop table t1;
+begin;
+grant usage on *.* to mysqltest_1@localhost identified by "password";
+grant select, update, insert on test.* to mysqltest@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+drop user mysqltest_1@localhost;
+
+#
+# Bug #3403 Wrong encodin in SHOW GRANTS output
+#
+SET NAMES koi8r;
+CREATE DATABASE ÂÄ;
+USE ÂÄ;
+CREATE TABLE ÔÁÂ (ËÏÌ int);
+
+begin;
+GRANT SELECT ON ÂÄ.* TO ÀÚÅÒ@localhost;
+commit;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+begin;
+REVOKE SELECT ON ÂÄ.* FROM ÀÚÅÒ@localhost;
+commit;
+
+begin;
+GRANT SELECT ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
+commit;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+begin;
+REVOKE SELECT ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
+commit;
+
+begin;
+GRANT SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
+commit;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+begin;
+REVOKE SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
+commit;
+
+DROP DATABASE ÂÄ;
+SET NAMES latin1;
+
+#
+# Bug #5831: REVOKE ALL PRIVILEGES, GRANT OPTION does not revoke everything
+#
+USE test;
+CREATE TABLE t1 (a int );
+CREATE TABLE t2 LIKE t1;
+CREATE TABLE t3 LIKE t1;
+CREATE TABLE t4 LIKE t1;
+CREATE TABLE t5 LIKE t1;
+CREATE TABLE t6 LIKE t1;
+CREATE TABLE t7 LIKE t1;
+CREATE TABLE t8 LIKE t1;
+CREATE TABLE t9 LIKE t1;
+CREATE TABLE t10 LIKE t1;
+CREATE DATABASE testdb1;
+CREATE DATABASE testdb2;
+CREATE DATABASE testdb3;
+CREATE DATABASE testdb4;
+CREATE DATABASE testdb5;
+CREATE DATABASE testdb6;
+CREATE DATABASE testdb7;
+CREATE DATABASE testdb8;
+CREATE DATABASE testdb9;
+CREATE DATABASE testdb10;
+begin;
+GRANT ALL ON testdb1.* TO testuser@localhost;
+GRANT ALL ON testdb2.* TO testuser@localhost;
+GRANT ALL ON testdb3.* TO testuser@localhost;
+GRANT ALL ON testdb4.* TO testuser@localhost;
+GRANT ALL ON testdb5.* TO testuser@localhost;
+GRANT ALL ON testdb6.* TO testuser@localhost;
+GRANT ALL ON testdb7.* TO testuser@localhost;
+GRANT ALL ON testdb8.* TO testuser@localhost;
+GRANT ALL ON testdb9.* TO testuser@localhost;
+GRANT ALL ON testdb10.* TO testuser@localhost;
+GRANT SELECT ON test.t1 TO testuser@localhost;
+GRANT SELECT ON test.t2 TO testuser@localhost;
+GRANT SELECT ON test.t3 TO testuser@localhost;
+GRANT SELECT ON test.t4 TO testuser@localhost;
+GRANT SELECT ON test.t5 TO testuser@localhost;
+GRANT SELECT ON test.t6 TO testuser@localhost;
+GRANT SELECT ON test.t7 TO testuser@localhost;
+GRANT SELECT ON test.t8 TO testuser@localhost;
+GRANT SELECT ON test.t9 TO testuser@localhost;
+GRANT SELECT ON test.t10 TO testuser@localhost;
+GRANT SELECT (a) ON test.t1 TO testuser@localhost;
+GRANT SELECT (a) ON test.t2 TO testuser@localhost;
+GRANT SELECT (a) ON test.t3 TO testuser@localhost;
+GRANT SELECT (a) ON test.t4 TO testuser@localhost;
+GRANT SELECT (a) ON test.t5 TO testuser@localhost;
+GRANT SELECT (a) ON test.t6 TO testuser@localhost;
+GRANT SELECT (a) ON test.t7 TO testuser@localhost;
+GRANT SELECT (a) ON test.t8 TO testuser@localhost;
+GRANT SELECT (a) ON test.t9 TO testuser@localhost;
+GRANT SELECT (a) ON test.t10 TO testuser@localhost;
+commit;
+begin;
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM testuser@localhost;
+commit;
+SHOW GRANTS FOR testuser@localhost;
+DROP USER testuser@localhost;
+DROP TABLE t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+DROP DATABASE testdb1;
+DROP DATABASE testdb2;
+DROP DATABASE testdb3;
+DROP DATABASE testdb4;
+DROP DATABASE testdb5;
+DROP DATABASE testdb6;
+DROP DATABASE testdb7;
+DROP DATABASE testdb8;
+DROP DATABASE testdb9;
+DROP DATABASE testdb10;
+
+#
+# Alter mysql system tables back to myisam
+#
+use mysql;
+alter table columns_priv engine=myisam;
+alter table db engine=myisam;
+alter table func engine=myisam;
+alter table help_category engine=myisam;
+alter table help_keyword engine=myisam;
+alter table help_relation engine=myisam;
+alter table help_topic engine=myisam;
+alter table host engine=myisam;
+alter table tables_priv engine=myisam;
+alter table time_zone engine=myisam;
+alter table time_zone_leap_second engine=myisam;
+alter table time_zone_name engine=myisam;
+alter table time_zone_transition engine=myisam;
+alter table time_zone_transition_type engine=myisam;
+alter table user engine=myisam;
+use test;
+flush privileges;
diff --git a/mysql-test/t/ndb_index.test b/mysql-test/t/ndb_index.test
new file mode 100644
index 00000000000..e65b24a9b20
--- /dev/null
+++ b/mysql-test/t/ndb_index.test
@@ -0,0 +1,129 @@
+-- source include/have_ndb.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+CREATE TABLE t1 (
+ PORT varchar(16) NOT NULL,
+ ACCESSNODE varchar(16) NOT NULL,
+ POP varchar(48) NOT NULL,
+ ACCESSTYPE int unsigned NOT NULL,
+ CUSTOMER_ID varchar(20) collate latin1_bin NOT NULL,
+ PROVIDER varchar(16),
+ TEXPIRE int unsigned,
+ NUM_IP int unsigned,
+ LEASED_NUM_IP int unsigned,
+ LOCKED_IP int unsigned,
+ STATIC_DNS int unsigned,
+ SUSPENDED_SERVICE int unsigned,
+ SUSPENDED_REASON int unsigned,
+ BGP_COMMUNITY int unsigned,
+ INDEX CUSTOMER_ID_INDEX(CUSTOMER_ID),
+ INDEX FQPN_INDEX(POP,ACCESSNODE,PORT),
+ PRIMARY KEY(POP,ACCESSNODE,PORT,ACCESSTYPE)
+) engine=ndbcluster;
+
+INSERT INTO t1 VALUES ('port67', 'node78', 'pop98', 1, 'kllopmn', 'pr_43', 121212, 1, 2, 3, 8, NULL, NULL, NULL);
+INSERT INTO t1 VALUES ('port67', 'node78', 'pop99', 2, 'klkighh', 'pr_44', 121213, 3, 3, 6, 7, NULL, NULL, NULL);
+INSERT INTO t1 VALUES ('port79', 'node79', 'pop79', 2, 'kpongfaa', 'pr_44', 981213, 2, 4, 10, 11, 2, 99, 1278);
+
+
+# Test select using port
+select port, accessnode, pop, accesstype from t1 where port='port67' order by accesstype;
+select port, accessnode, pop, accesstype from t1 where port='foo';
+
+# Test select using accessnode
+select port, accessnode, pop, accesstype from t1 where accessnode='node78' order by accesstype;
+select port, accessnode, pop, accesstype from t1 where accessnode='foo';
+
+# Test select using pop
+select port, accessnode, pop, accesstype from t1 where pop='pop98';
+select port, accessnode, pop, accesstype from t1 where pop='pop98';
+select port, accessnode, pop, accesstype from t1 where pop='pop98';
+select port, accessnode, pop, accesstype from t1 where pop='pop98' order by accesstype;
+# The following two querys will not return any rows since
+# the index used for access is case sensitive
+# They are thus disabled for now
+#select port, accessnode, pop, accesstype from t1 where pop='POP98';
+#select port, accessnode, pop, accesstype from t1 where pop='POP98' order by accesstype;
+select port, accessnode, pop, accesstype from t1 where pop='foo';
+
+# Test select using accesstype
+select port, accessnode, pop, accesstype from t1 where accesstype=1;
+select port, accessnode, pop, accesstype from t1 where accesstype=2 order by port;
+select port, accessnode, pop, accesstype from t1 where accesstype=98 order by port;
+
+# Test select using customer_id
+# NOTE! customer_id has a INDEX (ordered index in NDB), it's case sensitive!
+select port, accessnode, pop, accesstype from t1 where customer_id='kllopmn';
+select port, accessnode, pop, accesstype from t1 where customer_id='KLLOPMN';
+select port, accessnode, pop, accesstype from t1 where customer_id='kLLoPMn';
+select port, accessnode, pop, accesstype from t1 where customer_id='foo';
+
+# Test select using provider
+select port, accessnode, pop, accesstype from t1 where provider='pr_43';
+select port, accessnode, pop, accesstype from t1 where provider='foo';
+
+# Test select using texpire
+select port, accessnode from t1 where texpire=121212;
+select port, accessnode from t1 where texpire=2323;
+
+# Test select using num_ip
+select port, accessnode, pop, accesstype from t1 where num_ip=1;
+select port, accessnode, pop, accesstype from t1 where num_ip=89;
+
+# Test select using leased_num_ip
+select port, accessnode, pop, accesstype from t1 where leased_num_ip=2;
+select port, accessnode, pop, accesstype from t1 where leased_num_ip=89;
+
+# Test select using locked_ip
+select port, accessnode, pop, accesstype from t1 where locked_ip=3;
+select port, accessnode, pop, accesstype from t1 where locked_ip=89;
+
+# Test select using static_dns
+select port, accessnode, pop, accesstype from t1 where static_dns=8;
+select port, accessnode, pop, accesstype from t1 where static_dns=89;
+
+# Test select using suspended_service
+select port, accessnode, pop, accesstype from t1 where suspended_service=8;
+select port, accessnode, pop, accesstype from t1 where suspended_service=89;
+
+# Test select using suspended_reason
+select port, accessnode, pop, accesstype from t1 where suspended_reason=NULL;
+select port, accessnode, pop, accesstype from t1 where suspended_reason=89;
+select port, accessnode, pop, accesstype from t1 where suspended_reason=0;
+
+# Test select using bgp_community
+select port, accessnode, pop, accesstype from t1 where bgp_community=NULL;
+select port, accessnode, pop, accesstype from t1 where bgp_community=89;
+select port, accessnode, pop, accesstype from t1 where bgp_community=0;
+
+# Test select using full primary key
+select port, accessnode, pop, accesstype from t1 where port='port67' and accessnode='node78' and pop='pop98' and accesstype=1;
+select port, accessnode, pop, accesstype from t1 where port='port67' and accesstype=1 and accessnode='node78' and pop='pop98';
+select port, accessnode, pop, accesstype from t1 where pop='pop98' and port='port67' and accesstype=1 and accessnode='node78';
+select port, accessnode from t1 where port='foo' and accessnode='foo' and pop='foo' and accesstype=99;
+
+# Test select using partial primary key
+select port, accessnode, pop, accesstype from t1 where port='port67' and pop='pop98' and accesstype=1;
+select port, accessnode, pop, accesstype from t1 where accesstype=1 and accessnode='node78' and pop='pop98';
+select port, accessnode, pop, accesstype from t1 where port='port67' and accesstype=1 and accessnode='node78';
+select port, accessnode from t1 where port='foo' and accessnode='foo' and pop='foo';
+
+# Test select using CUSTOMER_ID_INDEX
+select port, accessnode, pop, accesstype from t1 where customer_id='kllopmn';
+select port, accessnode, pop, accesstype from t1 where customer_id='kllopmn' and accesstype=1;
+select port, accessnode, pop, accesstype from t1 where customer_id='kllopmn' and accesstype=2;
+select port, accessnode, pop, accesstype from t1 where accesstype=2 and customer_id='kllopmn';
+
+# Test select using FQPN_INDEX
+select port, accessnode, pop, accesstype from t1 where pop='pop98' and accessnode='node78' and port='port67';
+#select port, accessnode, pop, accesstype from t1 where pop='pop98' and accessnode='node78' and port='port67' order by accesstype;
+#select port, accessnode, pop, accesstype from t1 where accessnode='node78' and port='port67' and pop='pop98' order by accesstype;
+#select port, accessnode, pop, accesstype from t1 where port='port67' and pop='pop98' and accessnode='node78' order by accesstype;
+select port, accessnode, pop, accesstype from t1 where pop='pop98' and accessnode='node78' and port='port67' and customer_id='kllopmn';
+select port, accessnode, pop, accesstype from t1 where pop='pop98' and accessnode='node78' and port='port67' and customer_id='foo';
+
+
+drop table t1;
diff --git a/mysql-test/t/ndb_index_ordered.test b/mysql-test/t/ndb_index_ordered.test
new file mode 100644
index 00000000000..53177511bc6
--- /dev/null
+++ b/mysql-test/t/ndb_index_ordered.test
@@ -0,0 +1,174 @@
+-- source include/have_ndb.inc
+
+--disable_warnings
+drop table if exists t1, test1, test2;
+--enable_warnings
+
+#
+# Simple test to show use of ordered indexes
+#
+
+CREATE TABLE t1 (
+ a int unsigned NOT NULL PRIMARY KEY,
+ b int unsigned not null,
+ c int unsigned,
+ KEY(b)
+) engine=ndbcluster;
+
+insert t1 values(1, 2, 3), (2,3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
+select * from t1 order by b;
+select * from t1 where b >= 4 order by b;
+select * from t1 where b = 4 order by b;
+select * from t1 where b > 4 order by b;
+select * from t1 where b < 4 order by b;
+select * from t1 where b <= 4 order by b;
+
+# Test of reset_bounds
+select tt1.* from t1 as tt1, t1 as tt2 use index(b) where tt1.b = tt2.b order by tt1.b;
+select a, b, c from t1 where a!=2 and c=6;
+select a, b, c from t1 where a!=2 order by a;
+
+#
+# Here we should add some "explain select" to verify that the ordered index is
+# used for these queries.
+#
+
+#
+# Update using ordered index scan
+#
+
+update t1 set c = 3 where b = 3;
+select * from t1 order by a;
+update t1 set c = 10 where b >= 6;
+select * from t1 order by a;
+update t1 set c = 11 where b < 5;
+select * from t1 order by a;
+update t1 set c = 12 where b > 0;
+select * from t1 order by a;
+update t1 set c = 13 where b <= 3;
+select * from t1 order by a;
+update t1 set b = b + 1 where b > 4 and b < 7;
+select * from t1 order by a;
+-- Update primary key
+update t1 set a = a + 10 where b > 1 and b < 7;
+select * from t1 order by a;
+
+#
+# Delete using ordered index scan
+#
+
+drop table t1;
+
+CREATE TABLE t1 (
+ a int unsigned NOT NULL PRIMARY KEY,
+ b int unsigned not null,
+ c int unsigned,
+ KEY(b)
+) engine=ndbcluster;
+
+insert t1 values(1, 2, 13), (2,3, 13), (3, 4, 12), (4, 5, 12), (5,6, 12), (6,7, 12);
+
+delete from t1 where b = 3;
+select * from t1 order by a;
+delete from t1 where b >= 6;
+select * from t1 order by a;
+delete from t1 where b < 4;
+select * from t1 order by a;
+delete from t1 where b > 5;
+select * from t1 order by a;
+delete from t1 where b <= 4;
+select * from t1 order by a;
+
+drop table t1;
+
+
+#
+#multi part key
+#
+CREATE TABLE t1 (
+ a int unsigned NOT NULL PRIMARY KEY,
+ b int unsigned not null,
+ c int unsigned not null
+) engine = ndb;
+
+create index a1 on t1 (b, c);
+
+insert into t1 values (1, 2, 13);
+insert into t1 values (2,3, 13);
+insert into t1 values (3, 4, 12);
+insert into t1 values (4, 5, 12);
+insert into t1 values (5,6, 12);
+insert into t1 values (6,7, 12);
+insert into t1 values (7, 2, 1);
+insert into t1 values (8,3, 6);
+insert into t1 values (9, 4, 12);
+insert into t1 values (14, 5, 4);
+insert into t1 values (15,5,5);
+insert into t1 values (16,5, 6);
+insert into t1 values (17,4,4);
+insert into t1 values (18,1, 7);
+
+
+
+select * from t1 order by a;
+select * from t1 where b<=5 order by a;
+select * from t1 where b<=5 and c=0;
+insert into t1 values (19,4, 0);
+select * from t1 where b<=5 and c=0;
+select * from t1 where b=4 and c<=5 order by a;
+select * from t1 where b<=4 and c<=5 order by a;
+select * from t1 where b<=5 and c=0 or b<=5 and c=2;
+
+select count(*) from t1 where b = 0;
+select count(*) from t1 where b = 1;
+drop table t1;
+
+#
+# Indexing NULL values
+#
+
+CREATE TABLE t1 (
+ a int unsigned NOT NULL PRIMARY KEY,
+ b int unsigned,
+ c int unsigned,
+ KEY bc(b,c)
+) engine = ndb;
+
+insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL);
+select * from t1 use index (bc) where b IS NULL order by a;
+
+select * from t1 use index (bc)order by a;
+select * from t1 use index (bc) order by a;
+select * from t1 use index (PRIMARY) where b IS NULL order by a;
+select * from t1 use index (bc) where b IS NULL order by a;
+select * from t1 use index (bc) where b IS NULL and c IS NULL order by a;
+select * from t1 use index (bc) where b IS NULL and c = 2 order by a;
+select * from t1 use index (bc) where b < 4 order by a;
+select * from t1 use index (bc) where b IS NOT NULL order by a;
+drop table t1;
+
+#
+# Bug #6435
+CREATE TABLE test1 (
+SubscrID int(11) NOT NULL auto_increment,
+UsrID int(11) NOT NULL default '0',
+PRIMARY KEY (SubscrID),
+KEY idx_usrid (UsrID)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+
+INSERT INTO test1 VALUES (2,224),(3,224),(1,224);
+
+CREATE TABLE test2 (
+SbclID int(11) NOT NULL auto_increment,
+SbcrID int(11) NOT NULL default '0',
+PRIMARY KEY (SbclID),
+KEY idx_sbcrid (SbcrID)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+
+INSERT INTO test2 VALUES (3,2),(1,1),(2,1),(4,2);
+select * from test1 order by 1;
+select * from test2 order by 1;
+SELECT s.SubscrID,l.SbclID FROM test1 s left JOIN test2 l ON
+l.SbcrID=s.SubscrID WHERE s.UsrID=224 order by 1, 2;
+drop table test1;
+drop table test2;
diff --git a/mysql-test/t/ndb_index_unique.test b/mysql-test/t/ndb_index_unique.test
new file mode 100644
index 00000000000..f235d1ffc30
--- /dev/null
+++ b/mysql-test/t/ndb_index_unique.test
@@ -0,0 +1,288 @@
+-- source include/have_ndb.inc
+
+--disable_warnings
+drop table if exists t1, t2, t3, t4, t5, t6, t7;
+--enable_warnings
+
+#
+# Simple test to show use of UNIQUE indexes
+#
+
+CREATE TABLE t1 (
+ a int unsigned NOT NULL PRIMARY KEY,
+ b int unsigned not null,
+ c int unsigned,
+ UNIQUE(b)
+) engine=ndbcluster;
+
+insert t1 values(1, 2, 3), (2, 3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
+select * from t1 order by b;
+select * from t1 where b = 4 order by b;
+insert into t1 values(7,8,3);
+select * from t1 where b = 4 order by a;
+
+-- error 1062
+insert into t1 values(8, 2, 3);
+select * from t1 order by a;
+delete from t1 where a = 1;
+insert into t1 values(8, 2, 3);
+select * from t1 order by a;
+
+drop table t1;
+
+#
+# Indexing NULL values
+#
+
+CREATE TABLE t1 (
+ a int unsigned NOT NULL PRIMARY KEY,
+ b int unsigned,
+ c int unsigned,
+ UNIQUE bc(b,c)
+) engine = ndb;
+
+insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL);
+select * from t1 use index (bc) where b IS NULL order by a;
+
+select * from t1 use index (bc)order by a;
+select * from t1 use index (bc) order by a;
+select * from t1 use index (PRIMARY) where b IS NULL order by a;
+select * from t1 use index (bc) where b IS NULL order by a;
+select * from t1 use index (bc) where b IS NULL and c IS NULL order by a;
+select * from t1 use index (bc) where b IS NULL and c = 2 order by a;
+select * from t1 use index (bc) where b < 4 order by a;
+select * from t1 use index (bc) where b IS NOT NULL order by a;
+-- error 1062
+insert into t1 values(5,1,1);
+drop table t1;
+
+
+#
+# Show use of UNIQUE USING HASH indexes
+#
+
+CREATE TABLE t2 (
+ a int unsigned NOT NULL PRIMARY KEY,
+ b int unsigned not null,
+ c int unsigned not null,
+ UNIQUE USING HASH (b, c)
+) engine=ndbcluster;
+
+insert t2 values(1, 2, 3), (2, 3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
+select * from t2 where a = 3;
+select * from t2 where b = 4;
+select * from t2 where c = 6;
+insert into t2 values(7,8,3);
+select * from t2 where b = 4 order by a;
+
+-- error 1062
+insert into t2 values(8, 2, 3);
+select * from t2 order by a;
+delete from t2 where a = 1;
+insert into t2 values(8, 2, 3);
+select * from t2 order by a;
+
+drop table t2;
+
+-- error 1121
+CREATE TABLE t2 (
+ a int unsigned NOT NULL PRIMARY KEY,
+ b int unsigned not null,
+ c int unsigned,
+ UNIQUE USING HASH (b, c)
+) engine=ndbcluster;
+
+#
+# Show use of PRIMARY KEY USING HASH indexes
+#
+
+CREATE TABLE t3 (
+ a int unsigned NOT NULL,
+ b int unsigned not null,
+ c int unsigned,
+ PRIMARY KEY USING HASH (a, b)
+) engine=ndbcluster;
+
+insert t3 values(1, 2, 3), (2, 3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
+select * from t3 where a = 3;
+select * from t3 where b = 4;
+select * from t3 where c = 6;
+insert into t3 values(7,8,3);
+select * from t3 where b = 4 order by a;
+
+drop table t3;
+
+#
+# Indexes on NULL-able columns
+#
+
+CREATE TABLE t1 (
+ pk int NOT NULL PRIMARY KEY,
+ a int unsigned,
+ UNIQUE KEY (a)
+) engine=ndbcluster;
+
+insert into t1 values (-1,NULL), (0,0), (1,NULL),(2,2),(3,NULL),(4,4);
+
+select * from t1 order by pk;
+
+--error 1062
+insert into t1 values (5,0);
+select * from t1 order by pk;
+delete from t1 where a = 0;
+insert into t1 values (5,0);
+select * from t1 order by pk;
+
+CREATE TABLE t2 (
+ pk int NOT NULL PRIMARY KEY,
+ a int unsigned,
+ b tinyint NOT NULL,
+ c VARCHAR(10),
+ UNIQUE KEY si(a, c)
+) engine=ndbcluster;
+
+insert into t2 values (-1,1,17,NULL),(0,NULL,18,NULL),(1,3,19,'abc');
+
+select * from t2 order by pk;
+
+--error 1062
+insert into t2 values(2,3,19,'abc');
+select * from t2 order by pk;
+delete from t2 where c IS NOT NULL;
+insert into t2 values(2,3,19,'abc');
+select * from t2 order by pk;
+
+drop table t1, t2;
+
+#
+# More complex tables
+#
+
+CREATE TABLE t1 (
+ cid smallint(5) unsigned NOT NULL default '0',
+ cv varchar(250) NOT NULL default '',
+ PRIMARY KEY (cid),
+ UNIQUE KEY cv (cv)
+) engine=ndbcluster;
+INSERT INTO t1 VALUES (8,'dummy');
+CREATE TABLE t2 (
+ cid bigint(20) unsigned NOT NULL auto_increment,
+ cap varchar(255) NOT NULL default '',
+ PRIMARY KEY (cid),
+ UNIQUE KEY (cid, cap)
+) engine=ndbcluster;
+INSERT INTO t2 VALUES (NULL,'another dummy');
+CREATE TABLE t3 (
+ gid bigint(20) unsigned NOT NULL auto_increment,
+ gn varchar(255) NOT NULL default '',
+ must tinyint(4) default NULL,
+ PRIMARY KEY (gid)
+) engine=ndbcluster;
+INSERT INTO t3 VALUES (1,'V1',NULL);
+CREATE TABLE t4 (
+ uid bigint(20) unsigned NOT NULL default '0',
+ gid bigint(20) unsigned NOT NULL,
+ rid bigint(20) unsigned NOT NULL default '-1',
+ cid bigint(20) unsigned NOT NULL default '-1',
+ UNIQUE KEY m (uid,gid,rid,cid)
+) engine=ndbcluster;
+INSERT INTO t4 VALUES (1,1,2,4);
+INSERT INTO t4 VALUES (1,1,2,3);
+INSERT INTO t4 VALUES (1,1,5,7);
+INSERT INTO t4 VALUES (1,1,10,8);
+CREATE TABLE t5 (
+ rid bigint(20) unsigned NOT NULL auto_increment,
+ rl varchar(255) NOT NULL default '',
+ PRIMARY KEY (rid)
+) engine=ndbcluster;
+CREATE TABLE t6 (
+ uid bigint(20) unsigned NOT NULL auto_increment,
+ un varchar(250) NOT NULL default '',
+ uc smallint(5) unsigned NOT NULL default '0',
+ PRIMARY KEY (uid),
+ UNIQUE KEY nc (un,uc)
+) engine=ndbcluster;
+INSERT INTO t6 VALUES (1,'test',8);
+INSERT INTO t6 VALUES (2,'test2',9);
+INSERT INTO t6 VALUES (3,'tre',3);
+CREATE TABLE t7 (
+ mid bigint(20) unsigned NOT NULL PRIMARY KEY,
+ uid bigint(20) unsigned NOT NULL default '0',
+ gid bigint(20) unsigned NOT NULL,
+ rid bigint(20) unsigned NOT NULL default '-1',
+ cid bigint(20) unsigned NOT NULL default '-1',
+ UNIQUE KEY m (uid,gid,rid,cid)
+) engine=ndbcluster;
+INSERT INTO t7 VALUES(1, 1, 1, 1, 1);
+INSERT INTO t7 VALUES(2, 2, 1, 1, 1);
+INSERT INTO t7 VALUES(3, 3, 1, 1, 1);
+INSERT INTO t7 VALUES(4, 4, 1, 1, 1);
+INSERT INTO t7 VALUES(5, 5, 1, 1, 1);
+INSERT INTO t7 VALUES(6, 1, 1, 1, 6);
+INSERT INTO t7 VALUES(7, 2, 1, 1, 7);
+INSERT INTO t7 VALUES(8, 3, 1, 1, 8);
+INSERT INTO t7 VALUES(9, 4, 1, 1, 9);
+INSERT INTO t7 VALUES(10, 5, 1, 1, 10);
+
+select * from t1 where cv = 'dummy';
+select * from t1 where cv = 'test';
+select * from t2 where cap = 'another dummy';
+select * from t4 where uid = 1 and gid=1 and rid=2 and cid=4;
+select * from t4 where uid = 1 and gid=1 and rid=1 and cid=4;
+select * from t4 where uid = 1 order by cid;
+select * from t4 where rid = 2 order by cid;
+select * from t6 where un='test' and uc=8;
+select * from t6 where un='test' and uc=7;
+select * from t6 where un='test';
+select * from t7 where mid = 8;
+select * from t7 where uid = 8;
+select * from t7 where uid = 1 order by mid;
+select * from t7 where uid = 4 order by mid;
+select * from t7 where gid = 4;
+select * from t7 where gid = 1 order by mid;
+select * from t7 where cid = 4;
+select * from t7 where cid = 8;
+
+#
+# insert more records into t4
+#
+let $1=100;
+disable_query_log;
+while ($1)
+{
+ eval insert into t4 values(1, $1, 5, 12);
+ eval insert into t4 values($1, 3, 9, 11);
+ dec $1;
+}
+enable_query_log;
+
+select * from t4 where uid = 1 and gid=1 and rid=2 and cid=4;
+select * from t4 where uid = 1 and gid=1 and rid=1 and cid=4;
+select * from t4 where uid = 1 order by gid,cid;
+select * from t4 where uid = 1 order by gid,cid;
+select * from t4 where rid = 2 order by cid;
+
+
+drop table t1,t2,t3,t4,t5,t6,t7;
+
+# test null in indexes
+CREATE TABLE t1 (
+ a int unsigned NOT NULL PRIMARY KEY,
+ b int unsigned,
+ c int unsigned,
+ UNIQUE bc(b,c) ) engine = ndb;
+
+insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL);
+select * from t1 where b=1 and c=1;
+select * from t1 where b is null and c is null;
+select * from t1 where b is null and c = 2;
+select * from t1 where b = 4 and c is null;
+create table t8 as
+select * from t1 where (b = 1 and c = 1)
+ or (b is null and c is null)
+ or (b is null and c = 2)
+ or (b = 4 and c is null);
+select * from t8 order by a;
+select * from t1 order by a;
+drop table t1, t8;
+
diff --git a/mysql-test/t/ndb_insert.test b/mysql-test/t/ndb_insert.test
new file mode 100644
index 00000000000..611df3d84e9
--- /dev/null
+++ b/mysql-test/t/ndb_insert.test
@@ -0,0 +1,614 @@
+-- source include/have_ndb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+#
+# Basic test of INSERT in NDB
+#
+
+#
+# Create a normal table with primary key
+#
+CREATE TABLE t1 (
+ pk1 INT NOT NULL PRIMARY KEY,
+ b INT NOT NULL,
+ c INT NOT NULL
+) ENGINE=ndbcluster;
+
+INSERT INTO t1 VALUES (0, 0, 0);
+SELECT * FROM t1;
+
+INSERT INTO t1 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10),
+(11,11,11),(12,12,12),(13,13,13),(14,14,14),(15,15,15),
+(16,16,16),(17,17,17),(18,18,18),(19,19,19),(20,20,20),
+(21,21,21),(22,22,22),(23,23,23),(24,24,24),(25,25,25),
+(26,26,26),(27,27,27),(28,28,28),(29,29,29),(30,30,30),
+(31,31,31),(32,32,32),(33,33,33),(34,34,34),(35,35,35),
+(36,36,36),(37,37,37),(38,38,38),(39,39,39),(40,40,40),
+(41,41,41),(42,42,42),(43,43,43),(44,44,44),(45,45,45),
+(46,46,46),(47,47,47),(48,48,48),(49,49,49),(50,50,50),
+(51,51,51),(52,52,52),(53,53,53),(54,54,54),(55,55,55),
+(56,56,56),(57,57,57),(58,58,58),(59,59,59),(60,60,60),
+(61,61,61),(62,62,62),(63,63,63),(64,64,64),(65,65,65),
+(66,66,66),(67,67,67),(68,68,68),(69,69,69),(70,70,70),
+(71,71,71),(72,72,72),(73,73,73),(74,74,74),(75,75,75),
+(76,76,76),(77,77,77),(78,78,78),(79,79,79),(80,80,80),
+(81,81,81),(82,82,82),(83,83,83),(84,84,84),(85,85,85),
+(86,86,86),(87,87,87),(88,88,88),(89,89,89),(90,90,90),
+(91,91,91),(92,92,92),(93,93,93),(94,94,94),(95,95,95),
+(96,96,96),(97,97,97),(98,98,98),(99,99,99),(100,100,100),
+(101,101,101),(102,102,102),(103,103,103),(104,104,104),(105,105,105),
+(106,106,106),(107,107,107),(108,108,108),(109,109,109),(110,110,110),
+(111,111,111),(112,112,112),(113,113,113),(114,114,114),(115,115,115),
+(116,116,116),(117,117,117),(118,118,118),(119,119,119),(120,120,120),
+(121,121,121),(122,122,122),(123,123,123),(124,124,124),(125,125,125),
+(126,126,126),(127,127,127),(128,128,128),(129,129,129),(130,130,130),
+(131,131,131),(132,132,132),(133,133,133),(134,134,134),(135,135,135),
+(136,136,136),(137,137,137),(138,138,138),(139,139,139),(140,140,140),
+(141,141,141),(142,142,142),(143,143,143),(144,144,144),(145,145,145),
+(146,146,146),(147,147,147),(148,148,148),(149,149,149),(150,150,150),
+(151,151,151),(152,152,152),(153,153,153),(154,154,154),(155,155,155),
+(156,156,156),(157,157,157),(158,158,158),(159,159,159),(160,160,160),
+(161,161,161),(162,162,162),(163,163,163),(164,164,164),(165,165,165),
+(166,166,166),(167,167,167),(168,168,168),(169,169,169),(170,170,170),
+(171,171,171),(172,172,172),(173,173,173),(174,174,174),(175,175,175),
+(176,176,176),(177,177,177),(178,178,178),(179,179,179),(180,180,180),
+(181,181,181),(182,182,182),(183,183,183),(184,184,184),(185,185,185),
+(186,186,186),(187,187,187),(188,188,188),(189,189,189),(190,190,190),
+(191,191,191),(192,192,192),(193,193,193),(194,194,194),(195,195,195),
+(196,196,196),(197,197,197),(198,198,198),(199,199,199),(200,200,200),
+(201,201,201),(202,202,202),(203,203,203),(204,204,204),(205,205,205),
+(206,206,206),(207,207,207),(208,208,208),(209,209,209),(210,210,210),
+(211,211,211),(212,212,212),(213,213,213),(214,214,214),(215,215,215),
+(216,216,216),(217,217,217),(218,218,218),(219,219,219),(220,220,220),
+(221,221,221),(222,222,222),(223,223,223),(224,224,224),(225,225,225),
+(226,226,226),(227,227,227),(228,228,228),(229,229,229),(230,230,230),
+(231,231,231),(232,232,232),(233,233,233),(234,234,234),(235,235,235),
+(236,236,236),(237,237,237),(238,238,238),(239,239,239),(240,240,240),
+(241,241,241),(242,242,242),(243,243,243),(244,244,244),(245,245,245),
+(246,246,246),(247,247,247),(248,248,248),(249,249,249),(250,250,250),
+(251,251,251),(252,252,252),(253,253,253),(254,254,254),(255,255,255),
+(256,256,256),(257,257,257),(258,258,258),(259,259,259),(260,260,260),
+(261,261,261),(262,262,262),(263,263,263),(264,264,264),(265,265,265),
+(266,266,266),(267,267,267),(268,268,268),(269,269,269),(270,270,270),
+(271,271,271),(272,272,272),(273,273,273),(274,274,274),(275,275,275),
+(276,276,276),(277,277,277),(278,278,278),(279,279,279),(280,280,280),
+(281,281,281),(282,282,282),(283,283,283),(284,284,284),(285,285,285),
+(286,286,286),(287,287,287),(288,288,288),(289,289,289),(290,290,290),
+(291,291,291),(292,292,292),(293,293,293),(294,294,294),(295,295,295),
+(296,296,296),(297,297,297),(298,298,298),(299,299,299),(300,300,300),
+(301,301,301),(302,302,302),(303,303,303),(304,304,304),(305,305,305),
+(306,306,306),(307,307,307),(308,308,308),(309,309,309),(310,310,310),
+(311,311,311),(312,312,312),(313,313,313),(314,314,314),(315,315,315),
+(316,316,316),(317,317,317),(318,318,318),(319,319,319),(320,320,320),
+(321,321,321),(322,322,322),(323,323,323),(324,324,324),(325,325,325),
+(326,326,326),(327,327,327),(328,328,328),(329,329,329),(330,330,330),
+(331,331,331),(332,332,332),(333,333,333),(334,334,334),(335,335,335),
+(336,336,336),(337,337,337),(338,338,338),(339,339,339),(340,340,340),
+(341,341,341),(342,342,342),(343,343,343),(344,344,344),(345,345,345),
+(346,346,346),(347,347,347),(348,348,348),(349,349,349),(350,350,350),
+(351,351,351),(352,352,352),(353,353,353),(354,354,354),(355,355,355),
+(356,356,356),(357,357,357),(358,358,358),(359,359,359),(360,360,360),
+(361,361,361),(362,362,362),(363,363,363),(364,364,364),(365,365,365),
+(366,366,366),(367,367,367),(368,368,368),(369,369,369),(370,370,370),
+(371,371,371),(372,372,372),(373,373,373),(374,374,374),(375,375,375),
+(376,376,376),(377,377,377),(378,378,378),(379,379,379),(380,380,380),
+(381,381,381),(382,382,382),(383,383,383),(384,384,384),(385,385,385),
+(386,386,386),(387,387,387),(388,388,388),(389,389,389),(390,390,390),
+(391,391,391),(392,392,392),(393,393,393),(394,394,394),(395,395,395),
+(396,396,396),(397,397,397),(398,398,398),(399,399,399),(400,400,400),
+(401,401,401),(402,402,402),(403,403,403),(404,404,404),(405,405,405),
+(406,406,406),(407,407,407),(408,408,408),(409,409,409),(410,410,410),
+(411,411,411),(412,412,412),(413,413,413),(414,414,414),(415,415,415),
+(416,416,416),(417,417,417),(418,418,418),(419,419,419),(420,420,420),
+(421,421,421),(422,422,422),(423,423,423),(424,424,424),(425,425,425),
+(426,426,426),(427,427,427),(428,428,428),(429,429,429),(430,430,430),
+(431,431,431),(432,432,432),(433,433,433),(434,434,434),(435,435,435),
+(436,436,436),(437,437,437),(438,438,438),(439,439,439),(440,440,440),
+(441,441,441),(442,442,442),(443,443,443),(444,444,444),(445,445,445),
+(446,446,446),(447,447,447),(448,448,448),(449,449,449),(450,450,450),
+(451,451,451),(452,452,452),(453,453,453),(454,454,454),(455,455,455),
+(456,456,456),(457,457,457),(458,458,458),(459,459,459),(460,460,460),
+(461,461,461),(462,462,462),(463,463,463),(464,464,464),(465,465,465),
+(466,466,466),(467,467,467),(468,468,468),(469,469,469),(470,470,470),
+(471,471,471),(472,472,472),(473,473,473),(474,474,474),(475,475,475),
+(476,476,476),(477,477,477),(478,478,478),(479,479,479),(480,480,480),
+(481,481,481),(482,482,482),(483,483,483),(484,484,484),(485,485,485),
+(486,486,486),(487,487,487),(488,488,488),(489,489,489),(490,490,490),
+(491,491,491),(492,492,492),(493,493,493),(494,494,494),(495,495,495),
+(496,496,496),(497,497,497),(498,498,498),(499,499,499),(500, 500, 500);
+
+SELECT COUNT(*) FROM t1;
+
+INSERT INTO t1 VALUES
+(501,501,501),(502,502,502),(503,503,503),(504,504,504),(505,505,505),
+(506,506,506),(507,507,507),(508,508,508),(509,509,509),(510,510,510),
+(511,511,511),(512,512,512),(513,513,513),(514,514,514),(515,515,515),
+(516,516,516),(517,517,517),(518,518,518),(519,519,519),(520,520,520),
+(521,521,521),(522,522,522),(523,523,523),(524,524,524),(525,525,525),
+(526,526,526),(527,527,527),(528,528,528),(529,529,529),(530,530,530),
+(531,531,531),(532,532,532),(533,533,533),(534,534,534),(535,535,535),
+(536,536,536),(537,537,537),(538,538,538),(539,539,539),(540,540,540),
+(541,541,541),(542,542,542),(543,543,543),(544,544,544),(545,545,545),
+(546,546,546),(547,547,547),(548,548,548),(549,549,549),(550,550,550),
+(551,551,551),(552,552,552),(553,553,553),(554,554,554),(555,555,555),
+(556,556,556),(557,557,557),(558,558,558),(559,559,559),(560,560,560),
+(561,561,561),(562,562,562),(563,563,563),(564,564,564),(565,565,565),
+(566,566,566),(567,567,567),(568,568,568),(569,569,569),(570,570,570),
+(571,571,571),(572,572,572),(573,573,573),(574,574,574),(575,575,575),
+(576,576,576),(577,577,577),(578,578,578),(579,579,579),(580,580,580),
+(581,581,581),(582,582,582),(583,583,583),(584,584,584),(585,585,585),
+(586,586,586),(587,587,587),(588,588,588),(589,589,589),(590,590,590),
+(591,591,591),(592,592,592),(593,593,593),(594,594,594),(595,595,595),
+(596,596,596),(597,597,597),(598,598,598),(599,599,599),(600,600,600),
+(601,601,601),(602,602,602),(603,603,603),(604,604,604),(605,605,605),
+(606,606,606),(607,607,607),(608,608,608),(609,609,609),(610,610,610),
+(611,611,611),(612,612,612),(613,613,613),(614,614,614),(615,615,615),
+(616,616,616),(617,617,617),(618,618,618),(619,619,619),(620,620,620),
+(621,621,621),(622,622,622),(623,623,623),(624,624,624),(625,625,625),
+(626,626,626),(627,627,627),(628,628,628),(629,629,629),(630,630,630),
+(631,631,631),(632,632,632),(633,633,633),(634,634,634),(635,635,635),
+(636,636,636),(637,637,637),(638,638,638),(639,639,639),(640,640,640),
+(641,641,641),(642,642,642),(643,643,643),(644,644,644),(645,645,645),
+(646,646,646),(647,647,647),(648,648,648),(649,649,649),(650,650,650),
+(651,651,651),(652,652,652),(653,653,653),(654,654,654),(655,655,655),
+(656,656,656),(657,657,657),(658,658,658),(659,659,659),(660,660,660),
+(661,661,661),(662,662,662),(663,663,663),(664,664,664),(665,665,665),
+(666,666,666),(667,667,667),(668,668,668),(669,669,669),(670,670,670),
+(671,671,671),(672,672,672),(673,673,673),(674,674,674),(675,675,675),
+(676,676,676),(677,677,677),(678,678,678),(679,679,679),(680,680,680),
+(681,681,681),(682,682,682),(683,683,683),(684,684,684),(685,685,685),
+(686,686,686),(687,687,687),(688,688,688),(689,689,689),(690,690,690),
+(691,691,691),(692,692,692),(693,693,693),(694,694,694),(695,695,695),
+(696,696,696),(697,697,697),(698,698,698),(699,699,699),(700,700,700),
+(701,701,701),(702,702,702),(703,703,703),(704,704,704),(705,705,705),
+(706,706,706),(707,707,707),(708,708,708),(709,709,709),(710,710,710),
+(711,711,711),(712,712,712),(713,713,713),(714,714,714),(715,715,715),
+(716,716,716),(717,717,717),(718,718,718),(719,719,719),(720,720,720),
+(721,721,721),(722,722,722),(723,723,723),(724,724,724),(725,725,725),
+(726,726,726),(727,727,727),(728,728,728),(729,729,729),(730,730,730),
+(731,731,731),(732,732,732),(733,733,733),(734,734,734),(735,735,735),
+(736,736,736),(737,737,737),(738,738,738),(739,739,739),(740,740,740),
+(741,741,741),(742,742,742),(743,743,743),(744,744,744),(745,745,745),
+(746,746,746),(747,747,747),(748,748,748),(749,749,749),(750,750,750),
+(751,751,751),(752,752,752),(753,753,753),(754,754,754),(755,755,755),
+(756,756,756),(757,757,757),(758,758,758),(759,759,759),(760,760,760),
+(761,761,761),(762,762,762),(763,763,763),(764,764,764),(765,765,765),
+(766,766,766),(767,767,767),(768,768,768),(769,769,769),(770,770,770),
+(771,771,771),(772,772,772),(773,773,773),(774,774,774),(775,775,775),
+(776,776,776),(777,777,777),(778,778,778),(779,779,779),(780,780,780),
+(781,781,781),(782,782,782),(783,783,783),(784,784,784),(785,785,785),
+(786,786,786),(787,787,787),(788,788,788),(789,789,789),(790,790,790),
+(791,791,791),(792,792,792),(793,793,793),(794,794,794),(795,795,795),
+(796,796,796),(797,797,797),(798,798,798),(799,799,799),(800,800,800),
+(801,801,801),(802,802,802),(803,803,803),(804,804,804),(805,805,805),
+(806,806,806),(807,807,807),(808,808,808),(809,809,809),(810,810,810),
+(811,811,811),(812,812,812),(813,813,813),(814,814,814),(815,815,815),
+(816,816,816),(817,817,817),(818,818,818),(819,819,819),(820,820,820),
+(821,821,821),(822,822,822),(823,823,823),(824,824,824),(825,825,825),
+(826,826,826),(827,827,827),(828,828,828),(829,829,829),(830,830,830),
+(831,831,831),(832,832,832),(833,833,833),(834,834,834),(835,835,835),
+(836,836,836),(837,837,837),(838,838,838),(839,839,839),(840,840,840),
+(841,841,841),(842,842,842),(843,843,843),(844,844,844),(845,845,845),
+(846,846,846),(847,847,847),(848,848,848),(849,849,849),(850,850,850),
+(851,851,851),(852,852,852),(853,853,853),(854,854,854),(855,855,855),
+(856,856,856),(857,857,857),(858,858,858),(859,859,859),(860,860,860),
+(861,861,861),(862,862,862),(863,863,863),(864,864,864),(865,865,865),
+(866,866,866),(867,867,867),(868,868,868),(869,869,869),(870,870,870),
+(871,871,871),(872,872,872),(873,873,873),(874,874,874),(875,875,875),
+(876,876,876),(877,877,877),(878,878,878),(879,879,879),(880,880,880),
+(881,881,881),(882,882,882),(883,883,883),(884,884,884),(885,885,885),
+(886,886,886),(887,887,887),(888,888,888),(889,889,889),(890,890,890),
+(891,891,891),(892,892,892),(893,893,893),(894,894,894),(895,895,895),
+(896,896,896),(897,897,897),(898,898,898),(899,899,899),(900,900,900),
+(901,901,901),(902,902,902),(903,903,903),(904,904,904),(905,905,905),
+(906,906,906),(907,907,907),(908,908,908),(909,909,909),(910,910,910),
+(911,911,911),(912,912,912),(913,913,913),(914,914,914),(915,915,915),
+(916,916,916),(917,917,917),(918,918,918),(919,919,919),(920,920,920),
+(921,921,921),(922,922,922),(923,923,923),(924,924,924),(925,925,925),
+(926,926,926),(927,927,927),(928,928,928),(929,929,929),(930,930,930),
+(931,931,931),(932,932,932),(933,933,933),(934,934,934),(935,935,935),
+(936,936,936),(937,937,937),(938,938,938),(939,939,939),(940,940,940),
+(941,941,941),(942,942,942),(943,943,943),(944,944,944),(945,945,945),
+(946,946,946),(947,947,947),(948,948,948),(949,949,949),(950,950,950),
+(951,951,951),(952,952,952),(953,953,953),(954,954,954),(955,955,955),
+(956,956,956),(957,957,957),(958,958,958),(959,959,959),(960,960,960),
+(961,961,961),(962,962,962),(963,963,963),(964,964,964),(965,965,965),
+(966,966,966),(967,967,967),(968,968,968),(969,969,969),(970,970,970),
+(971,971,971),(972,972,972),(973,973,973),(974,974,974),(975,975,975),
+(976,976,976),(977,977,977),(978,978,978),(979,979,979),(980,980,980),
+(981,981,981),(982,982,982),(983,983,983),(984,984,984),(985,985,985),
+(986,986,986),(987,987,987),(988,988,988),(989,989,989),(990,990,990),
+(991,991,991),(992,992,992),(993,993,993),(994,994,994),(995,995,995),
+(996,996,996),(997,997,997),(998,998,998),(999,999,999),(1000,1000,1000),
+(1001,1001,1001),(1002,1002,1002),(1003,1003,1003),(1004,1004,1004),(1005,1005,1005),
+(1006,1006,1006),(1007,1007,1007),(1008,1008,1008),(1009,1009,1009),(1010,1010,1010),
+(1011,1011,1011),(1012,1012,1012),(1013,1013,1013),(1014,1014,1014),(1015,1015,1015),
+(1016,1016,1016),(1017,1017,1017),(1018,1018,1018),(1019,1019,1019),(1020,1020,1020),
+(1021,1021,1021),(1022,1022,1022),(1023,1023,1023),(1024,1024,1024),(1025,1025,1025),
+(1026,1026,1026),(1027,1027,1027),(1028,1028,1028),(1029,1029,1029),(1030,1030,1030),
+(1031,1031,1031),(1032,1032,1032),(1033,1033,1033),(1034,1034,1034),(1035,1035,1035),
+(1036,1036,1036),(1037,1037,1037),(1038,1038,1038),(1039,1039,1039),(1040,1040,1040),
+(1041,1041,1041),(1042,1042,1042),(1043,1043,1043),(1044,1044,1044),(1045,1045,1045),
+(1046,1046,1046),(1047,1047,1047),(1048,1048,1048),(1049,1049,1049),(1050,1050,1050),
+(1051,1051,1051),(1052,1052,1052),(1053,1053,1053),(1054,1054,1054),(1055,1055,1055),
+(1056,1056,1056),(1057,1057,1057),(1058,1058,1058),(1059,1059,1059),(1060,1060,1060),
+(1061,1061,1061),(1062,1062,1062),(1063,1063,1063),(1064,1064,1064),(1065,1065,1065),
+(1066,1066,1066),(1067,1067,1067),(1068,1068,1068),(1069,1069,1069),(1070,1070,1070),
+(1071,1071,1071),(1072,1072,1072),(1073,1073,1073),(1074,1074,1074),(1075,1075,1075),
+(1076,1076,1076),(1077,1077,1077),(1078,1078,1078),(1079,1079,1079),(1080,1080,1080),
+(1081,1081,1081),(1082,1082,1082),(1083,1083,1083),(1084,1084,1084),(1085,1085,1085),
+(1086,1086,1086),(1087,1087,1087),(1088,1088,1088),(1089,1089,1089),(1090,1090,1090),
+(1091,1091,1091),(1092,1092,1092),(1093,1093,1093),(1094,1094,1094),(1095,1095,1095),
+(1096,1096,1096),(1097,1097,1097),(1098,1098,1098),(1099,1099,1099),(1100,1100,1100),
+(1101,1101,1101),(1102,1102,1102),(1103,1103,1103),(1104,1104,1104),(1105,1105,1105),
+(1106,1106,1106),(1107,1107,1107),(1108,1108,1108),(1109,1109,1109),(1110,1110,1110),
+(1111,1111,1111),(1112,1112,1112),(1113,1113,1113),(1114,1114,1114),(1115,1115,1115),
+(1116,1116,1116),(1117,1117,1117),(1118,1118,1118),(1119,1119,1119),(1120,1120,1120),
+(1121,1121,1121),(1122,1122,1122),(1123,1123,1123),(1124,1124,1124),(1125,1125,1125),
+(1126,1126,1126),(1127,1127,1127),(1128,1128,1128),(1129,1129,1129),(1130,1130,1130),
+(1131,1131,1131),(1132,1132,1132),(1133,1133,1133),(1134,1134,1134),(1135,1135,1135),
+(1136,1136,1136),(1137,1137,1137),(1138,1138,1138),(1139,1139,1139),(1140,1140,1140),
+(1141,1141,1141),(1142,1142,1142),(1143,1143,1143),(1144,1144,1144),(1145,1145,1145),
+(1146,1146,1146),(1147,1147,1147),(1148,1148,1148),(1149,1149,1149),(1150,1150,1150),
+(1151,1151,1151),(1152,1152,1152),(1153,1153,1153),(1154,1154,1154),(1155,1155,1155),
+(1156,1156,1156),(1157,1157,1157),(1158,1158,1158),(1159,1159,1159),(1160,1160,1160),
+(1161,1161,1161),(1162,1162,1162),(1163,1163,1163),(1164,1164,1164),(1165,1165,1165),
+(1166,1166,1166),(1167,1167,1167),(1168,1168,1168),(1169,1169,1169),(1170,1170,1170),
+(1171,1171,1171),(1172,1172,1172),(1173,1173,1173),(1174,1174,1174),(1175,1175,1175),
+(1176,1176,1176),(1177,1177,1177),(1178,1178,1178),(1179,1179,1179),(1180,1180,1180),
+(1181,1181,1181),(1182,1182,1182),(1183,1183,1183),(1184,1184,1184),(1185,1185,1185),
+(1186,1186,1186),(1187,1187,1187),(1188,1188,1188),(1189,1189,1189),(1190,1190,1190),
+(1191,1191,1191),(1192,1192,1192),(1193,1193,1193),(1194,1194,1194),(1195,1195,1195),
+(1196,1196,1196),(1197,1197,1197),(1198,1198,1198),(1199,1199,1199),(1200,1200,1200),
+(1201,1201,1201),(1202,1202,1202),(1203,1203,1203),(1204,1204,1204),(1205,1205,1205),
+(1206,1206,1206),(1207,1207,1207),(1208,1208,1208),(1209,1209,1209),(1210,1210,1210),
+(1211,1211,1211),(1212,1212,1212),(1213,1213,1213),(1214,1214,1214),(1215,1215,1215),
+(1216,1216,1216),(1217,1217,1217),(1218,1218,1218),(1219,1219,1219),(1220,1220,1220),
+(1221,1221,1221),(1222,1222,1222),(1223,1223,1223),(1224,1224,1224),(1225,1225,1225),
+(1226,1226,1226),(1227,1227,1227),(1228,1228,1228),(1229,1229,1229),(1230,1230,1230),
+(1231,1231,1231),(1232,1232,1232),(1233,1233,1233),(1234,1234,1234),(1235,1235,1235),
+(1236,1236,1236),(1237,1237,1237),(1238,1238,1238),(1239,1239,1239),(1240,1240,1240),
+(1241,1241,1241),(1242,1242,1242),(1243,1243,1243),(1244,1244,1244),(1245,1245,1245),
+(1246,1246,1246),(1247,1247,1247),(1248,1248,1248),(1249,1249,1249),(1250,1250,1250),
+(1251,1251,1251),(1252,1252,1252),(1253,1253,1253),(1254,1254,1254),(1255,1255,1255),
+(1256,1256,1256),(1257,1257,1257),(1258,1258,1258),(1259,1259,1259),(1260,1260,1260),
+(1261,1261,1261),(1262,1262,1262),(1263,1263,1263),(1264,1264,1264),(1265,1265,1265),
+(1266,1266,1266),(1267,1267,1267),(1268,1268,1268),(1269,1269,1269),(1270,1270,1270),
+(1271,1271,1271),(1272,1272,1272),(1273,1273,1273),(1274,1274,1274),(1275,1275,1275),
+(1276,1276,1276),(1277,1277,1277),(1278,1278,1278),(1279,1279,1279),(1280,1280,1280),
+(1281,1281,1281),(1282,1282,1282),(1283,1283,1283),(1284,1284,1284),(1285,1285,1285),
+(1286,1286,1286),(1287,1287,1287),(1288,1288,1288),(1289,1289,1289),(1290,1290,1290),
+(1291,1291,1291),(1292,1292,1292),(1293,1293,1293),(1294,1294,1294),(1295,1295,1295),
+(1296,1296,1296),(1297,1297,1297),(1298,1298,1298),(1299,1299,1299),(1300,1300,1300),
+(1301,1301,1301),(1302,1302,1302),(1303,1303,1303),(1304,1304,1304),(1305,1305,1305),
+(1306,1306,1306),(1307,1307,1307),(1308,1308,1308),(1309,1309,1309),(1310,1310,1310),
+(1311,1311,1311),(1312,1312,1312),(1313,1313,1313),(1314,1314,1314),(1315,1315,1315),
+(1316,1316,1316),(1317,1317,1317),(1318,1318,1318),(1319,1319,1319),(1320,1320,1320),
+(1321,1321,1321),(1322,1322,1322),(1323,1323,1323),(1324,1324,1324),(1325,1325,1325),
+(1326,1326,1326),(1327,1327,1327),(1328,1328,1328),(1329,1329,1329),(1330,1330,1330),
+(1331,1331,1331),(1332,1332,1332),(1333,1333,1333),(1334,1334,1334),(1335,1335,1335),
+(1336,1336,1336),(1337,1337,1337),(1338,1338,1338),(1339,1339,1339),(1340,1340,1340),
+(1341,1341,1341),(1342,1342,1342),(1343,1343,1343),(1344,1344,1344),(1345,1345,1345),
+(1346,1346,1346),(1347,1347,1347),(1348,1348,1348),(1349,1349,1349),(1350,1350,1350),
+(1351,1351,1351),(1352,1352,1352),(1353,1353,1353),(1354,1354,1354),(1355,1355,1355),
+(1356,1356,1356),(1357,1357,1357),(1358,1358,1358),(1359,1359,1359),(1360,1360,1360),
+(1361,1361,1361),(1362,1362,1362),(1363,1363,1363),(1364,1364,1364),(1365,1365,1365),
+(1366,1366,1366),(1367,1367,1367),(1368,1368,1368),(1369,1369,1369),(1370,1370,1370),
+(1371,1371,1371),(1372,1372,1372),(1373,1373,1373),(1374,1374,1374),(1375,1375,1375),
+(1376,1376,1376),(1377,1377,1377),(1378,1378,1378),(1379,1379,1379),(1380,1380,1380),
+(1381,1381,1381),(1382,1382,1382),(1383,1383,1383),(1384,1384,1384),(1385,1385,1385),
+(1386,1386,1386),(1387,1387,1387),(1388,1388,1388),(1389,1389,1389),(1390,1390,1390),
+(1391,1391,1391),(1392,1392,1392),(1393,1393,1393),(1394,1394,1394),(1395,1395,1395),
+(1396,1396,1396),(1397,1397,1397),(1398,1398,1398),(1399,1399,1399),(1400,1400,1400),
+(1401,1401,1401),(1402,1402,1402),(1403,1403,1403),(1404,1404,1404),(1405,1405,1405),
+(1406,1406,1406),(1407,1407,1407),(1408,1408,1408),(1409,1409,1409),(1410,1410,1410),
+(1411,1411,1411),(1412,1412,1412),(1413,1413,1413),(1414,1414,1414),(1415,1415,1415),
+(1416,1416,1416),(1417,1417,1417),(1418,1418,1418),(1419,1419,1419),(1420,1420,1420),
+(1421,1421,1421),(1422,1422,1422),(1423,1423,1423),(1424,1424,1424),(1425,1425,1425),
+(1426,1426,1426),(1427,1427,1427),(1428,1428,1428),(1429,1429,1429),(1430,1430,1430),
+(1431,1431,1431),(1432,1432,1432),(1433,1433,1433),(1434,1434,1434),(1435,1435,1435),
+(1436,1436,1436),(1437,1437,1437),(1438,1438,1438),(1439,1439,1439),(1440,1440,1440),
+(1441,1441,1441),(1442,1442,1442),(1443,1443,1443),(1444,1444,1444),(1445,1445,1445),
+(1446,1446,1446),(1447,1447,1447),(1448,1448,1448),(1449,1449,1449),(1450,1450,1450),
+(1451,1451,1451),(1452,1452,1452),(1453,1453,1453),(1454,1454,1454),(1455,1455,1455),
+(1456,1456,1456),(1457,1457,1457),(1458,1458,1458),(1459,1459,1459),(1460,1460,1460),
+(1461,1461,1461),(1462,1462,1462),(1463,1463,1463),(1464,1464,1464),(1465,1465,1465),
+(1466,1466,1466),(1467,1467,1467),(1468,1468,1468),(1469,1469,1469),(1470,1470,1470),
+(1471,1471,1471),(1472,1472,1472),(1473,1473,1473),(1474,1474,1474),(1475,1475,1475),
+(1476,1476,1476),(1477,1477,1477),(1478,1478,1478),(1479,1479,1479),(1480,1480,1480),
+(1481,1481,1481),(1482,1482,1482),(1483,1483,1483),(1484,1484,1484),(1485,1485,1485),
+(1486,1486,1486),(1487,1487,1487),(1488,1488,1488),(1489,1489,1489),(1490,1490,1490),
+(1491,1491,1491),(1492,1492,1492),(1493,1493,1493),(1494,1494,1494),(1495,1495,1495),
+(1496,1496,1496),(1497,1497,1497),(1498,1498,1498),(1499,1499,1499),(1500,1500,1500),
+(1501,1501,1501),(1502,1502,1502),(1503,1503,1503),(1504,1504,1504),(1505,1505,1505),
+(1506,1506,1506),(1507,1507,1507),(1508,1508,1508),(1509,1509,1509),(1510,1510,1510),
+(1511,1511,1511),(1512,1512,1512),(1513,1513,1513),(1514,1514,1514),(1515,1515,1515),
+(1516,1516,1516),(1517,1517,1517),(1518,1518,1518),(1519,1519,1519),(1520,1520,1520),
+(1521,1521,1521),(1522,1522,1522),(1523,1523,1523),(1524,1524,1524),(1525,1525,1525),
+(1526,1526,1526),(1527,1527,1527),(1528,1528,1528),(1529,1529,1529),(1530,1530,1530),
+(1531,1531,1531),(1532,1532,1532),(1533,1533,1533),(1534,1534,1534),(1535,1535,1535),
+(1536,1536,1536),(1537,1537,1537),(1538,1538,1538),(1539,1539,1539),(1540,1540,1540),
+(1541,1541,1541),(1542,1542,1542),(1543,1543,1543),(1544,1544,1544),(1545,1545,1545),
+(1546,1546,1546),(1547,1547,1547),(1548,1548,1548),(1549,1549,1549),(1550,1550,1550),
+(1551,1551,1551),(1552,1552,1552),(1553,1553,1553),(1554,1554,1554),(1555,1555,1555),
+(1556,1556,1556),(1557,1557,1557),(1558,1558,1558),(1559,1559,1559),(1560,1560,1560),
+(1561,1561,1561),(1562,1562,1562),(1563,1563,1563),(1564,1564,1564),(1565,1565,1565),
+(1566,1566,1566),(1567,1567,1567),(1568,1568,1568),(1569,1569,1569),(1570,1570,1570),
+(1571,1571,1571),(1572,1572,1572),(1573,1573,1573),(1574,1574,1574),(1575,1575,1575),
+(1576,1576,1576),(1577,1577,1577),(1578,1578,1578),(1579,1579,1579),(1580,1580,1580),
+(1581,1581,1581),(1582,1582,1582),(1583,1583,1583),(1584,1584,1584),(1585,1585,1585),
+(1586,1586,1586),(1587,1587,1587),(1588,1588,1588),(1589,1589,1589),(1590,1590,1590),
+(1591,1591,1591),(1592,1592,1592),(1593,1593,1593),(1594,1594,1594),(1595,1595,1595),
+(1596,1596,1596),(1597,1597,1597),(1598,1598,1598),(1599,1599,1599),(1600,1600,1600),
+(1601,1601,1601),(1602,1602,1602),(1603,1603,1603),(1604,1604,1604),(1605,1605,1605),
+(1606,1606,1606),(1607,1607,1607),(1608,1608,1608),(1609,1609,1609),(1610,1610,1610),
+(1611,1611,1611),(1612,1612,1612),(1613,1613,1613),(1614,1614,1614),(1615,1615,1615),
+(1616,1616,1616),(1617,1617,1617),(1618,1618,1618),(1619,1619,1619),(1620,1620,1620),
+(1621,1621,1621),(1622,1622,1622),(1623,1623,1623),(1624,1624,1624),(1625,1625,1625),
+(1626,1626,1626),(1627,1627,1627),(1628,1628,1628),(1629,1629,1629),(1630,1630,1630),
+(1631,1631,1631),(1632,1632,1632),(1633,1633,1633),(1634,1634,1634),(1635,1635,1635),
+(1636,1636,1636),(1637,1637,1637),(1638,1638,1638),(1639,1639,1639),(1640,1640,1640),
+(1641,1641,1641),(1642,1642,1642),(1643,1643,1643),(1644,1644,1644),(1645,1645,1645),
+(1646,1646,1646),(1647,1647,1647),(1648,1648,1648),(1649,1649,1649),(1650,1650,1650),
+(1651,1651,1651),(1652,1652,1652),(1653,1653,1653),(1654,1654,1654),(1655,1655,1655),
+(1656,1656,1656),(1657,1657,1657),(1658,1658,1658),(1659,1659,1659),(1660,1660,1660),
+(1661,1661,1661),(1662,1662,1662),(1663,1663,1663),(1664,1664,1664),(1665,1665,1665),
+(1666,1666,1666),(1667,1667,1667),(1668,1668,1668),(1669,1669,1669),(1670,1670,1670),
+(1671,1671,1671),(1672,1672,1672),(1673,1673,1673),(1674,1674,1674),(1675,1675,1675),
+(1676,1676,1676),(1677,1677,1677),(1678,1678,1678),(1679,1679,1679),(1680,1680,1680),
+(1681,1681,1681),(1682,1682,1682),(1683,1683,1683),(1684,1684,1684),(1685,1685,1685),
+(1686,1686,1686),(1687,1687,1687),(1688,1688,1688),(1689,1689,1689),(1690,1690,1690),
+(1691,1691,1691),(1692,1692,1692),(1693,1693,1693),(1694,1694,1694),(1695,1695,1695),
+(1696,1696,1696),(1697,1697,1697),(1698,1698,1698),(1699,1699,1699),(1700,1700,1700),
+(1701,1701,1701),(1702,1702,1702),(1703,1703,1703),(1704,1704,1704),(1705,1705,1705),
+(1706,1706,1706),(1707,1707,1707),(1708,1708,1708),(1709,1709,1709),(1710,1710,1710),
+(1711,1711,1711),(1712,1712,1712),(1713,1713,1713),(1714,1714,1714),(1715,1715,1715),
+(1716,1716,1716),(1717,1717,1717),(1718,1718,1718),(1719,1719,1719),(1720,1720,1720),
+(1721,1721,1721),(1722,1722,1722),(1723,1723,1723),(1724,1724,1724),(1725,1725,1725),
+(1726,1726,1726),(1727,1727,1727),(1728,1728,1728),(1729,1729,1729),(1730,1730,1730),
+(1731,1731,1731),(1732,1732,1732),(1733,1733,1733),(1734,1734,1734),(1735,1735,1735),
+(1736,1736,1736),(1737,1737,1737),(1738,1738,1738),(1739,1739,1739),(1740,1740,1740),
+(1741,1741,1741),(1742,1742,1742),(1743,1743,1743),(1744,1744,1744),(1745,1745,1745),
+(1746,1746,1746),(1747,1747,1747),(1748,1748,1748),(1749,1749,1749),(1750,1750,1750),
+(1751,1751,1751),(1752,1752,1752),(1753,1753,1753),(1754,1754,1754),(1755,1755,1755),
+(1756,1756,1756),(1757,1757,1757),(1758,1758,1758),(1759,1759,1759),(1760,1760,1760),
+(1761,1761,1761),(1762,1762,1762),(1763,1763,1763),(1764,1764,1764),(1765,1765,1765),
+(1766,1766,1766),(1767,1767,1767),(1768,1768,1768),(1769,1769,1769),(1770,1770,1770),
+(1771,1771,1771),(1772,1772,1772),(1773,1773,1773),(1774,1774,1774),(1775,1775,1775),
+(1776,1776,1776),(1777,1777,1777),(1778,1778,1778),(1779,1779,1779),(1780,1780,1780),
+(1781,1781,1781),(1782,1782,1782),(1783,1783,1783),(1784,1784,1784),(1785,1785,1785),
+(1786,1786,1786),(1787,1787,1787),(1788,1788,1788),(1789,1789,1789),(1790,1790,1790),
+(1791,1791,1791),(1792,1792,1792),(1793,1793,1793),(1794,1794,1794),(1795,1795,1795),
+(1796,1796,1796),(1797,1797,1797),(1798,1798,1798),(1799,1799,1799),(1800,1800,1800),
+(1801,1801,1801),(1802,1802,1802),(1803,1803,1803),(1804,1804,1804),(1805,1805,1805),
+(1806,1806,1806),(1807,1807,1807),(1808,1808,1808),(1809,1809,1809),(1810,1810,1810),
+(1811,1811,1811),(1812,1812,1812),(1813,1813,1813),(1814,1814,1814),(1815,1815,1815),
+(1816,1816,1816),(1817,1817,1817),(1818,1818,1818),(1819,1819,1819),(1820,1820,1820),
+(1821,1821,1821),(1822,1822,1822),(1823,1823,1823),(1824,1824,1824),(1825,1825,1825),
+(1826,1826,1826),(1827,1827,1827),(1828,1828,1828),(1829,1829,1829),(1830,1830,1830),
+(1831,1831,1831),(1832,1832,1832),(1833,1833,1833),(1834,1834,1834),(1835,1835,1835),
+(1836,1836,1836),(1837,1837,1837),(1838,1838,1838),(1839,1839,1839),(1840,1840,1840),
+(1841,1841,1841),(1842,1842,1842),(1843,1843,1843),(1844,1844,1844),(1845,1845,1845),
+(1846,1846,1846),(1847,1847,1847),(1848,1848,1848),(1849,1849,1849),(1850,1850,1850),
+(1851,1851,1851),(1852,1852,1852),(1853,1853,1853),(1854,1854,1854),(1855,1855,1855),
+(1856,1856,1856),(1857,1857,1857),(1858,1858,1858),(1859,1859,1859),(1860,1860,1860),
+(1861,1861,1861),(1862,1862,1862),(1863,1863,1863),(1864,1864,1864),(1865,1865,1865),
+(1866,1866,1866),(1867,1867,1867),(1868,1868,1868),(1869,1869,1869),(1870,1870,1870),
+(1871,1871,1871),(1872,1872,1872),(1873,1873,1873),(1874,1874,1874),(1875,1875,1875),
+(1876,1876,1876),(1877,1877,1877),(1878,1878,1878),(1879,1879,1879),(1880,1880,1880),
+(1881,1881,1881),(1882,1882,1882),(1883,1883,1883),(1884,1884,1884),(1885,1885,1885),
+(1886,1886,1886),(1887,1887,1887),(1888,1888,1888),(1889,1889,1889),(1890,1890,1890),
+(1891,1891,1891),(1892,1892,1892),(1893,1893,1893),(1894,1894,1894),(1895,1895,1895),
+(1896,1896,1896),(1897,1897,1897),(1898,1898,1898),(1899,1899,1899),(1900,1900,1900),
+(1901,1901,1901),(1902,1902,1902),(1903,1903,1903),(1904,1904,1904),(1905,1905,1905),
+(1906,1906,1906),(1907,1907,1907),(1908,1908,1908),(1909,1909,1909),(1910,1910,1910),
+(1911,1911,1911),(1912,1912,1912),(1913,1913,1913),(1914,1914,1914),(1915,1915,1915),
+(1916,1916,1916),(1917,1917,1917),(1918,1918,1918),(1919,1919,1919),(1920,1920,1920),
+(1921,1921,1921),(1922,1922,1922),(1923,1923,1923),(1924,1924,1924),(1925,1925,1925),
+(1926,1926,1926),(1927,1927,1927),(1928,1928,1928),(1929,1929,1929),(1930,1930,1930),
+(1931,1931,1931),(1932,1932,1932),(1933,1933,1933),(1934,1934,1934),(1935,1935,1935),
+(1936,1936,1936),(1937,1937,1937),(1938,1938,1938),(1939,1939,1939),(1940,1940,1940),
+(1941,1941,1941),(1942,1942,1942),(1943,1943,1943),(1944,1944,1944),(1945,1945,1945),
+(1946,1946,1946),(1947,1947,1947),(1948,1948,1948),(1949,1949,1949),(1950,1950,1950),
+(1951,1951,1951),(1952,1952,1952),(1953,1953,1953),(1954,1954,1954),(1955,1955,1955),
+(1956,1956,1956),(1957,1957,1957),(1958,1958,1958),(1959,1959,1959),(1960,1960,1960),
+(1961,1961,1961),(1962,1962,1962),(1963,1963,1963),(1964,1964,1964),(1965,1965,1965),
+(1966,1966,1966),(1967,1967,1967),(1968,1968,1968),(1969,1969,1969),(1970,1970,1970),
+(1971,1971,1971),(1972,1972,1972),(1973,1973,1973),(1974,1974,1974),(1975,1975,1975),
+(1976,1976,1976),(1977,1977,1977),(1978,1978,1978),(1979,1979,1979),(1980,1980,1980),
+(1981,1981,1981),(1982,1982,1982),(1983,1983,1983),(1984,1984,1984),(1985,1985,1985),
+(1986,1986,1986),(1987,1987,1987),(1988,1988,1988),(1989,1989,1989),(1990,1990,1990),
+(1991,1991,1991),(1992,1992,1992),(1993,1993,1993),(1994,1994,1994),(1995,1995,1995),
+(1996,1996,1996),(1997,1997,1997),(1998,1998,1998),(1999,1999,1999);
+
+SELECT COUNT(*) FROM t1;
+
+
+#
+# Insert duplicate rows
+#
+--error 1062
+INSERT INTO t1 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
+
+select count(*) from t1;
+
+
+#
+# Test that select count(*) can see inserts made in the same transaction
+#
+begin;
+SELECT COUNT(*) FROM t1;
+INSERT INTO t1 VALUES
+(2001,2001,2001),(2002,2002,2002),(2003,2003,2003),(2004,2004,2004),(2005,2005,2005);
+SELECT COUNT(*) FROM t1;
+rollback;
+
+#
+# Insert duplicate rows, inside transaction
+# try to commit
+#
+begin;
+
+--error 1062
+INSERT INTO t1 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
+
+--error 1296
+commit;
+
+select * from t1 where pk1=1;
+select * from t1 where pk1=10;
+select count(*) from t1 where pk1 <= 10 order by pk1;
+select count(*) from t1;
+
+
+#
+# Insert duplicate rows, inside transaction
+# rollback
+#
+begin;
+
+--error 1062
+INSERT INTO t1 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
+
+rollback;
+
+select * from t1 where pk1=1;
+select * from t1 where pk1=10;
+select count(*) from t1 where pk1 <= 10 order by pk1;
+select count(*) from t1;
+
+
+#
+# Insert duplicate rows, inside transaction
+# then try to select, finally rollback
+#
+begin;
+
+--error 1062
+INSERT INTO t1 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
+--error 1296
+SELECT * FROM t1 WHERE pk1=10;
+
+rollback;
+
+select * from t1 where pk1=1;
+select * from t1 where pk1=10;
+select count(*) from t1 where pk1 <= 10 order by pk1;
+select count(*) from t1;
+
+
+#
+# Insert duplicate rows, inside transaction
+# then try to select, finally commit
+#
+begin;
+
+--error 1062
+INSERT INTO t1 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
+
+--error 1296
+SELECT * FROM t1 WHERE pk1=10;
+
+--error 1296
+SELECT * FROM t1 WHERE pk1=10;
+
+--error 1296
+commit;
+
+select * from t1 where pk1=1;
+select * from t1 where pk1=10;
+select count(*) from t1 where pk1 <= 10 order by pk1;
+select count(*) from t1;
+
+
+#
+# Insert duplicate rows, inside transaction
+# then try to do another insert
+#
+begin;
+
+--error 1062
+INSERT INTO t1 VALUES
+(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
+
+--error 1296
+INSERT INTO t1 values (4000, 40, 44);
+
+rollback;
+
+select * from t1 where pk1=1;
+select * from t1 where pk1=10;
+select count(*) from t1 where pk1 <= 10 order by pk1;
+select count(*) from t1;
+
+#
+# Insert duplicate rows using "insert .. select"
+
+#
+--error 1062
+insert into t1 select * from t1 where b < 10 order by pk1;
+
+DELETE FROM t1 WHERE pk1=2;
+
+begin;
+INSERT IGNORE INTO t1 VALUES(1,2,3),(2,3,4);
+select * from t1 where pk1 < 3 order by pk1;
+rollback;
+
+INSERT IGNORE INTO t1 VALUES(1,2,3),(2,3,4);
+select * from t1 where pk1 < 3 order by pk1;
+
+REPLACE INTO t1 values(1, 78, 3);
+select * from t1 where pk1=1;
+
+INSERT INTO t1 VALUES(1,1,1),(3,4,5) ON DUPLICATE KEY UPDATE b=79;
+select * from t1 where pk1 < 4 order by pk1;
+
+INSERT INTO t1 VALUES(1,1,1),(3,4,5) ON DUPLICATE KEY UPDATE b=pk1+c;
+select * from t1 where pk1 < 4 order by pk1;
+
+DELETE FROM t1 WHERE pk1 = 2 OR pk1 = 4 OR pk1 = 6;
+INSERT INTO t1 VALUES(1,1,1),(2,2,17),(3,4,5) ON DUPLICATE KEY UPDATE pk1=b;
+select * from t1 where pk1 = b and b != c order by pk1;
+
+# The following test case currently does not work
+#DELETE FROM t1;
+#CREATE UNIQUE INDEX bi ON t1(b);
+#INSERT INTO t1 VALUES
+#(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+#(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
+#INSERT INTO t1 VALUES(0,1,0),(21,21,21) ON DUPLICATE KEY UPDATE pk1=b+10,c=b+10;
+#select * from t1 order by pk1;
+
+DROP TABLE t1;
+
+#
+# Bug #6331: problem with 'insert ignore'
+#
+
+CREATE TABLE t1(a INT) ENGINE=ndb;
+INSERT IGNORE INTO t1 VALUES (1);
+INSERT IGNORE INTO t1 VALUES (1);
+INSERT IGNORE INTO t1 SELECT a FROM t1;
+INSERT IGNORE INTO t1 SELECT a FROM t1;
+INSERT IGNORE INTO t1 SELECT a FROM t1;
+INSERT IGNORE INTO t1 VALUES (1);
+INSERT IGNORE INTO t1 VALUES (1);
+SELECT * FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/t/ndb_limit.test b/mysql-test/t/ndb_limit.test
new file mode 100644
index 00000000000..c2d7a0ecfec
--- /dev/null
+++ b/mysql-test/t/ndb_limit.test
@@ -0,0 +1,82 @@
+-- source include/have_ndb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t2;
+--enable_warnings
+
+
+CREATE TABLE t2 (
+ a bigint unsigned NOT NULL PRIMARY KEY,
+ b int unsigned not null,
+ c int unsigned
+) engine=ndbcluster;
+
+
+#
+# insert records into table
+#
+let $1=1000;
+disable_query_log;
+while ($1)
+{
+ eval insert into t2 values($1*10, $1+9, 5*$1), ($1*10+1, $1+10, 7),($1*10+2, $1+10, 7*$1), ($1*10+3, $1+10, 10+$1), ($1*10+4, $1+10, 70*$1), ($1*10+5, $1+10, 7), ($1*10+6, $1+10, 9), ($1*10+7, $1+299, 899), ($1*10+8, $1+10, 12), ($1*10+9, $1+10, 14*$1);
+ dec $1;
+}
+enable_query_log;
+
+select count(*) from t2;
+
+delete from t2 limit 1;
+select count(*) from t2;
+
+delete from t2 limit 100;
+select count(*) from t2;
+
+delete from t2 limit 1000;
+select count(*) from t2;
+
+update t2 set c=12345678 limit 100;
+select count(*) from t2 where c=12345678;
+select count(*) from t2 where c=12345678 limit 1000;
+
+select * from t2 limit 0;
+
+drop table t2;
+
+CREATE TABLE `t2` (
+ `views` int(11) NOT NULL default '0',
+ `clicks` int(11) NOT NULL default '0',
+ `day` date NOT NULL default '0000-00-00',
+ `hour` tinyint(4) NOT NULL default '0',
+ `bannerid` smallint(6) NOT NULL default '0',
+ `zoneid` smallint(6) NOT NULL default '0',
+ `source` varchar(50) NOT NULL default '',
+ PRIMARY KEY (`day`,`hour`,`bannerid`,`zoneid`,`source`),
+ KEY `bannerid_day` (`bannerid`,`day`),
+ KEY `zoneid` (`zoneid`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+
+INSERT INTO `t2` VALUES
+( 1,0,'2004-09-17', 5,100,100,''),
+( 1,0,'2004-09-18', 7,100,100,''),
+( 17,0,'2004-09-27',20,132,100,''),
+( 4,0,'2004-09-16',23,132,100,''),
+( 86,0,'2004-09-18', 7,196,196,''),
+( 11,0,'2004-09-16',16,132,100,''),
+(140,0,'2004-09-18', 0,100,164,''),
+( 2,0,'2004-09-17', 7,132,100,''),
+(846,0,'2004-09-27',11,132,164,''),
+( 1,0,'2004-09-18', 8,132,100,''),
+( 22,0,'2004-09-27', 9,164,132,''),
+(711,0,'2004-09-27', 9,100,164,''),
+( 11,0,'2004-09-18', 0,196,132,''),
+( 41,0,'2004-09-27',15,196,132,''),
+( 57,0,'2004-09-18', 2,164,196,'');
+
+SELECT DATE_FORMAT(day, '%Y%m%d') as date, DATE_FORMAT(day, '%d-%m-%Y')
+as date_formatted FROM t2 GROUP BY day ORDER BY day DESC;
+
+SELECT DATE_FORMAT(day, '%Y%m%d') as date, DATE_FORMAT(day, '%d-%m-%Y')
+as date_formatted FROM t2 GROUP BY day ORDER BY day DESC LIMIT 2;
+
+drop table t2;
diff --git a/mysql-test/t/ndb_lock.test b/mysql-test/t/ndb_lock.test
new file mode 100644
index 00000000000..39a8655b972
--- /dev/null
+++ b/mysql-test/t/ndb_lock.test
@@ -0,0 +1,70 @@
+-- source include/have_ndb.inc
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
+--enable_warnings
+
+#
+# Transaction lock test to show that the NDB
+# table handler is working properly with
+# transaction locks
+#
+
+#
+# Testing of scan isolation
+#
+connection con1;
+create table t1 (x integer not null primary key, y varchar(32)) engine = ndb;
+insert into t1 values (1,'one'), (2,'two');
+select * from t1 order by x;
+
+connection con2;
+select * from t1 order by x;
+
+connection con1;
+start transaction;
+insert into t1 values (3,'three');
+select * from t1 order by x;
+
+connection con2;
+start transaction;
+select * from t1 order by x;
+
+connection con1;
+commit;
+
+connection con2;
+select * from t1 order by x;
+commit;
+
+drop table t1;
+
+###
+# Bug#6020
+create table t1 (pk integer not null primary key, u int not null, o int not null,
+ unique(u), key(o)) engine = ndb;
+insert into t1 values (1,1,1), (2,2,2), (3,3,3), (4,4,4), (5,5,5);
+
+lock tables t1 write;
+delete from t1 where pk = 1;
+unlock tables;
+select * from t1 order by pk;
+insert into t1 values (1,1,1);
+
+lock tables t1 write;
+delete from t1 where u = 1;
+unlock tables;
+select * from t1 order by pk;
+insert into t1 values (1,1,1);
+
+lock tables t1 write;
+delete from t1 where o = 1;
+unlock tables;
+select * from t1 order by pk;
+insert into t1 values (1,1,1);
+
+drop table t1;
+
diff --git a/mysql-test/t/ndb_minmax.test b/mysql-test/t/ndb_minmax.test
new file mode 100644
index 00000000000..3be193ce602
--- /dev/null
+++ b/mysql-test/t/ndb_minmax.test
@@ -0,0 +1,66 @@
+-- source include/have_ndb.inc
+
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+
+CREATE TABLE t1 (
+ a int PRIMARY KEY
+) engine = ndb;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+INSERT INTO t1 VALUES (6);
+
+select MAX(a) from t1;
+select MAX(a) from t1;
+select MAX(a) from t1;
+select MAX(a) from t1;
+select MIN(a) from t1;
+select MIN(a) from t1;
+select MIN(a) from t1;
+select * from t1 order by a;
+select MIN(a) from t1;
+select MAX(a) from t1;
+select MAX(a) from t1;
+select * from t1 order by a;
+drop table t1;
+
+
+CREATE TABLE t2 (
+ a int PRIMARY KEY,
+ b int not null,
+ c int not null,
+ KEY(b),
+ UNIQUE(c)
+) engine = ndb;
+
+INSERT INTO t2 VALUES (1, 5, 1);
+INSERT INTO t2 VALUES (2, 2, 7);
+INSERT INTO t2 VALUES (3, 3, 3);
+INSERT INTO t2 VALUES (4, 4, 4);
+INSERT INTO t2 VALUES (5, 5, 5);
+INSERT INTO t2 VALUES (6, 6, 6);
+INSERT INTO t2 VALUES (7, 2, 10);
+INSERT INTO t2 VALUES (8, 10, 2);
+
+
+select MAX(a) from t2;
+select MAX(b) from t2;
+select MAX(c) from t2;
+select MIN(a) from t2;
+select MIN(b) from t2;
+select MIN(c) from t2;
+select * from t2 order by a;
+select MIN(b) from t2;
+select MAX(a) from t2;
+select MAX(c) from t2;
+select * from t2 order by a;
+drop table t2;
+
+
+
+
diff --git a/mysql-test/t/ndb_replace.test b/mysql-test/t/ndb_replace.test
new file mode 100644
index 00000000000..59454b5a9fa
--- /dev/null
+++ b/mysql-test/t/ndb_replace.test
@@ -0,0 +1,27 @@
+-- source include/have_ndb.inc
+
+#
+# Test of REPLACE with NDB
+#
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+CREATE TABLE t1 (
+ gesuchnr int(11) DEFAULT '0' NOT NULL,
+ benutzer_id int(11) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (gesuchnr,benutzer_id)
+) engine=ndbcluster;
+
+replace into t1 (gesuchnr,benutzer_id) values (2,1);
+replace into t1 (gesuchnr,benutzer_id) values (1,1);
+replace into t1 (gesuchnr,benutzer_id) values (1,1);
+insert into t1 (gesuchnr, benutzer_id) value (3,2);
+replace into t1 (gesuchnr,benutzer_id) values (1,1);
+replace into t1 (gesuchnr,benutzer_id) values (1,1);
+--error 1062
+insert into t1 (gesuchnr,benutzer_id) values (1,1);
+replace into t1 (gesuchnr,benutzer_id) values (1,1);
+select * from t1 order by gesuchnr;
+drop table t1;
diff --git a/mysql-test/t/ndb_subquery.test b/mysql-test/t/ndb_subquery.test
new file mode 100644
index 00000000000..cebc1920eaa
--- /dev/null
+++ b/mysql-test/t/ndb_subquery.test
@@ -0,0 +1,38 @@
+-- source include/have_ndb.inc
+
+--disable_warnings
+drop table if exists t1;
+drop table if exists t2;
+--enable_warnings
+
+##########
+# bug#5367
+create table t1 (p int not null primary key, u int not null, o int not null,
+unique (u), key(o)) engine=ndb;
+
+create table t2 (p int not null primary key, u int not null, o int not null,
+unique (u), key(o)) engine=ndb;
+
+insert into t1 values (1,1,1),(2,2,2),(3,3,3);
+insert into t2 values (1,1,1),(2,2,2),(3,3,3), (4,4,4), (5,5,5);
+
+# Use pk
+explain select * from t2 where p NOT IN (select p from t1);
+select * from t2 where p NOT IN (select p from t1) order by p;
+
+# Use unique index
+explain select * from t2 where p NOT IN (select u from t1);
+select * from t2 where p NOT IN (select u from t1) order by p;
+
+# Use ordered index
+explain select * from t2 where p NOT IN (select o from t1);
+select * from t2 where p NOT IN (select o from t1) order by p;
+
+# Use scan
+explain select * from t2 where p NOT IN (select p+0 from t1);
+select * from t2 where p NOT IN (select p+0 from t1) order by p;
+
+drop table t1;
+drop table t2;
+# bug#5367
+##########
diff --git a/mysql-test/t/ndb_transaction.test b/mysql-test/t/ndb_transaction.test
new file mode 100644
index 00000000000..f8ed22207ea
--- /dev/null
+++ b/mysql-test/t/ndb_transaction.test
@@ -0,0 +1,297 @@
+-- source include/have_ndb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
+drop database if exists mysqltest;
+--enable_warnings
+
+#
+# Transactionc test to show that the NDB
+# table handler is working properly with
+# transactions
+#
+
+#
+# Create a normal table with primary key
+#
+CREATE TABLE t1 (
+ pk1 INT NOT NULL PRIMARY KEY,
+ attr1 INT NOT NULL
+) ENGINE=ndbcluster;
+
+# insert
+begin;
+insert into t1 values(1,1);
+insert into t1 values(2,2);
+select count(*) from t1;
+select * from t1 where pk1 = 1;
+select t1.attr1 from t1, t1 as t1x where t1.pk1 = t1x.pk1 + 1;
+rollback;
+
+select count(*) from t1;
+select * from t1 where pk1 = 1;
+select t1.attr1 from t1, t1 as t1x where t1.pk1 = t1x.pk1 + 1;
+
+begin;
+insert into t1 values(1,1);
+insert into t1 values(2,2);
+commit;
+
+select count(*) from t1;
+select * from t1 where pk1 = 1;
+select t1.attr1 from t1, t1 as t1x where t1.pk1 = t1x.pk1 + 1;
+
+# update
+begin;
+update t1 set attr1 = attr1 * 2;
+select count(*) from t1;
+select * from t1 where pk1 = 1;
+select * from t1, t1 as t1x where t1x.attr1 = t1.attr1 - 2;
+rollback;
+
+select count(*) from t1;
+select * from t1 where pk1 = 1;
+select * from t1, t1 as t1x where t1x.attr1 = t1.attr1 - 2;
+
+begin;
+update t1 set attr1 = attr1 * 2;
+commit;
+
+select count(*) from t1;
+select * from t1 where pk1 = 1;
+select * from t1, t1 as t1x where t1x.attr1 = t1.attr1 - 2;
+
+# delete
+begin;
+delete from t1 where attr1 = 2;
+select count(*) from t1;
+select * from t1 where pk1 = 1;
+select * from t1, t1 as t1x where t1x.attr1 = t1.attr1 - 2;
+rollback;
+
+select count(*) from t1;
+select * from t1 where pk1 = 1;
+select * from t1, t1 as t1x where t1x.attr1 = t1.attr1 - 2;
+
+begin;
+delete from t1 where attr1 = 2;
+commit;
+
+select count(*) from t1;
+select * from t1 where pk1 = 1;
+select * from t1, t1 as t1x where t1x.attr1 = t1.attr1 - 2;
+
+DROP TABLE t1;
+
+#
+# Create table without primary key
+# a hidden primary key column is created by handler
+#
+CREATE TABLE t1 (id INT, id2 int) engine=ndbcluster;
+
+# insert
+begin;
+insert into t1 values(1,1);
+insert into t1 values(2,2);
+select sum(id) from t1;
+select * from t1 where id = 1;
+select t1.id from t1, t1 as t1x where t1.id2 = t1x.id2 + 1;
+rollback;
+
+select sum(id) from t1;
+select * from t1 where id = 1;
+select t1.id from t1, t1 as t1x where t1.id2 = t1x.id2 + 1;
+
+begin;
+insert into t1 values(1,1);
+insert into t1 values(2,2);
+commit;
+
+select sum(id) from t1;
+select * from t1 where id = 1;
+select t1.id from t1, t1 as t1x where t1.id2 = t1x.id2 + 1;
+
+# update
+begin;
+update t1 set id = id * 2;
+select sum(id) from t1;
+select * from t1 where id = 2;
+select * from t1, t1 as t1x where t1x.id = t1.id - 2;
+rollback;
+
+select sum(id) from t1;
+select * from t1 where id = 2;
+select * from t1, t1 as t1x where t1x.id = t1.id - 2;
+
+begin;
+update t1 set id = id * 2;
+commit;
+
+select sum(id) from t1;
+select * from t1 where id = 2;
+select * from t1, t1 as t1x where t1x.id = t1.id - 2;
+
+# delete
+
+DROP TABLE t1;
+
+#
+# A more extensive test with a lot more records
+#
+
+CREATE TABLE t2 (
+ a bigint unsigned NOT NULL PRIMARY KEY,
+ b int unsigned not null,
+ c int unsigned
+) engine=ndbcluster;
+
+CREATE TABLE t3 (
+ a bigint unsigned NOT NULL,
+ b bigint unsigned not null,
+ c bigint unsigned,
+ PRIMARY KEY(a)
+) engine=ndbcluster;
+
+CREATE TABLE t4 (
+ a bigint unsigned NOT NULL,
+ b bigint unsigned not null,
+ c bigint unsigned NOT NULL,
+ d int unsigned,
+ PRIMARY KEY(a, b, c)
+) engine=ndbcluster;
+
+
+#
+# insert records into tables and rollback
+#
+let $1=100;
+disable_query_log;
+begin;
+while ($1)
+{
+ eval insert into t2 values($1, $1+9, 5);
+ eval insert into t3 values($1, $1+9, 5);
+ eval insert into t4 values($1, $1+9, 5, $1+26000);
+ dec $1;
+}
+rollback;
+enable_query_log;
+
+select count(*) from t2;
+select count(*) from t3;
+select count(*) from t4;
+
+#
+# insert records into tables and commit;
+#
+let $1=100;
+disable_query_log;
+begin;
+while ($1)
+{
+ eval insert into t2 values($1, $1+9, 5);
+ eval insert into t3 values($1, $1+9, 5);
+ eval insert into t4 values($1, $1+9, 5, $1+26000);
+ dec $1;
+}
+commit;
+enable_query_log;
+
+select count(*) from t2;
+select count(*) from t3;
+select count(*) from t4;
+
+#
+# delete every other record in the tables
+#
+let $1=100;
+disable_query_log;
+while ($1)
+{
+ eval delete from t2 where a=$1;
+ eval delete from t3 where a=$1;
+ eval delete from t4 where a=$1 and b=$1+9 and c=5;
+ dec $1;
+ dec $1;
+}
+enable_query_log;
+
+#
+# update records and rollback
+#
+begin;
+let $1=100;
+disable_query_log;
+while ($1)
+{
+ eval update t2 set c=$1 where a=$1;
+ eval update t3 set c=7 where a=$1 and b=$1+9 and c=5;
+ eval update t4 set d=$1+21987 where a=$1 and b=$1+9 and c=5;
+ dec $1;
+ dec $1;
+}
+rollback;
+enable_query_log;
+
+#
+# update records and commit
+#
+begin;
+let $1=100;
+disable_query_log;
+while ($1)
+{
+ eval update t2 set c=$1 where a=$1;
+ eval update t3 set c=7 where a=$1 and b=$1+9 and c=5;
+ eval update t4 set d=$1+21987 where a=$1 and b=$1+9 and c=5;
+ dec $1;
+ dec $1;
+}
+rollback;
+enable_query_log;
+
+drop table t2;
+drop table t3;
+drop table t4;
+
+#
+# Test multiple databases in one transaction
+#
+
+CREATE TABLE t1 (
+ pk1 INT NOT NULL PRIMARY KEY,
+ attr1 INT NOT NULL
+) ENGINE=ndbcluster;
+
+create database mysqltest;
+use mysqltest;
+
+CREATE TABLE t2 (
+ a bigint unsigned NOT NULL PRIMARY KEY,
+ b int unsigned not null,
+ c int unsigned
+) engine=ndbcluster;
+
+begin;
+insert into test.t1 values(1,1);
+insert into t2 values(1,1,1);
+insert into test.t1 values(2,2);
+insert into t2 values(2,2,2);
+select count(*) from test.t1;
+select count(*) from t2;
+select * from test.t1 where pk1 = 1;
+select * from t2 where a = 1;
+select test.t1.attr1
+from test.t1, test.t1 as t1x where test.t1.pk1 = t1x.pk1 + 1;
+select t2.a
+from t2, t2 as t2x where t2.a = t2x.a + 1;
+select test.t1.pk1, a from test.t1,t2 where b > test.t1.attr1;
+rollback;
+
+select count(*) from test.t1;
+select count(*) from t2;
+
+drop table test.t1, t2;
+drop database mysqltest;
+
+
diff --git a/mysql-test/t/ndb_truncate.test b/mysql-test/t/ndb_truncate.test
new file mode 100644
index 00000000000..63bb8cbefb6
--- /dev/null
+++ b/mysql-test/t/ndb_truncate.test
@@ -0,0 +1,33 @@
+-- source include/have_ndb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t2;
+--enable_warnings
+
+
+CREATE TABLE t2 (
+ a bigint unsigned NOT NULL PRIMARY KEY,
+ b int unsigned not null,
+ c int unsigned
+) engine=ndbcluster;
+
+
+#
+# insert records into table
+#
+let $1=500;
+disable_query_log;
+while ($1)
+{
+ eval insert into t2 values($1*10, $1+9, 5*$1), ($1*10+1, $1+10, 7),($1*10+2, $1+10, 7*$1), ($1*10+3, $1+10, 10+$1), ($1*10+4, $1+10, 70*$1), ($1*10+5, $1+10, 7), ($1*10+6, $1+10, 9), ($1*10+7, $1+299, 899), ($1*10+8, $1+10, 12), ($1*10+9, $1+10, 14*$1);
+ dec $1;
+}
+enable_query_log;
+
+select count(*) from t2;
+
+truncate table t2;
+
+select count(*) from t2;
+
+drop table t2;
diff --git a/mysql-test/t/ndb_types.test b/mysql-test/t/ndb_types.test
new file mode 100644
index 00000000000..d9f50c8b3fc
--- /dev/null
+++ b/mysql-test/t/ndb_types.test
@@ -0,0 +1,47 @@
+-- source include/have_ndb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+#
+# Test creation of different column types in NDB
+#
+
+CREATE TABLE t1 (
+ auto int(5) unsigned NOT NULL auto_increment,
+ string char(10) default "hello",
+ tiny tinyint(4) DEFAULT '0' NOT NULL ,
+ short smallint(6) DEFAULT '1' NOT NULL ,
+ medium mediumint(8) DEFAULT '0' NOT NULL,
+ long_int int(11) DEFAULT '0' NOT NULL,
+ longlong bigint(13) DEFAULT '0' NOT NULL,
+ real_float float(13,1) DEFAULT 0.0 NOT NULL,
+ real_double double(16,4),
+ utiny tinyint(3) unsigned DEFAULT '0' NOT NULL,
+ ushort smallint(5) unsigned zerofill DEFAULT '00000' NOT NULL,
+ umedium mediumint(8) unsigned DEFAULT '0' NOT NULL,
+ ulong int(11) unsigned DEFAULT '0' NOT NULL,
+ ulonglong bigint(13) unsigned DEFAULT '0' NOT NULL,
+ time_stamp timestamp,
+ date_field date,
+ time_field time,
+ date_time datetime,
+ options enum('one','two','tree') not null,
+ flags set('one','two','tree') not null,
+ PRIMARY KEY (auto),
+ KEY (utiny),
+ KEY (tiny),
+ KEY (short),
+ KEY any_name (medium),
+ KEY (longlong),
+ KEY (real_float),
+ KEY (ushort),
+ KEY (umedium),
+ KEY (ulong),
+ KEY (ulonglong,ulong),
+ KEY (options,flags)
+);
+
+
+drop table t1;
diff --git a/mysql-test/t/ndb_update.test b/mysql-test/t/ndb_update.test
new file mode 100644
index 00000000000..3b0e84e2344
--- /dev/null
+++ b/mysql-test/t/ndb_update.test
@@ -0,0 +1,22 @@
+-- source include/have_ndb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+#
+# Basic test of INSERT in NDB
+#
+
+#
+# Create a normal table with primary key
+#
+CREATE TABLE t1 (
+ pk1 INT NOT NULL PRIMARY KEY,
+ b INT NOT NULL,
+ c INT NOT NULL
+) ENGINE=ndbcluster;
+
+INSERT INTO t1 VALUES (0, 0, 1),(1,1,2),(2,2,3);
+UPDATE t1 set b = c;
+select * from t1 order by pk1;
diff --git a/mysql-test/t/negation_elimination.test b/mysql-test/t/negation_elimination.test
new file mode 100644
index 00000000000..c50a9678edb
--- /dev/null
+++ b/mysql-test/t/negation_elimination.test
@@ -0,0 +1,72 @@
+#
+# Test negation elimination
+#
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+create table t1 (a int, key (a));
+insert into t1 values (NULL), (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+(10), (11), (12), (13), (14), (15), (16), (17), (18), (19);
+
+explain select * from t1 where not(not(a));
+select * from t1 where not(not(a));
+explain select * from t1 where not(not(not(a > 10)));
+select * from t1 where not(not(not(a > 10)));
+explain select * from t1 where not(not(not(a < 5) and not(a > 10)));
+select * from t1 where not(not(not(a < 5) and not(a > 10)));
+explain select * from t1 where not(a = 10);
+select * from t1 where not(a = 10);
+explain select * from t1 where not(a != 10);
+select * from t1 where not(a != 1);
+explain select * from t1 where not(a < 10);
+select * from t1 where not(a < 10);
+explain select * from t1 where not(a >= 10);
+select * from t1 where not(a >= 10);
+explain select * from t1 where not(a > 10);
+select * from t1 where not(a > 10);
+explain select * from t1 where not(a <= 10);
+select * from t1 where not(a <= 10);
+explain select * from t1 where not(a is null);
+select * from t1 where not(a is null);
+explain select * from t1 where not(a is not null);
+select * from t1 where not(a is not null);
+explain select * from t1 where not(a < 5 or a > 15);
+select * from t1 where not(a < 5 or a > 15);
+explain select * from t1 where not(a < 15 and a > 5);
+select * from t1 where not(a < 15 and a > 5);
+
+explain select * from t1 where a = 2 or not(a < 10);
+select * from t1 where a = 2 or not(a < 10);
+explain select * from t1 where a > 5 and not(a > 10);
+select * from t1 where a > 5 and not(a > 10);
+explain select * from t1 where a > 5 xor a < 10;
+select * from t1 where a > 5 xor a < 10;
+
+explain select * from t1 where a = 2 or not(a < 5 or a > 15);
+select * from t1 where a = 2 or not(a < 5 or a > 15);
+explain select * from t1 where a = 7 or not(a < 15 and a > 5);
+select * from t1 where a = 7 or not(a < 15 and a > 5);
+
+explain select * from t1 where NULL or not(a < 15 and a > 5);
+select * from t1 where NULL or not(a < 15 and a > 5);
+explain select * from t1 where not(NULL and a > 5);
+select * from t1 where not(NULL and a > 5);
+explain select * from t1 where not(NULL or a);
+select * from t1 where not(NULL or a);
+explain select * from t1 where not(NULL and a);
+select * from t1 where not(NULL and a);
+
+explain select * from t1 where not((a < 5 or a < 10) and (not(a > 16) or a > 17));
+select * from t1 where not((a < 5 or a < 10) and (not(a > 16) or a > 17));
+explain select * from t1 where not((a < 5 and a < 10) and (not(a > 16) or a > 17));
+select * from t1 where not((a < 5 and a < 10) and (not(a > 16) or a > 17));
+explain select * from t1 where ((a between 5 and 15) and (not(a like 10)));
+select * from t1 where ((a between 5 and 15) and (not(a like 10)));
+
+delete from t1 where a > 3;
+select a, not(not(a)) from t1;
+explain extended select a, not(not(a)), not(a <= 2 and not(a)), not(a not like "1"), not (a not in (1,2)), not(a != 2) from t1 where not(not(a)) having not(not(a));
+
+drop table t1;
diff --git a/mysql-test/t/null.test b/mysql-test/t/null.test
index fc9b0a8aff2..9ddef252d67 100644
--- a/mysql-test/t/null.test
+++ b/mysql-test/t/null.test
@@ -1,8 +1,14 @@
+# Initialise
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
#
# Testing of NULL in a lot of different places
#
select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnull(null,1),ifnull(null,"TRUE"),ifnull("TRUE","ERROR"),1/0 is null,1 is not null;
+explain extended select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnull(null,1),ifnull(null,"TRUE"),ifnull("TRUE","ERROR"),1/0 is null,1 is not null;
select 1 | NULL,1 & NULL,1+NULL,1-NULL;
select NULL=NULL,NULL<>NULL,IFNULL(NULL,1.1)+0,IFNULL(NULL,1) | 0;
select strcmp("a",NULL),(1<NULL)+0.0,NULL regexp "a",null like "a%","a%" like null;
@@ -10,12 +16,13 @@ select concat("a",NULL),replace(NULL,"a","b"),replace("string","i",NULL),replace
select repeat("a",0),repeat("ab",5+5),repeat("ab",-1),reverse(NULL);
select field(NULL,"a","b","c");
select 2 between null and 1,2 between 3 AND NULL,NULL between 1 and 2,2 between NULL and 3, 2 between 1 AND null;
+explain extended select 2 between null and 1,2 between 3 AND NULL,NULL between 1 and 2,2 between NULL and 3, 2 between 1 AND null;
SELECT NULL AND NULL, 1 AND NULL, NULL AND 1, NULL OR NULL, 0 OR NULL, NULL OR 0;
SELECT (NULL OR NULL) IS NULL;
select NULL AND 0, 0 and NULL;
select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),inet_aton("122.226."),inet_aton("");
+explain extended select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),inet_aton("122.226."),inet_aton("");
-drop table if exists t1;
create table t1 (x int);
insert into t1 values (null);
select * from t1 where x != 0;
@@ -38,7 +45,7 @@ DROP TABLE t1;
#
# Testing of IFNULL
#
-create table t1 (a int, b int) type=myisam;
+create table t1 (a int, b int) engine=myisam;
insert into t1 values(20,null);
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
t2.b=t3.a;
@@ -79,26 +86,103 @@ INSERT INTO t1 (d) values (null),(null);
select * from t1;
drop table t1;
-# Test case for bug #4256
-
-CREATE TABLE t1(i int, KEY(i));
-
-INSERT INTO t1 VALUES(1);
+#
+# Test to check elimination of IS NULL predicate for a non-nullable attribute
+# (bug #1990)
+#
+create table t1 (a int not null, b int not null, index idx(a));
+insert into t1 values
+ (1,1), (2,2), (3,3), (4,4), (5,5), (6,6),
+ (7,7), (8,8), (9,9), (10,10), (11,11), (12,12);
+explain select * from t1 where a between 2 and 3;
+explain select * from t1 where a between 2 and 3 or b is null;
+drop table t1;
+select cast(NULL as signed);
-INSERT INTO t1 SELECT i*2 FROM t1;
-INSERT INTO t1 SELECT i*2 FROM t1;
-INSERT INTO t1 SELECT i*2 FROM t1;
-INSERT INTO t1 SELECT i*2 FROM t1;
-INSERT INTO t1 SELECT i*2 FROM t1;
-INSERT INTO t1 SELECT i*2 FROM t1;
-INSERT INTO t1 SELECT i*2 FROM t1;
-INSERT INTO t1 SELECT i*2 FROM t1;
-INSERT INTO t1 SELECT i*2 FROM t1;
+#
+# Test case for bug #4256
+#
-EXPLAIN SELECT * FROM t1 WHERE i=2 OR i IS NULL;
+create table t1(i int, key(i));
+insert into t1 values(1);
+insert into t1 select i*2 from t1;
+insert into t1 select i*2 from t1;
+insert into t1 select i*2 from t1;
+insert into t1 select i*2 from t1;
+insert into t1 select i*2 from t1;
+insert into t1 select i*2 from t1;
+insert into t1 select i*2 from t1;
+insert into t1 select i*2 from t1;
+insert into t1 select i*2 from t1;
+explain select * from t1 where i=2 or i is null;
+alter table t1 change i i int not null;
+explain select * from t1 where i=2 or i is null;
+drop table t1;
-ALTER TABLE t1 CHANGE i i int NOT NULL;
+#
+# NULL has its own type BINARY(0) by default.
+# But NULL should be weaker than a constant
+# when mixing charsets/collations
+#
+set names latin2;
+# Check that result type is taken from a non-null string
+create table t1 select
+ null as c00,
+ if(1, null, 'string') as c01,
+ if(0, null, 'string') as c02,
+ ifnull(null, 'string') as c03,
+ ifnull('string', null) as c04,
+ case when 0 then null else 'string' end as c05,
+ case when 1 then null else 'string' end as c06,
+ coalesce(null, 'string') as c07,
+ coalesce('string', null) as c08,
+ least('string',null) as c09,
+ least(null, 'string') as c10,
+ greatest('string',null) as c11,
+ greatest(null, 'string') as c12,
+ nullif('string', null) as c13,
+ nullif(null, 'string') as c14,
+ trim('string' from null) as c15,
+ trim(null from 'string') as c16,
+ substring_index('string', null, 1) as c17,
+ substring_index(null, 'string', 1) as c18,
+ elt(1, null, 'string') as c19,
+ elt(1, 'string', null) as c20,
+ concat('string', null) as c21,
+ concat(null, 'string') as c22,
+ concat_ws('sep', 'string', null) as c23,
+ concat_ws('sep', null, 'string') as c24,
+ concat_ws(null, 'string', 'string') as c25,
+ make_set(3, 'string', null) as c26,
+ make_set(3, null, 'string') as c27,
+ export_set(3, null, 'off', 'sep') as c29,
+ export_set(3, 'on', null, 'sep') as c30,
+ export_set(3, 'on', 'off', null) as c31,
+ replace(null, 'from', 'to') as c32,
+ replace('str', null, 'to') as c33,
+ replace('str', 'from', null) as c34,
+ insert('str', 1, 2, null) as c35,
+ insert(null, 1, 2, 'str') as c36,
+ lpad('str', 10, null) as c37,
+ rpad(null, 10, 'str') as c38;
+
+show create table t1;
+drop table t1;
-EXPLAIN SELECT * FROM t1 WHERE i=2 OR i IS NULL;
+#
+# Check that comparison is done according to
+# non-null string collation, i.e. case insensitively,
+# rather than according to NULL's collation, i.e. case sensitively
+#
+-- in field
+select
+ case 'str' when 'STR' then 'str' when null then 'null' end as c01,
+ case 'str' when null then 'null' when 'STR' then 'str' end as c02,
+ field(null, 'str1', 'str2') as c03,
+ field('str1','STR1', null) as c04,
+ field('str1', null, 'STR1') as c05,
+ 'string' in ('STRING', null) as c08,
+ 'string' in (null, 'STRING') as c09;
-DROP TABLE t1;
+# Restore charset to the default value.
+set names latin1;
diff --git a/mysql-test/t/null_key.test b/mysql-test/t/null_key.test
index b1cbd5cdfb0..9b346a181bf 100644
--- a/mysql-test/t/null_key.test
+++ b/mysql-test/t/null_key.test
@@ -1,8 +1,11 @@
#
# Check null keys
-drop table if exists t1;
-create table t1 (a int, b int not null,unique key (a,b),index(b)) type=myisam;
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
+create table t1 (a int, b int not null,unique key (a,b),index(b)) engine=myisam;
insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6);
explain select * from t1 where a is null;
explain select * from t1 where a is null and b = 2;
@@ -11,6 +14,7 @@ explain select * from t1 where a=2 and b = 2;
explain select * from t1 where a<=>b limit 2;
explain select * from t1 where (a is null or a > 0 and a < 3) and b < 5 limit 3;
explain select * from t1 where (a is null or a = 7) and b=7;
+explain select * from t1 where (a is null or a = 7) and b=7 order by a;
explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
explain select * from t1 where a > 1 and a < 3 limit 1;
@@ -22,6 +26,8 @@ select * from t1 where (a is null or a > 0 and a < 3) and b < 5 limit 3;
select * from t1 where (a is null or a > 0 and a < 3) and b > 7 limit 3;
select * from t1 where (a is null or a = 7) and b=7;
select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
+create table t2 like t1;
+insert into t2 select * from t1;
alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10));
explain select * from t1 where a is null and b = 2;
explain select * from t1 where a is null and b = 2 and c=0;
@@ -44,26 +50,55 @@ select * from t1 where (a is null or a > 0 and a < 3) and b > 7 limit 3;
select * from t1 where (a is null or a = 7) and b=7 and c=0;
select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
select * from t1 where b like "6%";
-drop table t1;
+#
+# Test ref_or_null optimization
+#
+drop table t1;
+rename table t2 to t1;
+alter table t1 modify b int null;
+insert into t1 values (7,null), (8,null), (8,7);
+explain select * from t1 where a = 7 and (b=7 or b is null);
+select * from t1 where a = 7 and (b=7 or b is null);
+explain select * from t1 where (a = 7 or a is null) and (b=7 or b is null);
+select * from t1 where (a = 7 or a is null) and (b=7 or b is null);
+explain select * from t1 where (a = 7 or a is null) and (a = 7 or a is null);
+select * from t1 where (a = 7 or a is null) and (a = 7 or a is null);
+create table t2 (a int);
+insert into t2 values (7),(8);
+explain select * from t2 straight_join t1 where t1.a=t2.a and b is null;
+drop index b on t1;
+explain select * from t2,t1 where t1.a=t2.a and b is null;
+select * from t2,t1 where t1.a=t2.a and b is null;
+explain select * from t2,t1 where t1.a=t2.a and (b= 7 or b is null);
+select * from t2,t1 where t1.a=t2.a and (b= 7 or b is null);
+explain select * from t2,t1 where (t1.a=t2.a or t1.a is null) and b= 7;
+select * from t2,t1 where (t1.a=t2.a or t1.a is null) and b= 7;
+explain select * from t2,t1 where (t1.a=t2.a or t1.a is null) and (b= 7 or b is null);
+select * from t2,t1 where (t1.a=t2.a or t1.a is null) and (b= 7 or b is null);
+insert into t2 values (null),(6);
+delete from t1 where a=8;
+explain select * from t2,t1 where t1.a=t2.a or t1.a is null;
+explain select * from t2,t1 where t1.a<=>t2.a or (t1.a is null and t1.b <> 9);
+select * from t2,t1 where t1.a<=>t2.a or (t1.a is null and t1.b <> 9);
+drop table t1,t2;
#
# The following failed for Matt Loschert
#
-DROP TABLE IF EXISTS t1,t2;
CREATE TABLE t1 (
id int(10) unsigned NOT NULL auto_increment,
uniq_id int(10) unsigned default NULL,
PRIMARY KEY (id),
UNIQUE KEY idx1 (uniq_id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
CREATE TABLE t2 (
id int(10) unsigned NOT NULL auto_increment,
uniq_id int(10) unsigned default NULL,
PRIMARY KEY (id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL);
INSERT INTO t2 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL);
@@ -101,13 +136,13 @@ CREATE TABLE `t1` (
`product_id` char(32) NOT NULL default '',
`product_type` int(11) NOT NULL default '0',
PRIMARY KEY (`order_id`,`product_id`,`product_type`)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
CREATE TABLE `t2` (
`order_id` char(32) NOT NULL default '',
`product_id` char(32) NOT NULL default '',
`product_type` int(11) NOT NULL default '0',
PRIMARY KEY (`order_id`,`product_id`,`product_type`)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 (order_id, product_id, product_type) VALUES
('3d7ce39b5d4b3e3d22aaafe9b633de51',1206029, 3),
('3d7ce39b5d4b3e3d22aaafe9b633de51',5880836, 3),
diff --git a/mysql-test/t/odbc.test b/mysql-test/t/odbc.test
index 3e0fc214d3e..9aac5948359 100644
--- a/mysql-test/t/odbc.test
+++ b/mysql-test/t/odbc.test
@@ -1,3 +1,8 @@
+# Initialise
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
#
# Test some ODBC compatibility
#
@@ -8,7 +13,6 @@ select {fn length("hello")}, { date "1997-10-20" };
# Test retreiving row with last insert_id value.
#
-drop table if exists t1;
create table t1 (a int not null auto_increment,b int not null,primary key (a,b));
insert into t1 SET A=NULL,B=1;
insert into t1 SET a=null,b=2;
diff --git a/mysql-test/t/olap.test b/mysql-test/t/olap.test
index 8fe547db615..674b4ade097 100644
--- a/mysql-test/t/olap.test
+++ b/mysql-test/t/olap.test
@@ -1,27 +1,127 @@
-drop table if exists sales;
-create table sales ( product varchar(32), country varchar(32), year int, profit int);
-insert into sales values ( 'Computer', 'India',2000, 1200),
-( 'TV', 'United States', 1999, 150),
-( 'Calculator', 'United States', 1999,50),
-( 'Computer', 'United States', 1999,1500),
-( 'Computer', 'United States', 2000,1500),
-( 'TV', 'United States', 2000, 150),
-( 'TV', 'India', 2000, 100),
-( 'TV', 'India', 2000, 100),
-( 'Calculator', 'United States', 2000,75),
-( 'Calculator', 'India', 2000,75),
-( 'TV', 'India', 1999, 100),
-( 'Computer', 'India', 1999,1200),
-( 'Computer', 'United States', 2000,1500),
-( 'Calculator', 'United States', 2000,75);
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
+create table t1 (product varchar(32), country_id int not null, year int, profit int);
+insert into t1 values ( 'Computer', 2,2000, 1200),
+( 'TV', 1, 1999, 150),
+( 'Calculator', 1, 1999,50),
+( 'Computer', 1, 1999,1500),
+( 'Computer', 1, 2000,1500),
+( 'TV', 1, 2000, 150),
+( 'TV', 2, 2000, 100),
+( 'TV', 2, 2000, 100),
+( 'Calculator', 1, 2000,75),
+( 'Calculator', 2, 2000,75),
+( 'TV', 1, 1999, 100),
+( 'Computer', 1, 1999,1200),
+( 'Computer', 2, 2000,1500),
+( 'Calculator', 2, 2000,75),
+( 'Phone', 3, 2003,10)
+;
+
+create table t2 (country_id int primary key, country char(20) not null);
+insert into t2 values (1, 'USA'),(2,'India'), (3,'Finland');
+
+# First simple rollups, with just grand total
+select product, sum(profit) from t1 group by product;
+select product, sum(profit) from t1 group by product with rollup;
+select product, sum(profit) from t1 group by 1 with rollup;
+select product, sum(profit),avg(profit) from t1 group by product with rollup;
+
+# Sub totals
+select product, country_id , year, sum(profit) from t1 group by product, country_id, year;
+select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup;
+explain extended select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup;
+select product, country_id , sum(profit) from t1 group by product desc, country_id with rollup;
+
+# limit
+select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup limit 5;
+select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup limit 3,3;
+
+select product, country_id, count(*), count(distinct year) from t1 group by product, country_id;
+select product, country_id, count(*), count(distinct year) from t1 group by product, country_id with rollup;
+
+# Test of having
+select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup having country_id = 1;
+select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup having sum(profit) > 200;
+select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup having sum(profit) > 7000;
+
+# Functions
+select concat(product,':',country_id) as 'prod', concat(":",year,":") as 'year',1+1, sum(profit)/count(*) from t1 group by 1,2 with rollup;
+select product, sum(profit)/count(*) from t1 group by product with rollup;
+select left(product,4) as prod, sum(profit)/count(*) from t1 group by prod with rollup;
+select concat(product,':',country_id), 1+1, sum(profit)/count(*) from t1 group by concat(product,':',country_id) with rollup;
+
+# Joins
+select product, country , year, sum(profit) from t1,t2 where t1.country_id=t2.country_id group by product, country, year with rollup;
+
+# Derived tables and sub selects
+select product, `sum` from (select product, sum(profit) as 'sum' from t1 group by product with rollup) as tmp where product is null;
+select product from t1 where exists (select product, country_id , sum(profit) from t1 as t2 where t1.product=t2.product group by product, country_id with rollup having sum(profit) > 6000);
+
+# The following doesn't return the expected answer, but this is a limitation
+# in the implementation so we should just document it
+select product, country_id , year, sum(profit) from t1 group by product, country_id, year having country_id is NULL;
+select concat(':',product,':'), sum(profit),avg(profit) from t1 group by product with rollup;
+
+# Error handling
+
+# Cube is not yet implemented
--error 1235
-select product, country , year, sum(profit) from sales group by product, country, year with cube;
+select product, country_id , year, sum(profit) from t1 group by product, country_id, year with cube;
--error 1235
-explain select product, country , year, sum(profit) from sales group by product, country, year with cube;
+explain select product, country_id , year, sum(profit) from t1 group by product, country_id, year with cube;
--error 1235
-select product, country , year, sum(profit) from sales group by product, country, year with rollup;
---error 1235
-explain select product, country , year, sum(profit) from sales group by product, country, year with rollup;
---error 1235
-select product, country , year, sum(profit) from sales group by product, country, year with cube union all select product, country , year, sum(profit) from sales group by product, country, year with rollup;
-drop table sales;
+select product, country_id , year, sum(profit) from t1 group by product, country_id, year with cube union all select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup;
+
+drop table t1,t2;
+
+#
+# Test bug with const tables
+#
+
+CREATE TABLE t1 (i int);
+INSERT INTO t1 VALUES(100);
+CREATE TABLE t2 (i int);
+INSERT INTO t2 VALUES (100),(200);
+SELECT i, COUNT(*) FROM t1 GROUP BY i WITH ROLLUP;
+SELECT t1.i, t2.i, COUNT(*) FROM t1,t2 GROUP BY t1.i,t2.i WITH ROLLUP;
+drop table t1,t2;
+
+#bug #4767: ROLLUP with LEFT JOIN
+
+CREATE TABLE user_day(
+ user_id INT NOT NULL,
+ date DATE NOT NULL,
+ UNIQUE INDEX user_date (user_id, date)
+);
+
+INSERT INTO user_day VALUES
+ (1, '2004-06-06' ),
+ (1, '2004-06-07' ),
+ (2, '2004-06-06' );
+
+SELECT
+ d.date AS day,
+ COUNT(d.user_id) as sample,
+ COUNT(next_day.user_id) AS not_cancelled
+ FROM user_day d
+ LEFT JOIN user_day next_day
+ ON next_day.user_id=d.user_id AND
+ next_day.date= DATE_ADD( d.date, interval 1 day )
+ GROUP BY day;
+
+SELECT
+ d.date AS day,
+ COUNT(d.user_id) as sample,
+ COUNT(next_day.user_id) AS not_cancelled
+ FROM user_day d
+ LEFT JOIN user_day next_day
+ ON next_day.user_id=d.user_id AND
+ next_day.date= DATE_ADD( d.date, interval 1 day )
+ GROUP BY day
+ WITH ROLLUP;
+
+DROP TABLE user_day;
+
diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test
index 25790f24738..912c9fb9bec 100644
--- a/mysql-test/t/openssl_1.test
+++ b/mysql-test/t/openssl_1.test
@@ -2,14 +2,16 @@
# Use mysql-test-run with --with-openssl option.
-- source include/have_openssl_1.inc
+--disable_warnings
drop table if exists t1;
+--enable_warnings
create table t1(f1 int);
insert into t1 values (5);
grant select on test.* to ssl_user1@localhost require SSL;
-grant select on test.* to ssl_user2@localhost require cipher "EDH-RSA-DES-CBC3-SHA";
-grant select on test.* to ssl_user3@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com";
-grant select on test.* to ssl_user4@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com";
+grant select on test.* to ssl_user2@localhost require cipher "DHE-RSA-AES256-SHA";
+grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com";
+grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com";
flush privileges;
connect (con1,localhost,ssl_user1,,);
connect (con2,localhost,ssl_user2,,);
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
index 86ecc4aa70d..988c106bf21 100644
--- a/mysql-test/t/order_by.test
+++ b/mysql-test/t/order_by.test
@@ -2,7 +2,9 @@
# Bug with order by
#
+--disable_warnings
drop table if exists t1,t2,t3;
+--enable_warnings
CREATE TABLE t1 (
id int(6) DEFAULT '0' NOT NULL,
@@ -78,6 +80,16 @@ select distinct i from t1 order by mod(i,2),i;
drop table t1;
#
+# bug#3681
+#
+
+create table t1 ( pk int primary key, name varchar(255) not null, number varchar(255) not null);
+insert into t1 values (1, 'Gamma', '123'), (2, 'Gamma Ext', '123a'), (3, 'Alpha', '001'), (4, 'Beta', '200c');
+select distinct t1.name as 'Building Name',t1.number as 'Building Number' from t1 order by t1.name asc;
+drop table t1;
+
+
+#
# Order by on first index part
#
@@ -85,8 +97,8 @@ create table t1 (id int not null,col1 int not null,col2 int not null,index(col1)
insert into t1 values(1,2,2),(2,2,1),(3,1,2),(4,1,1),(5,1,4),(6,2,3),(7,3,1),(8,2,4);
select * from t1 order by col1,col2;
select col1 from t1 order by id;
-select col1 as id from t1 order by t1.id;
-select concat(col1) as id from t1 order by t1.id;
+select col1 as id from t1 order by id;
+select concat(col1) as id from t1 order by id;
drop table t1;
#
@@ -168,7 +180,6 @@ drop table t1,t2,t3;
#bug reported by Wouter de Jong
-drop table if exists t1;
CREATE TABLE t1 (
member_id int(11) NOT NULL auto_increment,
inschrijf_datum varchar(20) NOT NULL default '',
@@ -198,7 +209,7 @@ CREATE TABLE t1 (
info text NOT NULL,
ipnr varchar(30) NOT NULL default '',
PRIMARY KEY (member_id)
-) TYPE=MyISAM PACK_KEYS=1;
+) ENGINE=MyISAM PACK_KEYS=1;
insert into t1 (member_id) values (1),(2),(3);
select member_id, nickname, voornaam FROM t1
@@ -260,7 +271,7 @@ CREATE TABLE t1 (
cid smallint(5) unsigned NOT NULL default '0',
PRIMARY KEY (gid),
KEY component_id (cid)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (103853,108),(103867,108),(103962,108),(104505,108),(104619,108),(104620,108);
ALTER TABLE t1 add skr int(10) not null;
@@ -271,13 +282,13 @@ CREATE TABLE t2 (
PRIMARY KEY (gid),
KEY uid (uid),
KEY status_id (sid)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t2 VALUES (103853,250,5),(103867,27,5),(103962,27,5),(104505,117,5),(104619,75,5),(104620,15,5);
CREATE TABLE t3 (
uid smallint(6) NOT NULL auto_increment,
PRIMARY KEY (uid)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t3 VALUES (1),(15),(27),(75),(117),(250);
ALTER TABLE t3 add skr int(10) not null;
@@ -346,12 +357,9 @@ SELECT * FROM t1 ORDER BY (a + b) DESC;
DROP TABLE t1;
#
-# Bug #1945 - Crashing bug with bad User Variables in UPDATE ... ORDER BY ...
+# Test of FORCE INDEX ... ORDER BY
#
-CREATE TABLE t1 (a INT, b INT);
-SET @id=0;
-UPDATE t1 SET a=0 ORDER BY (a=@id), b;
-DROP TABLE t1;
+
create table t1(id int not null auto_increment primary key, t char(12));
disable_query_log;
let $1 = 1000;
@@ -363,4 +371,132 @@ while ($1)
enable_query_log;
explain select id,t from t1 order by id;
explain select id,t from t1 force index (primary) order by id;
-drop table t1; \ No newline at end of file
+drop table t1;
+
+#
+# Test of test_if_subkey() function
+#
+CREATE TABLE t1 (
+ FieldKey varchar(36) NOT NULL default '',
+ LongVal bigint(20) default NULL,
+ StringVal mediumtext,
+ KEY FieldKey (FieldKey),
+ KEY LongField (FieldKey,LongVal),
+ KEY StringField (FieldKey,StringVal(32))
+);
+INSERT INTO t1 VALUES ('0',3,'0'),('0',2,'1'),('0',1,'2'),('1',2,'1'),('1',1,'3'), ('1',0,'2'),('2',3,'0'),('2',2,'1'),('2',1,'2'),('2',3,'0'),('2',2,'1'),('2',1,'2'),('3',2,'1'),('3',1,'2'),('3','3','3');
+EXPLAIN SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal;
+SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal;
+EXPLAIN SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal;
+SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal;
+EXPLAIN SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY FieldKey, LongVal;
+SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY FieldKey, LongVal;
+DROP TABLE t1;
+#
+# Bug #1945 - Crashing bug with bad User Variables in UPDATE ... ORDER BY ...
+#
+CREATE TABLE t1 (a INT, b INT);
+SET @id=0;
+UPDATE t1 SET a=0 ORDER BY (a=@id), b;
+DROP TABLE t1;
+
+#
+# Bug when doing an order by on a 1 byte string (Bug #2147)
+#
+
+CREATE TABLE t1 ( id smallint(6) unsigned NOT NULL default '0', menu tinyint(4) NOT NULL default '0', KEY id (id), KEY menu (menu)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (11384, 2),(11392, 2);
+SELECT id FROM t1 WHERE id <11984 AND menu =2 ORDER BY id DESC LIMIT 1 ;
+drop table t1;
+
+#
+# REF_OR_NULL optimization + filesort (bug #2419)
+#
+
+create table t1(a int, b int, index(b));
+insert into t1 values (2, 1), (1, 1), (4, NULL), (3, NULL), (6, 2), (5, 2);
+explain select * from t1 where b=1 or b is null order by a;
+select * from t1 where b=1 or b is null order by a;
+explain select * from t1 where b=2 or b is null order by a;
+select * from t1 where b=2 or b is null order by a;
+drop table t1;
+
+#
+# Bug #3155 - Strange results with index (x, y) ... WHERE ... ORDER BY pk
+#
+
+create table t1 (a int not null auto_increment, b int not null, c int not null, d int not null,
+key(a,b,d), key(c,b,a));
+create table t2 like t1;
+insert into t1 values (NULL, 1, 2, 0), (NULL, 2, 1, 1), (NULL, 3, 4, 2), (NULL, 4, 3, 3);
+insert into t2 select null, b, c, d from t1;
+insert into t1 select null, b, c, d from t2;
+insert into t2 select null, b, c, d from t1;
+insert into t1 select null, b, c, d from t2;
+insert into t2 select null, b, c, d from t1;
+insert into t1 select null, b, c, d from t2;
+insert into t2 select null, b, c, d from t1;
+insert into t1 select null, b, c, d from t2;
+insert into t2 select null, b, c, d from t1;
+insert into t1 select null, b, c, d from t2;
+optimize table t1;
+set @row=10;
+insert into t1 select 1, b, c + (@row:=@row - 1) * 10, d - @row from t2 limit 10;
+select * from t1 where a=1 and b in (1) order by c, b, a;
+select * from t1 where a=1 and b in (1);
+drop table t1, t2;
+
+#
+# Bug #4302
+# Ambiguos order by when renamed column is identical to another in result.
+# Should not fail and prefer column from t1 for sorting.
+#
+create table t1 (col1 int, col int);
+create table t2 (col2 int, col int);
+insert into t1 values (1,1),(2,2),(3,3);
+insert into t2 values (1,3),(2,2),(3,1);
+select t1.* , t2.col as t2_col from t1 left join t2 on (t1.col1=t2.col2)
+ order by col;
+
+#
+# Let us also test various ambiguos and potentially ambiguos cases
+# related to aliases
+#
+--error 1052
+select col1 as col, col from t1 order by col;
+--error 1052
+select t1.col as c1, t2.col as c2 from t1, t2 where t1.col1=t2.col2
+ order by col;
+--error 1052
+select t1.col as c1, t2.col as c2 from t1, t2 where t1.col1=t2.col2
+ order by col;
+--error 1052
+select col1 from t1, t2 where t1.col1=t2.col2 order by col;
+--error 1052
+select t1.col as t1_col, t2.col2 from t1, t2 where t1.col1=t2.col2
+ order by col;
+
+select t1.col as t1_col, t2.col from t1, t2 where t1.col1=t2.col2
+ order by col;
+select col2 as c, col as c from t2 order by col;
+select col2 as col, col as col2 from t2 order by col;
+select t2.col2, t2.col, t2.col from t2 order by col;
+
+select t2.col2 as col from t2 order by t2.col;
+select t2.col2 as col, t2.col from t2 order by t2.col;
+select t2.col2, t2.col, t2.col from t2 order by t2.col;
+
+drop table t1, t2;
+
+#
+# Bug #5428: a problem with small max_sort_length value
+#
+
+create table t1 (a char(25));
+insert into t1 set a = repeat('x', 20);
+insert into t1 set a = concat(repeat('x', 19), 'z');
+insert into t1 set a = concat(repeat('x', 19), 'ab');
+insert into t1 set a = concat(repeat('x', 19), 'aa');
+set max_sort_length=20;
+select a from t1 order by a;
+drop table t1;
diff --git a/mysql-test/t/order_fill_sortbuf.test b/mysql-test/t/order_fill_sortbuf.test
index 6419f2a93df..37620ebe331 100644
--- a/mysql-test/t/order_fill_sortbuf.test
+++ b/mysql-test/t/order_fill_sortbuf.test
@@ -3,7 +3,10 @@
# rows MySQL needs to use a merge during the sort phase.
#
+--disable_warnings
drop table if exists t1,t2;
+--enable_warnings
+
CREATE TABLE `t1` (
`id` int(11) NOT NULL default '0',
`id2` int(11) NOT NULL default '0',
diff --git a/mysql-test/t/outfile.test b/mysql-test/t/outfile.test
index c126d221bd2..59ce6cc56fe 100644
--- a/mysql-test/t/outfile.test
+++ b/mysql-test/t/outfile.test
@@ -2,9 +2,12 @@
# test of into outfile|dumpfile
#
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
# We need to check that we have 'file' privilege.
-#drop table if exists t1;
#create table t1 (`a` blob);
#insert into t1 values("hello world"),("Hello mars"),(NULL);
#select * into outfile "/tmp/select-test.1" from t1;
@@ -21,3 +24,20 @@
#select * into dumpfile "/tmp/select-test.99" from t1;
#select load_file("/tmp/select-test.not-exist");
#drop table t1;
+#drop table if exists t;
+#CREATE TABLE t ( t timestamp NOT NULL, c char(200) character set latin1 NOT NULL default '', i int(11), v varchar(200), b blob, KEY t (t)) ENGINE=MyISAM;
+#INSERT INTO t VALUES ('2002-12-20 12:01:20','',1,"aaa","bbb");
+#select * from t into outfile "check";
+#drop table if exists t;
+
+#
+# Bug #5382: 'explain select into outfile' crashes the server
+#
+
+CREATE TABLE t1 (a INT);
+EXPLAIN
+ SELECT *
+ INTO OUTFILE '/tmp/t1.txt'
+ FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
+ FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/t/overflow.test b/mysql-test/t/overflow.test
index 6619a87cabb..17e443d51f8 100644
--- a/mysql-test/t/overflow.test
+++ b/mysql-test/t/overflow.test
@@ -1,4 +1,4 @@
connect (con1,localhost,boo,,);
connection con1;
--- error 1064,1102
+-- error 1064,1102,1280
drop database AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA;
diff --git a/mysql-test/t/preload.test b/mysql-test/t/preload.test
new file mode 100644
index 00000000000..7a049d06a86
--- /dev/null
+++ b/mysql-test/t/preload.test
@@ -0,0 +1,100 @@
+#
+# Testing of PRELOAD
+#
+
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+
+
+create table t1 (
+ a int not null auto_increment,
+ b char(16) not null,
+ primary key (a),
+ key (b)
+);
+
+create table t2(
+ a int not null auto_increment,
+ b char(16) not null,
+ primary key (a),
+ key (b)
+);
+
+insert into t1(b) values
+ ('test0'),
+ ('test1'),
+ ('test2'),
+ ('test3'),
+ ('test4'),
+ ('test5'),
+ ('test6'),
+ ('test7');
+
+insert into t2(b) select b from t1;
+insert into t1(b) select b from t2;
+insert into t2(b) select b from t1;
+insert into t1(b) select b from t2;
+insert into t2(b) select b from t1;
+insert into t1(b) select b from t2;
+insert into t2(b) select b from t1;
+insert into t1(b) select b from t2;
+insert into t2(b) select b from t1;
+insert into t1(b) select b from t2;
+insert into t2(b) select b from t1;
+insert into t1(b) select b from t2;
+insert into t2(b) select b from t1;
+insert into t1(b) select b from t2;
+insert into t2(b) select b from t1;
+insert into t1(b) select b from t2;
+insert into t2(b) select b from t1;
+insert into t1(b) select b from t2;
+
+select count(*) from t1;
+select count(*) from t2;
+
+flush tables; flush status;
+show status like "key_read%";
+
+select count(*) from t1 where b = 'test1';
+show status like "key_read%";
+select count(*) from t1 where b = 'test1';
+show status like "key_read%";
+
+flush tables; flush status;
+select @@preload_buffer_size;
+load index into cache t1;
+show status like "key_read%";
+select count(*) from t1 where b = 'test1';
+show status like "key_read%";
+
+flush tables; flush status;
+show status like "key_read%";
+set session preload_buffer_size=256*1024;
+select @@preload_buffer_size;
+load index into cache t1 ignore leaves;
+show status like "key_read%";
+select count(*) from t1 where b = 'test1';
+show status like "key_read%";
+
+flush tables; flush status;
+show status like "key_read%";
+set session preload_buffer_size=1*1024;
+select @@preload_buffer_size;
+load index into cache t1, t2 key (primary,b) ignore leaves;
+show status like "key_read%";
+select count(*) from t1 where b = 'test1';
+select count(*) from t2 where b = 'test1';
+show status like "key_read%";
+
+flush tables; flush status;
+show status like "key_read%";
+load index into cache t3, t2 key (primary,b) ;
+show status like "key_read%";
+
+flush tables; flush status;
+show status like "key_read%";
+load index into cache t3 key (b), t2 key (c) ;
+show status like "key_read%";
+
+drop table t1, t2;
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
new file mode 100644
index 00000000000..92bf4ece4e3
--- /dev/null
+++ b/mysql-test/t/ps.test
@@ -0,0 +1,487 @@
+#
+# SQL Syntax for Prepared Statements test
+#
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
+create table t1
+(
+ a int primary key,
+ b char(10)
+);
+insert into t1 values (1,'one');
+insert into t1 values (2,'two');
+insert into t1 values (3,'three');
+insert into t1 values (4,'four');
+
+# basic functionality
+set @a=2;
+prepare stmt1 from 'select * from t1 where a <= ?';
+execute stmt1 using @a;
+set @a=3;
+execute stmt1 using @a;
+
+# non-existant statement
+--error 1243
+deallocate prepare no_such_statement;
+
+--error 1210
+execute stmt1;
+
+# Nesting ps commands is not allowed:
+--error 1064
+prepare stmt2 from 'prepare nested_stmt from "select 1"';
+
+--error 1064
+prepare stmt2 from 'execute stmt1';
+
+--error 1064
+prepare stmt2 from 'deallocate prepare z';
+
+# PS insert
+prepare stmt3 from 'insert into t1 values (?,?)';
+set @arg1=5, @arg2='five';
+execute stmt3 using @arg1, @arg2;
+select * from t1 where a>3;
+
+# PS update
+prepare stmt4 from 'update t1 set a=? where b=?';
+set @arg1=55, @arg2='five';
+execute stmt4 using @arg1, @arg2;
+select * from t1 where a>3;
+
+# PS create/delete
+prepare stmt4 from 'create table t2 (a int)';
+execute stmt4;
+prepare stmt4 from 'drop table t2';
+execute stmt4;
+
+# Do something that will cause error
+--error 1051
+execute stmt4;
+
+# placeholders in result field names.
+prepare stmt5 from 'select ? + a from t1';
+set @a=1;
+execute stmt5 using @a;
+
+execute stmt5 using @no_such_var;
+
+set @nullvar=1;
+set @nullvar=NULL;
+execute stmt5 using @nullvar;
+
+set @nullvar2=NULL;
+execute stmt5 using @nullvar2;
+
+# Check that multiple SQL statements are disabled inside PREPARE
+--error 1064
+prepare stmt6 from 'select 1; select2';
+
+--error 1064
+prepare stmt6 from 'insert into t1 values (5,"five"); select2';
+
+# This shouldn't parse
+--error 1064
+explain prepare stmt6 from 'insert into t1 values (5,"five"); select2';
+
+create table t2
+(
+ a int
+);
+
+insert into t2 values (0);
+
+# parameter is NULL
+set @arg00=NULL ;
+prepare stmt1 from 'select 1 FROM t2 where a=?' ;
+execute stmt1 using @arg00 ;
+
+# prepare using variables:
+--error 1064
+prepare stmt1 from @nosuchvar;
+
+set @ivar= 1234;
+--error 1064
+prepare stmt1 from @ivar;
+
+set @fvar= 123.4567;
+--error 1064
+prepare stmt1 from @fvar;
+
+drop table t1,t2;
+
+#
+# Bug #4105: Server crash on attempt to prepare a statement with character
+# set introducer
+#
+PREPARE stmt1 FROM "select _utf8 'A' collate utf8_bin = ?";
+set @var='A';
+EXECUTE stmt1 USING @var;
+DEALLOCATE PREPARE stmt1;
+
+#
+# BUG#3486: FOUND_ROWS() fails inside stored procedure [and prepared statement]
+#
+create table t1 (id int);
+prepare stmt1 from "select FOUND_ROWS()";
+select SQL_CALC_FOUND_ROWS * from t1;
+# Expect 0
+execute stmt1;
+insert into t1 values (1);
+select SQL_CALC_FOUND_ROWS * from t1;
+# Expect 1
+execute stmt1;
+# Expect 0
+execute stmt1;
+deallocate prepare stmt1;
+drop table t1;
+
+#
+# prepared EXPLAIN
+#
+create table t1
+(
+ c1 tinyint, c2 smallint, c3 mediumint, c4 int,
+ c5 integer, c6 bigint, c7 float, c8 double,
+ c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
+ c13 date, c14 datetime, c15 timestamp(14), c16 time,
+ c17 year, c18 bit, c19 bool, c20 char,
+ c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
+ c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
+ c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
+ c32 set('monday', 'tuesday', 'wednesday')
+) engine = MYISAM ;
+create table t2 like t1;
+
+set @stmt= ' explain SELECT (SELECT SUM(c1 + c12 + 0.0) FROM t2 where (t1.c2 - 0e-3) = t2.c2 GROUP BY t1.c15 LIMIT 1) as scalar_s, exists (select 1.0e+0 from t2 where t2.c3 * 9.0000000000 = t1.c4) as exists_s, c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s FROM t1, (select c25 x, c32 y from t2) tt WHERE x * 1 = c25 ' ;
+prepare stmt1 from @stmt ;
+execute stmt1 ;
+execute stmt1 ;
+explain SELECT (SELECT SUM(c1 + c12 + 0.0) FROM t2 where (t1.c2 - 0e-3) = t2.c2 GROUP BY t1.c15 LIMIT 1) as scalar_s, exists (select 1.0e+0 from t2 where t2.c3 * 9.0000000000 = t1.c4) as exists_s, c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s FROM t1, (select c25 x, c32 y from t2) tt WHERE x * 1 = c25;
+deallocate prepare stmt1;
+drop tables t1,t2;
+
+#
+# parameters from variables (for field creation)
+#
+set @arg00=1;
+prepare stmt1 from ' create table t1 (m int) as select 1 as m ' ;
+execute stmt1 ;
+select m from t1;
+drop table t1;
+prepare stmt1 from ' create table t1 (m int) as select ? as m ' ;
+execute stmt1 using @arg00;
+select m from t1;
+deallocate prepare stmt1;
+drop table t1;
+
+#
+# eq() for parameters
+#
+create table t1 (id int(10) unsigned NOT NULL default '0',
+ name varchar(64) NOT NULL default '',
+ PRIMARY KEY (id), UNIQUE KEY `name` (`name`));
+insert into t1 values (1,'1'),(2,'2'),(3,'3'),(4,'4'),(5,'5'),(6,'6'),(7,'7');
+prepare stmt1 from 'select name from t1 where id=? or id=?';
+set @id1=1,@id2=6;
+execute stmt1 using @id1, @id2;
+select name from t1 where id=1 or id=6;
+deallocate prepare stmt1;
+drop table t1;
+
+#
+# SHOW TABLE STATUS test
+#
+create table t1 ( a int primary key, b varchar(30)) engine = MYISAM ;
+prepare stmt1 from ' show table status from test like ''t1%'' ';
+--replace_column 8 4294967295 12 # 13 # 14 #
+execute stmt1;
+--replace_column 8 4294967295 12 # 13 # 14 #
+show table status from test like 't1%' ;
+deallocate prepare stmt1 ;
+drop table t1;
+
+#
+# Bug#4912 "mysqld crashs in case a statement is executed a second time":
+# negation elimination should work once and not break prepared statements
+#
+
+create table t1(a varchar(2), b varchar(3));
+prepare stmt1 from "select a, b from t1 where (not (a='aa' and b < 'zzz'))";
+execute stmt1;
+execute stmt1;
+deallocate prepare stmt1;
+drop table t1;
+
+#
+# Bug#5034 "prepared "select 1 into @arg15", second execute crashes
+# server".
+# Check that descendands of select_result can be reused in prepared
+# statements or are correctly created and deleted on each execute
+#
+
+prepare stmt1 from "select 1 into @var";
+execute stmt1;
+execute stmt1;
+prepare stmt1 from "create table t1 select 1 as i";
+execute stmt1;
+drop table t1;
+execute stmt1;
+prepare stmt1 from "insert into t1 select i from t1";
+execute stmt1;
+execute stmt1;
+prepare stmt1 from "select * from t1 into outfile 'f1.txt'";
+execute stmt1;
+deallocate prepare stmt1;
+drop table t1;
+
+#
+# BUG#5242 "Prepared statement names are case sensitive"
+#
+prepare stmt1 from 'select 1';
+prepare STMT1 from 'select 2';
+execute sTmT1;
+deallocate prepare StMt1;
+
+--error 1243
+deallocate prepare Stmt1;
+
+# also check that statement names are in right charset.
+set names utf8;
+prepare `Ì` from 'select 1234';
+execute `Ì` ;
+set names latin1;
+execute `ü`;
+set names default;
+
+
+#
+# BUG#4368 "select * from t1 where a like ?" crashes server if a is in utf8
+# and ? is in latin1
+# Check that Item converting latin1 to utf8 (for LIKE function) is created
+# in memory of prepared statement.
+#
+
+create table t1 (a varchar(10)) charset=utf8;
+insert into t1 (a) values ('yahoo');
+set character_set_connection=latin1;
+prepare stmt from 'select a from t1 where a like ?';
+set @var='google';
+execute stmt using @var;
+execute stmt using @var;
+deallocate prepare stmt;
+drop table t1;
+
+#
+# BUG#5510 "inserting Null in AutoIncrement primary key Column Fails"
+# (prepared statements)
+# The cause: misuse of internal MySQL 'Field' API.
+#
+
+create table t1 (a bigint(20) not null primary key auto_increment);
+insert into t1 (a) values (null);
+select * from t1;
+prepare stmt from "insert into t1 (a) values (?)";
+set @var=null;
+execute stmt using @var;
+select * from t1;
+drop table t1;
+#
+# check the same for timestamps
+#
+create table t1 (a timestamp not null);
+prepare stmt from "insert into t1 (a) values (?)";
+execute stmt using @var;
+--disable_result_log
+select * from t1;
+--enable_result_log
+deallocate prepare stmt;
+drop table t1;
+
+#
+# BUG#5688 "Upgraded 4.1.5 Server seg faults" # (prepared statements)
+# The test case speaks for itself.
+# Just another place where we used wrong memory root for Items created
+# during statement prepare.
+#
+prepare stmt from "select 'abc' like convert('abc' using utf8)";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+#
+# BUG#5748 "Prepared statement with BETWEEN and bigint values crashes
+# mysqld". Just another place where an item tree modification must be
+# rolled back.
+#
+create table t1 ( a bigint );
+prepare stmt from 'select a from t1 where a between ? and ?';
+set @a=1;
+execute stmt using @a, @a;
+execute stmt using @a, @a;
+execute stmt using @a, @a;
+drop table t1;
+deallocate prepare stmt;
+
+#
+# Bug #5987 subselect in bool function crashes server (prepared statements):
+# don't overwrite transformed subselects with old arguments of a bool
+# function.
+#
+create table t1 (a int);
+prepare stmt from "select * from t1 where 1 > (1 in (SELECT * FROM t1))";
+execute stmt;
+execute stmt;
+execute stmt;
+drop table t1;
+deallocate prepare stmt;
+
+#
+# Test case for Bug#6042 "constants propogation works only once (prepared
+# statements): check that the query plan changes whenever we change
+# placeholder value.
+#
+create table t1 (a int, b int);
+insert into t1 (a, b) values (1,1), (1,2), (2,1), (2,2);
+prepare stmt from
+"explain select * from t1 where t1.a=2 and t1.a=t1.b and t1.b > 1 + ?";
+--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
+set @v=5;
+execute stmt using @v;
+--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
+set @v=0;
+execute stmt using @v;
+--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
+set @v=5;
+execute stmt using @v;
+drop table t1;
+deallocate prepare stmt;
+
+#
+# A test case for Bug#5985 prepare stmt from "select rand(?)" crashes
+# server. Check that Item_func_rand is prepared-statements friendly.
+#
+create table t1 (a int);
+insert into t1 (a) values (1), (2), (3), (4);
+set @precision=10000000000;
+--replace_column 1 - 3 -
+select rand(),
+ cast(rand(10)*@precision as unsigned integer),
+ cast(rand(a)*@precision as unsigned integer) from t1;
+prepare stmt from
+"select rand(),
+ cast(rand(10)*@precision as unsigned integer),
+ cast(rand(a)*@precision as unsigned integer),
+ cast(rand(?)*@precision as unsigned integer) from t1";
+set @var=1;
+--replace_column 1 - 3 -
+execute stmt using @var;
+set @var=2;
+--replace_column 1 -
+execute stmt using @var;
+set @var=3;
+--replace_column 1 -
+execute stmt using @var;
+drop table t1;
+deallocate prepare stmt;
+
+#
+# A test case for Bug#6050 "EXECUTE stmt reports ambiguous fieldnames with
+# identical tables from different schemata"
+# Check that field name resolving in prepared statements works OK.
+#
+create database mysqltest1;
+create table t1 (a int);
+create table mysqltest1.t1 (a int);
+select * from t1, mysqltest1.t1;
+prepare stmt from "select * from t1, mysqltest1.t1";
+execute stmt;
+execute stmt;
+execute stmt;
+drop table t1;
+drop table mysqltest1.t1;
+drop database mysqltest1;
+deallocate prepare stmt;
+select '1.1' as a, '1.2' as a UNION SELECT '2.1', '2.2';
+prepare stmt from
+"select '1.1' as a, '1.2' as a UNION SELECT '2.1', '2.2'";
+execute stmt;
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+#
+# Test CREATE TABLE ... SELECT (Bug #6094)
+#
+create table t1 (a int);
+insert into t1 values (1),(2),(3);
+create table t2 select * from t1;
+prepare stmt FROM 'create table t2 select * from t1';
+drop table t2;
+execute stmt;
+drop table t2;
+execute stmt;
+--error 1050
+execute stmt;
+drop table t2;
+execute stmt;
+drop table t1,t2;
+deallocate prepare stmt;
+
+#
+# Bug#6088 "FOUND_ROWS returns wrong values for prepared statements when
+# LIMIT is used"
+#
+create table t1 (a int);
+insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+prepare stmt from "select sql_calc_found_rows * from t1 limit 2";
+execute stmt;
+select found_rows();
+execute stmt;
+select found_rows();
+execute stmt;
+select found_rows();
+deallocate prepare stmt;
+drop table t1;
+
+#
+# Bug#6047 "permission problem when executing mysql_stmt_execute with derived
+# table"
+#
+
+CREATE TABLE t1 (N int, M tinyint);
+INSERT INTO t1 VALUES (1,0),(1,0),(2,0),(2,0),(3,0);
+PREPARE stmt FROM 'UPDATE t1 AS P1 INNER JOIN (SELECT N FROM t1 GROUP BY N HAVING COUNT(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2';
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+
+#
+# Bug#6297 "prepared statement, wrong handling of <parameter> IS NULL"
+# Test that placeholders work with IS NULL/IS NOT NULL clauses.
+#
+prepare stmt from "select ? is null, ? is not null, ?";
+select @no_such_var is null, @no_such_var is not null, @no_such_var;
+execute stmt using @no_such_var, @no_such_var, @no_such_var;
+set @var='abc';
+select @var is null, @var is not null, @var;
+execute stmt using @var, @var, @var;
+set @var=null;
+select @var is null, @var is not null, @var;
+execute stmt using @var, @var, @var;
+
+#
+# Bug#6873 "PS, having with subquery, crash during execute"
+# check that if we modify having subtree, we update JOIN->having pointer
+#
+create table t1 (pnum char(3));
+create table t2 (pnum char(3));
+prepare stmt from "select pnum from t2 having pnum in (select 'p1' from t1)";
+execute stmt;
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+drop table t1, t2;
+
diff --git a/mysql-test/t/ps_10nestset.test b/mysql-test/t/ps_10nestset.test
new file mode 100644
index 00000000000..53e84f7a47d
--- /dev/null
+++ b/mysql-test/t/ps_10nestset.test
@@ -0,0 +1,71 @@
+###############################################
+# #
+# Prepared Statements test on #
+# "nested sets" representing hierarchies #
+# #
+###############################################
+
+# Source: http://kris.koehntopp.de/artikel/sql-self-references (dated 1999)
+# Source: http://dbmsmag.com/9603d06.html (dated 1996)
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+# "Nested Set": This table represents an employee list with a hierarchy tree.
+# The tree is not modeled by "parent" links but rather by showing the "left"
+# and "right" border of any person's "region". By convention, "l" < "r".
+# As it is a tree, these "regions" of two persons A and B are either disjoint,
+# or A's region is completely contained in B's (B.l < A.l < A.r < B.r:
+# B is A's boss), or vice versa.
+# Any other overlaps violate the model. See the references for more info.
+
+create table t1 (
+ id INTEGER AUTO_INCREMENT PRIMARY KEY,
+ emp CHAR(10) NOT NULL,
+ salary DECIMAL(6,2) NOT NULL,
+ l INTEGER NOT NULL,
+ r INTEGER NOT NULL);
+
+prepare st_ins from 'insert into t1 set emp = ?, salary = ?, l = ?, r = ?';
+
+# Initial employee list:
+# Jerry ( Bert () Chuck ( Donna () Eddie () Fred () ) )
+set @arg_nam= 'Jerry'; set @arg_sal= 1000; set @arg_l= 1; set @arg_r= 12;
+execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
+set @arg_nam= 'Bert'; set @arg_sal= 900; set @arg_l= 2; set @arg_r= 3;
+execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
+set @arg_nam= 'Chuck'; set @arg_sal= 900; set @arg_l= 4; set @arg_r= 11;
+execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
+set @arg_nam= 'Donna'; set @arg_sal= 800; set @arg_l= 5; set @arg_r= 6;
+execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
+set @arg_nam= 'Eddie'; set @arg_sal= 700; set @arg_l= 7; set @arg_r= 8;
+execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
+set @arg_nam= 'Fred'; set @arg_sal= 600; set @arg_l= 9; set @arg_r= 10;
+execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
+
+select * from t1;
+
+# Three successive raises, each one is 100 units for managers, 10 percent for others.
+prepare st_raise_base from 'update t1 set salary = salary * ( 1 + ? ) where r - l = 1';
+prepare st_raise_mgr from 'update t1 set salary = salary + ? where r - l > 1';
+let $1= 3;
+set @arg_percent= .10;
+set @arg_amount= 100;
+while ($1)
+{
+ execute st_raise_base using @arg_percent;
+ execute st_raise_mgr using @arg_amount;
+ dec $1;
+}
+
+select * from t1;
+
+# Now, increase salary to a multiple of 50 (checks for bug#6138)
+prepare st_round from 'update t1 set salary = salary + ? - ( salary MOD ? )';
+set @arg_round= 50;
+execute st_round using @arg_round, @arg_round;
+
+select * from t1;
+
+drop table t1;
diff --git a/mysql-test/t/ps_11bugs.test b/mysql-test/t/ps_11bugs.test
new file mode 100644
index 00000000000..5945b140645
--- /dev/null
+++ b/mysql-test/t/ps_11bugs.test
@@ -0,0 +1,131 @@
+###############################################
+# #
+# Prepared Statements #
+# re-testing bug DB entries #
+# #
+# The bugs are reported as "closed". #
+# Command sequences taken from bug report. #
+# No other test contains the bug# as comment. #
+# #
+# Tests drop/create tables 't1', 't2', ... #
+# #
+###############################################
+
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+
+# bug#1180: optimized away part of WHERE clause cause incorect prepared satatement results
+
+CREATE TABLE t1(session_id char(9) NOT NULL);
+INSERT INTO t1 VALUES ("abc");
+SELECT * FROM t1;
+
+prepare st_1180 from 'SELECT * FROM t1 WHERE ?="1111" and session_id = "abc"';
+
+# Must not find a row
+set @arg1= 'abc';
+execute st_1180 using @arg1;
+
+# Now, it should find one row
+set @arg1= '1111';
+execute st_1180 using @arg1;
+
+# Back to non-matching
+set @arg1= 'abc';
+execute st_1180 using @arg1;
+
+drop table t1;
+
+# end of bug#1180
+
+
+# bug#1644: Insertion of more than 3 NULL columns with parameter binding fails
+
+# Using prepared statements, insertion of more than three columns with NULL
+# values fails to insert additional NULLS. After the third column NULLS will
+# be inserted into the database as zeros.
+# First insert four columns of a value (i.e. 22) to verify binding is working
+# correctly. Then Bind to each columns bind parameter an is_null value of 1.
+# Then insert four more columns of integers, just for sanity.
+# A subsequent select on the server will result in this:
+# mysql> select * from foo_dfr;
+# +------+------+------+------+
+# | col1 | col2 | col3 | col4 |
+# +------+------+------+------+
+# | 22 | 22 | 22 | 22 |
+# | NULL | NULL | NULL | 0 |
+# | 88 | 88 | 88 | 88 |
+# +------+------+------+------+
+
+# Test is extended to more columns - code stores bit vector in bytes.
+
+create table t1 (
+ c_01 char(6), c_02 integer, c_03 real, c_04 int(3), c_05 varchar(20),
+ c_06 date, c_07 char(1), c_08 real, c_09 int(11), c_10 time,
+ c_11 char(6), c_12 integer, c_13 real, c_14 int(3), c_15 varchar(20),
+ c_16 date, c_17 char(1), c_18 real, c_19 int(11), c_20 text);
+# Do not use "timestamp" type, because it has a non-NULL default as of 4.1.2
+
+prepare st_1644 from 'insert into t1 values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
+
+set @arg01= 'row_1'; set @arg02= 1; set @arg03= 1.1; set @arg04= 111; set @arg05= 'row_one';
+set @arg06= '2004-10-12'; set @arg07= '1'; set @arg08= 1.1; set @arg09= '100100100'; set @arg10= '12:34:56';
+set @arg11= 'row_1'; set @arg12= 1; set @arg13= 1.1; set @arg14= 111; set @arg15= 'row_one';
+set @arg16= '2004-10-12'; set @arg17= '1'; set @arg18= 1.1; set @arg19= '100100100'; set @arg20= '12:34:56';
+execute st_1644 using @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg09, @arg10,
+ @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17, @arg18, @arg19, @arg20;
+
+set @arg01= NULL; set @arg02= NULL; set @arg03= NULL; set @arg04= NULL; set @arg05= NULL;
+set @arg06= NULL; set @arg07= NULL; set @arg08= NULL; set @arg09= NULL; set @arg10= NULL;
+set @arg11= NULL; set @arg12= NULL; set @arg13= NULL; set @arg14= NULL; set @arg15= NULL;
+set @arg16= NULL; set @arg17= NULL; set @arg18= NULL; set @arg19= NULL; set @arg20= NULL;
+execute st_1644 using @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg09, @arg10,
+ @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17, @arg18, @arg19, @arg20;
+
+set @arg01= 'row_3'; set @arg02= 3; set @arg03= 3.3; set @arg04= 333; set @arg05= 'row_three';
+set @arg06= '2004-10-12'; set @arg07= '3'; set @arg08= 3.3; set @arg09= '300300300'; set @arg10= '12:34:56';
+set @arg11= 'row_3'; set @arg12= 3; set @arg13= 3.3; set @arg14= 333; set @arg15= 'row_three';
+set @arg16= '2004-10-12'; set @arg17= '3'; set @arg18= 3.3; set @arg19= '300300300'; set @arg20= '12:34:56';
+execute st_1644 using @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg09, @arg10,
+ @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17, @arg18, @arg19, @arg20;
+
+select * from t1;
+
+drop table t1;
+
+# end of bug#1644
+
+
+# bug#1676: Prepared statement two-table join returns no rows when one is expected
+
+create table t1(
+ cola varchar(50) not null,
+ colb varchar(8) not null,
+ colc varchar(12) not null,
+ cold varchar(2) not null,
+ primary key (cola, colb, cold));
+
+create table t2(
+ cola varchar(50) not null,
+ colb varchar(8) not null,
+ colc varchar(2) not null,
+ cold float,
+ primary key (cold));
+
+insert into t1 values ('aaaa', 'yyyy', 'yyyy-dd-mm', 'R');
+
+insert into t2 values ('aaaa', 'yyyy', 'R', 203), ('bbbb', 'zzzz', 'C', 201);
+
+prepare st_1676 from 'select a.cola, a.colb, a.cold from t1 a, t2 b where a.cola = ? and a.colb = ? and a.cold = ? and b.cola = a.cola and b.colb = a.colb and b.colc = a.cold';
+
+set @arg0= "aaaa";
+set @arg1= "yyyy";
+set @arg2= "R";
+
+execute st_1676 using @arg0, @arg1, @arg2;
+
+drop table t1, t2;
+
+# end of bug#1676
+
diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test
new file mode 100644
index 00000000000..08c1ad85fb1
--- /dev/null
+++ b/mysql-test/t/ps_1general.test
@@ -0,0 +1,1051 @@
+###################### ps_general.test #######################
+# #
+# basic and miscellaneous tests for prepared statements #
+# #
+##############################################################
+
+#
+# NOTE: PLEASE SEE THE DETAILED DESCRIPTION AT THE BOTTOM OF THIS FILE
+# BEFORE ADDING NEW TEST CASES HERE !!!
+
+--disable_warnings
+drop table if exists t5, t6, t7, t8;
+drop database if exists mysqltest ;
+--enable_warnings
+
+--disable_query_log
+select '------ basic tests ------' as test_sequence ;
+--enable_query_log
+
+let $type= 'MYISAM' ;
+# create the tables (t1 and t9) used in many tests
+--source include/ps_create.inc
+# insert data into these tables
+--source include/ps_renew.inc
+
+
+################ The basic functions ################
+
+# 1. PREPARE stmt_name FROM <preparable statement>;
+# <preparable statement> ::=
+# 'literal_stmt' |
+# @variable_ref_stmt.
+# The statement may contain question marks as placeholders for parameters.
+#
+# Bind a statement name to a string containing a SQL statement and
+# send it to the server. The server will parse the statement and
+# reply with "Query Ok" or an error message.
+#
+PREPARE stmt FROM ' select * from t1 where a = ? ' ;
+
+# 2. EXECUTE stmt_name [USING @var [, @var ]];
+# Current values of supplied variables are used as parameters.
+#
+# Send the server the order to execute the statement and supply values
+# for the input parameters needed.
+# If no error occurs the server reply will be identical to the reply for
+# the query used in PREPARE with question marks replaced with values of
+# the input variables.
+#
+SET @var= 2 ;
+EXECUTE stmt USING @var ;
+# The non prepared statement with the same server reply would be:
+select * from t1 where a = @var ;
+
+# 3. DEALLOCATE PREPARE stmt_name;
+#
+# Send the server the order to drop the parse informations.
+# The server will reply with "Query Ok" or an error message.
+DEALLOCATE PREPARE stmt ;
+
+################ PREPARE ################
+# prepare without parameter
+prepare stmt1 from ' select 1 as my_col ' ;
+# prepare with parameter
+prepare stmt1 from ' select ? as my_col ' ;
+# prepare must fail (incomplete statements/wrong syntax)
+--error 1064
+prepare ;
+--error 1064
+prepare stmt1 ;
+--error 1064
+prepare stmt1 from ;
+--error 1064
+prepare_garbage stmt1 from ' select 1 ' ;
+--error 1064
+prepare stmt1 from_garbage ' select 1 ' ;
+--error 1064
+prepare stmt1 from ' select_garbage 1 ' ;
+--error 1064
+prepare from ' select 1 ' ;
+--error 1064
+prepare stmt1 ' select 1 ' ;
+--error 1064
+prepare ? from ' select ? as my_col ' ;
+# statement in variable
+set @arg00='select 1 as my_col';
+prepare stmt1 from @arg00;
+# prepare must fail (query variable is empty)
+set @arg00='';
+--error 1065
+prepare stmt1 from @arg00;
+set @arg00=NULL;
+# prepare must fail (query variable is NULL)
+--error 1064
+prepare stmt1 from @arg01;
+
+prepare stmt1 from ' select * from t1 where a <= 2 ' ;
+# prepare must fail (column x does not exist)
+--error 1054
+prepare stmt1 from ' select * from t1 where x <= 2 ' ;
+# cases derived from client_test.c: test_null()
+# prepare must fail (column x does not exist)
+--error 1054
+prepare stmt1 from ' insert into t1(a,x) values(?,?) ' ;
+--error 1054
+prepare stmt1 from ' insert into t1(x,a) values(?,?) ' ;
+--disable_warnings
+drop table if exists not_exist ;
+--enable_warnings
+# prepare must fail (table does not exist)
+--error 1146
+prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
+
+# case derived from client_test.c: test_prepare_syntax()
+# prepare must fail (incomplete statement)
+--error 1064
+prepare stmt1 from ' insert into t1 values(? ' ;
+--error 1064
+prepare stmt1 from ' select a, b from t1
+ where a=? and where ' ;
+
+################ EXECUTE ################
+# execute must fail (statement never_prepared never prepared)
+--error 1243
+execute never_prepared ;
+# execute must fail (prepare stmt1 just failed,
+# but there was a successful prepare of stmt1 before)
+prepare stmt1 from ' select * from t1 where a <= 2 ' ;
+--error 1146
+prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
+--error 1243
+execute stmt1 ;
+
+# drop the table between prepare and execute
+create table t5
+(
+ a int primary key,
+ b char(30),
+ c int
+);
+insert into t5( a, b, c) values( 1, 'original table', 1);
+prepare stmt2 from ' select * from t5 ' ;
+execute stmt2 ;
+drop table t5 ;
+# execute must fail (table was dropped after prepare)
+--error 1146
+execute stmt2 ;
+# cases derived from client_test.c: test_select_prepare()
+# 1. drop + create table (same column names/types/order)
+# between prepare and execute
+create table t5
+(
+ a int primary key,
+ b char(30),
+ c int
+);
+insert into t5( a, b, c) values( 9, 'recreated table', 9);
+execute stmt2 ;
+drop table t5 ;
+# 2. drop + create table (same column names/types but different order)
+# between prepare and execute
+create table t5
+(
+ a int primary key,
+ c int,
+ b char(30)
+);
+insert into t5( a, b, c) values( 9, 'recreated table', 9);
+execute stmt2 ;
+drop table t5 ;
+# 3. drop + create table (same column names/types/order+extra column)
+# between prepare and execute
+create table t5
+(
+ a int primary key,
+ b char(30),
+ c int,
+ d timestamp default current_timestamp
+);
+insert into t5( a, b, c) values( 9, 'recreated table', 9);
+execute stmt2 ;
+drop table t5 ;
+# 4. drop + create table (same column names/types, different order +
+# additional column) between prepare and execute
+create table t5
+(
+ a int primary key,
+ d timestamp default current_timestamp,
+ b char(30),
+ c int
+);
+insert into t5( a, b, c) values( 9, 'recreated table', 9);
+execute stmt2 ;
+drop table t5 ;
+# 5. drop + create table (same column names/order, different types)
+# between prepare and execute
+create table t5
+(
+ a timestamp default '2004-02-29 18:01:59',
+ b char(30),
+ c int
+);
+insert into t5( b, c) values( 'recreated table', 9);
+execute stmt2 ;
+drop table t5 ;
+# 6. drop + create table (same column types/order, different names)
+# between prepare and execute
+create table t5
+(
+ f1 int primary key,
+ f2 char(30),
+ f3 int
+);
+insert into t5( f1, f2, f3) values( 9, 'recreated table', 9);
+--error 1054
+execute stmt2 ;
+drop table t5 ;
+
+# execute without parameter
+prepare stmt1 from ' select * from t1 where a <= 2 ' ;
+execute stmt1 ;
+# execute with parameter
+set @arg00=1 ;
+set @arg01='two' ;
+prepare stmt1 from ' select * from t1 where a <= ? ' ;
+execute stmt1 using @arg00;
+# execute must fail (too small number of parameters)
+--error 1210
+execute stmt1 ;
+# execute must fail (too big number of parameters)
+--error 1210
+execute stmt1 using @arg00, @arg01;
+# execute must fail (parameter is not set)
+execute stmt1 using @not_set;
+
+################ DEALLOCATE ################
+# deallocate must fail (the statement 'never_prepared' was never prepared)
+--error 1243
+deallocate prepare never_prepared ;
+# deallocate must fail (prepare stmt1 just failed,
+# but there was a successful prepare before)
+prepare stmt1 from ' select * from t1 where a <= 2 ' ;
+--error 1146
+prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
+--error 1243
+deallocate prepare stmt1;
+create table t5
+(
+ a int primary key,
+ b char(10)
+);
+prepare stmt2 from ' select a,b from t5 where a <= 2 ' ;
+drop table t5 ;
+# deallocate prepared statement where the table was dropped after prepare
+deallocate prepare stmt2;
+
+## parallel use of more than one prepared statement handlers
+# switch between different queries
+prepare stmt1 from ' select a from t1 where a <= 2 ' ;
+prepare stmt2 from ' select b from t1 where a <= 2 ' ;
+execute stmt2 ;
+execute stmt1 ;
+# switch between statement handlers of the same query
+prepare stmt1 from ' select a from t1 where a <= 2 ' ;
+prepare stmt2 from ' select a from t1 where a <= 2 ' ;
+execute stmt2 ;
+execute stmt1 ;
+deallocate prepare stmt1 ;
+# Will the deallocate of stmt1 with the same query affect stmt2 ?
+execute stmt2 ;
+
+--disable_query_log
+select '------ show and misc tests ------' as test_sequence ;
+--enable_query_log
+
+--disable_warnings
+drop table if exists t2;
+--enable_warnings
+create table t2
+(
+ a int primary key, b char(10)
+);
+
+################ SHOW COMMANDS ################
+prepare stmt4 from ' show databases ';
+execute stmt4;
+prepare stmt4 from ' show tables from test like ''t2%'' ';
+execute stmt4;
+prepare stmt4 from ' show columns from t2 from test like ''a%'' ';
+execute stmt4;
+create index t2_idx on t2(b);
+prepare stmt4 from ' show index from t2 from test ';
+execute stmt4;
+prepare stmt4 from ' show table status from test like ''t2%'' ';
+# egalize date and time values
+--replace_column 12 # 13 # 14 #
+--replace_result 2147483647 64424509439
+# Bug#4288 : prepared statement 'show table status ..', wrong output on execute
+execute stmt4;
+# try the same with the big table
+prepare stmt4 from ' show table status from test like ''t9%'' ';
+# egalize date and time values
+--replace_column 12 # 13 # 14 #
+--replace_result 2147483647 4294967295
+# Bug#4288
+execute stmt4;
+prepare stmt4 from ' show status like ''Threads_running'' ';
+execute stmt4;
+prepare stmt4 from ' show variables like ''sql_mode'' ';
+execute stmt4;
+prepare stmt4 from ' show engine bdb logs ';
+# The output depends on the history (actions of the bdb engine).
+# That is the reason why, we switch the output here off.
+# (The real output will be tested in ps_6bdb.test)
+# --replace_result $MYSQL_TEST_DIR TEST_DIR
+--disable_result_log
+execute stmt4;
+--enable_result_log
+prepare stmt4 from ' show full processlist ';
+--replace_column 1 number
+execute stmt4;
+prepare stmt4 from ' show grants for user ';
+--error 1295
+prepare stmt4 from ' show create table t2 ';
+--error 1295
+prepare stmt4 from ' show master status ';
+--error 1295
+prepare stmt4 from ' show master logs ';
+--error 1295
+prepare stmt4 from ' show slave status ';
+--error 1295
+prepare stmt4 from ' show warnings limit 20 ';
+--error 1295
+prepare stmt4 from ' show errors limit 20 ';
+prepare stmt4 from ' show storage engines ';
+--replace_column 2 YES/NO
+execute stmt4;
+
+################ MISC STUFF ################
+## get a warning and an error
+# cases derived from client_test.c: test_warnings(), test_errors()
+--disable_warnings
+drop table if exists t5;
+--enable_warnings
+prepare stmt1 from ' drop table if exists t5 ' ;
+execute stmt1 ;
+prepare stmt1 from ' drop table t5 ' ;
+--error 1051
+execute stmt1 ;
+
+## SELECT @@version
+# cases derived from client_test.c: test_select_version()
+#
+# TODO: Metadata check is temporary disabled here, because metadata of
+# this statement also depends on @@version contents and you can't apply
+# replace_column and replace_result to it. It will be enabled again when
+# support of replace_column and replace_result on metadata will be
+# implemented.
+#
+#--enable_metadata
+prepare stmt1 from ' SELECT @@version ' ;
+# egalize the version
+--replace_column 1 <version>
+execute stmt1 ;
+#--disable_metadata
+
+## do @var:= and set @var=
+# cases derived from client_test.c: test_do_set()
+prepare stmt_do from ' do @var:= (1 in (select a from t1)) ' ;
+prepare stmt_set from ' set @var= (1 in (select a from t1)) ' ;
+let $1= 3 ;
+while ($1)
+{
+ execute stmt_do ;
+ --disable_query_log
+ select @var as 'content of @var is:' ;
+ --enable_query_log
+ execute stmt_set ;
+ --disable_query_log
+ select @var as 'content of @var is:' ;
+ --enable_query_log
+ dec $1 ;
+}
+# the same test with a table containing one column and 'select *'
+--disable_warnings
+drop table if exists t5 ;
+--enable_warnings
+create table t5 (a int) ;
+prepare stmt_do from ' do @var:= (1 in (select a from t5)) ' ;
+prepare stmt_set from ' set @var= (1 in (select a from t5)) ' ;
+let $1= 3 ;
+while ($1)
+{
+ execute stmt_do ;
+ --disable_query_log
+ select @var as 'content of @var is:' ;
+ --enable_query_log
+ execute stmt_set ;
+ --disable_query_log
+ select @var as 'content of @var is:' ;
+ --enable_query_log
+ dec $1 ;
+}
+drop table t5 ;
+deallocate prepare stmt_do ;
+deallocate prepare stmt_set ;
+
+## nonsense like prepare of prepare,execute or deallocate
+--error 1064
+prepare stmt1 from ' prepare stmt2 from '' select 1 '' ' ;
+--error 1064
+prepare stmt1 from ' execute stmt2 ' ;
+--error 1064
+prepare stmt1 from ' deallocate prepare never_prepared ' ;
+
+## switch the database connection
+--error 1295
+prepare stmt4 from ' use test ' ;
+
+## create/drop database
+--error 1295
+prepare stmt3 from ' create database mysqltest ';
+create database mysqltest ;
+--error 1295
+prepare stmt3 from ' drop database mysqltest ';
+drop database mysqltest ;
+
+## grant/revoke + drop user
+--error 1295
+prepare stmt3 from ' grant all on test.t1 to drop_user@localhost
+identified by ''looser'' ';
+grant all on test.t1 to drop_user@localhost
+identified by 'looser' ;
+--error 1295
+prepare stmt3 from ' revoke all privileges on test.t1 from
+drop_user@localhost ';
+revoke all privileges on test.t1 from drop_user@localhost ;
+--error 1295
+prepare stmt3 from ' drop user drop_user@localhost ';
+drop user drop_user@localhost;
+
+#### table related commands
+## describe
+prepare stmt3 from ' describe t2 ';
+execute stmt3;
+drop table t2 ;
+--error 1146
+execute stmt3;
+## lock/unlock
+--error 1295
+prepare stmt3 from ' lock tables t1 read ' ;
+--error 1295
+prepare stmt3 from ' unlock tables ' ;
+## Load/Unload table contents
+--error 1295
+prepare stmt1 from ' load data infile ''data.txt''
+into table t1 fields terminated by ''\t'' ';
+prepare stmt1 from ' select * into outfile ''data.txt'' from t1 ';
+execute stmt1 ;
+##
+--error 1295
+prepare stmt1 from ' optimize table t1 ' ;
+--error 1295
+prepare stmt1 from ' analyze table t1 ' ;
+--error 1295
+prepare stmt1 from ' checksum table t1 ' ;
+--error 1295
+prepare stmt1 from ' repair table t1 ' ;
+--error 1295
+prepare stmt1 from ' restore table t1 from ''data.txt'' ' ;
+## handler
+--error 1295
+prepare stmt1 from ' handler t1 open ';
+
+
+## commit/rollback
+--error 1295
+prepare stmt3 from ' commit ' ;
+--error 1295
+prepare stmt3 from ' rollback ' ;
+
+
+## switch the sql_mode
+prepare stmt4 from ' SET sql_mode=ansi ';
+execute stmt4;
+# check if the sql_mode is now ansi
+select 'a' || 'b' ;
+prepare stmt4 from ' SET sql_mode="" ';
+execute stmt4;
+# check if the sql_mode is not ansi
+select 'a' || 'b' ;
+# Will a switch of the sqlmode affect the execution of already prepared
+# statements ?
+prepare stmt5 from ' select ''a'' || ''b'' ' ;
+execute stmt5;
+SET sql_mode=ansi;
+execute stmt5;
+SET sql_mode="";
+
+--error 1295
+prepare stmt1 from ' flush local privileges ' ;
+--error 1295
+prepare stmt1 from ' reset query cache ' ;
+--error 1295
+prepare stmt1 from ' KILL 0 ';
+
+## simple explain
+# cases derived from client_test.c: test_explain_bug()
+prepare stmt1 from ' explain select a from t1 order by b ';
+# PS protocol gives slightly different metadata
+--disable_ps_protocol
+--enable_metadata
+execute stmt1;
+--disable_metadata
+SET @arg00=1 ;
+prepare stmt1 from ' explain select a from t1 where a > ? order by b ';
+--enable_metadata
+execute stmt1 using @arg00;
+--disable_metadata
+--enable_ps_protocol
+
+## parameters with probably problematic characters (quote, double quote)
+# cases derived from client_test.c: test_logs()
+# try if
+--disable_warnings
+drop table if exists t2;
+--enable_warnings
+create table t2 (id smallint, name varchar(20)) ;
+prepare stmt1 from ' insert into t2 values(?, ?) ' ;
+set @id= 9876 ;
+set @arg00= 'MySQL - Open Source Database' ;
+set @arg01= "'" ;
+set @arg02= '"' ;
+set @arg03= "my'sql'" ;
+set @arg04= 'my"sql"' ;
+insert into t2 values ( @id , @arg00 );
+insert into t2 values ( @id , @arg01 );
+insert into t2 values ( @id , @arg02 );
+insert into t2 values ( @id , @arg03 );
+insert into t2 values ( @id , @arg04 );
+prepare stmt1 from ' select * from t2 where id= ? and name= ? ';
+execute stmt1 using @id, @arg00 ;
+execute stmt1 using @id, @arg01 ;
+execute stmt1 using @id, @arg02 ;
+execute stmt1 using @id, @arg03 ;
+execute stmt1 using @id, @arg04 ;
+drop table t2;
+
+################ CREATE/DROP/ALTER/RENAME TESTS ################
+--disable_query_log
+select '------ create/drop/alter/rename tests ------' as test_sequence ;
+--enable_query_log
+
+--disable_warnings
+drop table if exists t2, t3;
+--enable_warnings
+
+## DROP TABLE
+prepare stmt_drop from ' drop table if exists t2 ' ;
+--disable_warnings
+execute stmt_drop;
+--enable_warnings
+
+## CREATE TABLE
+prepare stmt_create from ' create table t2 (
+ a int primary key, b char(10)) ';
+execute stmt_create;
+prepare stmt3 from ' create table t3 like t2 ';
+execute stmt3;
+drop table t3;
+
+## CREATE TABLE .. SELECT
+set @arg00=1;
+prepare stmt3 from ' create table t3 (m int) select ? as m ' ;
+# Bug#4280 server hangs, prepared "create table .. as select ? .."
+execute stmt3 using @arg00;
+select m from t3;
+drop table t3;
+
+--error 1295
+prepare stmt3 from ' create index t2_idx on t2(b) ';
+--error 1295
+prepare stmt3 from ' drop index t2_idx on t2 ' ;
+--error 1295
+prepare stmt3 from ' alter table t2 drop primary key ';
+
+## RENAME TABLE
+--disable_warnings
+drop table if exists new_t2;
+--enable_warnings
+prepare stmt3 from ' rename table t2 to new_t2 ';
+execute stmt3;
+--error 1050
+execute stmt3;
+rename table new_t2 to t2;
+drop table t2;
+## RENAME more than on TABLE within one statement
+# cases derived from client_test.c: test_rename()
+prepare stmt1 from ' rename table t5 to t6, t7 to t8 ' ;
+create table t5 (a int) ;
+# rename must fail, t7 does not exist
+--error 1017
+execute stmt1 ;
+create table t7 (a int) ;
+# rename, t5 -> t6 and t7 -> t8
+execute stmt1 ;
+# rename must fail, t5 and t7 does not exist t6 and t8 already exist
+--error 1050
+execute stmt1 ;
+rename table t6 to t5, t8 to t7 ;
+# rename, t5 -> t6 and t7 -> t8
+execute stmt1 ;
+drop table t6, t8 ;
+
+
+################ BIG STATEMENT TESTS ################
+--disable_query_log
+select '------ big statement tests ------' as test_sequence ;
+--enable_query_log
+# The following tests use huge numbers of lines, characters or parameters
+# per prepared statement.
+# I assume the server and also the client (mysqltest) are stressed.
+#
+# Attention: The limits used are NOT derived from the manual
+# or other sources.
+
+## many lines ( 50 )
+let $my_stmt= select 'ABC' as my_const_col from t1 where
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 AND
+1 = 1 ;
+eval ($my_stmt) ;
+eval prepare stmt1 from "$my_stmt" ;
+execute stmt1 ;
+execute stmt1 ;
+
+## many characters ( about 1400 )
+
+let $my_stmt= select 'ABC' as my_const_col FROM t1 WHERE
+'1234567890123456789012345678901234567890123456789012345678901234567890'
+= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
+'1234567890123456789012345678901234567890123456789012345678901234567890'
+= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
+'1234567890123456789012345678901234567890123456789012345678901234567890'
+= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
+'1234567890123456789012345678901234567890123456789012345678901234567890'
+= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
+'1234567890123456789012345678901234567890123456789012345678901234567890'
+= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
+'1234567890123456789012345678901234567890123456789012345678901234567890'
+= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
+'1234567890123456789012345678901234567890123456789012345678901234567890'
+= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
+'1234567890123456789012345678901234567890123456789012345678901234567890'
+= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
+'1234567890123456789012345678901234567890123456789012345678901234567890'
+= '1234567890123456789012345678901234567890123456789012345678901234567890' ;
+eval ($my_stmt) ;
+eval prepare stmt1 from "$my_stmt" ;
+execute stmt1 ;
+execute stmt1 ;
+
+
+## many parameters ( 50 )
+--disable_query_log
+set @arg00= 1;
+set @arg01= 1;
+set @arg02= 1;
+set @arg03= 1;
+set @arg04= 1;
+set @arg05= 1;
+set @arg06= 1;
+set @arg07= 1;
+set @arg10= 1;
+set @arg11= 1;
+set @arg12= 1;
+set @arg13= 1;
+set @arg14= 1;
+set @arg15= 1;
+set @arg16= 1;
+set @arg17= 1;
+set @arg20= 1;
+set @arg21= 1;
+set @arg22= 1;
+set @arg23= 1;
+set @arg24= 1;
+set @arg25= 1;
+set @arg26= 1;
+set @arg27= 1;
+set @arg30= 1;
+set @arg31= 1;
+set @arg32= 1;
+set @arg33= 1;
+set @arg34= 1;
+set @arg35= 1;
+set @arg36= 1;
+set @arg37= 1;
+set @arg40= 1;
+set @arg41= 1;
+set @arg42= 1;
+set @arg43= 1;
+set @arg44= 1;
+set @arg45= 1;
+set @arg46= 1;
+set @arg47= 1;
+set @arg50= 1;
+set @arg51= 1;
+set @arg52= 1;
+set @arg53= 1;
+set @arg54= 1;
+set @arg55= 1;
+set @arg56= 1;
+set @arg57= 1;
+set @arg60= 1;
+set @arg61= 1;
+--enable_query_log
+
+select 'ABC' as my_const_col FROM t1 WHERE
+@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
+@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
+@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
+@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
+@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
+@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
+@arg00=@arg00 ;
+prepare stmt1 from ' select ''ABC'' as my_const_col FROM t1 WHERE
+ ? = ? and ? = ? and ? = ? and ? = ? and
+ ? = ? and ? = ? and ? = ? and ? = ? and
+ ? = ? and ? = ? and ? = ? and ? = ? and
+ ? = ? and ? = ? and ? = ? and ? = ? and
+ ? = ? and ? = ? and ? = ? and ? = ? and
+ ? = ? and ? = ? and ? = ? and ? = ? and
+ ? = ? ' ;
+execute stmt1 using
+@arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00;
+execute stmt1 using
+@arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07,
+@arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17,
+@arg20, @arg21, @arg22, @arg23, @arg24, @arg25, @arg26, @arg27,
+@arg30, @arg31, @arg32, @arg33, @arg34, @arg35, @arg36, @arg37,
+@arg40, @arg41, @arg42, @arg43, @arg44, @arg45, @arg46, @arg47,
+@arg50, @arg51, @arg52, @arg53, @arg54, @arg55, @arg56, @arg57,
+@arg60, @arg61 ;
+
+# cases derived from client_test.c: test_mem_overun()
+--disable_warnings
+drop table if exists t5 ;
+--enable_warnings
+
+set @col_num= 1000 ;
+
+--disable_query_log
+set @string= 'create table t5( ' ;
+let $1=`select @col_num - 1` ;
+while ($1)
+{
+ eval set @string= concat(@string, 'c$1 int,') ;
+ dec $1 ;
+}
+set @string= concat(@string, 'c0 int)' );
+--enable_query_log
+select @string as "" ;
+prepare stmt1 from @string ;
+execute stmt1 ;
+
+--disable_query_log
+set @string= 'insert into t5 values(' ;
+let $1=`select @col_num - 1` ;
+while ($1)
+{
+ eval set @string= concat(@string, '1 ,') ;
+ dec $1 ;
+}
+eval set @string= concat(@string, '1 )') ;
+--enable_query_log
+select @string as "" ;
+prepare stmt1 from @string ;
+execute stmt1 ;
+
+prepare stmt1 from ' select * from t5 ' ;
+--enable_metadata
+# prevent too long lines
+--vertical_results
+--disable_result_log
+execute stmt1 ;
+--enable_result_log
+--disable_metadata
+--horizontal_results
+
+drop table t5 ;
+
+
+################ GRANT/REVOKE/DROP affecting a parallel session ################
+--disable_query_log
+select '------ grant/revoke/drop affects a parallel session test ------'
+ as test_sequence ;
+--enable_query_log
+
+#---------------------------------------------------------------------#
+# Here we test that:
+# 1. A new GRANT will be visible within another sessions. #
+# #
+# Let's assume there is a parallel session with an already prepared #
+# statement for a table. #
+# A DROP TABLE will affect the EXECUTE properties. #
+# A REVOKE will affect the EXECUTE properties. #
+#---------------------------------------------------------------------#
+
+# Who am I ?
+# this is different across different systems:
+# select current_user(), user() ;
+
+#### create a new user account ####
+## There should be no grants for that non existing user
+--error 1141
+show grants for second_user@localhost ;
+## create a new user account by using GRANT statements on t9
+create database mysqltest;
+# create the tables (t1 and t9) used in many tests
+use mysqltest;
+--disable_query_log
+--source include/ps_create.inc
+--source include/ps_renew.inc
+--enable_query_log
+eval use $DB;
+grant usage on mysqltest.* to second_user@localhost
+identified by 'looser' ;
+grant select on mysqltest.t9 to second_user@localhost
+identified by 'looser' ;
+show grants for second_user@localhost ;
+
+
+#### establish a second session to the new user account
+connect (con3,localhost,second_user,looser,mysqltest);
+## switch to the second session
+connection con3;
+# Who am I ?
+select current_user();
+## check the access rights
+show grants for current_user();
+prepare s_t9 from 'select c1 as my_col
+ from t9 where c1= 1' ;
+execute s_t9 ;
+# check that we cannot do a SELECT on the table t1;
+--error 1142
+select a as my_col from t1;
+
+
+#### give access rights to t1 and drop table t9
+## switch back to the first session
+connection default;
+grant select on mysqltest.t1 to second_user@localhost
+identified by 'looser' ;
+show grants for second_user@localhost ;
+drop table mysqltest.t9 ;
+show grants for second_user@localhost ;
+
+
+#### check the access as new user
+## switch to the second session
+connection con3;
+######## Question 1: The table t1 should be now accessible. ########
+show grants for second_user@localhost ;
+prepare s_t1 from 'select a as my_col from t1' ;
+execute s_t1 ;
+######## Question 2: The table t9 does not exist. ########
+--error 1146
+execute s_t9 ;
+
+
+#### revoke the access rights to t1
+## switch back to the first session
+connection default;
+revoke all privileges on mysqltest.t1 from second_user@localhost
+identified by 'looser' ;
+show grants for second_user@localhost ;
+
+#### check the access as new user
+## switch to the second session
+connection con3;
+show grants for second_user@localhost ;
+######## Question 2: The table t1 should be now not accessible. ########
+--error 1142
+execute s_t1 ;
+
+## cleanup
+## switch back to the first session
+connection default;
+## disconnect the second session
+disconnect con3 ;
+## remove all rights of second_user@localhost
+revoke all privileges, grant option from second_user@localhost ;
+show grants for second_user@localhost ;
+drop user second_user@localhost ;
+commit ;
+--error 1141
+show grants for second_user@localhost ;
+
+drop table t1,t9 ;
+drop database mysqltest;
+
+
+##### RULES OF THUMB TO PRESERVE THE SYSTEMATICS OF THE PS TEST CASES #####
+#
+# 0. You don't have the time to
+# - read and pay attention to these rules of thumb
+# - accept that QA may move your test case to a different place
+# (I will not change your code!!) .
+# Please append your test case to
+# t/ps.test
+#
+# 1. You have more time and want to get as much value from you test case as
+# possible. Please try to make the following decisions:
+#
+# Will the execution or result of the sub test case depend on the
+# properties of a storage engine ?
+#
+# NO --> alter t/ps_1general.test (Example: Command with syntax error)
+# If you need a table, please try to use
+# t1 - very simple table
+# t9 - table with nearly all available column types
+# whenever possible.
+#
+# The structure and the content of these tables can be found in
+# include/ps_create.inc CREATE TABLE ...
+# include/ps_renew.inc DELETE all rows and INSERT some rows
+#
+# Both tables are managed by the same storage engine.
+# The type of the storage engine is stored in the variable
+# '$type' . In ps_1general.test $type is set to 'MYISAM'.
+#
+# Please feel free to source ps_create.inc or ps_renew.inc
+# whenever you think it helps. But please restore the original
+# state of these tables after your tests, because the following
+# statements may depend on it.
+#
+# YES
+# |
+# |
+# Is it possible to apply the sub test case to all table types ?
+# YES --> alter include/ps_query.inc (for SELECTs)
+# include/ps_modify.inc (for INSERT/UPDATE/DELETE)
+# include/ps_modify1.inc (also for INSERT/UPDATE/DELETE,
+# but t/ps_5merge.test will not source that file)
+# Please try to find an appropriate place within the file.
+# It would be nice if we have some systematics in the
+# order of the sub test cases (if possible).
+#
+# Please be aware, that
+# include: ps_query.inc, ps_modify.inc, ps_modify1.inc
+# will be sourced by several test case files stored within the
+# subdirectory 't'. So every change here will affect several test
+# cases.
+#
+# NO
+# |
+# |
+# Append the sub test case to the appropriate
+# ps_<number><table type>.test .
+#
+# 2. The current structure of the PS tests
+#
+# t/ps_1general.test Check of basic PS features, SHOW commands and DDL
+# The tests should not depend on the table type.
+#
+# t/ps_2myisam Check of PS on tables of type MYISAM .
+# t/ps_3innodb Check of PS on tables of type InnoDB .
+# ...
+# t/ps_6bdb Check of PS on tables of type BDB .
+# All storage engine related tests use the variable $type to hold the
+# name of the storage engine.
+#
+# include/ps_query.inc test cases with SELECT/...
+# These test cases should not modify the content or
+# the structure (DROP/ALTER..) of the tables
+# 't1' and 't9'.
+# include/ps_modify.inc test cases with INSERT/UPDATE/...
+# These test cases should not modify the structure
+# (DROP/ALTER..) of the tables
+# 't1' and 't9'.
+# These two test sequences will be applied to all table types .
+#
+# include/ps_modify1.inc test cases with INSERT/UPDATE/...
+# This test sequences will be applied to all table types
+# except MERGE tables.
+#
+# include/ps_create.inc DROP and CREATE of the tables
+# 't1' and 't9' .
+# include/ps_renew.inc DELETE all rows and INSERT some rows, that means
+# recreate the original content of these tables.
+# Please do not alter the commands concerning these two tables.
+#
+# Please feel free and encouraged to exploit the current code sharing
+# mechanism of the 'ps_<number><table type>' test cases. It is an convenient
+# way to check all storage engines.
+#
+# Thank you for reading these rules of thumb.
+#
+# Matthias
diff --git a/mysql-test/t/ps_2myisam.test b/mysql-test/t/ps_2myisam.test
new file mode 100644
index 00000000000..534703efc14
--- /dev/null
+++ b/mysql-test/t/ps_2myisam.test
@@ -0,0 +1,42 @@
+###############################################
+# #
+# Prepared Statements test on MYISAM tables #
+# #
+###############################################
+
+#
+# NOTE: PLEASE SEE ps_1general.test (bottom)
+# BEFORE ADDING NEW TEST CASES HERE !!!
+
+use test;
+
+let $type= 'MYISAM' ;
+-- source include/ps_create.inc
+-- source include/ps_renew.inc
+
+-- source include/ps_query.inc
+
+# parameter in SELECT ... MATCH/AGAINST
+# case derived from client_test.c: test_bug1500()
+--disable_warnings
+drop table if exists t2 ;
+--enable_warnings
+eval create table t2 (s varchar(25), fulltext(s))
+ENGINE = $type ;
+insert into t2 values ('Gravedigger'), ('Greed'),('Hollow Dogs') ;
+commit ;
+
+prepare stmt1 from ' select s from t2 where match (s) against (?) ' ;
+set @arg00='Dogs' ;
+execute stmt1 using @arg00 ;
+prepare stmt1 from ' SELECT s FROM t2
+where match (s) against (concat(?,''digger'')) ';
+set @arg00='Grave' ;
+execute stmt1 using @arg00 ;
+drop table t2 ;
+
+-- source include/ps_modify.inc
+-- source include/ps_modify1.inc
+-- source include/ps_conv.inc
+
+drop table t1, t9;
diff --git a/mysql-test/t/ps_3innodb.test b/mysql-test/t/ps_3innodb.test
new file mode 100644
index 00000000000..f83b61914a2
--- /dev/null
+++ b/mysql-test/t/ps_3innodb.test
@@ -0,0 +1,24 @@
+###############################################
+# #
+# Prepared Statements test on InnoDB tables #
+# #
+###############################################
+
+#
+# NOTE: PLEASE SEE ps_1general.test (bottom)
+# BEFORE ADDING NEW TEST CASES HERE !!!
+
+use test;
+
+-- source include/have_innodb.inc
+
+let $type= 'InnoDB' ;
+-- source include/ps_create.inc
+-- source include/ps_renew.inc
+
+-- source include/ps_query.inc
+-- source include/ps_modify.inc
+-- source include/ps_modify1.inc
+-- source include/ps_conv.inc
+
+drop table t1, t9;
diff --git a/mysql-test/t/ps_4heap.test b/mysql-test/t/ps_4heap.test
new file mode 100644
index 00000000000..a7b2e332af4
--- /dev/null
+++ b/mysql-test/t/ps_4heap.test
@@ -0,0 +1,49 @@
+###############################################
+# #
+# Prepared Statements test on HEAP tables #
+# #
+###############################################
+
+#
+# NOTE: PLEASE SEE ps_1general.test (bottom)
+# BEFORE ADDING NEW TEST CASES HERE !!!
+
+use test;
+
+let $type= 'HEAP' ;
+--disable_warnings
+drop table if exists t1, t9 ;
+--enable_warnings
+eval create table t1
+(
+ a int, b varchar(30),
+ primary key(a)
+) engine = $type ;
+
+--disable_warnings
+drop table if exists t9;
+--enable_warnings
+# The used table type doesn't support BLOB/TEXT columns.
+# (The server would send error 1163 .)
+# So we use char(100) instead.
+eval create table t9
+(
+ c1 tinyint, c2 smallint, c3 mediumint, c4 int,
+ c5 integer, c6 bigint, c7 float, c8 double,
+ c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
+ c13 date, c14 datetime, c15 timestamp(14), c16 time,
+ c17 year, c18 bit, c19 bool, c20 char,
+ c21 char(10), c22 varchar(30), c23 char(100), c24 char(100),
+ c25 char(100), c26 char(100), c27 char(100), c28 char(100),
+ c29 char(100), c30 char(100), c31 enum('one', 'two', 'three'),
+ c32 set('monday', 'tuesday', 'wednesday'),
+ primary key(c1)
+) engine = $type ;
+-- source include/ps_renew.inc
+
+-- source include/ps_query.inc
+-- source include/ps_modify.inc
+-- source include/ps_modify1.inc
+-- source include/ps_conv.inc
+
+drop table t1, t9;
diff --git a/mysql-test/t/ps_5merge.test b/mysql-test/t/ps_5merge.test
new file mode 100644
index 00000000000..9a79842709c
--- /dev/null
+++ b/mysql-test/t/ps_5merge.test
@@ -0,0 +1,84 @@
+###############################################
+# #
+# Prepared Statements test on MERGE tables #
+# #
+###############################################
+
+#
+# NOTE: PLEASE SEE ps_1general.test (bottom)
+# BEFORE ADDING NEW TEST CASES HERE !!!
+
+use test;
+
+--disable_warnings
+drop table if exists t1, t1_1, t1_2,
+ t9, t9_1, t9_2;
+--enable_warnings
+let $type= 'MYISAM' ;
+-- source include/ps_create.inc
+rename table t1 to t1_1, t9 to t9_1 ;
+-- source include/ps_create.inc
+rename table t1 to t1_2, t9 to t9_2 ;
+
+create table t1
+(
+ a int, b varchar(30),
+ primary key(a)
+) ENGINE = MERGE UNION=(t1_1,t1_2)
+INSERT_METHOD=FIRST;
+create table t9
+(
+ c1 tinyint, c2 smallint, c3 mediumint, c4 int,
+ c5 integer, c6 bigint, c7 float, c8 double,
+ c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
+ c13 date, c14 datetime, c15 timestamp(14), c16 time,
+ c17 year, c18 bit, c19 bool, c20 char,
+ c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
+ c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
+ c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
+ c32 set('monday', 'tuesday', 'wednesday'),
+ primary key(c1)
+) ENGINE = MERGE UNION=(t9_1,t9_2)
+INSERT_METHOD=FIRST;
+-- source include/ps_renew.inc
+
+-- source include/ps_query.inc
+-- source include/ps_modify.inc
+# no test of ps_modify1, because insert .. select
+# is not allowed on MERGE tables
+# -- source include/ps_modify1.inc
+-- source include/ps_conv.inc
+
+# Lets's try the same tests with INSERT_METHOD=LAST
+drop table t1, t9 ;
+create table t1
+(
+ a int, b varchar(30),
+ primary key(a)
+) ENGINE = MERGE UNION=(t1_1,t1_2)
+INSERT_METHOD=LAST;
+create table t9
+(
+ c1 tinyint, c2 smallint, c3 mediumint, c4 int,
+ c5 integer, c6 bigint, c7 float, c8 double,
+ c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
+ c13 date, c14 datetime, c15 timestamp(14), c16 time,
+ c17 year, c18 bit, c19 bool, c20 char,
+ c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
+ c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
+ c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
+ c32 set('monday', 'tuesday', 'wednesday'),
+ primary key(c1)
+) ENGINE = MERGE UNION=(t9_1,t9_2)
+INSERT_METHOD=LAST;
+-- source include/ps_renew.inc
+
+-- source include/ps_query.inc
+-- source include/ps_modify.inc
+# no test of ps_modify1, because insert .. select
+# is not allowed on MERGE tables
+# -- source include/ps_modify1.inc
+-- source include/ps_conv.inc
+
+drop table t1, t1_1, t1_2,
+ t9_1, t9_2, t9;
diff --git a/mysql-test/t/ps_6bdb.test b/mysql-test/t/ps_6bdb.test
new file mode 100644
index 00000000000..5db3349279e
--- /dev/null
+++ b/mysql-test/t/ps_6bdb.test
@@ -0,0 +1,23 @@
+###############################################
+# #
+# Prepared Statements test on BDB tables #
+# #
+###############################################
+
+#
+# NOTE: PLEASE SEE ps_1general.test (bottom)
+# BEFORE ADDING NEW TEST CASES HERE !!!
+
+use test;
+
+-- source include/have_bdb.inc
+let $type= 'BDB' ;
+-- source include/ps_create.inc
+-- source include/ps_renew.inc
+
+-- source include/ps_query.inc
+-- source include/ps_modify.inc
+-- source include/ps_modify1.inc
+-- source include/ps_conv.inc
+
+drop table t1, t9;
diff --git a/mysql-test/t/ps_7ndb.test b/mysql-test/t/ps_7ndb.test
new file mode 100644
index 00000000000..b558f2f3c21
--- /dev/null
+++ b/mysql-test/t/ps_7ndb.test
@@ -0,0 +1,23 @@
+###############################################
+# #
+# Prepared Statements test on NDB tables #
+# #
+###############################################
+
+#
+# NOTE: PLEASE SEE ps_1general.test (bottom)
+# BEFORE ADDING NEW TEST CASES HERE !!!
+
+use test;
+
+-- source include/have_ndb.inc
+let $type= 'NDB' ;
+-- source include/ps_create.inc
+-- source include/ps_renew.inc
+
+-- source include/ps_query.inc
+-- source include/ps_modify.inc
+-- source include/ps_modify1.inc
+-- source include/ps_conv.inc
+
+drop table t1, t9;
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index 61fbadde1e1..d570073b1d2 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -11,8 +11,10 @@ flush query cache; # This crashed in some versions
flush query cache; # This crashed in some versions
reset query cache;
flush status;
+--disable_warnings
drop table if exists t1,t2,t3,t4,t11,t21;
drop database if exists mysqltest;
+--enable_warnings
#
# First simple test
@@ -43,7 +45,7 @@ create table t1 (a int not null);
insert into t1 values (1),(2),(3);
create table t2 (a int not null);
insert into t2 values (4),(5),(6);
-create table t3 (a int not null) type=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST;
+create table t3 (a int not null) engine=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST;
# insert
select * from t3;
select * from t3;
@@ -183,6 +185,7 @@ select RAND() from t1;
select UNIX_TIMESTAMP() from t1;
select USER() from t1;
select benchmark(1,1) from t1;
+explain extended select benchmark(1,1) from t1;
show status like "Qcache_queries_in_cache";
#
# Tests when the cache is filled
@@ -263,8 +266,9 @@ drop table t1;
#
# Charset convertion (cp1251_koi8 always present)
#
-create table t1 (a char(1) not null);
-insert into t1 values("á");
+create table t1 (a char(1) not null collate koi8r_general_ci);
+insert into t1 values(_koi8r"á");
+set CHARACTER SET koi8r;
select * from t1;
set CHARACTER SET cp1251_koi8;
select * from t1;
@@ -347,6 +351,40 @@ drop table t1;
show status like "Qcache_queries_in_cache";
#
+# Test of min result data unit size changing
+#
+show global variables like "query_cache_min_res_unit";
+set GLOBAL query_cache_min_res_unit=1001;
+show global variables like "query_cache_min_res_unit";
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+create table t2 (a int not null);
+insert into t2 values (1),(2),(3);
+select * from t1;
+select * from t1;
+select * from t2;
+select * from t2;
+show status like "Qcache_hits";
+show status like "Qcache_queries_in_cache";
+drop table t1;
+select a from t2;
+select a from t2;
+show status like "Qcache_hits";
+show status like "Qcache_queries_in_cache";
+drop table t2;
+set GLOBAL query_cache_min_res_unit=default;
+show global variables like "query_cache_min_res_unit";
+
+#
+# Case sensitive test
+#
+create table t1 (a int not null);
+insert into t1 values (1);
+select "aaa" from t1;
+select "AAA" from t1;
+drop table t1;
+
+#
# Test of query cache resizing
#
create table t1 (a int);
@@ -392,6 +430,7 @@ select * from t2;
show status like "Qcache_queries_in_cache";
select * from t3;
show status like "Qcache_queries_in_cache";
+update t1 set i=(select distinct 1 from (select * from t2) a);
drop table t1, t2, t3;
#
@@ -427,18 +466,21 @@ select * from t1 where id=2;
create table t1 (word char(20) not null);
select * from t1;
show status like "Qcache_queries_in_cache";
-load data infile '../../std_data/words.dat' into table t1;
+--replace_result $MYSQL_TEST_DIR TEST_DIR
+eval load data infile '$MYSQL_TEST_DIR/std_data/words.dat' into table t1;
show status like "Qcache_queries_in_cache";
+select count(*) from t1;
drop table t1;
#
# INTO OUTFILE/DUMPFILE test
#
-drop table if exists t1;
create table t1 (a int);
insert into t1 values (1),(2),(3);
show status like "Qcache_queries_in_cache";
-select * from t1 into outfile "query_caceh.out.file";
+select * from t1 into outfile "query_cache.out.file";
+--error 1086
+select * from t1 into outfile "query_cache.out.file";
select * from t1 limit 1 into dumpfile "query_cache.dump.file";
show status like "Qcache_queries_in_cache";
drop table t1;
@@ -456,7 +498,6 @@ show status like "Qcache_queries_in_cache";
SET OPTION SQL_SELECT_LIMIT=DEFAULT;
drop table t1;
-
#
# query cache crash on using same table twice in one query test
#
@@ -465,7 +506,6 @@ reset query cache;
flush status;
set GLOBAL query_cache_size=1048576;
-
create table t1 (a int not null);
insert into t1 values (1),(2),(3);
create table t2 (a text not null);
@@ -533,4 +573,103 @@ select * from t1;
drop table t1;
drop table t1;
-set GLOBAL query_cache_size=0;
+#
+# Test character set related variables:
+# character_set_result
+# character_set_client
+# charactet_set_connection/collation_connection
+# If at least one of the above variables has changed,
+# the cached query can't be reused. In the below test
+# absolutely the same query is used several times,
+# SELECT should fetch different results for every instance.
+# No hits should be produced.
+# New cache entry should appear for every SELECT.
+#
+SET NAMES koi8r;
+CREATE TABLE t1 (a char(1) character set koi8r);
+INSERT INTO t1 VALUES (_koi8r'á'),(_koi8r'Á');
+#
+# Run select
+#
+SELECT a,'Â','â'='Â' FROM t1;
+show status like "Qcache_hits";
+show status like "Qcache_queries_in_cache";
+#
+# Change collation_connection and run the same query again
+#
+set collation_connection=koi8r_bin;
+SELECT a,'Â','â'='Â' FROM t1;
+show status like "Qcache_hits";
+show status like "Qcache_queries_in_cache";
+#
+# Now change character_set_client and run the same query again
+#
+set character_set_client=cp1251;
+SELECT a,'Â','â'='Â' FROM t1;
+show status like "Qcache_hits";
+show status like "Qcache_queries_in_cache";
+#
+# And finally change character_set_results and run the same query again
+#
+set character_set_results=cp1251;
+SELECT a,'Â','â'='Â' FROM t1;
+show status like "Qcache_hits";
+show status like "Qcache_queries_in_cache";
+#
+# Keep things tidy
+#
+DROP TABLE t1;
+
+#
+# DROP current database test
+#
+CREATE TABLE t1 (a int(1));
+CREATE DATABASE mysqltest;
+USE mysqltest;
+DROP DATABASE mysqltest;
+SELECT * FROM test.t1;
+USE test;
+DROP TABLE t1;
+
+#
+# charset with NULL
+#
+set character_set_results=null;
+select @@character_set_results;
+set character_set_results=default;
+
+#
+# query cache and environment variables
+#
+# max_sort_length
+set GLOBAL query_cache_size=1355776;
+create table t1 (id int auto_increment primary key, c char(25));
+insert into t1 set c = repeat('x',24);
+insert into t1 set c = concat(repeat('x',24),'x');
+insert into t1 set c = concat(repeat('x',24),'w');
+insert into t1 set c = concat(repeat('x',24),'y');
+set max_sort_length=200;
+select c from t1 order by c, id;
+reset query cache;
+set max_sort_length=20;
+select c from t1 order by c, id;
+set max_sort_length=200;
+select c from t1 order by c, id;
+set max_sort_length=default;
+# sql_mode
+select '1' || '3' from t1;
+set SQL_MODE=oracle;
+select '1' || '3' from t1;
+set SQL_MODE=default;
+drop table t1;
+# group_concat_max_len
+create table t1 (a varchar(20), b int);
+insert into t1 values ('12345678901234567890', 1);
+set group_concat_max_len=10;
+select group_concat(a) FROM t1 group by b;
+set group_concat_max_len=1024;
+select group_concat(a) FROM t1 group by b;
+set group_concat_max_len=default;
+drop table t1;
+
+SET GLOBAL query_cache_size=0;
diff --git a/mysql-test/t/query_cache_merge.test b/mysql-test/t/query_cache_merge.test
index 02e316932a3..fef3f18df60 100644
--- a/mysql-test/t/query_cache_merge.test
+++ b/mysql-test/t/query_cache_merge.test
@@ -25,7 +25,7 @@ while ($1)
}
--enable_warnings
-create table t00 (a int) type=MERGE UNION=(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257) INSERT_METHOD=FIRST;
+create table t00 (a int) engine=MERGE UNION=(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257) INSERT_METHOD=FIRST;
enable_query_log;
select count(*) from t00;
select count(*) from t00;
diff --git a/mysql-test/t/raid.test b/mysql-test/t/raid.test
index 52a15ec3040..14a55db0c34 100644
--- a/mysql-test/t/raid.test
+++ b/mysql-test/t/raid.test
@@ -7,20 +7,32 @@ enable_query_log;
# Test of raided tables
#
-create database test_raid;
-create table test_raid.r1 (i int) raid_type=1;
-create table test_raid.r2 (i int) raid_type=1 raid_chunks=32;
-drop database test_raid;
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+DROP DATABASE IF EXISTS test_$1;
+--enable_warnings
+
+#
+# Test dropping database with raid tables
+#
+
+create database test_$1;
+create table test_$1.r1 (i int) raid_type=1;
+create table test_$1.r2 (i int) raid_type=1 raid_chunks=32;
+drop database test_$1;
#
# Bug #3182: Test using more than 257 raid chunks
#
-create database test_raid;
-create table test_raid.r2 (i int) raid_type=1 raid_chunks=257;
-show create table test_raid.r2;
-drop database test_raid;
+create database test_$1;
+create table test_$1.r2 (i int) raid_type=1 raid_chunks=257;
+show create table test_$1.r2;
+drop database test_$1;
+
+#
+# Test that data is spread over different raid directories
+#
-DROP TABLE IF EXISTS t1,t2;
CREATE TABLE t1 (
id int unsigned not null auto_increment primary key,
c char(255) not null
@@ -113,8 +125,8 @@ ALTER TABLE t1 DROP COLUMN x;
ALTER TABLE t1 RENAME t2;
select count(*) from t2;
DROP TABLE t2;
+
/* variable rows */
-DROP TABLE IF EXISTS t2;
CREATE TABLE t1 (
id int unsigned not null auto_increment primary key,
c varchar(255) not null
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test
index d67f28a1524..44f55da5722 100644
--- a/mysql-test/t/range.test
+++ b/mysql-test/t/range.test
@@ -2,7 +2,10 @@
# Problem with range optimizer
#
-drop table if exists t1;
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+
CREATE TABLE t1 (
event_date date DEFAULT '0000-00-00' NOT NULL,
type int(11) DEFAULT '0' NOT NULL,
@@ -115,7 +118,7 @@ drop table t1;
CREATE TABLE t1 (
t1ID int(10) unsigned NOT NULL auto_increment,
- art char(1) binary NOT NULL default '',
+ art binary(1) NOT NULL default '',
KNR char(5) NOT NULL default '',
RECHNR char(6) NOT NULL default '',
POSNR char(2) NOT NULL default '',
@@ -125,7 +128,7 @@ CREATE TABLE t1 (
KEY IdxArt (art),
KEY IdxKnr (KNR),
KEY IdxArtnr (ARTNR)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 (art) VALUES ('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
@@ -171,18 +174,6 @@ select count(*) from t1 where art = 'j' or art = 'J';
select count(*) from t1 where art = 'j';
select count(*) from t1 where art = 'J';
drop table t1;
-
-create table t1 ( id1 int not null, id2 int not null, idnull int null, c char(20), primary key (id1,id2));
-insert into t1 values (0,1,NULL,"aaa"), (1,1,NULL,"aaa"), (2,1,NULL,"aaa"),
- (3,1,NULL,"aaa"), (4,1,NULL,"aaa"), (5,1,NULL,"aaa"),
- (6,1,NULL,"aaa"), (7,1,NULL,"aaa"), (8,1,NULL,"aaa"),
- (9,1,NULL,"aaa"), (10,1,NULL,"aaa"), (11,1,NULL,"aaa"),
- (12,1,NULL,"aaa"), (13,1,NULL,"aaa"), (14,1,NULL,"aaa"),
- (15,1,NULL,"aaa"), (16,1,NULL,"aaa"), (17,1,NULL,"aaa"),
- (18,1,NULL,"aaa"), (19,1,NULL,"aaa"), (20,1,NULL,"aaa");
-select a.id1, b.idnull from t1 as a, t1 as b where a.id2=1 and a.id1=1 and b.id1=a.idnull order by b.id2 desc limit 1;
-drop table t1;
-
#
# BETWEEN problems
#
@@ -206,14 +197,14 @@ drop table t1;
#
# bug #1172
#
-CREATE TABLE t1 (key1 int(11) NOT NULL default '0', KEY i1 (key1), KEY i2 (key1));
+CREATE TABLE t1 (key1 int(11) NOT NULL default '0', KEY i1 (key1));
INSERT INTO t1 VALUES (0),(0),(1),(1);
CREATE TABLE t2 (keya int(11) NOT NULL default '0', KEY j1 (keya));
INSERT INTO t2 VALUES (0),(0),(1),(1),(2),(2);
explain select * from t1, t2 where (t1.key1 <t2.keya + 1) and t2.keya=3;
-explain select * from t1 force index(i2), t2 where (t1.key1 <t2.keya + 1) and t2.keya=3;
DROP TABLE t1,t2;
+#
# bug #1724: use RANGE on more selective column instead of REF on less
# selective
@@ -222,7 +213,7 @@ CREATE TABLE t1 (
b int(11) default NULL,
KEY a (a),
KEY b (b)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES
@@ -234,7 +225,6 @@ INSERT INTO t1 VALUES
# we expect that optimizer will choose index on A
EXPLAIN SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
-
DROP TABLE t1;
#
@@ -289,3 +279,169 @@ INSERT into t1 (owner,id,columnid,line) values (11,15,15,1),(11,13,13,5);
SELECT id, columnid, tableid, content, showid, line, ordinal FROM t1 WHERE owner=11 AND ((columnid IN ( 15, 13, 14 ) AND line IN ( 1, 2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 31 )) OR (columnid IN ( 13, 14 ) AND line IN ( 15 ))) LIMIT 0 , 30;
drop table t1;
+
+#
+# test for a bug with in() and unique key
+#
+
+create table t1 (id int(10) primary key);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+select id from t1 where id in (2,5,9) ;
+select id from t1 where id=2 or id=5 or id=9 ;
+drop table t1;
+create table t1 ( id1 int not null, id2 int not null, idnull int null, c char(20), primary key (id1,id2));
+insert into t1 values (0,1,NULL,"aaa"), (1,1,NULL,"aaa"), (2,1,NULL,"aaa"),
+ (3,1,NULL,"aaa"), (4,1,NULL,"aaa"), (5,1,NULL,"aaa"),
+ (6,1,NULL,"aaa"), (7,1,NULL,"aaa"), (8,1,NULL,"aaa"),
+ (9,1,NULL,"aaa"), (10,1,NULL,"aaa"), (11,1,NULL,"aaa"),
+ (12,1,NULL,"aaa"), (13,1,NULL,"aaa"), (14,1,NULL,"aaa"),
+ (15,1,NULL,"aaa"), (16,1,NULL,"aaa"), (17,1,NULL,"aaa"),
+ (18,1,NULL,"aaa"), (19,1,NULL,"aaa"), (20,1,NULL,"aaa");
+select a.id1, b.idnull from t1 as a, t1 as b where a.id2=1 and a.id1=1 and b.id1=a.idnull order by b.id2 desc limit 1;
+drop table t1;
+
+
+#
+# Problem with optimizing !=
+#
+
+create table t1 (
+ id int not null auto_increment,
+ name char(1) not null,
+ uid int not null,
+ primary key (id),
+ index uid_index (uid));
+
+create table t2 (
+ id int not null auto_increment,
+ name char(1) not null,
+ uid int not null,
+ primary key (id),
+ index uid_index (uid));
+
+insert into t1(id, uid, name) values(1, 0, ' ');
+insert into t1(uid, name) values(0, ' ');
+
+insert into t2(uid, name) select uid, name from t1;
+insert into t1(uid, name) select uid, name from t2;
+insert into t2(uid, name) select uid, name from t1;
+insert into t1(uid, name) select uid, name from t2;
+insert into t2(uid, name) select uid, name from t1;
+insert into t1(uid, name) select uid, name from t2;
+insert into t2(uid, name) select uid, name from t1;
+insert into t1(uid, name) select uid, name from t2;
+insert into t2(uid, name) select uid, name from t1;
+insert into t1(uid, name) select uid, name from t2;
+insert into t2(uid, name) select uid, name from t1;
+insert into t2(uid, name) select uid, name from t1;
+insert into t2(uid, name) select uid, name from t1;
+insert into t2(uid, name) select uid, name from t1;
+insert into t1(uid, name) select uid, name from t2;
+
+delete from t2;
+insert into t2(uid, name) values
+ (1, CHAR(64+1)),
+ (2, CHAR(64+2)),
+ (3, CHAR(64+3)),
+ (4, CHAR(64+4)),
+ (5, CHAR(64+5)),
+ (6, CHAR(64+6)),
+ (7, CHAR(64+7)),
+ (8, CHAR(64+8)),
+ (9, CHAR(64+9)),
+ (10, CHAR(64+10)),
+ (11, CHAR(64+11)),
+ (12, CHAR(64+12)),
+ (13, CHAR(64+13)),
+ (14, CHAR(64+14)),
+ (15, CHAR(64+15)),
+ (16, CHAR(64+16)),
+ (17, CHAR(64+17)),
+ (18, CHAR(64+18)),
+ (19, CHAR(64+19)),
+ (20, CHAR(64+20)),
+ (21, CHAR(64+21)),
+ (22, CHAR(64+22)),
+ (23, CHAR(64+23)),
+ (24, CHAR(64+24)),
+ (25, CHAR(64+25)),
+ (26, CHAR(64+26));
+
+insert into t1(uid, name) select uid, name from t2;
+
+delete from t2;
+insert into t2(id, uid, name) select id, uid, name from t1;
+
+select count(*) from t1;
+select count(*) from t2;
+
+explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
+explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0;
+
+select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
+select * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0;
+
+drop table t1,t2;
+
+# Fix for bug#4488
+#
+create table t1 (x bigint unsigned not null);
+insert into t1(x) values (0xfffffffffffffff0);
+insert into t1(x) values (0xfffffffffffffff1);
+select * from t1;
+select count(*) from t1 where x>0;
+select count(*) from t1 where x=0;
+select count(*) from t1 where x<0;
+select count(*) from t1 where x < -16;
+select count(*) from t1 where x = -16;
+select count(*) from t1 where x > -16;
+select count(*) from t1 where x = 18446744073709551601;
+
+
+create table t2 (x bigint not null);
+insert into t2(x) values (0xfffffffffffffff0);
+insert into t2(x) values (0xfffffffffffffff1);
+select * from t2;
+select count(*) from t2 where x>0;
+select count(*) from t2 where x=0;
+select count(*) from t2 where x<0;
+select count(*) from t2 where x < -16;
+select count(*) from t2 where x = -16;
+select count(*) from t2 where x > -16;
+select count(*) from t2 where x = 18446744073709551601;
+
+drop table t1;
+--disable_warnings
+create table t1 (x bigint unsigned not null primary key) engine=innodb;
+--enable_warnings
+insert into t1(x) values (0xfffffffffffffff0);
+insert into t1(x) values (0xfffffffffffffff1);
+select * from t1;
+select count(*) from t1 where x>0;
+select count(*) from t1 where x=0;
+select count(*) from t1 where x<0;
+select count(*) from t1 where x < -16;
+select count(*) from t1 where x = -16;
+# The following query returns wrong value because the range optimizer can't
+# handle search on a signed value for an unsigned parameter. This will be fixed in
+# 5.0
+select count(*) from t1 where x > -16;
+select count(*) from t1 where x = 18446744073709551601;
+
+drop table t1;
+
+#
+# Bug #6045: Binary Comparison regression in MySQL 4.1
+# Binary searches didn't use a case insensitive index.
+#
+set names latin1;
+create table t1 (a char(10), b text, key (a)) character set latin1;
+INSERT INTO t1 (a) VALUES
+('111'),('222'),('222'),('222'),('222'),('444'),('aaa'),('AAA'),('bbb');
+# all these three can be optimized
+explain select * from t1 where a='aaa';
+explain select * from t1 where a=binary 'aaa';
+explain select * from t1 where a='aaa' collate latin1_bin;
+# this one cannot:
+explain select * from t1 where a='aaa' collate latin1_german1_ci;
diff --git a/mysql-test/t/rename.test b/mysql-test/t/rename.test
index ce4651d8de3..497ff721c99 100644
--- a/mysql-test/t/rename.test
+++ b/mysql-test/t/rename.test
@@ -2,7 +2,12 @@
# Test of rename table
#
+--disable_warnings
drop table if exists t0,t1,t2,t3,t4;
+# Clear up from other tests (to ensure that SHOW TABLES below is right)
+drop table if exists t0,t5,t6,t7,t8,t9,t1_1,t1_2,t9_1,t9_2;
+--enable_warnings
+
create table t0 SELECT 1,"table 1";
create table t2 SELECT 2,"table 2";
create table t3 SELECT 3,"table 3";
@@ -29,4 +34,30 @@ rename table t3 to t4, t5 to t3, t1 to t2, t4 to t1;
select * from t1;
select * from t2;
select * from t3;
+
+# This should give a warning for t4
drop table if exists t1,t2,t3,t4;
+
+#
+# Test-case for Bug #2397 RENAME TABLES is not blocked by
+# FLUSH TABLES WITH READ LOCK
+#
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+
+connection con1;
+CREATE TABLE t1 (a int);
+CREATE TABLE t3 (a int);
+connection con2;
+FLUSH TABLES WITH READ LOCK;
+connection con1;
+send RENAME TABLE t1 TO t2, t3 to t4;
+connection con2;
+sleep 1;
+show tables;
+UNLOCK TABLES;
+sleep 1;
+show tables;
+
+drop table t2, t4;
diff --git a/mysql-test/t/repair.test b/mysql-test/t/repair.test
index 159fc090653..ef7043febbc 100644
--- a/mysql-test/t/repair.test
+++ b/mysql-test/t/repair.test
@@ -2,18 +2,34 @@
# Test of repair table
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+
create table t1 SELECT 1,"table 1";
repair table t1 use_frm;
-alter table t1 TYPE=HEAP;
+alter table t1 ENGINE=HEAP;
repair table t1 use_frm;
drop table t1;
+#
+# disabled keys during repair
+#
+create table t1(id int PRIMARY KEY, st varchar(10), KEY st_key(st));
+insert into t1 values(1, "One");
+alter table t1 disable keys;
+show keys from t1;
+repair table t1 extended;
+show keys from t1;
+drop table t1;
+
+
# non-existent table
repair table t1 use_frm;
-#
-# Create test table for repair2
-# The following must be last in this file
-
-create table t1 type=myisam SELECT 1,"table 1";
+create table t1 engine=myisam SELECT 1,"table 1";
+flush tables;
+system echo 1 > $MYSQL_TEST_DIR/var/master-data/test/t1.MYI ;
+repair table t1;
+repair table t1 use_frm;
+drop table t1;
diff --git a/mysql-test/t/repair_part2-master.sh b/mysql-test/t/repair_part2-master.sh
deleted file mode 100644
index 964bde06c18..00000000000
--- a/mysql-test/t/repair_part2-master.sh
+++ /dev/null
@@ -1 +0,0 @@
-echo "1" > $MYSQL_TEST_DIR/var/master-data/test/t1.MYI
diff --git a/mysql-test/t/repair_part2.test b/mysql-test/t/repair_part2.test
deleted file mode 100644
index 8c27e382dff..00000000000
--- a/mysql-test/t/repair_part2.test
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# This test starts with a crashed t1.MYI file left over from repair.test
-#
-
-repair table t1;
-repair table t1 use_frm;
-drop table t1;
diff --git a/mysql-test/t/replace.test b/mysql-test/t/replace.test
index e9e01615a62..8429d80a4ef 100644
--- a/mysql-test/t/replace.test
+++ b/mysql-test/t/replace.test
@@ -4,20 +4,22 @@
# Test of REPLACE with ISAM and MyISAM and HEAP
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
CREATE TABLE t1 (
gesuchnr int(11) DEFAULT '0' NOT NULL,
benutzer_id int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (gesuchnr,benutzer_id)
-) type=ISAM;
+) engine=ISAM;
replace into t1 (gesuchnr,benutzer_id) values (2,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
-alter table t1 type=myisam;
+alter table t1 engine=myisam;
replace into t1 (gesuchnr,benutzer_id) values (1,1);
-alter table t1 type=heap;
+alter table t1 engine=heap;
replace into t1 (gesuchnr,benutzer_id) values (1,1);
drop table t1;
@@ -25,12 +27,13 @@ drop table t1;
# Test when using replace on a key that has used up it's whole range
#
-create table t1 (a tinyint not null auto_increment primary key, b char(20));
-insert into t1 values (126,"first"),(0,"last");
+create table t1 (a tinyint not null auto_increment primary key, b char(20) default "default_value");
+insert into t1 values (126,"first"),(63, "middle"),(0,"last");
--error 1062
insert into t1 values (0,"error");
--error 1062
replace into t1 values (0,"error");
replace into t1 values (126,"first updated");
+replace into t1 values (63,default);
select * from t1;
drop table t1;
diff --git a/mysql-test/t/rollback.test b/mysql-test/t/rollback.test
index 6ea2cca887f..3cb1ea3024b 100644
--- a/mysql-test/t/rollback.test
+++ b/mysql-test/t/rollback.test
@@ -2,13 +2,22 @@
# This test should fail as MyISAM doesn't have rollback
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+# PS doesn't work with BEGIN ... ROLLBACK
+--disable_ps_protocol
-create table t1 (n int not null primary key) type=myisam;
+create table t1 (n int not null primary key) engine=myisam;
begin work;
insert into t1 values (4);
insert into t1 values (5);
-# Should give an error
-!$1196 rollback;
+rollback;
+select @@warning_count;
+select @@error_count;
+show warnings;
+show errors;
select * from t1;
+select @@warning_count;
+show warnings;
drop table t1;
diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test
new file mode 100644
index 00000000000..62e8eb7991c
--- /dev/null
+++ b/mysql-test/t/row.test
@@ -0,0 +1,84 @@
+# Initialise
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+select (1,2,3) IN ((3,2,3), (1,2,3), (1,3,3));
+select row(10,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3));
+select row(1,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3));
+select row(10,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3));
+select row('a',1.5,3) IN (row(1,2,3), row('a',1.5,3), row('a','a','a'));
+select row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3));
+select row('a',0,3) IN (row(3,2,3), row('a','a','3'), row(1,3,3));
+select row('a',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3));
+select row('b',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3));
+select row('b',1.5,3) IN (row('b',NULL,3), row('a',1.5,3), row(1,3,3));
+select row('b',1.5,3) IN (row('b',NULL,4), row('a',1.5,3), row(1,3,3));
+select (1,2,(3,4)) IN ((3,2,(3,4)), (1,2,(3,4)));
+-- error 1241
+select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,4));
+select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)));
+explain extended select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)));
+
+SELECT (1,2,3)=(0,NULL,3);
+SELECT (1,2,3)=(1,NULL,3);
+# here's something for Sanja to fix :)
+SELECT (1,2,3)=(1,NULL,0);
+
+SELECT ROW(1,2,3)=ROW(1,2,3);
+SELECT ROW(2,2,3)=ROW(1+1,2,3);
+SELECT ROW(1,2,3)=ROW(1+1,2,3);
+SELECT ROW(1,2,3)<ROW(1+1,2,3);
+SELECT ROW(1,2,3)>ROW(1+1,2,3);
+SELECT ROW(1,2,3)<=ROW(1+1,2,3);
+SELECT ROW(1,2,3)>=ROW(1+1,2,3);
+SELECT ROW(1,2,3)<>ROW(1+1,2,3);
+SELECT ROW(NULL,2,3)=ROW(NULL,2,3);
+SELECT ROW(NULL,2,3)<=>ROW(NULL,2,3);
+SELECT ROW(1,2,ROW(3,4,5))=ROW(1,2,ROW(3,4,5));
+SELECT ROW('test',2,3.33)=ROW('test',2,3.33);
+-- error 1241
+SELECT ROW('test',2,3.33)=ROW('test',2,3.33,4);
+SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,33));
+SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,3));
+SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,NULL));
+-- error 1241
+SELECT ROW('test',2,ROW(3,33))=ROW('test',2,4);
+
+create table t1 ( a int, b int, c int);
+insert into t1 values (1,2,3), (2,3,1), (3,2,1), (1,2,NULL);
+select * from t1 where ROW(1,2,3)=ROW(a,b,c);
+select * from t1 where ROW(0,2,3)=ROW(a,b,c);
+select * from t1 where ROW(1,2,3)<ROW(a,b,c);
+select ROW(a,2,3) IN(row(1,b,c), row(2,3,1)) from t1;
+select ROW(c,2,3) IN(row(1,b,a), row(2,3,1)) from t1;
+select ROW(a,b,c) IN(row(1,2,3), row(3,2,1)) from t1;
+select ROW(1,2,3) IN(row(a,b,c), row(1,2,3)) from t1;
+drop table t1;
+
+-- error 1241
+select ROW(1,1);
+
+create table t1 (i int);
+-- error 1241
+select 1 from t1 where ROW(1,1);
+-- error 1241
+select count(*) from t1 order by ROW(1,1);
+-- error 1241
+select count(*) from t1 having (1,1) order by i;
+drop table t1;
+
+create table t1 (a int, b int);
+insert into t1 values (1, 4);
+insert into t1 values (10, 40);
+insert into t1 values (1, 4);
+insert into t1 values (10, 43);
+insert into t1 values (1, 4);
+insert into t1 values (10, 41);
+insert into t1 values (1, 4);
+insert into t1 values (10, 43);
+insert into t1 values (1, 4);
+select a, MAX(b), (1, MAX(b)) = (1, 4) from t1 group by a;
+drop table t1;
+SELECT ROW(2,10) <=> ROW(3,4);
+SELECT ROW(NULL,10) <=> ROW(3,NULL);
diff --git a/mysql-test/t/rpl000001-slave.opt b/mysql-test/t/rpl000001-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl000001-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl000001.test b/mysql-test/t/rpl000001.test
index 4f978af0bec..835af92186f 100644
--- a/mysql-test/t/rpl000001.test
+++ b/mysql-test/t/rpl000001.test
@@ -1,5 +1,5 @@
source include/master-slave.inc;
-drop table if exists t1,t2,t3;
+
create table t1 (word char(20) not null);
load data infile '../../std_data/words.dat' into table t1;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
@@ -12,11 +12,11 @@ select * from t1 limit 10;
save_master_pos;
connection slave;
sync_with_master;
-slave stop;
+stop slave;
connection master;
set password for root@"localhost" = password('foo');
connection slave;
-slave start;
+start slave;
connection master;
#
# Give slave time to do at last one failed connect retry
@@ -43,7 +43,7 @@ sync_with_master;
connection master;
reset master;
connection slave;
-slave stop;
+stop slave;
reset slave;
connection master;
@@ -62,10 +62,12 @@ enable_query_log;
# Try to cause a large relay log lag on the slave
connection slave;
select get_lock("hold_slave",10);
-slave start;
+explain extended select get_lock("hold_slave",10);
+start slave;
#hope this is long enough for I/O thread to fetch over 16K relay log data
sleep 3;
select release_lock("hold_slave");
+explain extended select release_lock("hold_slave");
unlock tables;
connection master;
@@ -100,7 +102,7 @@ wait_for_slave_to_stop;
# show slave status;
set global sql_slave_skip_counter=1;
-slave start;
+start slave;
select count(*) from t1;
connection master1;
drop table t1;
@@ -108,14 +110,14 @@ create table t1 (n int);
insert into t1 values(3456);
insert into mysql.user (Host, User, Password)
VALUES ("10.10.10.%", "blafasel2", password("blafasel2"));
-select select_priv,user from mysql.user where user = 'blafasel2';
-update mysql.user set Select_priv = "Y" where User="blafasel2";
-select select_priv,user from mysql.user where user = 'blafasel2';
+select select_priv,user from mysql.user where user = _binary'blafasel2';
+update mysql.user set Select_priv = "Y" where User= _binary"blafasel2";
+select select_priv,user from mysql.user where user = _binary'blafasel2';
save_master_pos;
connection slave;
sync_with_master;
select n from t1;
-select select_priv,user from mysql.user where user = 'blafasel2';
+select select_priv,user from mysql.user where user = _binary'blafasel2';
connection master1;
drop table t1;
save_master_pos;
diff --git a/mysql-test/t/rpl000002.test b/mysql-test/t/rpl000002.test
index caf0b4ef6d8..4fbb6a595a4 100644
--- a/mysql-test/t/rpl000002.test
+++ b/mysql-test/t/rpl000002.test
@@ -1,33 +1,39 @@
source include/master-slave.inc;
-drop table if exists t1;
+
+# Test replication of auto_increment
+
create table t1 (n int auto_increment primary key);
set insert_id = 2000;
insert into t1 values (NULL),(NULL),(NULL);
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from t1;
connection master;
--replace_result $SLAVE_MYPORT 9999
show slave hosts;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-slave stop;
+sync_slave_with_master;
+stop slave;
connection master;
-drop table if exists t2;
+
+# Test replication of timestamp
+
create table t2(id int auto_increment primary key, created datetime);
set timestamp=12345;
insert into t2 set created=now();
select * from t2;
+
+# Test replication of CREATE .. LIKE (Bug #2557)
+
+create table t3 like t2;
+create temporary table t4 like t2;
+create table t5 select * from t4;
save_master_pos;
connection slave;
-slave start;
+start slave;
sync_with_master;
select * from t2;
+show create table t3;
+show create table t5;
connection master;
-drop table t2;
-save_master_pos;
-connection slave;
-sync_with_master;
+drop table t2,t3,t5;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl000003.test b/mysql-test/t/rpl000003.test
deleted file mode 100644
index f994ed94371..00000000000
--- a/mysql-test/t/rpl000003.test
+++ /dev/null
@@ -1,14 +0,0 @@
-source include/master-slave.inc;
-drop table if exists t1;
-create table t1(n int primary key);
-!insert into t1 values (1),(2),(2);
-insert into t1 values (3);
-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/rpl000004.test b/mysql-test/t/rpl000004.test
index 705e0d51b7b..8fc2977faab 100644
--- a/mysql-test/t/rpl000004.test
+++ b/mysql-test/t/rpl000004.test
@@ -1,18 +1,14 @@
source include/master-slave.inc;
+
set SQL_LOG_BIN=0;
-drop table if exists t1;
create table t1 (word char(20) not null, index(word));
load data infile '../../std_data/words.dat' into table t1;
-drop table if exists t2;
create table t2 (word char(20) not null);
load data infile '../../std_data/words.dat' into table t2;
create table t3 (word char(20) not null primary key);
connection slave;
-drop table if exists t1;
load table t1 from master;
-drop table if exists t2;
load table t2 from master;
-drop table if exists t3;
load table t3 from master;
check table t1;
select count(*) from t2;
diff --git a/mysql-test/t/rpl000005.test b/mysql-test/t/rpl000005.test
index 1cfea242b69..ae713633df3 100644
--- a/mysql-test/t/rpl000005.test
+++ b/mysql-test/t/rpl000005.test
@@ -1,5 +1,5 @@
source include/master-slave.inc;
-drop table if exists t1;
+
CREATE TABLE t1 (name varchar(64), age smallint(3));
INSERT INTO t1 SET name='Andy', age=31;
INSERT t1 SET name='Jacob', age=2;
diff --git a/mysql-test/t/rpl000006.test b/mysql-test/t/rpl000006.test
index ad8622c2a81..898ef309f50 100644
--- a/mysql-test/t/rpl000006.test
+++ b/mysql-test/t/rpl000006.test
@@ -5,12 +5,10 @@ source include/master-slave.inc;
# Don't log table creating to the slave as we want to test LOAD TABLE
set SQL_LOG_BIN=0,timestamp=200006;
-drop table if exists t1;
create table t1(t timestamp not null,a char(1));
insert into t1 ( a) values ('F');
select unix_timestamp(t) from t1;
connection slave;
-drop table if exists t1;
load table t1 from master;
select unix_timestamp(t) from t1;
@@ -32,7 +30,7 @@ set SQL_LOG_BIN=0;
CREATE TABLE t1 (
a int not null
-) TYPE=MyISAM MAX_ROWS=4000 CHECKSUM=1;
+) ENGINE=MyISAM MAX_ROWS=4000 CHECKSUM=1;
INSERT INTO t1 VALUES (1);
save_master_pos;
connection slave;
diff --git a/mysql-test/t/rpl000008-slave.opt b/mysql-test/t/rpl000008-slave.opt
index 79b3bf6174b..177f89e0910 100644
--- a/mysql-test/t/rpl000008-slave.opt
+++ b/mysql-test/t/rpl000008-slave.opt
@@ -1 +1 @@
---replicate-ignore-table=test.foo
+--replicate-ignore-table=test.mysqltest_foo
diff --git a/mysql-test/t/rpl000008.test b/mysql-test/t/rpl000008.test
index 12760008b6d..ea782b99d28 100644
--- a/mysql-test/t/rpl000008.test
+++ b/mysql-test/t/rpl000008.test
@@ -1,29 +1,36 @@
-#this one assumes we are ignoring updates on table foo, but doing
-#the ones on all other tables
+# This one assumes we are ignoring updates on table mysqltest_foo, but doing
+# the ones on all other tables
+
source include/master-slave.inc;
connection slave;
+
+#
+# For this test we must be in the test database
+#
use test;
-drop table if exists foo;
-create table foo (n int);
-insert into foo values(4);
+
+--disable_warnings
+drop table if exists mysqltest_foo;
+drop table if exists mysqltest_bar;
+--enable_warnings
+
+create table mysqltest_foo (n int);
+insert into mysqltest_foo values(4);
connection master;
use test;
-drop table if exists foo;
-create table foo (n int);
-insert into foo values(5);
-drop table if exists bar;
-create table bar (m int);
-insert into bar values(15);
-drop table if exists choo;
-create table choo (k int);
-insert into choo values(55);
+create table mysqltest_foo (n int);
+insert into mysqltest_foo values(5);
+create table mysqltest_bar (m int);
+insert into mysqltest_bar values(15);
+create table t1 (k int);
+insert into t1 values(55);
save_master_pos;
connection slave;
sync_with_master;
-select foo.n,bar.m,choo.k from foo,bar,choo;
+select mysqltest_foo.n,mysqltest_bar.m,t1.k from mysqltest_foo,mysqltest_bar,t1;
connection master;
-drop table if exists foo,bar,choo;
+drop table mysqltest_foo,mysqltest_bar,t1;
save_master_pos;
connection slave;
sync_with_master;
-drop table if exists foo,bar,choo;
+drop table mysqltest_foo,mysqltest_bar,t1;
diff --git a/mysql-test/t/rpl000009-slave.opt b/mysql-test/t/rpl000009-slave.opt
index 245e310c5d8..c015c02ba78 100644
--- a/mysql-test/t/rpl000009-slave.opt
+++ b/mysql-test/t/rpl000009-slave.opt
@@ -1 +1 @@
---replicate-wild-do-table=bar.%
+--replicate-wild-do-table=mysqltest.%
diff --git a/mysql-test/t/rpl000009.test b/mysql-test/t/rpl000009.test
index 4426cafe299..59451bc888d 100644
--- a/mysql-test/t/rpl000009.test
+++ b/mysql-test/t/rpl000009.test
@@ -1,38 +1,44 @@
-# This one assumes we are ignoring updates on tables in database foo, but doing
-# the ones in database bar
+# This one assumes we are ignoring updates on tables in database mysqltest2,
+# but doing the ones in database mysqltest
source include/master-slave.inc;
-drop database if exists foo;
-create database foo;
-drop database if exists bar;
-create database bar;
+--disable_warnings
+drop database if exists mysqltest;
+drop database if exists mysqltest2;
+drop database if exists mysqltest3;
+connection slave;
+drop database if exists mysqltest;
+drop database if exists mysqltest2;
+drop database if exists mysqltest3;
+connection master;
+create database mysqltest2;
+create database mysqltest;
+--enable_warnings
+
save_master_pos;
connection slave;
sync_with_master;
-create database foo;
-drop table if exists foo.foo;
-create table foo.foo (n int);
-insert into foo.foo values(4);
+create database mysqltest2;
+create table mysqltest2.foo (n int);
+insert into mysqltest2.foo values(4);
connection master;
-drop table if exists foo.foo;
-create table foo.foo (n int);
-insert into foo.foo values(5);
-drop table if exists bar.bar;
-create table bar.bar (m int);
-insert into bar.bar values(15);
+create table mysqltest2.foo (n int);
+insert into mysqltest2.foo values(5);
+create table mysqltest.bar (m int);
+insert into mysqltest.bar values(15);
save_master_pos;
connection slave;
sync_with_master;
-select foo.foo.n,bar.bar.m from foo.foo,bar.bar;
+select mysqltest2.foo.n,mysqltest.bar.m from mysqltest2.foo,mysqltest.bar;
connection master;
-drop database bar;
-drop database if exists foo;
+drop database mysqltest;
+drop database if exists mysqltest2;
save_master_pos;
connection slave;
sync_with_master;
--error 1008
-drop database bar;
-drop database foo;
+drop database mysqltest;
+drop database mysqltest2;
# Now let's test load data from master
@@ -40,19 +46,19 @@ drop database foo;
connection master;
set sql_log_bin = 0;
-create database foo;
-create database bar;
+create database mysqltest2;
+create database mysqltest;
show databases;
-create table foo.t1(n int, s char(20));
-create table foo.t2(n int, s text);
-insert into foo.t1 values (1, 'one'), (2, 'two'), (3, 'three');
-insert into foo.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen');
-
-create table bar.t1(n int, s char(20));
-create table bar.t2(n int, s text);
-insert into bar.t1 values (1, 'one bar'), (2, 'two bar'), (3, 'three bar');
-insert into bar.t2 values (11, 'eleven bar'), (12, 'twelve bar'),
- (13, 'thirteen bar');
+create table mysqltest2.t1(n int, s char(20));
+create table mysqltest2.t2(n int, s text);
+insert into mysqltest2.t1 values (1, 'one'), (2, 'two'), (3, 'three');
+insert into mysqltest2.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen');
+
+create table mysqltest.t1(n int, s char(20));
+create table mysqltest.t2(n int, s text);
+insert into mysqltest.t1 values (1, 'one test'), (2, 'two test'), (3, 'three test');
+insert into mysqltest.t2 values (11, 'eleven test'), (12, 'twelve test'),
+ (13, 'thirteen test');
set sql_log_bin = 1;
save_master_pos;
connection slave;
@@ -60,53 +66,57 @@ sync_with_master;
# This should show that the slave is empty at this point
show databases;
-# Create foo and foo2 on slave; we expect that LOAD DATA FROM MASTER will
-# neither touch database foo nor foo2.
-create database foo;
-create table foo.t1(n int, s char(20));
-insert into foo.t1 values (1, 'original foo.t1');
-create table foo.t3(n int, s char(20));
-insert into foo.t3 values (1, 'original foo.t3');
-create database foo2;
-create table foo2.t1(n int, s char(20));
-insert into foo2.t1 values (1, 'original foo2.t1');
-# Create bar, and bar.t1, to check that it gets replaced,
-# and bar.t3 to check that it is not touched (there is no bar.t3 on master)
-create database bar;
-create table bar.t1(n int, s char(20));
-insert into bar.t1 values (1, 'original bar.t1');
-create table bar.t3(n int, s char(20));
-insert into bar.t3 values (1, 'original bar.t3');
+# Create mysqltest2 and mysqltest3 on slave; we expect that LOAD DATA FROM
+# MASTER will neither touch database mysqltest nor mysqltest3
+create database mysqltest2;
+create table mysqltest2.t1(n int, s char(20));
+insert into mysqltest2.t1 values (1, 'original foo.t1');
+create table mysqltest2.t3(n int, s char(20));
+insert into mysqltest2.t3 values (1, 'original foo.t3');
+create database mysqltest3;
+create table mysqltest3.t1(n int, s char(20));
+insert into mysqltest3.t1 values (1, 'original foo2.t1');
+
+# Create mysqltest, and mysqltest.t1, to check that it gets replaced,
+# and mysqltest.t3 to check that it is not touched (there is no
+# mysqltest.t3 on master)
+create database mysqltest;
+create table mysqltest.t1(n int, s char(20));
+insert into mysqltest.t1 values (1, 'original bar.t1');
+create table mysqltest.t3(n int, s char(20));
+insert into mysqltest.t3 values (1, 'original bar.t3');
load data from master;
# Now let's check if we have the right tables and the right data in them
show databases;
-use foo;
-# LOAD DATA FROM MASTER uses only replicate_*_db rules to decide which databases
-# have to be copied. So it thinks "foo" has to be copied. Before 4.0.16 it would
-# first drop "foo", then create "foo". This "drop" is a bug; in that case t3
-# would disappear.
-# So here the effect of this bug (BUG#1248) would be to leave an empty "foo" on
-# the slave.
+use mysqltest2;
+
+# LOAD DATA FROM MASTER uses only replicate_*_db rules to decide which
+# databases have to be copied. So it thinks "mysqltest" has to be
+# copied. Before 4.0.16 it would first drop "mysqltest", then create
+# "mysqltest". This "drop" is a bug; in that case t3 would disappear. So
+# here the effect of this bug (BUG#1248) would be to leave an empty
+# "mysqltest" on the slave.
+
show tables; # should be t1 & t3
select * from t1; # should be slave's original
-use foo2;
+use mysqltest3;
show tables; # should be t1
select * from t1; # should be slave's original
-use bar;
+use mysqltest;
show tables; # should contain master's copied t1&t2, slave's original t3
-select * from bar.t1;
-select * from bar.t2;
-select * from bar.t3;
+select * from mysqltest.t1;
+select * from mysqltest.t2;
+select * from mysqltest.t3;
# Now let's see if replication works
connection master;
-insert into bar.t1 values (4, 'four bar');
+insert into mysqltest.t1 values (4, 'four test');
save_master_pos;
connection slave;
sync_with_master;
-select * from bar.t1;
+select * from mysqltest.t1;
# Check that LOAD DATA FROM MASTER is able to create master.info
# if needed (if RESET SLAVE was used before), before writing to it (BUG#2922).
@@ -117,28 +127,33 @@ load data from master;
start slave;
# see if replication coordinates were restored fine
connection master;
-insert into bar.t1 values (5, 'five bar');
+insert into mysqltest.t1 values (5, 'five bar');
save_master_pos;
connection slave;
sync_with_master;
-select * from bar.t1;
+select * from mysqltest.t1;
# Check that LOAD DATA FROM MASTER reports the error if it can't drop a
# table to be overwritten.
# DISABLED FOR NOW AS chmod IS NOT PORTABLE ON NON-UNIX
-# insert into bar.t1 values(10, 'should be there');
+# insert into mysqltest.t1 values(10, 'should be there');
# flush tables;
-# system chmod 500 var/slave-data/bar/;
+# system chmod 500 var/slave-data/mysqltest/;
# --error 6
# load data from master; # should fail (errno 13)
-# system chmod 700 var/slave-data/bar/;
-# select * from bar.t1; # should contain the row (10, ...)
+# system chmod 700 var/slave-data/mysqltest/;
+# select * from mysqltest.t1; # should contain the row (10, ...)
# Check that LOAD TABLE FROM MASTER fails if the table exists on slave
--error 1050
-load table bar.t1 from master;
-drop table bar.t1;
+load table mysqltest.t1 from master;
+drop table mysqltest.t1;
+load table mysqltest.t1 from master;
+
+# Check what happens when requestion not existing table
+#
+--error 1188
load table bar.t1 from master;
# as LOAD DATA FROM MASTER failed it did not restart slave threads
@@ -147,10 +162,11 @@ load table bar.t1 from master;
# Now time for cleanup
connection master;
-drop database bar;
-drop database foo;
+drop database mysqltest;
+drop database mysqltest2;
save_master_pos;
connection slave;
sync_with_master;
-drop database foo;
-drop database foo2;
+# These has to be droped on slave as they are not replicated
+drop database mysqltest2;
+drop database mysqltest3;
diff --git a/mysql-test/t/rpl000010.test b/mysql-test/t/rpl000010.test
index 05a211fbd85..0725214694a 100644
--- a/mysql-test/t/rpl000010.test
+++ b/mysql-test/t/rpl000010.test
@@ -1,10 +1,8 @@
-#this tests the offset off by 22 mystery bug
-#must run slave with --disconnect-slave-event-count=1 --master-connect-retry=1
+# This tests the offset off by 22 mystery bug
+# Must run slave with --disconnect-slave-event-count=1 --master-connect-retry=1
+
source include/master-slave.inc;
-connection slave;
-drop table if exists t1;
-connection master;
-drop table if exists t1;
+
create table t1 (n int not null auto_increment primary key);
insert into t1 values(NULL);
insert into t1 values(2);
diff --git a/mysql-test/t/rpl000011.test b/mysql-test/t/rpl000011.test
index d75937e3f81..3b00afe10e4 100644
--- a/mysql-test/t/rpl000011.test
+++ b/mysql-test/t/rpl000011.test
@@ -1,21 +1,15 @@
source include/master-slave.inc;
-drop table if exists t1;
+
create table t1 (n int);
insert into t1 values(1);
-save_master_pos;
-connection slave;
-sync_with_master;
-slave stop;
-slave start;
+sync_slave_with_master;
+stop slave;
+start slave;
connection master;
insert into t1 values(2);
-save_master_pos;
-connection slave;
#let slave catch up
-sync_with_master;
+sync_slave_with_master;
select * from t1;
connection master;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl000012.test b/mysql-test/t/rpl000012.test
index 9f8ba9a4f91..7f440eaaa13 100644
--- a/mysql-test/t/rpl000012.test
+++ b/mysql-test/t/rpl000012.test
@@ -1,18 +1,16 @@
source include/master-slave.inc;
connection master;
-drop table if exists t1,t2,t3;
create table t2 (n int);
create temporary table t1 (n int);
insert into t1 values(1),(2),(3);
insert into t2 select * from t1;
-drop table if exists test.t3;
-create temporary table test.t3 (n int not null);
-alter table test.t3 add primary key(n);
+create temporary table t3 (n int not null);
+alter table t3 add primary key(n);
flush logs;
insert into t3 values (100);
insert into t2 select * from t3;
-drop table if exists test.t3;
+drop table if exists t3;
insert into t2 values (101);
connection master1;
create temporary table t1 (n int);
diff --git a/mysql-test/t/rpl000013.test b/mysql-test/t/rpl000013.test
index 14619796e01..94d5feb3925 100644
--- a/mysql-test/t/rpl000013.test
+++ b/mysql-test/t/rpl000013.test
@@ -3,7 +3,7 @@ save_master_pos;
connection slave;
sync_with_master;
connection master;
-drop table if exists t2;
+
create table t2(n int);
create temporary table t1 (n int);
insert into t1 values(1),(2),(3);
@@ -31,6 +31,10 @@ show status like 'Slave_open_temp_tables';
#
connect (master2,localhost,root,,);
connection master2;
+
+# We will get a warning for t1 as this is a temporary table that doesn't
+# exist in this connection.
+
drop table if exists t1,t2;
save_master_pos;
connection slave;
diff --git a/mysql-test/t/rpl000015.test b/mysql-test/t/rpl000015.test
index 7c5a8bf3743..b7fff94f7f3 100644
--- a/mysql-test/t/rpl000015.test
+++ b/mysql-test/t/rpl000015.test
@@ -7,31 +7,33 @@ save_master_pos;
connection slave;
reset slave;
--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 33 #
show slave status;
change master to master_host='127.0.0.1';
# The following needs to be cleaned up when change master is fixed
---replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT
+--replace_result $MASTER_MYPORT MASTER_PORT $MYSQL_TCP_PORT MASTER_PORT
+--replace_column 1 # 33 #
show slave status;
--replace_result $MASTER_MYPORT MASTER_PORT
eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$MASTER_MYPORT;
--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 33 #
show slave status;
-slave start;
+start slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 33 #
show slave status;
connection master;
+--disable_warnings
drop table if exists t1;
+--enable_warnings
create table t1 (n int);
insert into t1 values (10),(45),(90);
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from t1;
connection master;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl000016-slave.opt b/mysql-test/t/rpl000016-slave.opt
deleted file mode 100644
index f27601e0d7d..00000000000
--- a/mysql-test/t/rpl000016-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
--O max_binlog_size=2048
diff --git a/mysql-test/t/rpl000017-slave.sh b/mysql-test/t/rpl000017-slave.sh
index 066b4880cc1..4dbbaec31ce 100755
--- a/mysql-test/t/rpl000017-slave.sh
+++ b/mysql-test/t/rpl000017-slave.sh
@@ -1,11 +1,11 @@
rm -f $MYSQL_TEST_DIR/var/log/*relay*
rm -f $MYSQL_TEST_DIR/var/slave-data/relay-log.info
cat > $MYSQL_TEST_DIR/var/slave-data/master.info <<EOF
-master-bin.001
+master-bin.000001
4
127.0.0.1
replicate
-aaaaaaaaaaaaaaabthispartofthepasswordisnotused
+aaaaaaaaaaaaaaab
$MASTER_MYPORT
1
0
diff --git a/mysql-test/t/rpl000017.test b/mysql-test/t/rpl000017.test
index d4f41f1e374..cf808a2cbc0 100644
--- a/mysql-test/t/rpl000017.test
+++ b/mysql-test/t/rpl000017.test
@@ -5,17 +5,15 @@ reset master;
grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab';
grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaaaaaab';
connection slave;
-slave start;
+start slave;
connection master;
+--disable_warnings
drop table if exists t1;
+--enable_warnings
create table t1(n int);
insert into t1 values(24);
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from t1;
connection master;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl000018.test b/mysql-test/t/rpl000018.test
index 3bd5fd0ef09..884ec9727d2 100644
--- a/mysql-test/t/rpl000018.test
+++ b/mysql-test/t/rpl000018.test
@@ -12,18 +12,16 @@ server_stop master;
server_start master;
connection slave;
reset slave;
-slave start;
+start slave;
connection master;
-show master logs;
+show binary logs;
+--disable_warnings
drop table if exists t1;
+--enable_warnings
create table t1(n int);
insert into t1 values (3351);
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from t1;
connection master;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_EE_error.test b/mysql-test/t/rpl_EE_error.test
index de69c4897c3..1a1572b48b0 100644
--- a/mysql-test/t/rpl_EE_error.test
+++ b/mysql-test/t/rpl_EE_error.test
@@ -6,7 +6,7 @@
source include/master-slave.inc;
-create table t1 (a int) type=myisam;
+create table t1 (a int) engine=myisam;
flush tables;
system rm ./var/master-data/test/t1.MYI ;
drop table t1;
@@ -17,7 +17,7 @@ sync_with_master;
# Now a real error.
connection master;
-create table t1 (a int, unique(a)) type=myisam;
+create table t1 (a int, unique(a)) engine=myisam;
set sql_log_bin=0;
insert into t1 values(2);
set sql_log_bin=1;
diff --git a/mysql-test/t/rpl_alter.test b/mysql-test/t/rpl_alter.test
index f1fbf60776b..a913f01cd81 100644
--- a/mysql-test/t/rpl_alter.test
+++ b/mysql-test/t/rpl_alter.test
@@ -1,19 +1,22 @@
source include/master-slave.inc;
-drop database if exists test_$1;
-create database test_$1;
-create table test_$1.t1 ( n int);
-alter table test_$1.t1 add m int;
-insert into test_$1.t1 values (1,2);
-create table test_$1.t2 (n int);
-insert into test_$1.t2 values (45);
-rename table test_$1.t2 to test_$1.t3, test_$1.t1 to test_$1.t2;
+--disable_warnings
+drop database if exists mysqltest;
+--enable_warnings
+create database mysqltest;
+
+create table mysqltest.t1 ( n int);
+alter table mysqltest.t1 add m int;
+insert into mysqltest.t1 values (1,2);
+create table mysqltest.t2 (n int);
+insert into mysqltest.t2 values (45);
+rename table mysqltest.t2 to mysqltest.t3, mysqltest.t1 to mysqltest.t2;
save_master_pos;
connection slave;
sync_with_master;
-select * from test_$1.t2;
-select * from test_$1.t3;
+select * from mysqltest.t2;
+select * from mysqltest.t3;
connection master;
-drop database test_$1;
+drop database mysqltest;
save_master_pos;
connection slave;
sync_with_master;
diff --git a/mysql-test/t/rpl_change_master.test b/mysql-test/t/rpl_change_master.test
index a13e045cf48..e6452b5b619 100644
--- a/mysql-test/t/rpl_change_master.test
+++ b/mysql-test/t/rpl_change_master.test
@@ -12,9 +12,11 @@ connection slave;
stop slave;
select * from t1;
--replace_result $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 33 #
show slave status;
change master to master_user='root';
--replace_result $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 33 #
show slave status;
# Will restart from after the values(2), which is bug
select release_lock("a");
diff --git a/mysql-test/t/rpl_charset.test b/mysql-test/t/rpl_charset.test
new file mode 100644
index 00000000000..68036ae49f1
--- /dev/null
+++ b/mysql-test/t/rpl_charset.test
@@ -0,0 +1,171 @@
+# Replication of character sets.
+# This test will fail if the server/client does not support enough charsets.
+
+# Remember that there currently exists
+# Bug #2326: Charset of table is determined by charset of db only if "USE db;"
+
+source include/master-slave.inc;
+--disable_warnings
+drop database if exists mysqltest2;
+drop database if exists mysqltest3;
+--enable_warnings
+
+create database mysqltest2 character set latin2;
+set @@character_set_server=latin5;
+create database mysqltest3;
+--disable_query_log
+select "--- --master--" as "";
+--enable_query_log
+show create database mysqltest2;
+show create database mysqltest3;
+sync_slave_with_master;
+--disable_query_log
+select "--- --slave--" as "";
+--enable_query_log
+show create database mysqltest2;
+show create database mysqltest3;
+
+connection master;
+set @@collation_server=armscii8_bin;
+drop database mysqltest3;
+create database mysqltest3;
+--disable_query_log
+select "--- --master--" as "";
+--enable_query_log
+show create database mysqltest3;
+sync_slave_with_master;
+--disable_query_log
+select "--- --slave--" as "";
+--enable_query_log
+show create database mysqltest3;
+
+connection master;
+use mysqltest2;
+create table t1 (a int auto_increment primary key, b varchar(100));
+set character_set_client=cp850, collation_connection=latin2_croatian_ci;
+insert into t1 (b) values(@@character_set_server);
+insert into t1 (b) values(@@collation_server);
+# character_set_database and collation_database are not tested as they
+# are not replicated (Bar said that this variable may be removed shortly).
+insert into t1 (b) values(@@character_set_client);
+# collation_client does not exist
+insert into t1 (b) values(@@character_set_connection);
+insert into t1 (b) values(@@collation_connection);
+--disable_query_log
+select "--- --master--" as "";
+--enable_query_log
+select * from t1 order by a;
+sync_slave_with_master;
+--disable_query_log
+select "--- --slave--" as "";
+--enable_query_log
+select * from mysqltest2.t1 order by a;
+
+connection master;
+set character_set_client=latin1, collation_connection=latin1_german1_ci;
+truncate table t1;
+insert into t1 (b) values(@@collation_connection);
+insert into t1 (b) values(LEAST("Müller","Muffler"));
+set collation_connection=latin1_german2_ci;
+insert into t1 (b) values(@@collation_connection);
+insert into t1 (b) values(LEAST("Müller","Muffler"));
+--disable_query_log
+select "--- --master--" as "";
+--enable_query_log
+select * from t1 order by a;
+sync_slave_with_master;
+--disable_query_log
+select "--- --slave--" as "";
+--enable_query_log
+select * from mysqltest2.t1 order by a;
+
+# See if SET ONE_SHOT gets into binlog when LOAD DATA
+connection master;
+load data infile '../../std_data/words.dat' into table t1 (b);
+
+# See if user var is prefixed with collation in binlog and replicated well.
+# Note: replication of user variables is broken as far as derivation is
+# concerned. That's because when we store a user variable in the binlog,
+# we lose its derivation. So later on the slave, it's impossible to
+# know if the collation was explicit or not, so we use DERIVATION_NONE,
+# which provokes error messages (like 'Illegal mix of collation') when
+# we replay the master's INSERT/etc statements.
+set @a= _cp850 'Müller' collate cp850_general_ci;
+truncate table t1;
+insert into t1 (b) values(collation(@a));
+--disable_query_log
+select "--- --master--" as "";
+--enable_query_log
+select * from t1 order by a;
+sync_slave_with_master;
+--disable_query_log
+select "--- --slave--" as "";
+--enable_query_log
+select * from mysqltest2.t1 order by a;
+
+connection master;
+drop database mysqltest2;
+drop database mysqltest3;
+show binlog events from 79;
+sync_slave_with_master;
+
+# Check that we can't change global.collation_server
+
+error 1105;
+set global character_set_server=latin2;
+connection master;
+error 1105;
+set global character_set_server=latin2;
+
+# Check that SET ONE_SHOT is really one shot
+
+set one_shot @@character_set_server=latin5;
+set @@max_join_size=1000;
+select @@character_set_server;
+select @@character_set_server;
+set @@character_set_server=latin5;
+select @@character_set_server;
+select @@character_set_server;
+
+# ONE_SHOT on not charset/collation stuff is not allowed
+error 1105;
+set one_shot max_join_size=10;
+
+# Test of wrong character set numbers;
+error 1115;
+set character_set_client=9999999;
+error 1273;
+set collation_server=9999998;
+
+# This one was contributed by Sergey Petrunia (BUG#3943)
+
+use test;
+CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255));
+SET CHARACTER_SET_CLIENT=koi8r,
+ CHARACTER_SET_CONNECTION=cp1251,
+ CHARACTER_SET_RESULTS=koi8r;
+INSERT INTO t1 (c1, c2) VALUES ('îÕ, ÚÁ ÒÙÂÁÌËÕ','îÕ, ÚÁ ÒÙÂÁÌËÕ');
+select hex(c1), hex(c2) from t1;
+sync_slave_with_master;
+select hex(c1), hex(c2) from t1;
+
+# Now test for BUG##5705: SET CHARATER_SET_SERVERetc will be lost if
+# STOP SLAVE before following query
+
+stop slave;
+delete from t1;
+change master to master_log_pos=5847;
+start slave until master_log_file='master-bin.000001', master_log_pos=5983;
+# Slave is supposed to stop _after_ the INSERT, even though 5983 is
+# the position of the beginning of the INSERT; after SET slave is not
+# supposed to increment position.
+wait_for_slave_to_stop;
+# When you merge this into 5.0 you will have to adjust positions
+# above; the first master_log_pos above should be the one of the SET,
+# the second should be the one of the INSERT.
+start slave;
+sync_with_master;
+select hex(c1), hex(c2) from t1;
+connection master;
+drop table t1;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_commit_after_flush.test b/mysql-test/t/rpl_commit_after_flush.test
index edbbd1bfad6..62c89b3aae6 100644
--- a/mysql-test/t/rpl_commit_after_flush.test
+++ b/mysql-test/t/rpl_commit_after_flush.test
@@ -1,6 +1,6 @@
source include/master-slave.inc;
source include/have_innodb.inc;
-create table t1 (a int) type=innodb;
+create table t1 (a int) engine=innodb;
begin;
insert into t1 values(1);
flush tables with read lock;
diff --git a/mysql-test/t/rpl_create_database-master.opt b/mysql-test/t/rpl_create_database-master.opt
new file mode 100644
index 00000000000..85660a17140
--- /dev/null
+++ b/mysql-test/t/rpl_create_database-master.opt
@@ -0,0 +1 @@
+--binlog-do-db=mysqltest_sisyfos --binlog-do-db=mysqltest_prometheus
diff --git a/mysql-test/t/rpl_create_database-slave.opt b/mysql-test/t/rpl_create_database-slave.opt
new file mode 100644
index 00000000000..96d630c9229
--- /dev/null
+++ b/mysql-test/t/rpl_create_database-slave.opt
@@ -0,0 +1 @@
+--replicate-do-db=mysqltest_sisyfos --replicate-do-db=mysqltest_prometheus
diff --git a/mysql-test/t/rpl_create_database.test b/mysql-test/t/rpl_create_database.test
new file mode 100644
index 00000000000..7ed0d5dbdbb
--- /dev/null
+++ b/mysql-test/t/rpl_create_database.test
@@ -0,0 +1,70 @@
+#
+# Tests for replication of statements that manipulate databases.
+#
+# For this test file, we have a number of databases. All databases
+# with "greek" names will be replicated on the slave, while other names
+# (e.g., american) will not be replicated.
+#
+
+source include/master-slave.inc;
+
+# Bug#6391 (binlog-do-db rules ignored)
+# In this case, 'mysqltest_bob' should not be replicated to the slave.
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest_prometheus;
+DROP DATABASE IF EXISTS mysqltest_sisyfos;
+DROP DATABASE IF EXISTS mysqltest_bob;
+sync_slave_with_master;
+# This database is not replicated
+DROP DATABASE IF EXISTS mysqltest_bob;
+--enable_warnings
+
+connection master;
+CREATE DATABASE mysqltest_prometheus;
+CREATE DATABASE mysqltest_sisyfos;
+CREATE DATABASE mysqltest_bob;
+
+USE mysqltest_sisyfos;
+# These should be replicated
+CREATE TABLE t1 (b int);
+INSERT INTO t1 VALUES(1);
+
+USE mysqltest_bob;
+# These should *not* be replicated
+CREATE TABLE t2 (b int);
+INSERT INTO t2 VALUES(2);
+
+# Current database is now 'mysqltest_bob'
+# The following should be replicated
+ALTER DATABASE mysqltest_sisyfos CHARACTER SET latin1;
+
+USE mysqltest_sisyfos;
+# The following should *not* be replicated
+ALTER DATABASE mysqltest_bob CHARACTER SET latin1;
+
+SHOW DATABASES;
+sync_slave_with_master;
+SHOW DATABASES;
+
+connection master;
+DROP DATABASE IF EXISTS mysqltest_sisyfos;
+USE mysqltest_prometheus;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1);
+CREATE DATABASE mysqltest_sisyfos;
+USE mysqltest_sisyfos;
+CREATE TABLE t2 (a INT);
+let $VERSION=`select version()`;
+--replace_result $VERSION VERSION
+SHOW BINLOG EVENTS;
+SHOW DATABASES;
+sync_slave_with_master;
+SHOW DATABASES;
+SHOW CREATE TABLE mysqltest_prometheus.t1;
+SHOW CREATE TABLE mysqltest_sisyfos.t2;
+
+connection master;
+DROP DATABASE IF EXISTS mysqltest_prometheus;
+DROP DATABASE IF EXISTS mysqltest_sisyfos;
+DROP DATABASE IF EXISTS mysqltest_bob;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_delete_all.test b/mysql-test/t/rpl_delete_all.test
new file mode 100644
index 00000000000..23848720107
--- /dev/null
+++ b/mysql-test/t/rpl_delete_all.test
@@ -0,0 +1,41 @@
+source include/master-slave.inc;
+
+connection slave;
+create database mysqltest;
+connection master;
+drop database if exists mysqltest;
+sync_slave_with_master;
+# can't read dir
+--replace_result "Errcode: 1" "Errcode: X" "Errcode: 2" "Errcode: X"
+--error 12
+show tables from mysqltest;
+
+connection slave;
+create table t1 (a int);
+connection master;
+drop table if exists t1;
+sync_slave_with_master;
+# table does not exist
+--error 1146
+select * from t1;
+
+connection master;
+create table t1 (a int);
+sync_slave_with_master;
+insert into t1 values(1);
+connection master;
+delete from t1;
+sync_slave_with_master;
+select * from t1;
+
+insert into t1 values(1);
+connection master;
+insert into t1 values(2);
+update t1 set a=2;
+sync_slave_with_master;
+select * from t1;
+
+# cleanup
+connection master;
+drop table t1;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_do_grant.test b/mysql-test/t/rpl_do_grant.test
index 89ff1afb5c9..27a22874497 100644
--- a/mysql-test/t/rpl_do_grant.test
+++ b/mysql-test/t/rpl_do_grant.test
@@ -4,16 +4,16 @@ source include/master-slave.inc;
# do not be influenced by other tests.
connection master;
-delete from mysql.user where user='rpl_do_grant';
-delete from mysql.db where user='rpl_do_grant';
+delete from mysql.user where user=_binary'rpl_do_grant';
+delete from mysql.db where user=_binary'rpl_do_grant';
flush privileges;
save_master_pos;
connection slave;
sync_with_master;
# if these DELETE did nothing on the master, we need to do them manually on the
# slave.
-delete from mysql.user where user='rpl_ignore_grant';
-delete from mysql.db where user='rpl_ignore_grant';
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
# test replication of GRANT
@@ -31,12 +31,12 @@ set password for rpl_do_grant@localhost=password("does it work?");
save_master_pos;
connection slave;
sync_with_master;
-select password<>'' from mysql.user where user='rpl_do_grant';
+select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant';
# clear what we have done, to not influence other tests.
connection master;
-delete from mysql.user where user='rpl_do_grant';
-delete from mysql.db where user='rpl_do_grant';
+delete from mysql.user where user=_binary'rpl_do_grant';
+delete from mysql.db where user=_binary'rpl_do_grant';
flush privileges;
save_master_pos;
connection slave;
diff --git a/mysql-test/t/rpl_drop.test b/mysql-test/t/rpl_drop.test
index 6fc2500fc97..ab5b608cab6 100644
--- a/mysql-test/t/rpl_drop.test
+++ b/mysql-test/t/rpl_drop.test
@@ -1,7 +1,9 @@
# Testcase for BUG#4552 (DROP on two tables, one of which does not
# exist, must be binlogged with a non-zero error code)
source include/master-slave.inc;
+--disable_warnings
drop table if exists t1, t2;
+--enable_warnings
create table t1 (a int);
--error 1051;
drop table t1, t2;
diff --git a/mysql-test/t/rpl_empty_master_crash.test b/mysql-test/t/rpl_empty_master_crash.test
index afa76ce10bb..bee9ef72dc4 100644
--- a/mysql-test/t/rpl_empty_master_crash.test
+++ b/mysql-test/t/rpl_empty_master_crash.test
@@ -1,6 +1,8 @@
source include/master-slave.inc;
-drop table if exists t1;
+
+--replace_column 1 # 33 #
show slave status;
+
#
# Load table should not succeed on the master as this is not a slave
#
diff --git a/mysql-test/t/rpl_error_ignored_table.test b/mysql-test/t/rpl_error_ignored_table.test
index a0b0f1fd599..0062a67ff1a 100644
--- a/mysql-test/t/rpl_error_ignored_table.test
+++ b/mysql-test/t/rpl_error_ignored_table.test
@@ -15,6 +15,7 @@ sync_with_master;
# The port number is different when doing the release build with
# Do-compile, hence we have to replace the port number here accordingly
--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 33 #
show slave status;
# check that the table has been ignored, because otherwise the test is nonsense
show tables like 't1';
@@ -44,7 +45,7 @@ select (@id := id) - id from t3;
kill @id;
drop table t2,t3;
connection master;
---error 1053,0;
+--error 0,1053;
reap;
connection master1;
show binlog events from 79;
diff --git a/mysql-test/t/rpl_failed_optimize-master.opt b/mysql-test/t/rpl_failed_optimize-master.opt
new file mode 100644
index 00000000000..3f82baff598
--- /dev/null
+++ b/mysql-test/t/rpl_failed_optimize-master.opt
@@ -0,0 +1 @@
+--loose-innodb-lock-wait-timeout=1
diff --git a/mysql-test/t/rpl_failed_optimize.test b/mysql-test/t/rpl_failed_optimize.test
new file mode 100644
index 00000000000..d245d1bacbb
--- /dev/null
+++ b/mysql-test/t/rpl_failed_optimize.test
@@ -0,0 +1,18 @@
+source include/have_innodb.inc;
+source include/master-slave.inc;
+
+#
+# BUG#5551 "Failed OPTIMIZE TABLE is logged to binary log"
+# Replication should work when OPTIMIZE TABLE timeouts, and
+# when OPTIMIZE TABLE is executed on a non-existing table
+#
+
+CREATE TABLE t1 ( a int ) ENGINE=InnoDB;
+BEGIN;
+INSERT INTO t1 VALUES (1);
+
+connection master1;
+OPTIMIZE TABLE t1;
+
+OPTIMIZE TABLE non_existing;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_failsafe.test b/mysql-test/t/rpl_failsafe.test
index 866efbce5bf..ae61b061153 100644
--- a/mysql-test/t/rpl_failsafe.test
+++ b/mysql-test/t/rpl_failsafe.test
@@ -7,18 +7,16 @@ show variables like 'rpl_recovery_rank';
show status like 'Rpl_status';
create table t1(n int);
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
show variables like 'rpl_recovery_rank';
show status like 'Rpl_status';
connection slave_sec;
-slave start;
+start slave;
sync_with_master;
show variables like 'rpl_recovery_rank';
show status like 'Rpl_status';
connection slave_ter;
-slave start;
+start slave;
sync_with_master;
show variables like 'rpl_recovery_rank';
show status like 'Rpl_status';
diff --git a/mysql-test/t/rpl_flush_log_loop.test b/mysql-test/t/rpl_flush_log_loop.test
index 8a3da1a2b02..74920722868 100644
--- a/mysql-test/t/rpl_flush_log_loop.test
+++ b/mysql-test/t/rpl_flush_log_loop.test
@@ -7,15 +7,16 @@ connection slave;
--replace_result $MASTER_MYPORT MASTER_PORT
eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$MASTER_MYPORT;
-slave start;
+start slave;
connection master;
-slave stop;
+stop slave;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$SLAVE_MYPORT;
-slave start;
+start slave;
sleep 5;
flush logs;
sleep 5;
--replace_result $SLAVE_MYPORT SLAVE_PORT
+--replace_column 1 # 33 #
show slave status;
diff --git a/mysql-test/t/rpl_flush_tables.test b/mysql-test/t/rpl_flush_tables.test
new file mode 100644
index 00000000000..b98235fbed8
--- /dev/null
+++ b/mysql-test/t/rpl_flush_tables.test
@@ -0,0 +1,35 @@
+#
+# Test of replicating FLUSH TABLES to make
+# RENAME TABLE work with MERGE tables on the slave.
+# Test of FLUSH NO_WRITE_TO_BINLOG by the way.
+#
+source include/master-slave.inc;
+
+create table t1 (a int);
+insert into t1 values (10);
+create table t2 (a int);
+create table t3 (a int) engine=merge union(t1);
+create table t4 (a int);
+# We force the slave to open t3 (because we want to try confusing him) with this :
+insert into t4 select * from t3;
+rename table t1 to t5, t2 to t1;
+# RENAME may have confused the master (this is a known bug): so FLUSH tables,
+# first don't write it to the binlog, to test the NO_WRITE_TO_BINLOG keyword.
+flush no_write_to_binlog tables;
+# Check that it's not in the binlog.
+--replace_result $SERVER_VERSION SERVER_VERSION
+show binlog events;
+# Check that the master is not confused.
+select * from t3;
+# This FLUSH should go into the binlog to not confuse the slave.
+flush tables;
+# Check that it's in the binlog.
+--replace_result $SERVER_VERSION SERVER_VERSION
+show binlog events;
+save_master_pos;
+connection slave;
+sync_with_master;
+# Check that the slave is not confused.
+select * from t3;
+# Note that all this confusion may cause warnings 'table xx is open on rename'
+# in the .err files; these are not fatal and are not reported by mysql-test-run.
diff --git a/mysql-test/t/rpl_get_lock.test b/mysql-test/t/rpl_get_lock.test
index e93268e6074..5e58753e59a 100644
--- a/mysql-test/t/rpl_get_lock.test
+++ b/mysql-test/t/rpl_get_lock.test
@@ -5,6 +5,7 @@ insert into t1 values(get_lock("lock",2));
dirty_close master;
connection master1;
select get_lock("lock",2);
+
select release_lock("lock");
#ignore
disable_query_log;
@@ -21,7 +22,8 @@ connection slave;
sync_with_master;
select get_lock("lock",3);
select * from t1;
-select is_free_lock("lock");
+select is_free_lock("lock"), is_used_lock("lock") = connection_id();
+explain extended select is_free_lock("lock"), is_used_lock("lock");
# Check lock functions
select is_free_lock("lock2");
select is_free_lock(NULL);
diff --git a/mysql-test/t/rpl_ignore_grant.test b/mysql-test/t/rpl_ignore_grant.test
index 2fd7f186b3e..9b012d08df3 100644
--- a/mysql-test/t/rpl_ignore_grant.test
+++ b/mysql-test/t/rpl_ignore_grant.test
@@ -6,16 +6,16 @@ source include/master-slave.inc;
# do not be influenced by other tests.
connection master;
-delete from mysql.user where user='rpl_ignore_grant';
-delete from mysql.db where user='rpl_ignore_grant';
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
save_master_pos;
connection slave;
sync_with_master;
# as these DELETE were not replicated, we need to do them manually on the
# slave.
-delete from mysql.user where user='rpl_ignore_grant';
-delete from mysql.db where user='rpl_ignore_grant';
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
# test non-replication of GRANT
@@ -29,8 +29,8 @@ sync_with_master;
--error 1141 #("no such grant for user")
show grants for rpl_ignore_grant@localhost;
# check it another way
-select count(*) from mysql.user where user='rpl_ignore_grant';
-select count(*) from mysql.db where user='rpl_ignore_grant';
+select count(*) from mysql.user where user=_binary'rpl_ignore_grant';
+select count(*) from mysql.db where user=_binary'rpl_ignore_grant';
# test non-replication of SET PASSWORD
# first force creation of the user on slave (because as the user does not exist
@@ -42,16 +42,16 @@ set password for rpl_ignore_grant@localhost=password("does it work?");
save_master_pos;
connection slave;
sync_with_master;
-select password<>'' from mysql.user where user='rpl_ignore_grant';
+select password<>_binary'' from mysql.user where user=_binary'rpl_ignore_grant';
# clear what we have done, to not influence other tests.
connection master;
-delete from mysql.user where user='rpl_ignore_grant';
-delete from mysql.db where user='rpl_ignore_grant';
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
save_master_pos;
connection slave;
sync_with_master;
-delete from mysql.user where user='rpl_ignore_grant';
-delete from mysql.db where user='rpl_ignore_grant';
+delete from mysql.user where user=_binary'rpl_ignore_grant';
+delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
diff --git a/mysql-test/t/rpl_init_slave-slave.opt b/mysql-test/t/rpl_init_slave-slave.opt
new file mode 100644
index 00000000000..337e8a60d97
--- /dev/null
+++ b/mysql-test/t/rpl_init_slave-slave.opt
@@ -0,0 +1 @@
+--init-slave="set global max_connections=500"
diff --git a/mysql-test/t/rpl_init_slave.test b/mysql-test/t/rpl_init_slave.test
new file mode 100644
index 00000000000..3ea04117ced
--- /dev/null
+++ b/mysql-test/t/rpl_init_slave.test
@@ -0,0 +1,26 @@
+source include/master-slave.inc;
+
+#
+# Test of init_slave variable
+#
+
+save_master_pos;
+connection slave;
+sleep 1;
+show variables like 'init_slave';
+show variables like 'max_connections';
+sync_with_master;
+reset master;
+connection master;
+show variables like 'init_slave';
+show variables like 'max_connections';
+save_master_pos;
+connection slave;
+sync_with_master;
+set global init_connect="set @c=1";
+show variables like 'init_connect';
+connection master;
+save_master_pos;
+connection slave;
+sync_with_master;
+stop slave;
diff --git a/mysql-test/t/rpl_insert_id-slave.opt b/mysql-test/t/rpl_insert_id-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_insert_id-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_insert_id.test b/mysql-test/t/rpl_insert_id.test
index a6da44de456..4c27c03af60 100644
--- a/mysql-test/t/rpl_insert_id.test
+++ b/mysql-test/t/rpl_insert_id.test
@@ -6,7 +6,6 @@
source include/master-slave.inc;
source include/have_innodb.inc
connection master;
-drop table if exists t1;
create table t1(a int auto_increment, key(a));
create table t2(b int auto_increment, c int, key(b));
insert into t1 values (1),(2),(3);
@@ -24,8 +23,8 @@ connection master;
drop table t1;
drop table t2;
--disable_warnings
-create table t1(a int auto_increment, key(a)) type=innodb;
-create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) type=innodb;
+create table t1(a int auto_increment, key(a)) engine=innodb;
+create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) engine=innodb;
--enable_warnings
SET FOREIGN_KEY_CHECKS=0;
insert into t1 values (10);
diff --git a/mysql-test/t/rpl_insert_ignore-slave.opt b/mysql-test/t/rpl_insert_ignore-slave.opt
new file mode 100644
index 00000000000..627becdbfb5
--- /dev/null
+++ b/mysql-test/t/rpl_insert_ignore-slave.opt
@@ -0,0 +1 @@
+--innodb
diff --git a/mysql-test/t/rpl_insert_ignore.test b/mysql-test/t/rpl_insert_ignore.test
new file mode 100644
index 00000000000..58eaa287817
--- /dev/null
+++ b/mysql-test/t/rpl_insert_ignore.test
@@ -0,0 +1,71 @@
+# Testcase for BUG#6287 "Slave skips auto_increment values in Replication with InnoDB"
+# The bug was that if on master, INSERT IGNORE ignored some
+# rows, and the table was InnoDB with auto_inc column, then on slave
+# some rows received an auto_inc bigger than on master.
+# Slave needs to be started with --innodb to store table in InnoDB.
+# Same test for MyISAM (which had no bug).
+
+-- source include/have_innodb.inc
+
+-- source include/master-slave.inc
+
+CREATE TABLE t1 (
+ a int unsigned not null auto_increment primary key,
+ b int unsigned,
+ unique (b)
+) ENGINE=innodb;
+
+CREATE TABLE t2 (
+ a int unsigned, # to force INSERT SELECT to have a certain order
+ b int unsigned
+) ENGINE=innodb;
+
+
+INSERT INTO t1 VALUES (NULL, 1);
+INSERT INTO t1 VALUES (NULL, 2);
+INSERT INTO t1 VALUES (NULL, 3);
+INSERT INTO t1 VALUES (NULL, 4);
+
+# An alternation of values which will conflict in t1 and will not.
+
+INSERT INTO t2 VALUES (1, 1);
+INSERT INTO t2 VALUES (2, 2);
+INSERT INTO t2 VALUES (3, 5);
+INSERT INTO t2 VALUES (4, 3);
+INSERT INTO t2 VALUES (5, 4);
+INSERT INTO t2 VALUES (6, 6);
+
+INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
+
+# Compare results
+
+SELECT * FROM t1 ORDER BY a;
+
+sync_slave_with_master;
+SELECT * FROM t1 ORDER BY a;
+
+# Now do the same for MyISAM
+
+connection master;
+drop table t1;
+CREATE TABLE t1 (
+ a int unsigned not null auto_increment primary key,
+ b int unsigned,
+ unique (b)
+) ENGINE=myisam;
+
+INSERT INTO t1 VALUES (1, 1);
+INSERT INTO t1 VALUES (2, 2);
+INSERT INTO t1 VALUES (3, 3);
+INSERT INTO t1 VALUES (4, 4);
+
+INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
+
+SELECT * FROM t1 ORDER BY a;
+
+sync_slave_with_master;
+SELECT * FROM t1 ORDER BY a;
+
+connection master;
+drop table t1, t2;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_loaddata.test b/mysql-test/t/rpl_loaddata.test
index a3bb8c9aec9..10213644836 100644
--- a/mysql-test/t/rpl_loaddata.test
+++ b/mysql-test/t/rpl_loaddata.test
@@ -2,13 +2,14 @@
# Honours autoincrement values
# i.e. if the master and slave have the same sequence
#
-# check replication of load data for temporary tables with additional parameters
+# check replication of load data for temporary tables with additional
+# parameters
#
# check if duplicate entries trigger an error (they should unless IGNORE or
# REPLACE was used on the master) (bug 571).
#
# check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and
-# Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986).
+# Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986)
source include/master-slave.inc;
@@ -71,6 +72,7 @@ set global sql_slave_skip_counter=1;
start slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 33 #
show slave status;
# Trigger error again to test CHANGE MASTER
@@ -90,6 +92,7 @@ stop slave;
change master to master_user='test';
change master to master_user='root';
--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 33 #
show slave status;
# Trigger error again to test RESET SLAVE
@@ -111,6 +114,7 @@ wait_for_slave_to_stop;
stop slave;
reset slave;
--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 33 #
show slave status;
# Finally, see if logging is done ok on master for a failing LOAD DATA INFILE
diff --git a/mysql-test/t/rpl_loaddata_rule_m.test b/mysql-test/t/rpl_loaddata_rule_m.test
index 18f295f8ce2..678dae13889 100644
--- a/mysql-test/t/rpl_loaddata_rule_m.test
+++ b/mysql-test/t/rpl_loaddata_rule_m.test
@@ -3,16 +3,21 @@
# This is for BUG#1100 (LOAD DATA INFILE was half-logged).
source include/master-slave.inc;
+
+--disable_warnings
+drop database if exists mysqltest;
+--enable_warnings
+
connection slave;
-reset master;
+stop slave; # don't need slave for this test
# Test logging on master
connection master;
# 'test' is the current database
-create database test2;
+create database mysqltest;
create table t1(a int, b int, unique(b));
-use test2;
+use mysqltest;
load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
show binlog events from 79; # should be nothing
-drop database test2;
+drop database mysqltest;
diff --git a/mysql-test/t/rpl_log.test b/mysql-test/t/rpl_log.test
index df2b9ecd0cb..8fdccdd068d 100644
--- a/mysql-test/t/rpl_log.test
+++ b/mysql-test/t/rpl_log.test
@@ -1,8 +1,18 @@
source include/master-slave.inc;
-#clean up slave binlogs
+# Clean up old slave's binlogs.
+# The slave is started with --log-slave-updates
+# and this test does SHOW BINLOG EVENTS on the slave's
+# binlog. But previous tests can influence the current test's
+# binlog (e.g. a temporary table in the previous test has not
+# been explicitly deleted, and at the beginning of the current
+# test the slave immediately writes DROP TEMPORARY TABLE this_old_table).
+# We wait for the slave to have written all he wants to the binlog
+# (otherwise RESET MASTER may come too early).
+save_master_pos;
connection slave;
-slave stop;
+sync_with_master;
+stop slave;
reset master;
reset slave;
# We are going to read the slave's binlog which contains file_id (for some LOAD
@@ -59,10 +69,10 @@ connection slave;
# Note that the above 'slave start' will cause a 3rd rotate event (a fake one)
# to go into the relay log (the master always sends a fake one when replication
# starts).
-slave start;
+start slave;
sync_with_master;
flush logs;
-slave stop;
+stop slave;
connection master;
# Create some entries for second log
@@ -72,27 +82,28 @@ insert into t1 values (1);
drop table t1;
--replace_result $VERSION VERSION
show binlog events;
-show binlog events in 'master-bin.002';
-show master logs;
+show binlog events in 'master-bin.000002';
+show binary logs;
save_master_pos;
connection slave;
-slave start;
+start slave;
sync_with_master;
-show master logs;
+show binary logs;
--replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
-show binlog events in 'slave-bin.001' from 4;
+show binlog events in 'slave-bin.000001' from 4;
--replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
-show binlog events in 'slave-bin.002' from 4;
+show binlog events in 'slave-bin.000002' from 4;
--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 33 #
show slave status;
# Need to recode the following
-#show new master for slave with master_log_file='master-bin.001' and master_log_pos=4 and master_server_id=1;
-#show new master for slave with master_log_file='master-bin.001' and master_log_pos=79 and master_server_id=1;
-#show new master for slave with master_log_file='master-bin.001' and master_log_pos=311 and master_server_id=1;
-#show new master for slave with master_log_file='master-bin.002' and master_log_pos=4 and master_server_id=1;
-#show new master for slave with master_log_file='master-bin.002' and master_log_pos=122 and master_server_id=1;
+#show new master for slave with master_log_file='master-bin.000001' and master_log_pos=4 and master_server_id=1;
+#show new master for slave with master_log_file='master-bin.000001' and master_log_pos=79 and master_server_id=1;
+#show new master for slave with master_log_file='master-bin.000001' and master_log_pos=311 and master_server_id=1;
+#show new master for slave with master_log_file='master-bin.000002' and master_log_pos=4 and master_server_id=1;
+#show new master for slave with master_log_file='master-bin.000002' and master_log_pos=122 and master_server_id=1;
--error 1220
-show binlog events in 'slave-bin.005' from 4;
+show binlog events in 'slave-bin.000005' from 4;
diff --git a/mysql-test/t/rpl_log_pos.test b/mysql-test/t/rpl_log_pos.test
index 1a9a5bc3448..a40736577c8 100644
--- a/mysql-test/t/rpl_log_pos.test
+++ b/mysql-test/t/rpl_log_pos.test
@@ -3,29 +3,31 @@
#
source include/master-slave.inc;
show master status;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 33 #
show slave status;
-slave stop;
+stop slave;
change master to master_log_pos=73;
-slave start;
+start slave;
sleep 5;
-slave stop;
+stop slave;
change master to master_log_pos=73;
--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 33 #
show slave status;
-slave start;
+start slave;
sleep 5;
--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 33 #
show slave status;
-slave stop;
+stop slave;
change master to master_log_pos=173;
-slave start;
+start slave;
sleep 2;
--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 33 #
show slave status;
connection master;
show master status;
@@ -35,13 +37,11 @@ create table t1 (n int);
insert into t1 values (1),(2),(3);
save_master_pos;
connection slave;
-slave stop;
+stop slave;
change master to master_log_pos=79;
-slave start;
+start slave;
sync_with_master;
select * from t1;
connection master;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_master_pos_wait.test b/mysql-test/t/rpl_master_pos_wait.test
index 24479636c91..4d4d51b04ab 100644
--- a/mysql-test/t/rpl_master_pos_wait.test
+++ b/mysql-test/t/rpl_master_pos_wait.test
@@ -7,6 +7,7 @@ sync_with_master;
# Ask for a master log that has certainly not been reached yet
# timeout= 2 seconds
select master_pos_wait('master-bin.999999',0,2);
+explain extended select master_pos_wait('master-bin.999999',0,2);
# Testcase for bug 651 (master_pos_wait() hangs if slave idle and STOP SLAVE).
send select master_pos_wait('master-bin.999999',0);
connection slave1;
diff --git a/mysql-test/t/rpl_max_relay_size.test b/mysql-test/t/rpl_max_relay_size.test
index d2278b6d6df..cbcc115a942 100644
--- a/mysql-test/t/rpl_max_relay_size.test
+++ b/mysql-test/t/rpl_max_relay_size.test
@@ -29,6 +29,7 @@ select @@global.max_relay_log_size;
start slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 33 #
show slave status;
stop slave;
reset slave;
@@ -37,7 +38,7 @@ select @@global.max_relay_log_size;
start slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 18 #
+--replace_column 1 # 33 #
show slave status;
stop slave;
reset slave;
@@ -46,6 +47,7 @@ select @@global.max_relay_log_size;
start slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 33 #
show slave status;
# Tests below are mainly to ensure that we have not coded with wrong assumptions
@@ -56,6 +58,7 @@ reset slave;
# (to make sure it does not crash).
flush logs;
--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 33 #
show slave status;
reset slave;
@@ -71,8 +74,9 @@ save_master_pos;
connection slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 33 #
show slave status;
-# one more rotation, to be sure Relay_log_space is correctly updated
+# one more rotation, to be sure Relay_Log_Space is correctly updated
flush logs;
connection master;
drop table t1;
@@ -80,6 +84,7 @@ save_master_pos;
connection slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 33 #
show slave status;
connection master;
diff --git a/mysql-test/t/rpl_misc_functions-slave.sh b/mysql-test/t/rpl_misc_functions-slave.sh
new file mode 100755
index 00000000000..c293715e16f
--- /dev/null
+++ b/mysql-test/t/rpl_misc_functions-slave.sh
@@ -0,0 +1 @@
+rm -f $MYSQL_TEST_DIR/var/master-data/test/rpl_misc_functions.outfile
diff --git a/mysql-test/t/rpl_misc_functions.test b/mysql-test/t/rpl_misc_functions.test
new file mode 100644
index 00000000000..12eadbb25ed
--- /dev/null
+++ b/mysql-test/t/rpl_misc_functions.test
@@ -0,0 +1,30 @@
+#
+# Test of replicating some difficult functions
+#
+source include/master-slave.inc;
+
+create table t1(id int, i int, r1 int, r2 int, p varchar(100));
+insert into t1 values(1, connection_id(), 0, 0, "");
+# don't put rand and password in the same query, to see if they replicate
+# independently
+# Pure rand test
+insert into t1 values(2, 0, rand()*1000, rand()*1000, "");
+# change the rand suite on the master (we do this because otherwise password()
+# benefits from the fact that the above rand() is well replicated :
+# it picks the same sequence element, which hides a possible bug in password() replication.
+set sql_log_bin=0;
+insert into t1 values(6, 0, rand(), rand(), "");
+delete from t1 where id=6;
+set sql_log_bin=1;
+# Pure password test
+insert into t1 values(3, 0, 0, 0, password('does_this_work?'));
+# "altogether now"
+insert into t1 values(4, connection_id(), rand()*1000, rand()*1000, password('does_this_still_work?'));
+select * into outfile 'rpl_misc_functions.outfile' from t1;
+sync_slave_with_master;
+create table t2 like t1;
+# read the values from the master table
+load data local infile './var/master-data/test/rpl_misc_functions.outfile' into table t2;
+# compare them with the replica; the SELECT below should return no row
+select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and t1.r2=t2.r2 and t1.p=t2.p);
+stop slave;
diff --git a/mysql-test/t/rpl_multi_update.test b/mysql-test/t/rpl_multi_update.test
index cefa9face12..88994aa66bd 100644
--- a/mysql-test/t/rpl_multi_update.test
+++ b/mysql-test/t/rpl_multi_update.test
@@ -1,15 +1,14 @@
source include/master-slave.inc;
-drop table if exists t1,t2;
CREATE TABLE t1 (
a int unsigned not null auto_increment primary key,
b int unsigned
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
CREATE TABLE t2 (
a int unsigned not null auto_increment primary key,
b int unsigned
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (NULL, 0);
INSERT INTO t1 SELECT NULL, 0 FROM t1;
diff --git a/mysql-test/t/rpl_mystery22.test b/mysql-test/t/rpl_mystery22.test
index 5280cb360dd..d49f1a210f4 100644
--- a/mysql-test/t/rpl_mystery22.test
+++ b/mysql-test/t/rpl_mystery22.test
@@ -4,9 +4,7 @@ source include/master-slave.inc;
# first, cause a duplicate key problem on the slave
create table t1(n int auto_increment primary key);
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
insert into t1 values (2);
connection master;
insert into t1 values(NULL);
@@ -16,11 +14,11 @@ connection slave;
sleep 3; # there is no way around this sleep - we have to wait until
# the slave tries to run the query, fails and aborts slave thread
delete from t1 where n = 2;
-slave start;
+start slave;
sync_with_master;
#now the buggy slave would be confused on the offset but it can replicate
#in order to make it break, we need to stop/start the slave one more time
-slave stop;
+stop slave;
connection master;
# to be able to really confuse the slave, we need some non-auto-increment
# events in the log
@@ -29,7 +27,7 @@ drop table t2;
insert into t1 values(NULL);
save_master_pos;
connection slave;
-slave start;
+start slave;
#now the truth comes out - if the slave is buggy, it will never sync because
#the slave thread is not able to read events
sync_with_master;
@@ -37,7 +35,5 @@ select * from t1;
#clean up
connection master;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_openssl.test b/mysql-test/t/rpl_openssl.test
new file mode 100644
index 00000000000..8a36904f4d4
--- /dev/null
+++ b/mysql-test/t/rpl_openssl.test
@@ -0,0 +1,62 @@
+source include/have_openssl_1.inc;
+source include/master-slave.inc;
+
+# We don't test all types of ssl auth params here since it's a bit hard
+# until problems with OpenSSL 0.9.7 are unresolved
+
+# creating replication user for whom ssl auth is required
+# preparing playground
+connection master;
+grant replication slave on *.* to replssl@'%' require ssl;
+create table t1 (t int);
+save_master_pos;
+
+#syncing with master
+connection slave;
+sync_with_master;
+
+#trying to use this user without ssl
+stop slave;
+change master to master_user='replssl',master_password='';
+start slave;
+
+#showing that replication don't work
+connection master;
+insert into t1 values (1);
+#reasonable timeout for changes to propagate to slave
+sleep 3;
+connection slave;
+select * from t1;
+
+#showing that replication could work with ssl params
+stop slave;
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+eval change master to master_ssl=1 , master_ssl_ca ='$MYSQL_TEST_DIR/std_data/cacert.pem', master_ssl_cert='$MYSQL_TEST_DIR/std_data/client-cert.pem', master_ssl_key='$MYSQL_TEST_DIR/std_data/client-key.pem';
+start slave;
+
+#avoiding unneeded sleeps
+connection master;
+save_master_pos;
+connection slave;
+sync_with_master;
+
+#checking that replication is ok
+select * from t1;
+
+#checking show slave status
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 33 #
+show slave status;
+
+#checking if replication works without ssl also performing clean up
+stop slave;
+change master to master_user='root',master_password='', master_ssl=0;
+start slave;
+connection master;
+drop table t1;
+save_master_pos;
+connection slave;
+sync_with_master;
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 33 #
+show slave status;
diff --git a/mysql-test/t/rpl_ps.test b/mysql-test/t/rpl_ps.test
new file mode 100644
index 00000000000..79f48381a4f
--- /dev/null
+++ b/mysql-test/t/rpl_ps.test
@@ -0,0 +1,43 @@
+#
+# Test of replicating user variables
+#
+source include/master-slave.inc;
+
+#save_master_pos;
+#connection slave;
+#sync_with_master;
+#reset master;
+#connection master;
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+create table t1(n char(30));
+
+prepare stmt1 from 'insert into t1 values (?)';
+set @var1= "from-master-1";
+execute stmt1 using @var1;
+set @var1= "from-master-2-'',";
+execute stmt1 using @var1;
+select * from t1;
+
+set @var2= 'insert into t1 values (concat("from-var-", ?))';
+prepare stmt2 from @var2;
+set @var1='from-master-3';
+execute stmt2 using @var1;
+
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from t1;
+
+connection master;
+
+drop table t1;
+
+save_master_pos;
+connection slave;
+sync_with_master;
+stop slave;
+
diff --git a/mysql-test/t/rpl_redirect.test b/mysql-test/t/rpl_redirect.test
index 4082542f295..c533c0052f0 100644
--- a/mysql-test/t/rpl_redirect.test
+++ b/mysql-test/t/rpl_redirect.test
@@ -3,6 +3,8 @@
#
source include/master-slave.inc;
+# We disable this for now as PS doesn't handle redirection
+--disable_ps_protocol
#first, make sure the slave has had enough time to register
save_master_pos;
@@ -12,6 +14,7 @@ sync_with_master;
#discover slaves
connection master;
--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 33 #
SHOW SLAVE STATUS;
--replace_result $SLAVE_MYPORT SLAVE_PORT
SHOW SLAVE HOSTS;
@@ -19,7 +22,6 @@ rpl_probe;
#turn on master/slave query direction auto-magic
enable_rpl_parse;
-drop table if exists t1;
create table t1 ( n int);
insert into t1 values (1),(2),(3),(4);
disable_rpl_parse;
diff --git a/mysql-test/t/rpl_relayrotate-slave.opt b/mysql-test/t/rpl_relayrotate-slave.opt
new file mode 100644
index 00000000000..8b671423363
--- /dev/null
+++ b/mysql-test/t/rpl_relayrotate-slave.opt
@@ -0,0 +1,4 @@
+-O max_binlog_size=16384
+--innodb
+--log-warnings
+
diff --git a/mysql-test/t/rpl_relayrotate.test b/mysql-test/t/rpl_relayrotate.test
new file mode 100644
index 00000000000..1bc6b574663
--- /dev/null
+++ b/mysql-test/t/rpl_relayrotate.test
@@ -0,0 +1,75 @@
+# When the relay log gets rotated while the I/O thread
+# is reading a transaction, the transaction spans on two or more
+# relay logs. If STOP SLAVE occurs while the SQL thread is
+# executing a part of the transaction in the non-first relay logs,
+# we test if START SLAVE will resume in the beginning of the
+# transaction (i.e., step back to the first relay log)
+
+# The slave is started with max_binlog_size=16384 bytes,
+# to force many rotations (approximately 30 rotations)
+
+source include/have_innodb.inc;
+source include/master-slave.inc;
+connection slave;
+stop slave;
+connection master;
+--disable_warnings
+create table t1 (a int) engine=innodb;
+--enable_warnings
+let $1=8000;
+disable_query_log;
+begin;
+while ($1)
+{
+# eval means expand $ expressions
+ eval insert into t1 values( $1 );
+ dec $1;
+}
+commit;
+# This will generate a 500kB master's binlog,
+# which corresponds to 30 slave's relay logs.
+enable_query_log;
+save_master_pos;
+connection slave;
+reset slave;
+start slave;
+# We wait 1 sec for the SQL thread to be somewhere in
+# the middle of the transaction, hopefully not in
+# the first relay log, and hopefully before the COMMIT.
+# Usually it stops when the SQL thread is around the 15th relay log.
+# We cannot use MASTER_POS_WAIT() as master's position
+# increases only when the slave executes the COMMIT.
+# Note that except when using Valgrind, 1 second is enough for the I/O slave
+# thread to fetch the whole master's binlog.
+sleep 1;
+stop slave;
+# We suppose the SQL thread stopped before COMMIT.
+# If so the transaction was rolled back
+# and the table is now empty.
+# Now restart
+start slave;
+# And see if the table contains '8000'
+# which proves that the transaction restarted at
+# the right place.
+# We must wait for the transaction to commit before
+# reading, MASTER_POS_WAIT() will do it for sure
+# (the only statement with position>=3000 is COMMIT).
+select master_pos_wait('master-bin.001',3000)>=0;
+select * from t1 where a=8000;
+
+connection master;
+
+# The following DROP is a very important cleaning task:
+# imagine the next test is run with --skip-innodb: it will do
+# DROP TABLE IF EXISTS t1; but this will delete the frm and leave
+# some data in the InnoDB datafile (because at that time mysqld
+# does not know about InnoDB : --skip-innodb). So if later in the
+# test suite a test wants to create an InnoDB table called t1, it
+# will fail with
+# InnoDB: Error: table t1 already exists in InnoDB internal
+# InnoDB: data dictionary. Have you deleted the .frm file etc
+drop table t1;
+# wait until this drop is executed on slave
+save_master_pos;
+connection slave;
+sync_with_master;
diff --git a/mysql-test/t/rpl_relayspace-slave.opt b/mysql-test/t/rpl_relayspace-slave.opt
index 05cb01731d2..06d96aa3b9a 100644
--- a/mysql-test/t/rpl_relayspace-slave.opt
+++ b/mysql-test/t/rpl_relayspace-slave.opt
@@ -1 +1 @@
- -O relay_log_space_limit=10 \ No newline at end of file
+--relay_log_space_limit=10
diff --git a/mysql-test/t/rpl_replicate_do.test b/mysql-test/t/rpl_replicate_do.test
index 0800062dc05..7066f6e53d8 100644
--- a/mysql-test/t/rpl_replicate_do.test
+++ b/mysql-test/t/rpl_replicate_do.test
@@ -2,9 +2,12 @@
# updates on t1
source include/master-slave.inc;
+--disable_warnings
drop table if exists t11;
connection slave;
drop table if exists t11;
+--enable_warnings
+
create table t2 (n int);
insert into t2 values(4);
connection master;
@@ -24,7 +27,12 @@ select * from t2;
--error 1146
select * from t11;
connection master;
-drop table if exists t1,t2,t3,t11;
+drop table if exists t1,t2,t11;
save_master_pos;
connection slave;
sync_with_master;
+# show slave status, just to see of it prints replicate-do-table
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 33 #
+show slave status;
+
diff --git a/mysql-test/t/rpl_reset_slave.test b/mysql-test/t/rpl_reset_slave.test
index 083492c3fc0..d58e9c711d1 100644
--- a/mysql-test/t/rpl_reset_slave.test
+++ b/mysql-test/t/rpl_reset_slave.test
@@ -11,20 +11,24 @@ save_master_pos;
connection slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 33 #
show slave status;
stop slave;
change master to master_user='test';
--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 33 #
show slave status;
reset slave;
--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 33 #
show slave status;
start slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 33 #
show slave status;
# test of crash with temp tables & RESET SLAVE
diff --git a/mysql-test/t/rpl_rewrite_db-slave.opt b/mysql-test/t/rpl_rewrite_db-slave.opt
new file mode 100644
index 00000000000..a462ad19ba0
--- /dev/null
+++ b/mysql-test/t/rpl_rewrite_db-slave.opt
@@ -0,0 +1 @@
+"--replicate-rewrite-db=test->rewrite" "--replicate-rewrite-db=mysqltest1->test"
diff --git a/mysql-test/t/rpl_rewrite_db.test b/mysql-test/t/rpl_rewrite_db.test
new file mode 100644
index 00000000000..b6118854037
--- /dev/null
+++ b/mysql-test/t/rpl_rewrite_db.test
@@ -0,0 +1,77 @@
+source include/master-slave.inc;
+--disable_warnings
+drop database if exists mysqltest1;
+--enable_warnings
+create database mysqltest1;
+
+use mysqltest1;
+create table t1 (a int);
+insert into t1 values(9);
+select * from mysqltest1.t1;
+sync_slave_with_master;
+show databases like 'mysqltest1'; # should be empty
+select * from test.t1;
+# cleanup
+connection master;
+drop table t1;
+drop database mysqltest1;
+sync_slave_with_master;
+
+#
+# BUG#6353:
+# Option --replicate-rewrite-db should work together with LOAD DATA INFILE
+#
+
+connection slave;
+--disable_warnings
+drop database if exists rewrite;
+--enable_warnings
+create database rewrite;
+
+connection master;
+use test;
+create table t1 (a date, b date, c date not null, d date);
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',';
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
+sync_slave_with_master;
+
+connection slave;
+select * from rewrite.t1;
+
+connection master;
+truncate table t1;
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
+sync_slave_with_master;
+
+connection slave;
+select * from rewrite.t1;
+
+connection master;
+drop table t1;
+create table t1 (a text, b text);
+load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
+sync_slave_with_master;
+
+connection slave;
+select concat('|',a,'|'), concat('|',b,'|') from rewrite.t1;
+
+connection master;
+drop table t1;
+create table t1 (a int, b char(10));
+load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
+sync_slave_with_master;
+
+connection slave;
+select * from rewrite.t1;
+
+connection master;
+truncate table t1;
+load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
+sync_slave_with_master;
+
+connection slave;
+# The empty line last comes from the end line field in the file
+select * from rewrite.t1;
+
+connection master;
+drop table t1;
diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test
index 76a06d01fa9..da4d5f0bce1 100644
--- a/mysql-test/t/rpl_rotate_logs.test
+++ b/mysql-test/t/rpl_rotate_logs.test
@@ -1,5 +1,5 @@
#
-# Test are run with max_binlog_size=2048 to force automatic rotation of the
+# Test is run with max_binlog_size=2048 to force automatic rotation of the
# binary log
# Tests done:
# - Check that slaves reports correct failures if master.info has strange
@@ -8,26 +8,33 @@
# - Ensure that temporary tables works over flush logs and binary log
# changes
# - Test creating a duplicate key error and recover from it
-#
+
connect (master,localhost,root,,test,$MASTER_MYPORT,master.sock);
+--disable_warnings
drop table if exists t1, t2, t3, t4;
+--enable_warnings
connect (slave,localhost,root,,test,$SLAVE_MYPORT,slave.sock);
system cat /dev/null > var/slave-data/master.info;
system chmod 000 var/slave-data/master.info;
connection slave;
+--disable_warnings
drop table if exists t1, t2, t3, t4;
-# START SLAVE will fail because it can't read the file (mode 000) (system error 13)
+--enable_warnings
+
+# START SLAVE will fail because it can't read the file (mode 000)
+# (system error 13)
--error 1201
-slave start;
+start slave;
system chmod 600 var/slave-data/master.info;
# It will fail again because the file is empty so the slave cannot get valuable
# info about how to connect to the master from it (failure in
# init_strvar_from_file() in init_master_info()).
--error 1201
-slave start;
+start slave;
--replace_result $MASTER_MYPORT MASTER_PORT
-# CHANGE MASTER will fail because it first parses master.info before changing it
-# (so when master.info is bad, people have to use RESET SLAVE first).
+
+# CHANGE MASTER will fail because it first parses master.info before changing
+# it (so when master.info is bad, people have to use RESET SLAVE first).
--error 1201
eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root';
reset slave;
@@ -36,7 +43,7 @@ eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master
connection master;
reset master;
connection slave;
-slave start;
+start slave;
connection master;
#
@@ -46,11 +53,9 @@ create temporary table temp_table (a char(80) not null);
insert into temp_table values ("testing temporary tables");
create table t1 (s text);
insert into t1 values('Could not break slave'),('Tried hard');
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 18 #
+--replace_column 1 # 33 #
show slave status;
select * from t1;
connection master;
@@ -58,12 +63,10 @@ flush logs;
create table t2(m int not null auto_increment primary key);
insert into t2 values (34),(67),(123);
flush logs;
-show master logs;
+show binary logs;
create table t3 select * from temp_table;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from t3;
connection master;
@@ -86,23 +89,26 @@ wait_for_slave_to_stop;
#restart slave skipping one event
set global sql_slave_skip_counter=1;
-slave start;
+start slave;
connection master;
-save_master_pos;
#let slave catch up
-connection slave;
-sync_with_master;
+sync_slave_with_master;
connection master;
-purge master logs to 'master-bin.003';
+purge master logs to 'master-bin.000002';
show master logs;
+# we just tests if synonyms are accepted
+purge binary logs to 'master-bin.000002';
+show binary logs;
+# sleeping 10 seconds or more would make the slave believe connection is down
+--real_sleep 1;
+purge master logs before now();
+show binary logs;
insert into t2 values (65);
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 18 #
+--replace_column 1 # 33 #
show slave status;
select * from t2;
@@ -126,7 +132,7 @@ while ($1)
enable_query_log;
select count(*) from t3 where n >= 4;
create table t4 select * from temp_table;
-show master logs;
+show binary logs;
show master status;
save_master_pos;
connection slave;
@@ -134,7 +140,7 @@ sync_with_master;
select * from t4;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 18 #
+--replace_column 1 # 33 #
show slave status;
# because of concurrent insert, the table may not be up to date
# if we do not lock
@@ -144,6 +150,4 @@ unlock tables;
#clean up
connection master;
drop table if exists t1,t2,t3,t4;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_server_id1.test b/mysql-test/t/rpl_server_id1.test
index 1bd4d9547c7..4d504325294 100644
--- a/mysql-test/t/rpl_server_id1.test
+++ b/mysql-test/t/rpl_server_id1.test
@@ -1,9 +1,11 @@
-# This test checks that a slave does not execute queries originating
-# from itself, by default.
+# This test checks that the slave I/O thread refuses to start if slave
+# and master have the same server id (because this is a useless setup,
+# and otherwise SHOW SLAVE STATUS shows progress but all queries are
+# ignored, which has caught our customers), unless
+# --replicate-same-server-id.
source include/master-slave.inc;
connection slave;
-drop table if exists t1;
create table t1 (n int);
reset master;
# replicate ourselves
@@ -19,5 +21,4 @@ insert into t1 values (1);
# (when slave is its own master without --replicate-same-server-id)
sleep 2; # enough time for the event to be replicated (it should not)
show status like "slave_running";
-select * from t1;
drop table t1;
diff --git a/mysql-test/t/rpl_set_charset.test b/mysql-test/t/rpl_set_charset.test
index bd68ce17bbc..269074b1c42 100644
--- a/mysql-test/t/rpl_set_charset.test
+++ b/mysql-test/t/rpl_set_charset.test
@@ -20,13 +20,6 @@ INSERT INTO t1 VALUES ('àáâãäåæçèéêëìíîï','E0');
INSERT INTO t1 VALUES ('ðñòóôõö÷øùúûüýþÿ','F0');
select "--- on master ---";
select hex(a),b from t1 order by b;
-# It's complicated to verify that the charset is reset to default in
-# the binlog after each query, except by checking the binlog. When you
-# merge this into 4.1/5.0, the 1979 will have to be changed; all you have
-# to do is read the var/log/master-bin.0*01 with mysqlbinlog, verify
-# that a SET CHARACTER SET DEFAULT is just after the last INSERT, and
-# replace 1979 by its position (the "# at" line above the SET).
-show binlog events from 1979;
save_master_pos;
connection slave;
sync_with_master;
diff --git a/mysql-test/t/rpl_skip_error.test b/mysql-test/t/rpl_skip_error.test
index d43c59ef024..86c89c70314 100644
--- a/mysql-test/t/rpl_skip_error.test
+++ b/mysql-test/t/rpl_skip_error.test
@@ -1,5 +1,4 @@
source include/master-slave.inc;
-drop table if exists t1;
create table t1 (n int not null primary key);
save_master_pos;
diff --git a/mysql-test/t/rpl_sporadic_master.test b/mysql-test/t/rpl_sporadic_master.test
index e59b93b4475..b24901c62a9 100644
--- a/mysql-test/t/rpl_sporadic_master.test
+++ b/mysql-test/t/rpl_sporadic_master.test
@@ -9,22 +9,16 @@ insert into t1 values (NULL),(NULL);
truncate table t1;
# We have to use 4 in the following to make this test work with all table types
insert into t1 values (4),(NULL);
-save_master_pos;
-connection slave;
-sync_with_master;
-slave stop;
-slave start;
+sync_slave_with_master;
+stop slave;
+start slave;
connection master;
insert into t1 values (NULL),(NULL);
flush logs;
truncate table t1;
insert into t1 values (10),(NULL),(NULL),(NULL),(NULL),(NULL);
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from t1;
connection master;
drop table t1,t2;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_temporary.test b/mysql-test/t/rpl_temporary.test
new file mode 100644
index 00000000000..f84c9b09aef
--- /dev/null
+++ b/mysql-test/t/rpl_temporary.test
@@ -0,0 +1,131 @@
+source include/master-slave.inc;
+
+# Clean up old slave's binlogs.
+# The slave is started with --log-slave-updates
+# and this test does SHOW BINLOG EVENTS on the slave's
+# binlog. But previous tests can influence the current test's
+# binlog (e.g. a temporary table in the previous test has not
+# been explicitly deleted, or it has but the slave hasn't had
+# enough time to catch it before STOP SLAVE,
+# and at the beginning of the current
+# test the slave immediately writes DROP TEMPORARY TABLE this_old_table).
+# We wait for the slave to have written all he wants to the binlog
+# (otherwise RESET MASTER may come too early).
+save_master_pos;
+connection slave;
+sync_with_master;
+reset master;
+connection master;
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+# We want to connect as an unprivileged user. But if we use user="" then this
+# will pick the Unix login, which will cause problems if you're running the test
+# as root.
+connect (con3,localhost,zedjzlcsjhd,,);
+
+# We are going to use SET PSEUDO_THREAD_ID in this test;
+# check that it requires the SUPER privilege.
+
+connection con3;
+SET @save_select_limit=@@session.sql_select_limit;
+--error 1227
+SET @@session.sql_select_limit=10, @@session.pseudo_thread_id=100;
+SELECT @@session.sql_select_limit = @save_select_limit; #shouldn't have changed
+# While we are here we also test that SQL_LOG_BIN can't be set
+--error 1227
+SET @@session.sql_select_limit=10, @@session.sql_log_bin=0;
+SELECT @@session.sql_select_limit = @save_select_limit; #shouldn't have changed
+# Now as root, to be sure it works
+connection con2;
+SET @@session.pseudo_thread_id=100;
+SET @@session.pseudo_thread_id=connection_id();
+SET @@session.sql_log_bin=0;
+SET @@session.sql_log_bin=1;
+
+connection con3;
+let $VERSION=`select version()`;
+
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
+create table t1(f int);
+create table t2(f int);
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
+connection con1;
+create temporary table t3(f int);
+insert into t3 select * from t1 where f<6;
+sleep 1;
+
+connection con2;
+create temporary table t3(f int);
+sleep 1;
+
+connection con1;
+insert into t2 select count(*) from t3;
+sleep 1;
+
+connection con2;
+insert into t3 select * from t1 where f>=4;
+sleep 1;
+
+connection con1;
+drop temporary table t3;
+sleep 1;
+
+connection con2;
+insert into t2 select count(*) from t3;
+drop temporary table t3;
+
+select * from t2;
+
+--replace_result $VERSION VERSION
+show binlog events;
+
+drop table t1, t2;
+
+use test;
+SET TIMESTAMP=1040323920;
+create table t1(f int);
+SET TIMESTAMP=1040323931;
+create table t2(f int);
+SET TIMESTAMP=1040323938;
+insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
+SET TIMESTAMP=1040323945;
+SET @@session.pseudo_thread_id=1;
+create temporary table t3(f int);
+SET TIMESTAMP=1040323952;
+SET @@session.pseudo_thread_id=1;
+insert into t3 select * from t1 where f<6;
+SET TIMESTAMP=1040324145;
+SET @@session.pseudo_thread_id=2;
+create temporary table t3(f int);
+SET TIMESTAMP=1040324186;
+SET @@session.pseudo_thread_id=1;
+insert into t2 select count(*) from t3;
+SET TIMESTAMP=1040324200;
+SET @@session.pseudo_thread_id=2;
+insert into t3 select * from t1 where f>=4;
+SET TIMESTAMP=1040324211;
+SET @@session.pseudo_thread_id=1;
+drop temporary table t3;
+SET TIMESTAMP=1040324219;
+SET @@session.pseudo_thread_id=2;
+insert into t2 select count(*) from t3;
+SET TIMESTAMP=1040324224;
+SET @@session.pseudo_thread_id=2;
+drop temporary table t3;
+
+select * from t2;
+drop table t1,t2;
+
+# Create last a temporary table that is not dropped at end to ensure that we
+# don't get any memory leaks for this
+
+create temporary table t3 (f int);
+sync_with_master;
+
+# The server will now close done
diff --git a/mysql-test/t/rpl_timezone-master.opt b/mysql-test/t/rpl_timezone-master.opt
new file mode 100644
index 00000000000..8e43bfbbb7e
--- /dev/null
+++ b/mysql-test/t/rpl_timezone-master.opt
@@ -0,0 +1 @@
+--default-time-zone=Europe/Moscow
diff --git a/mysql-test/t/rpl_timezone-slave.opt b/mysql-test/t/rpl_timezone-slave.opt
new file mode 100644
index 00000000000..8e43bfbbb7e
--- /dev/null
+++ b/mysql-test/t/rpl_timezone-slave.opt
@@ -0,0 +1 @@
+--default-time-zone=Europe/Moscow
diff --git a/mysql-test/t/rpl_timezone.test b/mysql-test/t/rpl_timezone.test
new file mode 100644
index 00000000000..8dff90a84cf
--- /dev/null
+++ b/mysql-test/t/rpl_timezone.test
@@ -0,0 +1,84 @@
+# Test of replication of time zones.
+source include/master-slave.inc;
+
+# Some preparations
+let $VERSION=`select version()`;
+create table t1 (t timestamp);
+create table t2 (t char(32));
+
+#
+# Let us check how well replication works when we are saving datetime
+# value in TIMESTAMP field.
+#
+connection master;
+select @@time_zone;
+set time_zone='UTC';
+insert into t1 values ('20040101000000'), ('20040611093902');
+select * from t1;
+# On slave we still in 'Europe/Moscow' so we should see equivalent but
+# textually different values.
+sync_slave_with_master;
+select * from t1;
+
+# Let us check also that setting of time_zone back to default also works
+# well
+connection master;
+delete from t1;
+set time_zone='Europe/Moscow';
+insert into t1 values ('20040101000000'), ('20040611093902');
+select * from t1;
+sync_slave_with_master;
+select * from t1;
+connection master;
+# We should not see SET ONE_SHOT time_zone before second insert
+--replace_result $VERSION VERSION
+show binlog events;
+
+#
+# Now let us check how well we replicate statments reading TIMESTAMP fields
+# (We should see the same data on master and on slave but it should differ
+# from originally inserted)
+#
+set time_zone='MET';
+insert into t2 (select t from t1);
+select * from t1;
+sync_slave_with_master;
+select * from t2;
+
+#
+# Now let us check how well we replicate various CURRENT_* functions
+#
+connection master;
+delete from t2;
+set timestamp=1000072000;
+insert into t2 values (current_timestamp), (current_date), (current_time);
+sync_slave_with_master;
+# Values in ouput of these to queries should differ because we are in
+# in 'MET' on master and in 'Europe/Moscow on slave...
+set timestamp=1000072000;
+select current_timestamp, current_date, current_time;
+select * from t2;
+
+#
+# At last let us check replication of FROM_UNIXTIME/UNIX_TIMESTAMP functions.
+#
+connection master;
+delete from t2;
+insert into t2 values (from_unixtime(1000000000)),
+ (unix_timestamp('2001-09-09 03:46:40'));
+select * from t2;
+sync_slave_with_master;
+# We should get same result on slave as on master
+select * from t2;
+
+#
+# Let us check that we are not allowing to set global time_zone with
+# replication
+#
+connection master;
+--error 1105
+set global time_zone='MET';
+
+# Clean up
+drop table t1, t2;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_trunc_binlog.test b/mysql-test/t/rpl_trunc_binlog.test
index 98138b61ab7..2ade41ee96d 100644
--- a/mysql-test/t/rpl_trunc_binlog.test
+++ b/mysql-test/t/rpl_trunc_binlog.test
@@ -1,7 +1,7 @@
-# We are testing if a binlog which contains BEGIN but not COMMIT (the master did
-# while writing the transaction to the binlog) triggers an error on slave.
-# So we use such a truncated binlog and simulate that the master restarted after
-# this.
+# We are testing if a binlog which contains BEGIN but not COMMIT (the
+# master did while writing the transaction to the binlog) triggers an
+# error on slave. So we use such a truncated binlog and simulate that
+# the master restarted after this.
source include/master-slave.inc;
@@ -13,13 +13,13 @@ source include/have_bdb.inc;
stop slave;
connection master;
flush logs;
-system mv -f var/log/master-bin.001 var/log/master-bin.002;
-system cp std_data/trunc_binlog.001 var/log/master-bin.001;
+system mv -f var/log/master-bin.000001 var/log/master-bin.000002;
+system cp std_data/trunc_binlog.000001 var/log/master-bin.000001;
connection slave;
reset slave;
start slave;
# can't sync_with_master so we must sleep
sleep 3;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 18 #
+--replace_column 1 # 23 # 33 #
show slave status;
diff --git a/mysql-test/t/rpl_until.test b/mysql-test/t/rpl_until.test
new file mode 100644
index 00000000000..45b343ace14
--- /dev/null
+++ b/mysql-test/t/rpl_until.test
@@ -0,0 +1,82 @@
+source include/master-slave.inc;
+
+# prepare version for substitutions
+let $VERSION=`select version()`;
+
+# stop slave before he will start replication also sync with master
+# for avoiding undetermenistic behaviour
+save_master_pos;
+connection slave;
+sync_with_master;
+stop slave;
+
+connection master;
+# create some events on master
+create table t1(n int not null auto_increment primary key);
+insert into t1 values (1),(2),(3),(4);
+drop table t1;
+create table t2(n int not null auto_increment primary key);
+insert into t2 values (1),(2);
+insert into t2 values (3),(4);
+drop table t2;
+--replace_result $VERSION VERSION
+show binlog events;
+
+# try to replicate all queries until drop of t1
+connection slave;
+start slave until master_log_file='master-bin.000001', master_log_pos=244;
+sleep 2;
+# here table should be still not deleted
+select * from t1;
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 9 # 23 # 33 #
+show slave status;
+
+# this should fail right after start
+start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
+# again this table should be still not deleted
+select * from t1;
+sleep 2;
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 9 # 23 # 33 #
+show slave status;
+
+# try replicate all until second insert to t2;
+start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=537;
+sleep 4;
+select * from t2;
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 9 # 23 # 33 #
+show slave status;
+
+# clean up
+start slave;
+connection master;
+save_master_pos;
+connection slave;
+sync_with_master;
+stop slave;
+
+# this should stop immideately
+start slave until master_log_file='master-bin.000001', master_log_pos=561;
+# 2 is not enough when running with valgrind
+real_sleep 4
+# here the sql slave thread should be stopped
+--replace_result $MASTER_MYPORT MASTER_MYPORT bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
+--replace_column 1 # 9 # 23 # 33 #
+show slave status;
+
+#testing various error conditions
+--error 1277
+start slave until master_log_file='master-bin', master_log_pos=561;
+--error 1277
+start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
+--error 1277
+start slave until master_log_file='master-bin.000001';
+--error 1277
+start slave until relay_log_file='slave-relay-bin.000002';
+--error 1277
+start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
+
+start slave sql_thread;
+start slave until master_log_file='master-bin.000001', master_log_pos=561;
diff --git a/mysql-test/t/rpl_user_variables.test b/mysql-test/t/rpl_user_variables.test
new file mode 100644
index 00000000000..73b3ace473e
--- /dev/null
+++ b/mysql-test/t/rpl_user_variables.test
@@ -0,0 +1,55 @@
+#
+# Test of replicating user variables
+#
+source include/master-slave.inc;
+# Disable PS as the log positions differs
+--disable_ps_protocol
+
+
+# Clean up old slave's binlogs.
+# The slave is started with --log-slave-updates
+# and this test does SHOW BINLOG EVENTS on the slave's
+# binlog. But previous tests can influence the current test's
+# binlog (e.g. a temporary table in the previous test has not
+# been explicitly deleted, or it has but the slave hasn't had
+# enough time to catch it before STOP SLAVE,
+# and at the beginning of the current
+# test the slave immediately writes DROP TEMPORARY TABLE this_old_table).
+# We wait for the slave to have written all he wants to the binlog
+# (otherwise RESET MASTER may come too early).
+save_master_pos;
+connection slave;
+sync_with_master;
+reset master;
+connection master;
+
+create table t1(n char(30));
+set @i1:=12345678901234, @i2:=-12345678901234, @i3:=0, @i4:=-1;
+set @s1:='This is a test', @r1:=12.5, @r2:=-12.5;
+set @n1:=null;
+set @s2:='', @s3:='abc\'def', @s4:= 'abc\\def', @s5:= 'abc''def';
+insert into t1 values (@i1), (@i2), (@i3), (@i4);
+insert into t1 values (@r1), (@r2);
+insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5);
+insert into t1 values (@n1);
+insert into t1 values (@n2); # not explicitely set before
+insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1);
+insert into t1 values (@a+(@b:=@a+1));
+set @q:='abc';
+insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'));
+set @a:=5;
+insert into t1 values (@a),(@a);
+connection master1; # see if variable is reset in binlog when thread changes
+insert into t1 values (@a),(@a),(@a*5);
+select * from t1;
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from t1;
+show binlog events from 141;
+connection master;
+drop table t1;
+save_master_pos;
+connection slave;
+sync_with_master;
+stop slave;
diff --git a/mysql-test/t/sel000001.test b/mysql-test/t/sel000001.test
deleted file mode 100644
index ad4af1f92fb..00000000000
--- a/mysql-test/t/sel000001.test
+++ /dev/null
@@ -1,31 +0,0 @@
-# sel000001
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# This test is just a simple select.
-# Testing WHERE clause.
-#
-
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (s CHAR(20) PRIMARY KEY, id INT);
-INSERT INTO t1 VALUES ('cat', 1), ('mouse', 3), ('dog', 2), ('snake', 77);
-SELECT s, id FROM t1 WHERE s = 'mouse';
-drop table t1;
-
-#
-#test for bug #717
-#
-CREATE TABLE t1 (
- node int(11) NOT NULL default '0',
- maxchild int(11) NOT NULL default '0',
- PRIMARY KEY (`node`)
-);
-INSERT INTO t1 (node, maxchild) VALUES (4,4),(5,5),(1,244);
-SELECT * FROM t1 g1, t1 g2
- WHERE g1.node <= g2.node and g2.node <= g1.maxchild and g2.node = g2.maxchild;
-DROP TABLE t1;
diff --git a/mysql-test/t/sel000002.test b/mysql-test/t/sel000002.test
deleted file mode 100644
index 9a89db2821c..00000000000
--- a/mysql-test/t/sel000002.test
+++ /dev/null
@@ -1,17 +0,0 @@
-# sel000002
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# This test is just a simple select.
-#
-
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (n INT);
-INSERT INTO t1 VALUES (1), (2), (3);
-SELECT * FROM t1;
-drop table t1;
diff --git a/mysql-test/t/sel000003.test b/mysql-test/t/sel000003.test
deleted file mode 100644
index a3f6a7337c2..00000000000
--- a/mysql-test/t/sel000003.test
+++ /dev/null
@@ -1,18 +0,0 @@
-# sel000003
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# This test is just a simple select.
-# Testing count() function and GROUP BY clause.
-#
-
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (name CHAR(20) NOT NULL PRIMARY KEY, score SMALLINT NOT NULL, KEY(score));
-INSERT INTO t1 VALUES ('Sasha', 20), ('Matt', 20), ('Monty', 10), ('David', 10), ('Tim', 10), ('Jeremy', 10);
-SELECT COUNT(*) as n, score FROM t1 GROUP BY score;
-drop table t1;
diff --git a/mysql-test/t/sel000031.test b/mysql-test/t/sel000031.test
deleted file mode 100644
index 29bafbb3040..00000000000
--- a/mysql-test/t/sel000031.test
+++ /dev/null
@@ -1,20 +0,0 @@
-# sel000031
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# test for a bug with elt() and order by
-
-drop table if exists t1,t2;
-create table t1 (id int(10) not null unique);
-create table t2 (id int(10) not null primary key,
-val int(10) not null);
-insert into t1 values (1),(2),(4);
-insert into t2 values (1,1),(2,1),(3,1),(4,2);
-
-select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id;
-drop table t1,t2;
diff --git a/mysql-test/t/sel000032.test b/mysql-test/t/sel000032.test
deleted file mode 100644
index d31ba69e9d8..00000000000
--- a/mysql-test/t/sel000032.test
+++ /dev/null
@@ -1,20 +0,0 @@
-# sel000032
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# test for a bug with elt()
-
-drop table if exists t1,t2;
-create table t1 (id int(10) not null unique);
-create table t2 (id int(10) not null primary key,
-val int(10) not null);
-insert into t1 values (1),(2),(4);
-insert into t2 values (1,1),(2,1),(3,1),(4,2);
-
-select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id;
-drop table t1,t2;
diff --git a/mysql-test/t/sel000033.test b/mysql-test/t/sel000033.test
deleted file mode 100644
index 165e43ad9f8..00000000000
--- a/mysql-test/t/sel000033.test
+++ /dev/null
@@ -1,18 +0,0 @@
-# sel000033
-#
-# Versions
-# --------
-# 3.22
-# 3.23
-#
-# Description
-# -----------
-# test for a bug with in() and unique key
-
-drop table if exists t1;
-create table t1 (id int(10) primary key);
-insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-select id from t1 where id in (2,5,9) ;
-select id from t1 where id=2 or id=5 or id=9 ;
-drop table t1;
diff --git a/mysql-test/t/sel000100.test b/mysql-test/t/sel000100.test
deleted file mode 100644
index d587fa4ebd0..00000000000
--- a/mysql-test/t/sel000100.test
+++ /dev/null
@@ -1,46 +0,0 @@
-DROP TABLE IF EXISTS t1,t2;
-
-CREATE TABLE t1 (
- ID int(11) NOT NULL auto_increment,
- NAME varchar(75) DEFAULT '' NOT NULL,
- LINK_ID int(11) DEFAULT '0' NOT NULL,
- PRIMARY KEY (ID),
- KEY NAME (NAME),
- KEY LINK_ID (LINK_ID)
-);
-
-INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (1,'Mike',0);
-INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (2,'Jack',0);
-INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (3,'Bill',0);
-
-CREATE TABLE t2 (
- ID int(11) NOT NULL auto_increment,
- NAME varchar(150) DEFAULT '' NOT NULL,
- PRIMARY KEY (ID),
- KEY NAME (NAME)
-);
-
-SELECT DISTINCT
- t2.id AS key_link_id,
- t2.name AS link
-FROM t1
-LEFT JOIN t2 ON t1.link_id=t2.id
-GROUP BY t1.id
-ORDER BY link;
-
-drop table t1,t2;
-
-#
-# test case for #674
-#
-CREATE TABLE t1 (
- html varchar(5) default NULL,
- rin int(11) default '0',
- out int(11) default '0'
-) TYPE=MyISAM;
-
-INSERT INTO t1 VALUES ('1',1,0);
-
-SELECT DISTINCT html,SUM(out)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin;
-
-drop table t1;
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index e6b1ffbe8d7..9bbd26a9c1c 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -6,7 +6,11 @@
# Simple select test
#
+--disable_warnings
drop table if exists t1,t2,t3,t4;
+# The following may be left from older tests
+drop table if exists t1_1,t1_2,t9_1,t9_2;
+--enable_warnings
CREATE TABLE t1 (
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
@@ -1379,7 +1383,7 @@ INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1009,"gems",447,2374
INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1010,"clinker",512,786542,76234234);
--enable_query_log
-create temporary table tmp type = myisam select * from t3;
+create temporary table tmp engine = myisam select * from t3;
insert into t3 select * from tmp;
insert into tmp select * from t3;
@@ -1491,14 +1495,12 @@ select t2.fld1,fld3,period,price,price2 from t2,t3 where t2.fld1>= 18201 and t2.
# We need another table for join stuff..
#
-drop table if exists company;
-
create table t4 (
companynr tinyint(2) unsigned zerofill NOT NULL default '00',
companyname char(30) NOT NULL default '',
PRIMARY KEY (companynr),
UNIQUE KEY companyname(companyname)
-) TYPE=MyISAM MAX_ROWS=50 PACK_KEYS=1 COMMENT='companynames';
+) ENGINE=MyISAM MAX_ROWS=50 PACK_KEYS=1 COMMENT='companynames';
--disable_query_log
INSERT INTO t4 (companynr, companyname) VALUES (29,'company 1');
@@ -1595,8 +1597,9 @@ select fld3 from t2 where (((fld3 like "_%L%" ) or (fld3 like "%ok%")) and ( fld
select count(*) from t1;
select companynr,count(*),sum(fld1) from t2 group by companynr;
select companynr,count(*) from t2 group by companynr order by companynr desc limit 5;
-select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1) from t2 where companynr = 34 and fld4<>"";
-select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1) from t2 group by companynr limit 3;
+select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>"";
+explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>"";
+select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
select companynr,t2nr,count(price),sum(price),min(price),max(price),avg(price) from t3 where companynr = 37 group by companynr,t2nr limit 10;
select /*! SQL_SMALL_RESULT */ companynr,t2nr,count(price),sum(price),min(price),max(price),avg(price) from t3 where companynr = 37 group by companynr,t2nr limit 10;
select companynr,count(price),sum(price),min(price),max(price),avg(price) from t3 group by companynr ;
@@ -1703,12 +1706,18 @@ select t2.companynr,companyname,count(*) from t2,t4 where t2.companynr=t4.compan
select count(*) from t2;
select count(*) from t2 where fld1 < 098024;
+# PS does correct pre-zero here. MySQL can't do it as it returns a number.
+--disable_ps_protocol
select min(fld1) from t2 where fld1>= 098024;
+--enable_ps_protocol
select max(fld1) from t2 where fld1>= 098024;
select count(*) from t3 where price2=76234234;
select count(*) from t3 where companynr=512 and price2=76234234;
explain select min(fld1),max(fld1),count(*) from t2;
+# PS does correct pre-zero here. MySQL can't do it as it returns a number.
+--disable_ps_protocol
select min(fld1),max(fld1),count(*) from t2;
+--enable_ps_protocol
select min(t2nr),max(t2nr) from t3 where t2nr=2115 and price2=823742;
select count(*),min(t2nr),max(t2nr) from t3 where name='spates' and companynr=78;
select t2nr,count(*) from t3 where name='gems' group by t2nr limit 20;
@@ -1748,6 +1757,15 @@ DO 1;
DO benchmark(100,1+1),1,1;
#
+# Bug #6449: do default;
+#
+
+--error 1064
+do default;
+--error 1054
+do foobar;
+
+#
# random in WHERE clause
#
@@ -1766,11 +1784,13 @@ DROP TABLE t1;
# Test of bug with SUM(CASE...)
#
-CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, mmid int(10) unsigned default NULL, hdid int(10) unsigned default NULL, fsid int(10) unsigned default NULL, ctid int(10) unsigned default NULL, dtid int(10) unsigned default NULL, cost int(10) unsigned default NULL, performance int(10) unsigned default NULL, serialnumber bigint(20) unsigned default NULL, monitored tinyint(3) unsigned default '1', removed tinyint(3) unsigned default '0', target tinyint(3) unsigned default '0', dt_modified timestamp(14) NOT NULL, name varchar(255) binary default NULL, description varchar(255) default NULL, UNIQUE KEY hmid (hmid,volid)) TYPE=MyISAM;
+CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, mmid int(10) unsigned default NULL, hdid int(10) unsigned default NULL, fsid int(10) unsigned default NULL, ctid int(10) unsigned default NULL, dtid int(10) unsigned default NULL, cost int(10) unsigned default NULL, performance int(10) unsigned default NULL, serialnumber bigint(20) unsigned default NULL, monitored tinyint(3) unsigned default '1', removed tinyint(3) unsigned default '0', target tinyint(3) unsigned default '0', dt_modified timestamp(14) NOT NULL, name varchar(255) binary default NULL, description varchar(255) default NULL, UNIQUE KEY hmid (hmid,volid)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (200001,2,1,1,100,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\E$',''),(200002,2,2,1,101,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\C$',''),(200003,1,3,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,0,1,20020425060427,'c:',NULL);
-CREATE TABLE t2 ( hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, sampletid smallint(5) unsigned default NULL, sampletime datetime default NULL, samplevalue bigint(20) unsigned default NULL, KEY idx1 (hmid,volid,sampletid,sampletime)) TYPE=MyISAM;
+CREATE TABLE t2 ( hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, sampletid smallint(5) unsigned default NULL, sampletime datetime default NULL, samplevalue bigint(20) unsigned default NULL, KEY idx1 (hmid,volid,sampletid,sampletime)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12:00:01',35);
-SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'NULL' AND b.sampletime < 'NULL' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
+SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'wrong-date-value' AND b.sampletime < 'wrong-date-value' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
+# Testing the same select with NULL's instead of invalid datetime values
+SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= NULL AND b.sampletime < NULL AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
DROP TABLE t1,t2;
#
@@ -1785,6 +1805,10 @@ select wss_type from t1 where wss_type ='102935229216544104';
select wss_type from t1 where wss_type ='102935229216544093';
select wss_type from t1 where wss_type =102935229216544093;
drop table t1;
+select 1+2,"aaaa",3.13*2.0 into @a,@b,@c;
+select @a;
+select @b;
+select @c;
#
# Test of removing redundant braces in the FROM part
@@ -1831,9 +1855,9 @@ select * from t1 natural join (t1 as t2 left join t1 as t3 using (a));
select * from (t1 as t2 left join t1 as t3 using (a)) natural join t1;
drop table t1;
-CREATE TABLE t1 ( aa char(2), id int(11) NOT NULL auto_increment, t2_id int(11) NOT NULL default '0', PRIMARY KEY (id), KEY replace_id (t2_id)) TYPE=MyISAM;
+CREATE TABLE t1 ( aa char(2), id int(11) NOT NULL auto_increment, t2_id int(11) NOT NULL default '0', PRIMARY KEY (id), KEY replace_id (t2_id)) ENGINE=MyISAM;
INSERT INTO t1 VALUES ("1",8264,2506),("2",8299,2517),("3",8301,2518),("4",8302,2519),("5",8303,2520),("6",8304,2521),("7",8305,2522);
-CREATE TABLE t2 ( id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) TYPE=MyISAM;
+CREATE TABLE t2 ( id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (2517), (2518), (2519), (2520), (2521), (2522);
select * from t1, t2 WHERE t1.t2_id = t2.id and t1.t2_id > 0 order by t1.id LIMIT 0, 5;
drop table t1,t2;
@@ -1857,7 +1881,6 @@ select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
drop table t1,t2,t3,t4;
-
#
# Bug #2298
#
@@ -1898,7 +1921,7 @@ CREATE TABLE t1 (
c char(10) NOT NULL default '',
PRIMARY KEY (i),
UNIQUE KEY c (c)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,'a');
INSERT INTO t1 VALUES (2,'b');
@@ -1906,6 +1929,4 @@ INSERT INTO t1 VALUES (3,'c');
EXPLAIN SELECT i FROM t1 WHERE i=1;
-EXPLAIN SELECT i FROM t1 WHERE i=1;
-
DROP TABLE t1;
diff --git a/mysql-test/t/select_found.test b/mysql-test/t/select_found.test
index 7599277a867..943174462e3 100644
--- a/mysql-test/t/select_found.test
+++ b/mysql-test/t/select_found.test
@@ -1,8 +1,10 @@
#
# Testing of found_rows()
#
-
+--disable_warnings
drop table if exists t1,t2;
+--enable_warnings
+
create table t1 (a int not null auto_increment, b int not null, primary key(a));
insert into t1 (b) values (2),(3),(5),(5),(5),(6),(7),(9);
select SQL_CALC_FOUND_ROWS * from t1;
@@ -52,8 +54,18 @@ CREATE TABLE t2 (
UNIQUE KEY e_n (email,name)
);
-INSERT INTO t2 VALUES (1,'name1','email1'),(2,'name2','email2'),(3,'name3','email3'),(4,'name4','email4'),(5,'name5','email5'),(6,'name6','email6'),(7,'name7','email7'),(8,'name8','email8'),(9,'name9','email9'),(10,'name10','email10'),(11,'name11','email11'),(12,'name12','email12'),(13,'name13','email13'),(14,'name14','email14'),(15,'name15','email15'),(16,'name16','email16'),(17,'name17','email17'),(18,'name18','email18'),(19,'name19','email19'),(20,'name20','email20'),(21,'name21','email21'),(22,'name22','email22'),(23,'name23','email23'),(24,'name24','email24'),(25,'name25','email25'),(26,'name26','email26'),(27,'name27','email27'),(28,'name28','email28'),(29,'name29','email29'),(30,'name30','email30'),(31,'name31','email31'),(32,'name32','email32'),(33,'name33','email33'),(34,'name34','email34'),(35,'name35','email35'),(36,'name36','email36'),(37,'name37','email37'),(38,'name38','email38'),(39,'name39','email39'),(40,'name40','email40'),(41,'name41','email41'),(42,'name42','email42'),(43,'name43','email43'),(44,'name44','email44'),(45,'name45','email45'),(46,'name46','email46'),(47,'name47','email47'),(48,'name48','email48'),(49,'name49','email49'),(50,'name50','email50'),(51,'name51','email51'),(52,'name52','email52'),(53,'name53','email53'),(54,'name54','email54'),(55,'name55','email55'),(56,'name56','email56'),(57,'name57','email57'),(58,'name58','email58'),(59,'name59','email59'),(60,'name60','email60'),(61,'name61','email61'),(62,'name62','email62'),(63,'name63','email63'),(64,'name64','email64'),(65,'name65','email65'),(66,'name66','email66'),(67,'name67','email67'),(68,'name68','email68'),(69,'name69','email69'),(70,'name70','email70'),(71,'name71','email71'),(72,'name72','email72'),(73,'name73','email73'),(74,'name74','email74'),(75,'name75','email75'),(76,'name76','email76'),(77,'name77','email77'),(78,'name78','email78'),(79,'name79','email79'),(80,'name80','email80'),(81,'name81','email81'),(82,'name82','email82'),(83,'name83','email83'),(84,'name84','email84'),(85,'name85','email85'),(86,'name86','email86'),(87,'name87','email87'),(88,'name88','email88'),(89,'name89','email89'),(90,'name90','email90'),(91,'name91','email91'),(92,'name92','email92'),(93,'name93','email93'),(94,'name94','email94'),(95,'name95','email95'),(96,'name96','email96'),(97,'name97','email97'),(98,'name98','email98'),(99,'name99','email99'),(100,'name100','email100'),(101,'name101','email101'),(102,'name102','email102'),(103,'name103','email103'),(104,'name104','email104'),(105,'name105','email105'),(106,'name106','email106'),(107,'name107','email107'),(108,'name108','email108'),(109,'name109','email109'),(110,'name110','email110'),(111,'name111','email111'),(112,'name112','email112'),(113,'name113','email113'),(114,'name114','email114'),(115,'name115','email115'),(116,'name116','email116'),(117,'name117','email117'),(118,'name118','email118'),(119,'name119','email119'),(120,'name120','email120'),(121,'name121','email121'),(122,'name122','email122'),(123,'name123','email123'),(124,'name124','email124'),(125,'name125','email125'),(126,'name126','email126'),(127,'name127','email127'),(128,'name128','email128'),(129,'name129','email129'),(130,'name130','email130'),(131,'name131','email131'),(132,'name132','email132'),(133,'name133','email133'),(134,'name134','email134'),(135,'name135','email135'),(136,'name136','email136'),(137,'name137','email137'),(138,'name138','email138'),(139,'name139','email139'),(140,'name140','email140'),(141,'name141','email141'),(142,'name142','email142'),(143,'name143','email143'),(144,'name144','email144'),(145,'name145','email145'),(146,'name146','email146'),(147,'name147','email147'),(148,'name148','email148'),(149,'name149','email149'),(150,'name150','email150'),(151,'name151','email151'),(152,'name152','email152'),(153,'name153','email153'),(154,'name154','email154'),(155,'name155','email155'),(156,'name156','email156'),(157,'name157','email157'),(158,'name158','email158'),(159,'name159','email159'),(160,'name160','email160'),(161,'name161','email161'),(162,'name162','email162'),(163,'name163','email163'),(164,'name164','email164'),(165,'name165','email165'),(166,'name166','email166'),(167,'name167','email167'),(168,'name168','email168'),(169,'name169','email169'),(170,'name170','email170'),(171,'name171','email171'),(172,'name172','email172'),(173,'name173','email173'),(174,'name174','email174'),(175,'name175','email175'),(176,'name176','email176'),(177,'name177','email177'),(178,'name178','email178'),(179,'name179','email179'),(180,'name180','email180'),(181,'name181','email181'),(182,'name182','email182'),(183,'name183','email183'),(184,'name184','email184'),(185,'name185','email185'),(186,'name186','email186'),(187,'name187','email187'),(188,'name188','email188'),(189,'name189','email189'),(190,'name190','email190'),(191,'name191','email191'),(192,'name192','email192'),(193,'name193','email193'),(194,'name194','email194'),(195,'name195','email195'),(196,'name196','email196'),(197,'name197','email197'),(198,'name198','email198'),(199,'name199','email199'),(200,'name200','email200');
-
+disable_query_log;
+let $1=200;
+let $2=0;
+while ($1)
+{
+ inc $2;
+ eval INSERT INTO t2 VALUES ($2,'name$2','email$2');
+ dec $1;
+}
+enable_query_log;
+
+EXPLAIN SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
SELECT FOUND_ROWS();
@@ -62,7 +74,7 @@ SELECT FOUND_ROWS();
SELECT DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
SELECT DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL ORDER BY email LIMIT 10;
-INSERT INTO `t1` (`id`, `kid`) VALUES ('', '150');
+INSERT INTO `t1` (`id`, `kid`) VALUES ('0', '150');
SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
SELECT FOUND_ROWS();
@@ -79,11 +91,19 @@ CREATE TABLE `t1` (
`maxnumrep` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`numeropost`),
KEY `maxnumrep` (`maxnumrep`)
-) TYPE=MyISAM ROW_FORMAT=FIXED;
+) ENGINE=MyISAM ROW_FORMAT=FIXED;
INSERT INTO t1 (titre,maxnumrep) VALUES
('test1','1'),('test2','2'),('test3','3');
SELECT SQL_CALC_FOUND_ROWS titre,numeropost,maxnumrep FROM t1 WHERE numeropost IN (1,2) ORDER BY maxnumrep DESC LIMIT 0, 1;
SELECT FOUND_ROWS();
+SELECT SQL_CALC_FOUND_ROWS 1 FROM (SELECT 1) as a LIMIT 0;
+SELECT FOUND_ROWS();
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE numeropost > 1 LIMIT 0;
+SELECT FOUND_ROWS();
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 0;
+SELECT FOUND_ROWS();
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 ORDER BY numeropost LIMIT 0;
+SELECT FOUND_ROWS();
drop table t1;
#
diff --git a/mysql-test/t/select_safe.test b/mysql-test/t/select_safe.test
index 904479635c2..3cafd31a879 100644
--- a/mysql-test/t/select_safe.test
+++ b/mysql-test/t/select_safe.test
@@ -2,7 +2,10 @@
# test of safe selects
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+
SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=4, SQL_MAX_JOIN_SIZE=9;
create table t1 (a int auto_increment primary key, b char(20));
insert into t1 values(1,"test");
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index 2cd2012d109..7788215dd27 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -2,7 +2,15 @@
# Test of some show commands
#
+--disable_warnings
drop table if exists t1,t2;
+drop database if exists mysqltest;
+
+delete from mysql.user where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
+delete from mysql.db where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
+flush privileges;
+--enable_warnings
+
create table t1 (a int not null primary key, b int not null,c int not null, key(b,c));
insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4);
check table t1 fast;
@@ -13,7 +21,8 @@ check table t1 changed;
check table t1 medium;
check table t1 extended;
show index from t1;
-!$1062 insert into t1 values (5,5,5);
+--error 1062
+insert into t1 values (5,5,5);
optimize table t1;
optimize table t1;
drop table t1;
@@ -49,9 +58,16 @@ drop table t2;
create table t1 (
test_set set( 'val1', 'val2', 'val3' ) not null default '',
- name char(20) default 'O''Brien'
+ name char(20) default 'O''Brien' comment 'O''Brien as default',
+ c int not null comment 'int column',
+ `c-b` int comment 'name with a minus',
+ `space 2` int comment 'name with a space'
) comment = 'it\'s a table' ;
-show create table t1 ;
+show create table t1;
+set sql_quote_show_create=0;
+show create table t1;
+set sql_quote_show_create=1;
+show full columns from t1;
drop table t1;
create table t1 (a int not null, unique aa (a));
@@ -68,7 +84,7 @@ insert into t1 values (1);
show open tables;
drop table t1;
-create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" TYPE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed;
+create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" ENGINE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed;
show create table t1;
alter table t1 MAX_ROWS=200 ROW_FORMAT=dynamic PACK_KEYS=0;
show create table t1;
@@ -78,6 +94,7 @@ drop table t1;
create table t1 (a decimal(9,2), b decimal (9,0), e double(9,2), f double(5,0), h float(3,2), i float(3,0));
show columns from t1;
+show full columns from t1;
drop table t1;
#
@@ -106,7 +123,7 @@ type_blob blob,
type_medium_blob mediumblob,
type_long_blob longblob,
index(type_short)
-) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" TYPE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed CHARSET=latin1;
+) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" ENGINE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed CHARSET=latin1;
# Not tested above: RAID_# UNION INSERT_METHOD DATA DIRECTORY INDEX DIRECTORY
show create table t1;
@@ -131,3 +148,176 @@ drop table t1;
create table t1 (c decimal(3,3), d double(3,3), f float(3,3));
show columns from t1;
drop table t1;
+
+#
+# Test for Bug #2593 "SHOW CREATE TABLE doesn't properly double quotes"
+#
+
+SET @old_sql_mode= @@sql_mode, sql_mode= '';
+SET @old_sql_quote_show_create= @@sql_quote_show_create, sql_quote_show_create= OFF;
+
+######### hook for WL#1324 #
+--error 1103
+CREATE TABLE `a/b` (i INT);
+# the above test should WORK when WL#1324 is done,
+# it should be removed and
+# the following part should be uncommented then
+#########################################################
+# begin of part that must be uncommented when WL#1324 is done
+#########################################################
+#CREATE TABLE ```ab``cd``` (i INT);
+#SHOW CREATE TABLE ```ab``cd```;
+#DROP TABLE ```ab``cd```;
+
+#CREATE TABLE ```ab````cd``` (i INT);
+#SHOW CREATE TABLE ```ab````cd```;
+#DROP TABLE ```ab````cd```;
+
+#CREATE TABLE ```a` (i INT);
+#SHOW CREATE TABLE ```a`;
+#DROP TABLE ```a`;
+
+SET sql_mode= 'ANSI_QUOTES';
+
+#CREATE TABLE """a" (i INT);
+#SHOW CREATE TABLE """a";
+#DROP TABLE """a";
+#########################################################
+# end of part that must be uncommented when WL#1324 is done
+#########################################################
+
+# to test quotes around keywords.. :
+
+SET sql_mode= '';
+SET sql_quote_show_create= OFF;
+
+CREATE TABLE t1 (i INT);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE `table` (i INT);
+SHOW CREATE TABLE `table`;
+DROP TABLE `table`;
+
+SET sql_quote_show_create= @old_sql_quote_show_create;
+SET sql_mode= @old_sql_mode;
+
+#
+# Test for bug #2719 "Heap tables status shows wrong or missing data."
+#
+
+select @@max_heap_table_size;
+
+CREATE TABLE t1 (
+ a int(11) default NULL,
+ KEY a TYPE BTREE (a)
+) ENGINE=HEAP;
+
+CREATE TABLE t2 (
+ b int(11) default NULL,
+ index(b)
+) ENGINE=HEAP;
+
+CREATE TABLE t3 (
+ a int(11) default NULL,
+ b int(11) default NULL,
+ KEY a TYPE BTREE (a),
+ index(b)
+) ENGINE=HEAP;
+
+insert into t1 values (1),(2);
+insert into t2 values (1),(2);
+insert into t3 values (1,1),(2,2);
+--replace_column 6 # 7 # 8 # 9 #
+show table status;
+insert into t1 values (3),(4);
+insert into t2 values (3),(4);
+insert into t3 values (3,3),(4,4);
+--replace_column 6 # 7 # 8 # 9 #
+show table status;
+insert into t1 values (5);
+insert into t2 values (5);
+insert into t3 values (5,5);
+--replace_column 6 # 7 # 8 # 9 #
+show table status;
+delete from t1 where a=3;
+delete from t2 where b=3;
+delete from t3 where a=3;
+--replace_column 6 # 7 # 8 # 9 # 10 #
+show table status;
+delete from t1;
+delete from t2;
+delete from t3;
+--replace_column 6 # 7 # 8 # 9 #
+show table status;
+insert into t1 values (5);
+insert into t2 values (5);
+insert into t3 values (5,5);
+--replace_column 6 # 7 # 8 # 9 #
+show table status;
+delete from t1 where a=5;
+delete from t2 where b=5;
+delete from t3 where a=5;
+--replace_column 6 # 7 # 8 # 9 # 10 #
+show table status;
+
+drop table t1, t2, t3;
+
+#
+# Test for bug #3342 SHOW CREATE DATABASE seems to require DROP privilege
+#
+
+create database mysqltest;
+show create database mysqltest;
+create table mysqltest.t1(a int);
+insert into mysqltest.t1 values(1);
+grant select on `mysqltest`.* to mysqltest_1@localhost;
+grant usage on `mysqltest`.* to mysqltest_2@localhost;
+grant drop on `mysqltest`.* to mysqltest_3@localhost;
+
+connect (con1,localhost,mysqltest_1,,mysqltest);
+connection con1;
+select * from t1;
+show create database mysqltest;
+--error 1044
+drop table t1;
+--error 1044
+drop database mysqltest;
+
+connect (con2,localhost,mysqltest_2,,test);
+connection con2;
+--error 1044
+select * from mysqltest.t1;
+--error 1044
+show create database mysqltest;
+--error 1044
+drop table mysqltest.t1;
+--error 1044
+drop database mysqltest;
+
+connect (con3,localhost,mysqltest_3,,test);
+connection con3;
+--error 1044
+select * from mysqltest.t1;
+--error 1044
+show create database mysqltest;
+drop table mysqltest.t1;
+drop database mysqltest;
+
+connection default;
+set names binary;
+delete from mysql.user
+where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
+delete from mysql.db
+where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
+flush privileges;
+
+#Bug #4374 SHOW TABLE STATUS FROM ignores collation_connection
+# This test fails on MAC OSX, so it is temporary disabled.
+# This needs WL#1324 to be done.
+#set names latin1;
+#create database `ä`;
+#create table `ä`.`ä` (a int) engine=heap;
+#--replace_column 7 # 8 # 9 #
+#show table status from `ä` LIKE 'ä';
+#drop database `ä`;
diff --git a/mysql-test/t/sql_mode.test b/mysql-test/t/sql_mode.test
new file mode 100644
index 00000000000..f841d36e837
--- /dev/null
+++ b/mysql-test/t/sql_mode.test
@@ -0,0 +1,82 @@
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+CREATE TABLE `t1` (
+ a int not null auto_increment,
+ `pseudo` varchar(35) character set latin2 NOT NULL default '',
+ `email` varchar(60) character set latin2 NOT NULL default '',
+ PRIMARY KEY (a),
+ UNIQUE KEY `email` USING BTREE (`email`)
+) ENGINE=HEAP CHARSET=latin1 ROW_FORMAT DYNAMIC;
+set @@sql_mode="";
+show variables like 'sql_mode';
+show create table t1;
+set @@sql_mode="ansi_quotes";
+show variables like 'sql_mode';
+show create table t1;
+set @@sql_mode="no_table_options";
+show variables like 'sql_mode';
+show create table t1;
+set @@sql_mode="no_key_options";
+show variables like 'sql_mode';
+show create table t1;
+set @@sql_mode="no_field_options,mysql323,mysql40";
+show variables like 'sql_mode';
+show create table t1;
+set sql_mode="postgresql,oracle,mssql,db2,maxdb";
+select @@sql_mode;
+show create table t1;
+drop table t1;
+
+#
+# Check that a binary collation adds 'binary'
+# suffix into a char() column definition in
+# mysql40 and mysql2323 modes. This allows
+# not to lose the column's case sensitivity
+# when loading the dump in pre-4.1 servers.
+#
+# Thus, in 4.0 and 3.23 modes we dump:
+#
+# 'char(10) collate xxx_bin' as 'char(10) binary'
+# 'binary(10)' as 'binary(10)'
+#
+# In mysql-4.1 these types are different, and they will
+# be recreated differently.
+#
+# In mysqld-4.0 the the above two types were the same,
+# so it will create a 'char(10) binary' column for both definitions.
+#
+CREATE TABLE t1 (
+ a char(10),
+ b char(10) collate latin1_bin,
+ c binary(10)
+) character set latin1;
+set @@sql_mode="";
+show create table t1;
+set @@sql_mode="mysql323";
+show create table t1;
+set @@sql_mode="mysql40";
+show create table t1;
+drop table t1;
+
+#
+# BUG#5318 - failure: 'IGNORE_SPACE' affects numeric values after DEFAULT
+#
+# Force the usage of the default
+set session sql_mode = '';
+# statement for comparison, value starts with '.'
+create table t1 ( min_num dec(6,6) default .000001);
+show create table t1;
+drop table t1 ;
+#
+set session sql_mode = 'IGNORE_SPACE';
+# statement for comparison, value starts with '0'
+create table t1 ( min_num dec(6,6) default 0.000001);
+show create table t1;
+drop table t1 ;
+# This statement fails, value starts with '.'
+create table t1 ( min_num dec(6,6) default .000001);
+show create table t1;
+drop table t1 ;
+
diff --git a/mysql-test/t/status.test b/mysql-test/t/status.test
index cffca437cf1..31d9c8154d5 100644
--- a/mysql-test/t/status.test
+++ b/mysql-test/t/status.test
@@ -4,7 +4,9 @@
# This would work if mysqltest run would be threaded and handle each
# connection in a separate thread.
#
--- source include/not_embedded.inc
+--source include/not_embedded.inc
+# PS causes different statistics
+--disable_ps_protocol
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
@@ -13,8 +15,11 @@ flush status;
show status like 'Table_lock%';
connection con1;
SET SQL_LOG_BIN=0;
+--disable_warnings
drop table if exists t1;
-create table t1(n int) type=myisam;
+--enable_warnings
+
+create table t1(n int) engine=myisam;
insert into t1 values(1);
connection con2;
lock tables t1 read;
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
new file mode 100644
index 00000000000..f59851fa722
--- /dev/null
+++ b/mysql-test/t/subselect.test
@@ -0,0 +1,1388 @@
+# Initialise
+--disable_warnings
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12;
+--enable_warnings
+
+select (select 2);
+explain extended select (select 2);
+SELECT (SELECT 1) UNION SELECT (SELECT 2);
+explain extended SELECT (SELECT 1) UNION SELECT (SELECT 2);
+SELECT (SELECT (SELECT 0 UNION SELECT 0));
+explain extended SELECT (SELECT (SELECT 0 UNION SELECT 0));
+-- error 1247
+SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a;
+-- error 1247
+SELECT (SELECT 1 FROM (SELECT 1) as b HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) as c HAVING a=1) as b;
+SELECT (SELECT 1),MAX(1) FROM (SELECT 1) as a;
+-- error 1247
+SELECT (SELECT a) as a;
+EXPLAIN EXTENDED SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
+SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
+-- error 1054
+SELECT (SELECT 1), a;
+SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1;
+-- error 1054
+SELECT 1 FROM (SELECT (SELECT a) b) c;
+SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id);
+-- error 1241
+SELECT * FROM (SELECT 1) a WHERE 1 IN (SELECT 1,1);
+SELECT 1 IN (SELECT 1);
+SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
+-- error 1221
+select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
+-- error 1108
+SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
+SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
+SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
+SELECT (SELECT 1,2,3) = ROW(1,2,3);
+SELECT (SELECT 1,2,3) = ROW(1,2,1);
+SELECT (SELECT 1,2,3) < ROW(1,2,1);
+SELECT (SELECT 1,2,3) > ROW(1,2,1);
+SELECT (SELECT 1,2,3) = ROW(1,2,NULL);
+SELECT ROW(1,2,3) = (SELECT 1,2,3);
+SELECT ROW(1,2,3) = (SELECT 1,2,1);
+SELECT ROW(1,2,3) < (SELECT 1,2,1);
+SELECT ROW(1,2,3) > (SELECT 1,2,1);
+SELECT ROW(1,2,3) = (SELECT 1,2,NULL);
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a');
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b');
+SELECT (SELECT 1.5,2,'a') = ROW('b',2,'b');
+SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a');
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,'c','a');
+SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a');
+
+-- error 1241
+SELECT (SELECT * FROM (SELECT 'test' a,'test' b) a);
+
+SELECT 1 as a,(SELECT a+a) b,(SELECT b);
+
+create table t1 (a int);
+create table t2 (a int, b int);
+create table t3 (a int);
+create table t4 (a int not null, b int not null);
+insert into t1 values (2);
+insert into t2 values (1,7),(2,7);
+insert into t4 values (4,8),(3,8),(5,9);
+-- error 1247
+select (select a from t1 where t1.a = a1) as a2, (select b from t2 where t2.b=a2) as a1;
+select (select a from t1 where t1.a=t2.a), a from t2;
+select (select a from t1 where t1.a=t2.b), a from t2;
+select (select a from t1), a, (select 1 union select 2 limit 1) from t2;
+select (select a from t3), a from t2;
+select * from t2 where t2.a=(select a from t1);
+insert into t3 values (6),(7),(3);
+select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1);
+(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 order by a limit 2) limit 3;
+(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a);
+explain extended (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a);
+select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
+select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from
+(select * from t2 where a>1) as tt;
+explain extended select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from
+(select * from t2 where a>1) as tt;
+select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1);
+select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a > t1.a) order by 1 desc limit 1);
+select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a < t1.a) order by 1 desc limit 1);
+select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
+explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
+select * from t3 where exists (select * from t2 where t2.b=t3.a);
+select * from t3 where not exists (select * from t2 where t2.b=t3.a);
+select * from t3 where a in (select b from t2);
+select * from t3 where a not in (select b from t2);
+select * from t3 where a = some (select b from t2);
+select * from t3 where a <> any (select b from t2);
+
+# Rewrite: select * from t3 where not exists (select b from t2 where a <> b);
+select * from t3 where a = all (select b from t2);
+
+select * from t3 where a <> all (select b from t2);
+insert into t2 values (100, 5);
+select * from t3 where a < any (select b from t2);
+select * from t3 where a < all (select b from t2);
+select * from t3 where a >= any (select b from t2);
+explain extended select * from t3 where a >= any (select b from t2);
+select * from t3 where a >= all (select b from t2);
+delete from t2 where a=100;
+-- error 1241
+select * from t3 where a in (select a,b from t2);
+-- error 1241
+select * from t3 where a in (select * from t2);
+insert into t4 values (12,7),(1,7),(10,9),(9,6),(7,6),(3,9),(1,10);
+-- empty set
+select b,max(a) as ma from t4 group by b having b < (select max(t2.a) from t2 where t2.b=t4.b);
+insert into t2 values (2,10);
+select b,max(a) as ma from t4 group by b having ma < (select max(t2.a) from t2 where t2.b=t4.b);
+delete from t2 where a=2 and b=10;
+select b,max(a) as ma from t4 group by b having b >= (select max(t2.a) from t2 where t2.b=t4.b);
+create table t5 (a int);
+select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+insert into t5 values (5);
+select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+insert into t5 values (2);
+select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+explain extended select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+-- error 1242
+select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
+create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
+create table t7( uq int primary key, name char(25));
+insert into t7 values(1,"Oblastnaia bolnitsa"),(2,"Bolnitsa Krasnogo Kresta");
+insert into t6 values (1,1),(1,2),(2,2),(1,3);
+select * from t6 where exists (select * from t7 where uq = clinic_uq);
+explain extended select * from t6 where exists (select * from t7 where uq = clinic_uq);
+
+# not unique fields
+-- error 1052
+select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
+
+# different tipes & group functions
+drop table t1,t2,t3;
+
+CREATE TABLE t3 (a varchar(20),b char(1) NOT NULL default '0');
+INSERT INTO t3 VALUES ('W','a'),('A','c'),('J','b');
+CREATE TABLE t2 (a varchar(20),b int NOT NULL default '0');
+INSERT INTO t2 VALUES ('W','1'),('A','3'),('J','2');
+CREATE TABLE t1 (a varchar(20),b date NOT NULL default '0000-00-00');
+INSERT INTO t1 VALUES ('W','1732-02-22'),('A','1735-10-30'),('J','1743-04-13');
+SELECT * FROM t1 WHERE b = (SELECT MIN(b) FROM t1);
+SELECT * FROM t2 WHERE b = (SELECT MIN(b) FROM t2);
+SELECT * FROM t3 WHERE b = (SELECT MIN(b) FROM t3);
+
+CREATE TABLE `t8` (
+ `pseudo` varchar(35) character set latin1 NOT NULL default '',
+ `email` varchar(60) character set latin1 NOT NULL default '',
+ PRIMARY KEY (`pseudo`),
+ UNIQUE KEY `email` (`email`)
+) ENGINE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC;
+
+INSERT INTO t8 (pseudo,email) VALUES ('joce','test');
+INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1');
+INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1');
+EXPLAIN EXTENDED SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
+-- error 1241
+SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
+t8 WHERE pseudo='joce');
+-- error 1241
+SELECT pseudo FROM t8 WHERE pseudo=(SELECT * FROM t8 WHERE
+pseudo='joce');
+SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
+-- error 1242
+SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo LIKE '%joce%');
+
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8;
+
+#searchconthardwarefr3 forumconthardwarefr7
+CREATE TABLE `t1` (
+ `topic` mediumint(8) unsigned NOT NULL default '0',
+ `date` date NOT NULL default '0000-00-00',
+ `pseudo` varchar(35) character set latin1 NOT NULL default '',
+ PRIMARY KEY (`pseudo`,`date`,`topic`),
+ KEY `topic` (`topic`)
+) ENGINE=MyISAM ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 (topic,date,pseudo) VALUES
+('43506','2002-10-02','joce'),('40143','2002-08-03','joce');
+EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
+EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
+SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
+SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
+SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1) UNION ALL SELECT 1;
+-- error 1242
+SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1) UNION SELECT 1;
+EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1);
+drop table t1;
+
+#forumconthardwarefr7 searchconthardwarefr7
+CREATE TABLE `t1` (
+ `numeropost` mediumint(8) unsigned NOT NULL auto_increment,
+ `maxnumrep` int(10) unsigned NOT NULL default '0',
+ PRIMARY KEY (`numeropost`),
+ UNIQUE KEY `maxnumrep` (`maxnumrep`)
+) ENGINE=MyISAM ROW_FORMAT=FIXED;
+
+INSERT INTO t1 (numeropost,maxnumrep) VALUES (40143,1),(43506,2);
+
+CREATE TABLE `t2` (
+ `mot` varchar(30) NOT NULL default '',
+ `topic` mediumint(8) unsigned NOT NULL default '0',
+ `date` date NOT NULL default '0000-00-00',
+ `pseudo` varchar(35) NOT NULL default '',
+ PRIMARY KEY (`mot`,`pseudo`,`date`,`topic`)
+ ) ENGINE=MyISAM ROW_FORMAT=DYNAMIC;
+
+INSERT INTO t2 (mot,topic,date,pseudo) VALUES ('joce','40143','2002-10-22','joce'), ('joce','43506','2002-10-22','joce');
+select numeropost as a FROM t1 GROUP BY (SELECT 1 FROM t1 HAVING a=1);
+SELECT numeropost,maxnumrep FROM t1 WHERE exists (SELECT 1 FROM t2 WHERE (mot='joce') AND date >= '2002-10-21' AND t1.numeropost = t2.topic) ORDER BY maxnumrep DESC LIMIT 0, 20;
+-- error 1054
+SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) b;
+-- error 1054
+SELECT 1 IN (SELECT 1 FROM t2 HAVING a);
+
+SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic);
+SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100);
+SELECT * from t2 where topic IN (SELECT SUM(topic) FROM t1);
+SELECT * from t2 where topic = any (SELECT topic FROM t2 GROUP BY topic);
+SELECT * from t2 where topic = any (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100);
+SELECT * from t2 where topic = any (SELECT SUM(topic) FROM t1);
+SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic);
+SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100);
+SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) from t2;
+SELECT * from t2 where topic = all (SELECT SUM(topic) FROM t2);
+SELECT * from t2 where topic <> any (SELECT SUM(topic) FROM t2);
+SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000);
+SELECT * from t2 where topic = any (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000);
+SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000);
+SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) from t2;
+drop table t1,t2;
+
+#forumconthardwarefr7
+CREATE TABLE `t1` (
+ `numeropost` mediumint(8) unsigned NOT NULL auto_increment,
+ `maxnumrep` int(10) unsigned NOT NULL default '0',
+ PRIMARY KEY (`numeropost`),
+ UNIQUE KEY `maxnumrep` (`maxnumrep`)
+) ENGINE=MyISAM ROW_FORMAT=FIXED;
+
+INSERT INTO t1 (numeropost,maxnumrep) VALUES (1,0),(2,1);
+-- error 1242
+select numeropost as a FROM t1 GROUP BY (SELECT 1 FROM t1 HAVING a=1);
+-- error 1242
+select numeropost as a FROM t1 ORDER BY (SELECT 1 FROM t1 HAVING a=1);
+drop table t1;
+
+create table t1 (a int);
+insert into t1 values (1),(2),(3);
+(select * from t1) union (select * from t1) order by (select a from t1 limit 1);
+drop table t1;
+
+#iftest
+CREATE TABLE t1 (field char(1) NOT NULL DEFAULT 'b');
+INSERT INTO t1 VALUES ();
+-- error 1242
+SELECT field FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1 FROM (SELECT 1) a HAVING field='b');
+drop table t1;
+
+# threadhardwarefr7
+CREATE TABLE `t1` (
+ `numeropost` mediumint(8) unsigned NOT NULL default '0',
+ `numreponse` int(10) unsigned NOT NULL auto_increment,
+ `pseudo` varchar(35) NOT NULL default '',
+ PRIMARY KEY (`numeropost`,`numreponse`),
+ UNIQUE KEY `numreponse` (`numreponse`),
+ KEY `pseudo` (`pseudo`,`numeropost`)
+) ENGINE=MyISAM;
+-- error 1247
+SELECT (SELECT numeropost FROM t1 HAVING numreponse=a),numreponse FROM (SELECT * FROM t1) as a;
+-- error 1054
+SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=a) FROM (SELECT * FROM t1) as a;
+SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT * FROM t1) as a;
+INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
+-- error 1242
+EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
+EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
+EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
+drop table t1;
+
+CREATE TABLE t1 (a int(1));
+INSERT INTO t1 VALUES (1);
+SELECT 1 FROM (SELECT a FROM t1) b HAVING (SELECT b.a)=1;
+drop table t1;
+
+#update with subselects
+create table t1 (a int NOT NULL, b int, primary key (a));
+create table t2 (a int NOT NULL, b int, primary key (a));
+insert into t1 values (0, 10),(1, 11),(2, 12);
+insert into t2 values (1, 21),(2, 22),(3, 23);
+select * from t1;
+-- error 1093
+update t1 set b= (select b from t1);
+-- error 1242
+update t1 set b= (select b from t2);
+update t1 set b= (select b from t2 where t1.a = t2.a);
+select * from t1;
+drop table t1, t2;
+
+#delete with subselects
+create table t1 (a int NOT NULL, b int, primary key (a));
+create table t2 (a int NOT NULL, b int, primary key (a));
+insert into t1 values (0, 10),(1, 11),(2, 12);
+insert into t2 values (1, 21),(2, 12),(3, 23);
+select * from t1;
+select * from t1 where b = (select b from t2 where t1.a = t2.a);
+-- error 1093
+delete from t1 where b = (select b from t1);
+-- error 1242
+delete from t1 where b = (select b from t2);
+delete from t1 where b = (select b from t2 where t1.a = t2.a);
+select * from t1;
+drop table t1, t2;
+
+#multi-delete with subselects
+
+create table t11 (a int NOT NULL, b int, primary key (a));
+create table t12 (a int NOT NULL, b int, primary key (a));
+create table t2 (a int NOT NULL, b int, primary key (a));
+insert into t11 values (0, 10),(1, 11),(2, 12);
+insert into t12 values (33, 10),(22, 11),(2, 12);
+insert into t2 values (1, 21),(2, 12),(3, 23);
+select * from t11;
+select * from t12;
+-- error 1093
+delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
+-- error 1242
+delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
+delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
+select * from t11;
+select * from t12;
+drop table t11, t12, t2;
+
+#insert with subselects
+CREATE TABLE t1 (x int);
+create table t2 (a int);
+create table t3 (b int);
+insert into t2 values (1);
+insert into t3 values (1),(2);
+-- error 1093
+INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
+-- error 1242
+INSERT INTO t1 (x) VALUES ((SELECT b FROM t3));
+INSERT INTO t1 (x) VALUES ((SELECT a FROM t2));
+select * from t1;
+insert into t2 values (1);
+INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
+-- sleep 1
+select * from t1;
+INSERT INTO t1 (x) select (SELECT SUM(a)+1 FROM t2) FROM t2;
+select * from t1;
+INSERT INTO t1 (x) select (SELECT SUM(x)+2 FROM t1) FROM t2;
+-- error 1054
+INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(x) FROM t2));
+INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
+-- sleep 1
+select * from t1;
+#
+#TODO: should be uncommented after bug 380 fix pushed
+#INSERT INTO t1 (x) SELECT (SELECT SUM(a)+b FROM t2) from t3;
+#select * from t1;
+drop table t1, t2, t3;
+
+#replace with subselects
+CREATE TABLE t1 (x int not null, y int, primary key (x));
+create table t2 (a int);
+create table t3 (a int);
+insert into t2 values (1);
+insert into t3 values (1),(2);
+select * from t1;
+-- error 1093
+replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2));
+-- error 1242
+replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2));
+replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2));
+select * from t1;
+replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+2 FROM t2));
+select * from t1;
+replace DELAYED into t1 (x, y) VALUES ((SELECT a+3 FROM t2), (SELECT a FROM t2));
+-- sleep 1
+select * from t1;
+replace DELAYED into t1 (x, y) VALUES ((SELECT a+3 FROM t2), (SELECT a+1 FROM t2));
+-- sleep 1
+select * from t1;
+replace LOW_PRIORITY into t1 (x, y) VALUES ((SELECT a+1 FROM t2), (SELECT a FROM t2));
+select * from t1;
+drop table t1, t2, t3;
+
+-- error 1096
+SELECT * FROM (SELECT 1) b WHERE 1 IN (SELECT *);
+
+CREATE TABLE t2 (id int(11) default NULL, KEY id (id)) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t2 VALUES (1),(2);
+SELECT * FROM t2 WHERE id IN (SELECT 1);
+EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1);
+SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
+SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1));
+EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1));
+EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
+SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3);
+SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
+-- error 1093
+INSERT INTO t2 VALUES ((SELECT * FROM t2));
+-- error 1093
+INSERT INTO t2 VALUES ((SELECT id FROM t2));
+SELECT * FROM t2;
+CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t1 values (1),(1);
+-- error 1242
+UPDATE t2 SET id=(SELECT * FROM t1);
+drop table t2, t1;
+
+#NULL test
+create table t1 (a int);
+insert into t1 values (1),(2),(3);
+select 1 IN (SELECT * from t1);
+select 10 IN (SELECT * from t1);
+select NULL IN (SELECT * from t1);
+update t1 set a=NULL where a=2;
+select 1 IN (SELECT * from t1);
+select 3 IN (SELECT * from t1);
+select 10 IN (SELECT * from t1);
+select 1 > ALL (SELECT * from t1);
+select 10 > ALL (SELECT * from t1);
+select 1 > ANY (SELECT * from t1);
+select 10 > ANY (SELECT * from t1);
+drop table t1;
+create table t1 (a varchar(20));
+insert into t1 values ('A'),('BC'),('DEF');
+select 'A' IN (SELECT * from t1);
+select 'XYZS' IN (SELECT * from t1);
+select NULL IN (SELECT * from t1);
+update t1 set a=NULL where a='BC';
+select 'A' IN (SELECT * from t1);
+select 'DEF' IN (SELECT * from t1);
+select 'XYZS' IN (SELECT * from t1);
+select 'A' > ALL (SELECT * from t1);
+select 'XYZS' > ALL (SELECT * from t1);
+select 'A' > ANY (SELECT * from t1);
+select 'XYZS' > ANY (SELECT * from t1);
+drop table t1;
+create table t1 (a float);
+insert into t1 values (1.5),(2.5),(3.5);
+select 1.5 IN (SELECT * from t1);
+select 10.5 IN (SELECT * from t1);
+select NULL IN (SELECT * from t1);
+update t1 set a=NULL where a=2.5;
+select 1.5 IN (SELECT * from t1);
+select 3.5 IN (SELECT * from t1);
+select 10.5 IN (SELECT * from t1);
+select 1.5 > ALL (SELECT * from t1);
+select 10.5 > ALL (SELECT * from t1);
+select 1.5 > ANY (SELECT * from t1);
+select 10.5 > ANY (SELECT * from t1);
+explain extended select (select a+1) from t1;
+select (select a+1) from t1;
+drop table t1;
+
+#
+# Null with keys
+#
+
+CREATE TABLE t1 (a int(11) NOT NULL default '0', PRIMARY KEY (a));
+CREATE TABLE t2 (a int(11) default '0', INDEX (a));
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+INSERT INTO t2 VALUES (1),(2),(3);
+SELECT t1.a, t1.a in (select t2.a from t2) FROM t1;
+explain extended SELECT t1.a, t1.a in (select t2.a from t2) FROM t1;
+CREATE TABLE t3 (a int(11) default '0');
+INSERT INTO t3 VALUES (1),(2),(3);
+SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1;
+explain extended SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1;
+drop table t1,t2,t3;
+
+#LIMIT is not supported now
+create table t1 (a float);
+-- error 1235
+select 10.5 IN (SELECT * from t1 LIMIT 1);
+-- error 1235
+select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5);
+drop table t1;
+
+create table t1 (a int, b int, c varchar(10));
+create table t2 (a int);
+insert into t1 values (1,2,'a'),(2,3,'b'),(3,4,'c');
+insert into t2 values (1),(2),(NULL);
+select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a'),(select c from t1 where a=t2.a) from t2;
+select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2;
+select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c'),(select c from t1 where a=t2.a) from t2;
+drop table t1,t2;
+
+create table t1 (a int, b real, c varchar(10));
+insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b');
+select ROW(1, 1, 'a') IN (select a,b,c from t1);
+select ROW(1, 2, 'a') IN (select a,b,c from t1);
+select ROW(1, 1, 'a') IN (select b,a,c from t1);
+select ROW(1, 1, 'a') IN (select a,b,c from t1 where a is not null);
+select ROW(1, 2, 'a') IN (select a,b,c from t1 where a is not null);
+select ROW(1, 1, 'a') IN (select b,a,c from t1 where a is not null);
+select ROW(1, 1, 'a') IN (select a,b,c from t1 where c='b' or c='a');
+select ROW(1, 2, 'a') IN (select a,b,c from t1 where c='b' or c='a');
+select ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a');
+-- error 1235
+select ROW(1, 1, 'a') IN (select b,a,c from t1 limit 2);
+drop table t1;
+
+create table t1 (a int);
+insert into t1 values (1);
+do @a:=(SELECT a from t1);
+select @a;
+set @a:=2;
+set @a:=(SELECT a from t1);
+select @a;
+drop table t1;
+-- error 1146
+do (SELECT a from t1);
+-- error 1146
+set @a:=(SELECT a from t1);
+
+CREATE TABLE t1 (a int, KEY(a));
+HANDLER t1 OPEN;
+-- error 1064
+HANDLER t1 READ a=((SELECT 1));
+HANDLER t1 CLOSE;
+drop table t1;
+
+create table t1 (a int);
+create table t2 (b int);
+insert into t1 values (1),(2);
+insert into t2 values (1);
+select a from t1 where a in (select a from t1 where a in (select b from t2));
+drop table t1, t2;
+
+create table t1 (a int, b int);
+create table t2 like t1;
+insert into t1 values (1,2),(1,3),(1,4),(1,5);
+insert into t2 values (1,2),(1,3);
+select * from t1 where row(a,b) in (select a,b from t2);
+drop table t1, t2;
+
+CREATE TABLE `t1` (`i` int(11) NOT NULL default '0',PRIMARY KEY (`i`)) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t1 VALUES (1);
+UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
+select * from t1;
+drop table t1;
+
+#test of uncacheable subqueries
+CREATE TABLE t1 (a int(1));
+EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1;
+EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1;
+EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1;
+drop table t1;
+
+
+CREATE TABLE `t1` (
+ `mot` varchar(30) character set latin1 NOT NULL default '',
+ `topic` mediumint(8) unsigned NOT NULL default '0',
+ `date` date NOT NULL default '0000-00-00',
+ `pseudo` varchar(35) character set latin1 NOT NULL default '',
+ PRIMARY KEY (`mot`,`pseudo`,`date`,`topic`),
+ KEY `pseudo` (`pseudo`,`date`,`topic`),
+ KEY `topic` (`topic`)
+) ENGINE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC;
+
+CREATE TABLE `t2` (
+ `mot` varchar(30) character set latin1 NOT NULL default '',
+ `topic` mediumint(8) unsigned NOT NULL default '0',
+ `date` date NOT NULL default '0000-00-00',
+ `pseudo` varchar(35) character set latin1 NOT NULL default '',
+ PRIMARY KEY (`mot`,`pseudo`,`date`,`topic`),
+ KEY `pseudo` (`pseudo`,`date`,`topic`),
+ KEY `topic` (`topic`)
+) ENGINE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC;
+
+CREATE TABLE `t3` (
+ `numeropost` mediumint(8) unsigned NOT NULL auto_increment,
+ `maxnumrep` int(10) unsigned NOT NULL default '0',
+ PRIMARY KEY (`numeropost`),
+ UNIQUE KEY `maxnumrep` (`maxnumrep`)
+) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t1 VALUES ('joce','1','','joce'),('test','2','','test');
+
+INSERT INTO t2 VALUES ('joce','1','','joce'),('test','2','','test');
+
+INSERT INTO t3 VALUES (1,1);
+
+SELECT DISTINCT topic FROM t2 WHERE NOT EXISTS(SELECT * FROM t3 WHERE
+numeropost=topic);
+select * from t1;
+DELETE FROM t1 WHERE topic IN (SELECT DISTINCT topic FROM t2 WHERE NOT
+EXISTS(SELECT * FROM t3 WHERE numeropost=topic));
+select * from t1;
+
+drop table t1, t2, t3;
+
+SELECT * FROM (SELECT 1 as a,(SELECT a)) a;
+CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT 1)) a;
+SHOW CREATE TABLE t1;
+drop table t1;
+CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a)) a;
+SHOW CREATE TABLE t1;
+drop table t1;
+CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a;
+SHOW CREATE TABLE t1;
+drop table t1;
+CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a;
+select * from t1;
+SHOW CREATE TABLE t1;
+drop table t1;
+
+create table t1 (a int);
+insert into t1 values (1), (2), (3);
+explain extended select a,(select (select rand() from t1 limit 1) from t1 limit 1)
+from t1;
+drop table t1;
+
+#
+# error in IN
+#
+-- error 1146
+select t1.Continent, t2.Name, t2.Population from t1 LEFT JOIN t2 ON t1.Code = t2.Country where t2.Population IN (select max(t2.Population) AS Population from t2, t1 where t2.Country = t1.Code group by Continent);
+
+#
+# complex subquery
+#
+
+CREATE TABLE t1 (
+ ID int(11) NOT NULL auto_increment,
+ name char(35) NOT NULL default '',
+ t2 char(3) NOT NULL default '',
+ District char(20) NOT NULL default '',
+ Population int(11) NOT NULL default '0',
+ PRIMARY KEY (ID)
+) ENGINE=MyISAM;
+
+INSERT INTO t1 VALUES (130,'Sydney','AUS','New South Wales',3276207);
+INSERT INTO t1 VALUES (131,'Melbourne','AUS','Victoria',2865329);
+INSERT INTO t1 VALUES (132,'Brisbane','AUS','Queensland',1291117);
+
+CREATE TABLE t2 (
+ Code char(3) NOT NULL default '',
+ Name char(52) NOT NULL default '',
+ Continent enum('Asia','Europe','North America','Africa','Oceania','Antarctica','South America') NOT NULL default 'Asia',
+ Region char(26) NOT NULL default '',
+ SurfaceArea float(10,2) NOT NULL default '0.00',
+ IndepYear smallint(6) default NULL,
+ Population int(11) NOT NULL default '0',
+ LifeExpectancy float(3,1) default NULL,
+ GNP float(10,2) default NULL,
+ GNPOld float(10,2) default NULL,
+ LocalName char(45) NOT NULL default '',
+ GovernmentForm char(45) NOT NULL default '',
+ HeadOfState char(60) default NULL,
+ Capital int(11) default NULL,
+ Code2 char(2) NOT NULL default '',
+ PRIMARY KEY (Code)
+) ENGINE=MyISAM;
+
+INSERT INTO t2 VALUES ('AUS','Australia','Oceania','Australia and New Zealand',7741220.00,1901,18886000,79.8,351182.00,392911.00,'Australia','Constitutional Monarchy, Federation','Elisabeth II',135,'AU');
+INSERT INTO t2 VALUES ('AZE','Azerbaijan','Asia','Middle East',86600.00,1991,7734000,62.9,4127.00,4100.00,'Azärbaycan','Federal Republic','Heydär Äliyev',144,'AZ');
+
+select t2.Continent, t1.Name, t1.Population from t2 LEFT JOIN t1 ON t2.Code = t1.t2 where t1.Population IN (select max(t1.Population) AS Population from t1, t2 where t1.t2 = t2.Code group by Continent);
+
+drop table t1, t2;
+
+#
+# constants in IN
+#
+CREATE TABLE `t1` (
+ `id` mediumint(8) unsigned NOT NULL auto_increment,
+ `pseudo` varchar(35) character set latin1 NOT NULL default '',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `pseudo` (`pseudo`)
+) ENGINE=MyISAM PACK_KEYS=1 ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 (pseudo) VALUES ('test');
+SELECT 0 IN (SELECT 1 FROM t1 a);
+EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a);
+INSERT INTO t1 (pseudo) VALUES ('test1');
+SELECT 0 IN (SELECT 1 FROM t1 a);
+EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a);
+drop table t1;
+
+CREATE TABLE `t1` (
+ `i` int(11) NOT NULL default '0',
+ PRIMARY KEY (`i`)
+) ENGINE=MyISAM CHARSET=latin1;
+
+INSERT INTO t1 VALUES (1);
+UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i));
+UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
+-- error 1109
+UPDATE t1 SET t.i=i+(SELECT MAX(i) FROM (SELECT 1) t);
+select * from t1;
+drop table t1;
+
+#
+# Multi update test
+#
+CREATE TABLE t1 (
+ id int(11) default NULL
+) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t1 VALUES (1),(1),(2),(2),(1),(3);
+CREATE TABLE t2 (
+ id int(11) default NULL,
+ name varchar(15) default NULL
+) ENGINE=MyISAM CHARSET=latin1;
+
+INSERT INTO t2 VALUES (4,'vita'), (1,'vita'), (2,'vita'), (1,'vita');
+update t1, t2 set t2.name='lenka' where t2.id in (select id from t1);
+select * from t2;
+drop table t1,t2;
+
+#
+# correct NULL in <CONSTANT> IN (SELECT ...)
+#
+create table t1 (a int, unique index indexa (a));
+insert into t1 values (-1), (-4), (-2), (NULL);
+select -10 IN (select a from t1 FORCE INDEX (indexa));
+drop table t1;
+
+#
+# Test optimization for sub selects
+#
+create table t1 (id int not null auto_increment primary key, salary int, key(salary));
+insert into t1 (salary) values (100),(1000),(10000),(10),(500),(5000),(50000);
+explain extended SELECT id FROM t1 where salary = (SELECT MAX(salary) FROM t1);
+drop table t1;
+
+CREATE TABLE t1 (
+ ID int(10) unsigned NOT NULL auto_increment,
+ SUB_ID int(3) unsigned NOT NULL default '0',
+ REF_ID int(10) unsigned default NULL,
+ REF_SUB int(3) unsigned default '0',
+ PRIMARY KEY (ID,SUB_ID),
+ UNIQUE KEY t1_PK (ID,SUB_ID),
+ KEY t1_FK (REF_ID,REF_SUB),
+ KEY t1_REFID (REF_ID)
+) ENGINE=MyISAM CHARSET=cp1251;
+INSERT INTO t1 VALUES (1,0,NULL,NULL),(2,0,NULL,NULL);
+SELECT DISTINCT REF_ID FROM t1 WHERE ID= (SELECT DISTINCT REF_ID FROM t1 WHERE ID=2);
+DROP TABLE t1;
+
+#
+# uninterruptable update
+#
+create table t1 (a int, b int);
+create table t2 (a int, b int);
+
+insert into t1 values (1,0), (2,0), (3,0);
+insert into t2 values (1,1), (2,1), (3,1), (2,2);
+
+update ignore t1 set b=(select b from t2 where t1.a=t2.a);
+select * from t1;
+
+drop table t1, t2;
+
+#
+# reduced subselect in ORDER BY & GROUP BY clauses
+#
+
+CREATE TABLE `t1` (
+ `id` mediumint(8) unsigned NOT NULL auto_increment,
+ `pseudo` varchar(35) NOT NULL default '',
+ `email` varchar(60) NOT NULL default '',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `email` (`email`),
+ UNIQUE KEY `pseudo` (`pseudo`)
+) ENGINE=MyISAM CHARSET=latin1 PACK_KEYS=1 ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 (id,pseudo,email) VALUES (1,'test','test'),(2,'test1','test1');
+SELECT pseudo as a, pseudo as b FROM t1 GROUP BY (SELECT a) ORDER BY (SELECT id*1);
+drop table if exists t1;
+
+(SELECT 1 as a) UNION (SELECT 1) ORDER BY (SELECT a+0);
+
+#
+# IN subselect optimization test
+#
+create table t1 (a int not null, b int, primary key (a));
+create table t2 (a int not null, primary key (a));
+create table t3 (a int not null, b int, primary key (a));
+insert into t1 values (1,10), (2,20), (3,30), (4,40);
+insert into t2 values (2), (3), (4), (5);
+insert into t3 values (10,3), (20,4), (30,5);
+select * from t2 where t2.a in (select a from t1);
+explain extended select * from t2 where t2.a in (select a from t1);
+select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
+explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
+select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
+explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
+drop table t1, t2, t3;
+create table t1 (a int, b int, index a (a,b));
+create table t2 (a int, index a (a));
+create table t3 (a int, b int, index a (a));
+insert into t1 values (1,10), (2,20), (3,30), (4,40);
+disable_query_log;
+# making table large enough
+let $1 = 10000;
+while ($1)
+ {
+ eval insert into t1 values (rand()*100000+200,rand()*100000);
+ dec $1;
+ }
+enable_query_log;
+insert into t2 values (2), (3), (4), (5);
+insert into t3 values (10,3), (20,4), (30,5);
+select * from t2 where t2.a in (select a from t1);
+explain extended select * from t2 where t2.a in (select a from t1);
+select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
+explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
+select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
+explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
+insert into t1 values (3,31);
+select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
+select * from t2 where t2.a in (select a from t1 where t1.b <> 30 and t1.b <> 31);
+explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
+drop table t1, t2, t3;
+
+#
+# alloc_group_fields() working
+#
+create table t1 (a int, b int);
+create table t2 (a int, b int);
+create table t3 (a int, b int);
+insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10);
+insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1);
+insert into t3 values (3,3), (2,2), (1,1);
+select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3;
+drop table t1,t2,t3;
+
+#
+# aggregate functions in HAVING test
+#
+create table t1 (s1 int);
+create table t2 (s1 int);
+insert into t1 values (1);
+insert into t2 values (1);
+select * from t1 where exists (select s1 from t2 having max(t2.s1)=t1.s1);
+drop table t1,t2;
+
+#
+# update subquery with wrong field (to force name resolving
+# in UPDATE name space)
+#
+create table t1 (s1 int);
+create table t2 (s1 int);
+insert into t1 values (1);
+insert into t2 values (1);
+-- error 1054
+update t1 set s1 = s1 + 1 where 1 = (select x.s1 as A from t2 WHERE t2.s1 > t1.s1 order by A);
+DROP TABLE t1, t2;
+
+#
+# collation test
+#
+CREATE TABLE t1 (s1 CHAR(5) COLLATE latin1_german1_ci,
+ s2 CHAR(5) COLLATE latin1_swedish_ci);
+INSERT INTO t1 VALUES ('z','?');
+-- error 1267
+select * from t1 where s1 > (select max(s2) from t1);
+-- error 1267
+select * from t1 where s1 > any (select max(s2) from t1);
+drop table t1;
+
+#
+# aggregate functions reinitialization
+#
+create table t1(toid int,rd int);
+create table t2(userid int,pmnew int,pmtotal int);
+insert into t2 values(1,0,0),(2,0,0);
+insert into t1 values(1,0),(1,0),(1,0),(1,12),(1,15),(1,123),(1,12312),(1,12312),(1,123),(2,0),(2,0),(2,1),(2,2);
+select userid,pmtotal,pmnew, (select count(rd) from t1 where toid=t2.userid) calc_total, (select count(rd) from t1 where rd=0 and toid=t2.userid) calc_new from t2 where userid in (select distinct toid from t1);
+drop table t1, t2;
+
+#
+# row union
+#
+create table t1 (s1 char(5));
+-- error 1241
+select (select 'a','b' from t1 union select 'a','b' from t1) from t1;
+insert into t1 values ('tttt');
+select * from t1 where ('a','b')=(select 'a','b' from t1 union select 'a','b' from t1);
+explain extended (select * from t1);
+(select * from t1);
+drop table t1;
+
+#
+# IN optimisation test results
+#
+create table t1 (s1 char(5), index s1(s1));
+create table t2 (s1 char(5), index s1(s1));
+insert into t1 values ('a1'),('a2'),('a3');
+insert into t2 values ('a1'),('a2');
+select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
+select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
+select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
+select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
+explain extended select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
+explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
+explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
+explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
+drop table t1,t2;
+
+#
+# correct ALL optimisation
+#
+create table t2 (a int, b int);
+create table t3 (a int);
+insert into t3 values (6),(7),(3);
+select * from t3 where a >= all (select b from t2);
+explain extended select * from t3 where a >= all (select b from t2);
+select * from t3 where a >= some (select b from t2);
+explain extended select * from t3 where a >= some (select b from t2);
+select * from t3 where a >= all (select b from t2 group by 1);
+explain extended select * from t3 where a >= all (select b from t2 group by 1);
+select * from t3 where a >= some (select b from t2 group by 1);
+explain extended select * from t3 where a >= some (select b from t2 group by 1);
+select * from t3 where NULL >= any (select b from t2);
+explain extended select * from t3 where NULL >= any (select b from t2);
+select * from t3 where NULL >= any (select b from t2 group by 1);
+explain extended select * from t3 where NULL >= any (select b from t2 group by 1);
+select * from t3 where NULL >= some (select b from t2);
+explain extended select * from t3 where NULL >= some (select b from t2);
+select * from t3 where NULL >= some (select b from t2 group by 1);
+explain extended select * from t3 where NULL >= some (select b from t2 group by 1);
+#
+# optimized static ALL/ANY with grouping
+#
+insert into t2 values (2,2), (2,1), (3,3), (3,1);
+select * from t3 where a > all (select max(b) from t2 group by a);
+explain extended select * from t3 where a > all (select max(b) from t2 group by a);
+drop table t2, t3;
+
+#
+# correct used_tables()
+#
+
+CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ;
+INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now());
+CREATE TABLE `t2` (`db_id` int(11) NOT NULL auto_increment,`name` varchar(200) NOT NULL default '',`primary_uid` smallint(6) NOT NULL default '0',`secondary_uid` smallint(6) NOT NULL default '0',PRIMARY KEY (`db_id`),UNIQUE KEY `name_2` (`name`),FULLTEXT KEY `name` (`name`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=2147483647;
+INSERT INTO `t2` (`db_id`, `name`, `primary_uid`, `secondary_uid`) VALUES (18, 'Not Set 1', 0, 0),(19, 'Valid', 1, 2),(20, 'Valid 2', 1, 2),(21, 'Should Not Return', 1, 2),(26, 'Not Set 2', 0, 0),(-1, 'ALL DB\'S', 0, 0);
+CREATE TABLE `t3` (`taskgenid` mediumint(9) NOT NULL auto_increment,`dbid` int(11) NOT NULL default '0',`taskid` int(11) NOT NULL default '0',`mon` tinyint(4) NOT NULL default '1',`tues` tinyint(4) NOT NULL default '1',`wed` tinyint(4) NOT NULL default '1',`thur` tinyint(4) NOT NULL default '1',`fri` tinyint(4) NOT NULL default '1',`sat` tinyint(4) NOT NULL default '0',`sun` tinyint(4) NOT NULL default '0',`how_often` smallint(6) NOT NULL default '1',`userid` smallint(6) NOT NULL default '0',`active` tinyint(4) NOT NULL default '1',PRIMARY KEY (`taskgenid`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=2 ;
+INSERT INTO `t3` (`taskgenid`, `dbid`, `taskid`, `mon`, `tues`,`wed`, `thur`, `fri`, `sat`, `sun`, `how_often`, `userid`, `active`) VALUES (1,-1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1);
+CREATE TABLE `t4` (`task_id` smallint(6) NOT NULL default '0',`description` varchar(200) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO `t4` (`task_id`, `description`) VALUES (1, 'Daily Check List'),(2, 'Weekly Status');
+select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid;
+SELECT dbid, name FROM t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND ((date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01')) AND t4.task_id = taskid;
+drop table t1,t2,t3,t4;
+
+#
+# cardinality check
+#
+CREATE TABLE t1 (id int(11) default NULL) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t1 VALUES (1),(5);
+CREATE TABLE t2 (id int(11) default NULL) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t2 VALUES (2),(6);
+-- error 1241
+select * from t1 where (1,2,6) in (select * from t2);
+DROP TABLE t1,t2;
+
+#
+# DO and SET with errors
+#
+create table t1 (s1 int);
+insert into t1 values (1);
+insert into t1 values (2);
+-- error 1242
+set sort_buffer_size = (select s1 from t1);
+do (select * from t1);
+drop table t1;
+
+#
+# optimized ALL/ANY with union
+#
+create table t1 (s1 char);
+insert into t1 values ('e');
+select * from t1 where 'f' > any (select s1 from t1);
+select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1);
+explain extended select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1);
+drop table t1;
+
+#
+# filesort in subquery (restoring join_tab)
+#
+CREATE TABLE t1 (number char(11) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t1 VALUES ('69294728265'),('18621828126'),('89356874041'),('95895001874');
+CREATE TABLE t2 (code char(5) NOT NULL default '',UNIQUE KEY code (code)) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t2 VALUES ('1'),('1226'),('1245'),('1862'),('18623'),('1874'),('1967'),('6');
+select c.number as phone,(select p.code from t2 p where c.number like concat(p.code, '%') order by length(p.code) desc limit 1) as code from t1 c;
+drop table t1, t2;
+
+#
+# unresolved field error
+#
+create table t1 (s1 int);
+create table t2 (s1 int);
+-- error 1054
+select * from t1 where (select count(*) from t2 where t1.s2) = 1;
+-- error 1054
+select * from t1 where (select count(*) from t2 group by t1.s2) = 1;
+-- error 1109
+select count(*) from t2 group by t1.s2;
+drop table t1, t2;
+
+#
+# fix_fields() in add_ref_to_table_cond()
+#
+CREATE TABLE t1(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC VARCHAR(20) DEFAULT NULL,PRIMARY KEY (COLA, COLB));
+CREATE TABLE t2(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC CHAR(1) NOT NULL,PRIMARY KEY (COLA));
+INSERT INTO t1 VALUES (1,1,'1A3240'), (1,2,'4W2365');
+INSERT INTO t2 VALUES (100, 200, 'C');
+SELECT DISTINCT COLC FROM t1 WHERE COLA = (SELECT COLA FROM t2 WHERE COLB = 200 AND COLC ='C' LIMIT 1);
+DROP TABLE t1, t2;
+
+CREATE TABLE t1 (a int(1));
+INSERT INTO t1 VALUES (1),(1),(1),(1),(1),(2),(3),(4),(5);
+SELECT DISTINCT (SELECT a) FROM t1 LIMIT 100;
+DROP TABLE t1;
+
+#
+# Bug 2198
+#
+
+create table t1 (a int, b decimal(13, 3));
+insert into t1 values (1, 0.123);
+select a, (select max(b) from t1) into outfile "subselect.out.file.1" from t1;
+delete from t1;
+load data infile "subselect.out.file.1" into table t1;
+select * from t1;
+drop table t1;
+
+#
+# Bug 2479
+#
+
+CREATE TABLE `t1` (
+ `id` int(11) NOT NULL auto_increment,
+ `id_cns` tinyint(3) unsigned NOT NULL default '0',
+ `tipo` enum('','UNO','DUE') NOT NULL default '',
+ `anno_dep` smallint(4) unsigned zerofill NOT NULL default '0000',
+ `particolare` mediumint(8) unsigned NOT NULL default '0',
+ `generale` mediumint(8) unsigned NOT NULL default '0',
+ `bis` tinyint(3) unsigned NOT NULL default '0',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `idx_cns_gen_anno` (`anno_dep`,`id_cns`,`generale`,`particolare`),
+ UNIQUE KEY `idx_cns_par_anno` (`id_cns`,`anno_dep`,`tipo`,`particolare`,`bis`)
+);
+INSERT INTO `t1` VALUES (1,16,'UNO',1987,2048,9681,0),(2,50,'UNO',1987,1536,13987,0),(3,16,'UNO',1987,2432,14594,0),(4,16,'UNO',1987,1792,13422,0),(5,16,'UNO',1987,1025,10240,0),(6,16,'UNO',1987,1026,7089,0);
+CREATE TABLE `t2` (
+ `id` tinyint(3) unsigned NOT NULL auto_increment,
+ `max_anno_dep` smallint(6) unsigned NOT NULL default '0',
+ PRIMARY KEY (`id`)
+);
+INSERT INTO `t2` VALUES (16,1987),(50,1990),(51,1990);
+
+SELECT cns.id, cns.max_anno_dep, cns.max_anno_dep = (SELECT s.anno_dep FROM t1 AS s WHERE s.id_cns = cns.id ORDER BY s.anno_dep DESC LIMIT 1) AS PIPPO FROM t2 AS cns;
+
+DROP TABLE t1, t2;
+
+#
+# GLOBAL LIMIT
+#
+create table t1 (a int);
+insert into t1 values (1), (2), (3);
+SET SQL_SELECT_LIMIT=1;
+select sum(a) from (select * from t1) as a;
+select 2 in (select * from t1);
+SET SQL_SELECT_LIMIT=default;
+drop table t1;
+
+#
+# Bug #3118: subselect + order by
+#
+
+CREATE TABLE t1 (a int, b int, INDEX (a));
+INSERT INTO t1 VALUES (1, 1), (1, 2), (1, 3);
+SELECT * FROM t1 WHERE a = (SELECT MAX(a) FROM t1 WHERE a = 1) ORDER BY b;
+DROP TABLE t1;
+
+# Item_cond fix field
+#
+create table t1(val varchar(10));
+insert into t1 values ('aaa'), ('bbb'),('eee'),('mmm'),('ppp');
+select count(*) from t1 as w1 where w1.val in (select w2.val from t1 as w2 where w2.val like 'm%') and w1.val in (select w3.val from t1 as w3 where w3.val like 'e%');
+drop table t1;
+
+#
+# ref_or_null replacing with ref
+#
+create table t1 (id int not null, text varchar(20) not null default '', primary key (id));
+insert into t1 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text11'), (12, 'text12');
+select * from t1 where id not in (select id from t1 where id < 8);
+select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null);
+explain extended select * from t1 where id not in (select id from t1 where id < 8);
+explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null);
+insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
+create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
+insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
+select * from t1 a left join t2 b on (a.id=b.id or b.id is null) join t1 c on (if(isnull(b.id), 1000, b.id)=c.id);
+explain extended select * from t1 a left join t2 b on (a.id=b.id or b.id is null) join t1 c on (if(isnull(b.id), 1000, b.id)=c.id);
+drop table t1,t2;
+
+#
+# Static tables & rund() in subqueries
+#
+create table t1 (a int);
+insert into t1 values (1);
+explain select benchmark(1000, (select a from t1 where a=sha(rand())));
+drop table t1;
+
+#
+# bug 3188
+#
+create table t1(id int);
+create table t2(id int);
+create table t3(flag int);
+-- error 1064
+select (select * from t3 where id not null) from t1, t2;
+drop table t1,t2,t3;
+
+#
+# aggregate functions (Bug #3505)
+#
+CREATE TABLE t1 (id INT);
+CREATE TABLE t2 (id INT);
+INSERT INTO t1 VALUES (1), (2);
+INSERT INTO t2 VALUES (1);
+SELECT t1.id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id);
+SELECT t1.id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id) ORDER BY t1.id;
+DROP TABLE t1,t2;
+
+#
+# ALL/ANY test
+#
+CREATE TABLE t1 ( a int, b int );
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+SELECT a FROM t1 WHERE a > ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a < ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a = ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a >= ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <= ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <> ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a > ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a < ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a = ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a >= ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <= ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <> ALL ( SELECT a FROM t1 WHERE b = 2 );
+ALTER TABLE t1 ADD INDEX (a);
+SELECT a FROM t1 WHERE a > ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a < ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a = ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a >= ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <= ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <> ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a > ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a < ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a = ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a >= ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <= ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <> ALL ( SELECT a FROM t1 WHERE b = 2 );
+DROP TABLE t1;
+
+#
+# SELECT(EXISTS * ...)optimisation
+#
+create table t1 (a int, b int);
+insert into t1 values (1,2),(3,4);
+select * from t1 up where exists (select * from t1 where t1.a=up.a);
+explain extended select * from t1 up where exists (select * from t1 where t1.a=up.a);
+drop table t1;
+
+#
+# Bug #4102: subselect in HAVING
+#
+
+CREATE TABLE t1 (t1_a int);
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 (t2_a int, t2_b int, PRIMARY KEY (t2_a, t2_b));
+INSERT INTO t2 VALUES (1, 1), (1, 2);
+SELECT * FROM t1, t2 table2 WHERE t1_a = 1 AND table2.t2_a = 1
+ HAVING table2.t2_b = (SELECT MAX(t2_b) FROM t2 WHERE t2_a = table2.t2_a);
+DROP TABLE t1, t2;
+
+#
+# Test problem with NULL and derived tables (Bug #4097)
+#
+
+CREATE TABLE t1 (id int(11) default NULL,name varchar(10) default NULL);
+INSERT INTO t1 VALUES (1,'Tim'),(2,'Rebecca'),(3,NULL);
+CREATE TABLE t2 (id int(11) default NULL, pet varchar(10) default NULL);
+INSERT INTO t2 VALUES (1,'Fido'),(2,'Spot'),(3,'Felix');
+SELECT a.*, b.* FROM (SELECT * FROM t1) AS a JOIN t2 as b on a.id=b.id;
+drop table t1,t2;
+
+#
+# outer fields resolving in INSERT/REPLACE and CRETE with SELECT
+#
+CREATE TABLE t1 ( a int, b int );
+CREATE TABLE t2 ( c int, d int );
+INSERT INTO t1 VALUES (1,2), (2,3), (3,4);
+SELECT a AS abc, b FROM t1 WHERE b = (SELECT MIN(b) FROM t1 WHERE a=abc);
+INSERT INTO t2 SELECT a AS abc, b FROM t1 WHERE b = (SELECT MIN(b) FROM t1 WHERE a=abc);
+select * from t2;
+CREATE TABLE t3 SELECT a AS abc, b FROM t1 WHERE b = (SELECT MIN(b) FROM t1 WHERE a=abc);
+select * from t3;
+prepare stmt1 from "INSERT INTO t2 SELECT a AS abc, b FROM t1 WHERE b = (SELECT MIN(b) FROM t1 WHERE a=abc);";
+execute stmt1;
+deallocate prepare stmt1;
+select * from t2;
+drop table t3;
+prepare stmt1 from "CREATE TABLE t3 SELECT a AS abc, b FROM t1 WHERE b = (SELECT MIN(b) FROM t1 WHERE a=abc);";
+execute stmt1;
+select * from t3;
+deallocate prepare stmt1;
+DROP TABLE t1, t2, t3;
+
+#
+# Aggregate function comparation with ALL/ANY/SOME subselect
+#
+CREATE TABLE `t1` ( `a` int(11) default NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+insert into t1 values (1);
+CREATE TABLE `t2` ( `b` int(11) default NULL, `a` int(11) default NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+insert into t2 values (1,2);
+select t000.a, count(*) `C` FROM t1 t000 GROUP BY t000.a HAVING count(*) > ALL (SELECT count(*) FROM t2 t001 WHERE t001.a=1);
+drop table t1,t2;
+
+#
+# BUG#4769 - fulltext in subselect
+#
+create table t1 (a int not null auto_increment primary key, b varchar(40), fulltext(b));
+insert into t1 (b) values ('ball'),('ball games'), ('games'), ('foo'), ('foobar'), ('Serg'), ('Sergei'),('Georg'), ('Patrik'),('Hakan');
+create table t2 (a int);
+insert into t2 values (1),(3),(2),(7);
+select a,b from t1 where match(b) against ('Ball') > 0;
+select a from t2 where a in (select a from t1 where match(b) against ('Ball') > 0);
+drop table t1,t2;
+
+#
+# BUG#5003 - like in subselect
+#
+CREATE TABLE t1(`IZAVORGANG_ID` VARCHAR(11) CHARACTER SET latin1 COLLATE latin1_bin,`KUERZEL` VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_bin,`IZAANALYSEART_ID` VARCHAR(11) CHARACTER SET latin1 COLLATE latin1_bin,`IZAPMKZ_ID` VARCHAR(11) CHARACTER SET latin1 COLLATE latin1_bin);
+CREATE INDEX AK01IZAVORGANG ON t1(izaAnalyseart_id,Kuerzel);
+INSERT INTO t1(`IZAVORGANG_ID`,`KUERZEL`,`IZAANALYSEART_ID`,`IZAPMKZ_ID`)VALUES('D0000000001','601','D0000000001','I0000000001');
+INSERT INTO t1(`IZAVORGANG_ID`,`KUERZEL`,`IZAANALYSEART_ID`,`IZAPMKZ_ID`)VALUES('D0000000002','602','D0000000001','I0000000001');
+INSERT INTO t1(`IZAVORGANG_ID`,`KUERZEL`,`IZAANALYSEART_ID`,`IZAPMKZ_ID`)VALUES('D0000000003','603','D0000000001','I0000000001');
+INSERT INTO t1(`IZAVORGANG_ID`,`KUERZEL`,`IZAANALYSEART_ID`,`IZAPMKZ_ID`)VALUES('D0000000004','101','D0000000001','I0000000001');
+SELECT `IZAVORGANG_ID` FROM t1 WHERE `KUERZEL` IN(SELECT MIN(`KUERZEL`)`Feld1` FROM t1 WHERE `KUERZEL` LIKE'601%'And`IZAANALYSEART_ID`='D0000000001');
+drop table t1;
+
+#
+# Optimized IN with compound index
+#
+CREATE TABLE `t1` ( `aid` int(11) NOT NULL default '0', `bid` int(11) NOT NULL default '0', PRIMARY KEY (`aid`,`bid`));
+CREATE TABLE `t2` ( `aid` int(11) NOT NULL default '0', `bid` int(11) NOT NULL default '0', PRIMARY KEY (`aid`,`bid`));
+insert into t1 values (1,1),(1,2),(2,1),(2,2);
+insert into t2 values (1,2),(2,2);
+select * from t1 where t1.aid not in (select aid from t2 where bid=t1.bid);
+alter table t2 drop primary key;
+alter table t2 add key KEY1 (aid, bid);
+select * from t1 where t1.aid not in (select aid from t2 where bid=t1.bid);
+alter table t2 drop key KEY1;
+alter table t2 add primary key (bid, aid);
+select * from t1 where t1.aid not in (select aid from t2 where bid=t1.bid);
+drop table t1,t2;
+
+#
+# resolving fields of grouped outer SELECT
+#
+CREATE TABLE t1 (howmanyvalues bigint, avalue int);
+INSERT INTO t1 VALUES (1, 1),(2, 1),(2, 2),(3, 1),(3, 2),(3, 3),(4, 1),(4, 2),(4, 3),(4, 4);
+SELECT howmanyvalues, count(*) from t1 group by howmanyvalues;
+SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues = a.howmanyvalues) as mycount from t1 a group by a.howmanyvalues;
+CREATE INDEX t1_howmanyvalues_idx ON t1 (howmanyvalues);
+SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues+1 = a.howmanyvalues+1) as mycount from t1 a group by a.howmanyvalues;
+SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues = a.howmanyvalues) as mycount from t1 a group by a.howmanyvalues;
+SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues = a.avalue) as mycount from t1 a group by a.howmanyvalues;
+drop table t1;
+
+create table t1 (x int);
+select (select b.x from t1 as b where b.x=a.x) from t1 as a where a.x=2 group by a.x;
+drop table t1;
+
+#
+# Test of correct maybe_null flag returning by subquwery for temporary table
+# creation
+#
+CREATE TABLE `t1` ( `master` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `slave` int(10) unsigned NOT NULL default '0', `access` int(10) unsigned NOT NULL default '0', UNIQUE KEY `access_u` (`master`,`map`,`slave`));
+INSERT INTO `t1` VALUES (1,0,0,700),(1,1,1,400),(1,5,5,400),(1,12,12,400),(1,12,32,400),(4,12,32,400);
+CREATE TABLE `t2` ( `id` int(10) unsigned NOT NULL default '0', `pid` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `level` tinyint(4) unsigned NOT NULL default '0', `title` varchar(255) default NULL, PRIMARY KEY (`id`,`pid`,`map`), KEY `level` (`level`), KEY `id` (`id`,`map`)) ;
+INSERT INTO `t2` VALUES (6,5,12,7,'a'),(12,0,0,7,'a'),(12,1,0,7,'a'),(12,5,5,7,'a'),(12,5,12,7,'a');
+-- error 1054
+SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
+SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
+drop tables t1,t2;
+
+#
+# Test for bug #6462. "Same request on same data returns different
+# results." a.k.a. "Proper cleanup of subqueries is missing for
+# SET and DO statements".
+#
+create table t1 (a int not null, b int not null, c int, primary key (a,b));
+insert into t1 values (1,1,1), (2,2,2), (3,3,3);
+set @b:= 0;
+# Let us check that subquery will use covering index
+explain select sum(a) from t1 where b > @b;
+# This should not crash -debug server due to failing assertion
+set @a:= (select sum(a) from t1 where b > @b);
+# And this should not falsely report index usage
+explain select a from t1 where c=2;
+# Same for DO statement
+do @a:= (select sum(a) from t1 where b > @b);
+explain select a from t1 where c=2;
+drop table t1;
+
+#
+# Subselect in non-select command just after connection
+#
+connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
+connection root;
+set @got_val= (SELECT 1 FROM (SELECT 'A' as my_col) as T1 ) ;
+
+#
+# primary query with temporary table and subquery with groupping
+#
+create table t1 (a int, b int);
+create table t2 (a int, b int);
+insert into t1 values (1,1),(1,2),(1,3),(2,4),(2,5);
+insert into t2 values (1,3),(2,1);
+select distinct a,b, (select max(b) from t2 where t1.b=t2.a) from t1 order by t1.b;
+drop table t1, t2;
+
+#
+# subqueries with full text search
+#
+create table t1 (id int);
+create table t2 (id int, body text, fulltext (body));
+insert into t1 values(1),(2),(3);
+insert into t2 values (1,'test'), (2,'mysql'), (3,'test'), (4,'test');
+select count(distinct id) from t1 where id in (select id from t2 where match(body) against ('mysql' in boolean mode));
+drop table t2,t1;
+
+#
+# Equal operation under row and empty subquery
+#
+create table t1 (s1 int,s2 int);
+insert into t1 values (20,15);
+select * from t1 where (('a',null) <=> (select 'a',s2 from t1 where s1 = 0));
+drop table t1;
+
+#
+# ALL/ANY with NULL
+#
+create table t1 (s1 int);
+insert into t1 values (1),(null);
+select * from t1 where s1 < all (select s1 from t1);
+select s1, s1 < all (select s1 from t1) from t1;
+drop table t1;
+
+#
+# reference on changable fields from subquery
+#
+CREATE TABLE t1 (
+ Code char(3) NOT NULL default '',
+ Name char(52) NOT NULL default '',
+ Continent enum('Asia','Europe','North America','Africa','Oceania','Antarctica','South America') NOT NULL default 'Asia',
+ Region char(26) NOT NULL default '',
+ SurfaceArea float(10,2) NOT NULL default '0.00',
+ IndepYear smallint(6) default NULL,
+ Population int(11) NOT NULL default '0',
+ LifeExpectancy float(3,1) default NULL,
+ GNP float(10,2) default NULL,
+ GNPOld float(10,2) default NULL,
+ LocalName char(45) NOT NULL default '',
+ GovernmentForm char(45) NOT NULL default '',
+ HeadOfState char(60) default NULL,
+ Capital int(11) default NULL,
+ Code2 char(2) NOT NULL default ''
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('XXX','Xxxxx','Oceania','Xxxxxx',26.00,0,0,0,0,0,'Xxxxx','Xxxxx','Xxxxx',NULL,'XX');
+INSERT INTO t1 VALUES ('ASM','American Samoa','Oceania','Polynesia',199.00,0,68000,75.1,334.00,NULL,'Amerika Samoa','US Territory','George W. Bush',54,'AS');
+INSERT INTO t1 VALUES ('ATF','French Southern territories','Antarctica','Antarctica',7780.00,0,0,NULL,0.00,NULL,'Terres australes françaises','Nonmetropolitan Territory of France','Jacques Chirac',NULL,'TF');
+INSERT INTO t1 VALUES ('UMI','United States Minor Outlying Islands','Oceania','Micronesia/Caribbean',16.00,0,0,NULL,0.00,NULL,'United States Minor Outlying Islands','Dependent Territory of the US','George W. Bush',NULL,'UM');
+/*!40000 ALTER TABLE t1 ENABLE KEYS */;
+SELECT DISTINCT Continent AS c FROM t1 WHERE Code <> SOME ( SELECT Code FROM t1 WHERE Continent = c AND Population < 200);
+drop table t1;
diff --git a/mysql-test/t/subselect2.test b/mysql-test/t/subselect2.test
new file mode 100644
index 00000000000..2d42320334a
--- /dev/null
+++ b/mysql-test/t/subselect2.test
@@ -0,0 +1,149 @@
+-- source include/have_innodb.inc
+
+#
+# test of big query with a lot of IN subqueries.
+#
+
+--disable_warnings
+drop table if exists t1, t2, t3, t4;
+--enable_warnings
+
+CREATE TABLE t1
+(
+DOCID VARCHAR(32)BINARY NOT NULL
+, UUID VARCHAR(32)BINARY NOT NULL
+, MIMETYPE VARCHAR(80)BINARY
+, CONTENTDATA LONGBLOB
+, CONTENTSIZE INTEGER
+, VERSIONID INTEGER
+, REPID VARCHAR(32)BINARY
+, MODIFIED TIMESTAMP
+, MODIFIER VARCHAR(255)BINARY
+, ORIGINATOR INTEGER
+
+, PRIMARY KEY ( DOCID )
+) ENGINE=InnoDB
+;
+
+CREATE TABLE t2
+(
+DOCID VARCHAR(32)BINARY NOT NULL
+, DOCNAME VARCHAR(255)BINARY NOT NULL
+, DOCTYPEID VARCHAR(32)BINARY NOT NULL
+, FOLDERID VARCHAR(32)BINARY NOT NULL
+, AUTHOR VARCHAR(255)BINARY
+, CREATED TIMESTAMP NOT NULL
+, TITLE VARCHAR(255)BINARY
+, SUBTITLE VARCHAR(255)BINARY
+, DOCABSTRACT LONGBLOB
+, PUBLISHDATE TIMESTAMP
+, EXPIRATIONDATE TIMESTAMP
+, LOCKEDBY VARCHAR(80)BINARY
+, STATUS VARCHAR(80)BINARY
+, PARENTDOCID VARCHAR(32)BINARY
+, REPID VARCHAR(32)BINARY
+, MODIFIED TIMESTAMP NOT NULL
+, MODIFIER VARCHAR(255)BINARY NOT NULL
+, PUBLISHSTATUS INTEGER
+, ORIGINATOR INTEGER
+
+, PRIMARY KEY ( DOCID )
+) ENGINE=InnoDB
+;
+CREATE INDEX DDOCTYPEID_IDX ON t2 (DOCTYPEID);
+CREATE INDEX DFOLDERID_IDX ON t2 (FOLDERID);
+CREATE TABLE t3
+(
+FOLDERID VARCHAR(32)BINARY NOT NULL
+, FOLDERNAME VARCHAR(255)BINARY NOT NULL
+, CREATOR VARCHAR(255)BINARY
+, CREATED TIMESTAMP NOT NULL
+, DESCRIPTION VARCHAR(255)BINARY
+, FOLDERTYPE INTEGER NOT NULL
+, MODIFIED TIMESTAMP
+, MODIFIER VARCHAR(255)BINARY
+, FOLDERSIZE INTEGER NOT NULL
+, PARENTID VARCHAR(32)BINARY
+, REPID VARCHAR(32)BINARY
+, ORIGINATOR INTEGER
+
+, PRIMARY KEY ( FOLDERID )
+) ENGINE=InnoDB;
+
+CREATE INDEX FFOLDERID_IDX ON t3 (FOLDERID);
+CREATE INDEX CMFLDRPARNT_IDX ON t3 (PARENTID);
+
+CREATE TABLE t4
+(
+DOCTYPEID VARCHAR(32)BINARY NOT NULL
+, DOCTYPENAME VARCHAR(80)BINARY NOT NULL
+, DESCRIPTION VARCHAR(255)BINARY
+, EXTNDATA LONGBLOB
+, MODIFIED TIMESTAMP
+, MODIFIER VARCHAR(255)BINARY
+, ORIGINATOR INTEGER
+
+, PRIMARY KEY ( DOCTYPEID )
+) ENGINE=InnoDB;
+
+INSERT INTO t2 VALUES("c373e9f59cf15a6c3e57444553544200", "c373e9f59cf15a6c3e57444553544200", "340d243d45f111d497b00010a4ef934d", "2f6161e879db43c1a5b82c21ddc49089", NULL, "2003-06-06 07:48:42", NULL, NULL, NULL, "2003-06-06 07:48:42", "2003-06-06 07:48:42", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-06 07:48:42", "admin", "0", NULL);
+
+INSERT INTO t2 VALUES("c373e9f5a472f43ba45e444553544200", "c373e9f5a472f43ba45e444553544200", "340d243d45f111d497b00010a4ef934d", "2f6161e879db43c1a5b82c21ddc49089", NULL, "2003-06-07 18:50:12", NULL, NULL, NULL, "2003-06-07 18:50:12", "2003-06-07 18:50:12", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-07 18:50:12", "admin", "0", NULL);
+
+
+INSERT INTO t2 VALUES("c373e9f5a4a0f56014eb444553544200", "c373e9f5a4a0f56014eb444553544200", "340d243d45f111d497b00010a4ef934d", "2f6161e879db43c1a5b82c21ddc49089", NULL, "2003-06-07 19:39:26", NULL, NULL, NULL, "2003-06-07 19:39:26", "2003-06-07 19:39:26", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-07 19:39:26", "admin", "0", NULL);
+INSERT INTO t2 VALUES("c373e9f5a4a0f8fa4a86444553544200", "c373e9f5a4a0f8fa4a86444553544200", "340d243d45f111d497b00010a4ef934d", "2f6161e879db43c1a5b82c21ddc49089", NULL, "2003-06-07 19:43:05", NULL, NULL, NULL, "2003-06-07 19:43:05", "2003-06-07 19:43:05", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-07 19:43:05", "admin", "0", NULL);
+INSERT INTO t2 VALUES("c373e9f5ac7b537205ce444553544200", "c373e9f5ac7b537205ce444553544200", "340d243d45f111d497b00010a4ef934d", "2f6161e879db43c1a5b82c21ddc49089", NULL, "2003-06-09 08:15:24", NULL, NULL, NULL, "2003-06-09 08:15:24", "2003-06-09 08:15:24", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-09 08:15:24", "admin", "0", NULL);
+INSERT INTO t2 VALUES("c373e9f5ad0792012454444553544200", "c373e9f5ad0792012454444553544200", "340d243d45f111d497b00010a4ef934d", "2f6161e879db43c1a5b82c21ddc49089", NULL, "2003-06-09 10:51:44", NULL, NULL, NULL, "2003-06-09 10:51:44", "2003-06-09 10:51:44", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-09 10:51:44", "admin", "0", NULL);
+INSERT INTO t2 VALUES("c373e9f5ad079821ef34444553544200", "First Discussion", "c373e9f5ad079174ff17444553544200", "c373e9f5ad0796c0eca4444553544200", "Goldilocks", "2003-06-09 11:16:50", "Title: First Discussion", NULL, NULL, "2003-06-09 10:51:26", "2003-06-09 10:51:26", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-09 11:16:50", "admin", "0", NULL);
+INSERT INTO t2 VALUES("c373e9f5ad07993f3859444553544200", "Last Discussion", "c373e9f5ad079174ff17444553544200", "c373e9f5ad0796c0eca4444553544200", "Goldilocks", "2003-06-09 11:21:06", "Title: Last Discussion", NULL, "Setting new abstract and keeping doc checked out", "2003-06-09 10:51:26", "2003-06-09 10:51:26", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-09 11:21:06", "admin", "0", NULL);
+INSERT INTO t2 VALUES("c373e9f5ad079a3219c4444553544200", "testdoclayout", "340d243c45f111d497b00010a4ef934d", "c373e9f5ad0796c0eca4444553544200", "Goldilocks", "2003-06-09 11:25:31", "Title: Test doc layout", "Subtitle: test doc layout", NULL, "2003-06-09 10:51:27", "2003-06-09 10:51:27", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-09 11:25:31", "admin", "0", NULL);
+
+
+
+INSERT INTO t3 VALUES("0c9aab05b15048c59bc35c8461507deb", "System", "System", "2003-06-05 16:30:00", "The system content repository folder.", "3", "2003-06-05 16:30:00", "System", "0", NULL, "9c9aab05b15048c59bc35c8461507deb", "1");
+INSERT INTO t3 VALUES("2f6161e879db43c1a5b82c21ddc49089", "Default", "System", "2003-06-09 10:52:02", "The default content repository folder.", "3", "2003-06-05 16:30:00", "System", "0", NULL, "03eea05112b845949f3fd03278b5fe43", "1");
+INSERT INTO t3 VALUES("c373e9f5ad0791724315444553544200", "AddDocumentTest", "admin", "2003-06-09 10:51:25", "Movie Reviews", "0", "2003-06-09 10:51:25", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad07919e1963444553544200", "NewDestDirectory", "admin", "2003-06-09 10:51:28", "Adding new directory", "128", "2003-06-09 10:51:28", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad07919fe525444553544200", "SubDestDirectory", "admin", "2003-06-09 10:51:28", "Adding new directory", "128", "2003-06-09 10:51:28", "admin", "0", "c373e9f5ad07919e1963444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0791a0dab5444553544200", "Level1", "admin", "2003-06-09 10:51:29", NULL, "0", "2003-06-09 10:51:29", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0791a14669444553544200", "Level2", "admin", "2003-06-09 10:51:29", NULL, "0", "2003-06-09 10:51:29", "admin", "0", "c373e9f5ad0791a0dab5444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0791a23c0e444553544200", "Level3", "admin", "2003-06-09 10:51:29", NULL, "0", "2003-06-09 10:51:29", "admin", "0", "c373e9f5ad0791a14669444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0791a6b11f444553544200", "Dir1", "admin", "2003-06-09 10:51:30", NULL, "0", "2003-06-09 10:51:30", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0791a897d6444553544200", "Dir2", "admin", "2003-06-09 10:51:30", NULL, "0", "2003-06-09 10:51:30", "admin", "0", "c373e9f5ad0791a6b11f444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0791a9a063444553544200", "NewDestDirectory", "admin", "2003-06-09 10:51:31", NULL, "0", "2003-06-09 10:51:31", "admin", "0", "c373e9f5ad0791a897d6444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0791aa73e3444553544200", "LevelA", "admin", "2003-06-09 10:51:31", NULL, "0", "2003-06-09 10:51:31", "admin", "0", "c373e9f5ad0791a0dab5444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0791ab034b444553544200", "LevelB", "admin", "2003-06-09 10:51:31", NULL, "0", "2003-06-09 10:51:31", "admin", "0", "c373e9f5ad0791aa73e3444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0791ac7311444553544200", "LevelC", "admin", "2003-06-09 10:51:32", NULL, "0", "2003-06-09 10:51:32", "admin", "0", "c373e9f5ad0791ab034b444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0791ad66cf444553544200", "test2", "admin", "2003-06-09 10:51:32", NULL, "0", "2003-06-09 10:51:32", "admin", "0", "c373e9f5ad0791724315444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0791aebd87444553544200", "test3", "admin", "2003-06-09 10:51:33", NULL, "0", "2003-06-09 10:51:33", "admin", "0", "c373e9f5ad0791ad66cf444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0791dbaac4444553544200", "Special Café Folder", "admin", "2003-06-09 10:51:43", "test folder names with special chars", "0", "2003-06-09 10:51:43", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0796bf913f444553544200", "CopiedFolder", "admin", "2003-06-09 11:09:05", "Movie Reviews", "0", "2003-06-09 11:09:05", "admin", "0", "c373e9f5ad0791a23c0e444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0796c0eca4444553544200", "Movie Reviews", "admin", "2003-06-09 11:09:13", "Movie Reviews", "0", "2003-06-09 11:09:13", "admin", "33", "c373e9f5ad0796bf913f444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad0796d9b895444553544200", "NewBookFolder", "admin", "2003-06-09 11:12:41", "NewBooks - folder", "0", "2003-06-09 11:12:41", "admin", "0", "c373e9f5ad0796c0eca4444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
+INSERT INTO t3 VALUES("c373e9f5ad079b4c9355444553544200", "CopiedFolder", "admin", "2003-06-09 11:26:34", "Movie Reviews", "0", "2003-06-09 11:26:34", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL);
+
+
+INSERT INTO t4 VALUES("340d243c45f111d497b00010a4ef934d", "Document Layout", "The system Document Layouts Document Type", NULL, "2003-06-05 16:30:00", "System", "1");
+INSERT INTO t4 VALUES("340d243d45f111d497b00010a4ef934d", "Default", "The default system Document Type", NULL, "2003-06-05 16:30:00", "System", "1");
+INSERT INTO t4 VALUES("4d09dd60850711d4998a204c4f4f5020", "__SystemResourceType", "The type for all the uploaded resources", NULL, "2003-06-05 16:30:00", "System", "1");
+INSERT INTO t4 VALUES("91d4d595478211d497b40010a4ef934d", "__PmcSystemDefaultType", "The type for all the default available fields", NULL, "2003-06-05 16:30:00", "System", "1");
+INSERT INTO t4 VALUES("c373e9f59cf15a59b08a444553544200", "NoFieldDocType", "plain doc type", NULL, "2003-06-06 07:48:40", "admin", NULL);
+INSERT INTO t4 VALUES("c373e9f59cf15a5c6a99444553544200", "Movie Review", "This doc type is for movie reviews", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<props autocheckin=\"false\" autopublish=\"false\" binary=\"choice\" categories=\"none\" cleanup=\"false\" folder=\"none\"><![CDATA[Doc type for cm tests]]></props>\r\n", "2003-06-06 07:48:40", "admin", NULL);
+INSERT INTO t4 VALUES("c373e9f59cf15a6116a5444553544200", "Special DocÃu20A4u20A4u0113ééøÉu016BType", "test special chars xxxé in doc type", NULL, "2003-06-06 07:48:41", "admin", NULL);
+INSERT INTO t4 VALUES("c373e9f59cf15a695d47444553544200", "Movie", NULL, NULL, "2003-06-06 07:48:41", "admin", NULL);
+INSERT INTO t4 VALUES("c373e9f5ad079174ff17444553544200", "Discussion", NULL, NULL, "2003-06-09 10:51:25", "admin", NULL);
+INSERT INTO t4 VALUES("c373e9f5ad0791da7e2b444553544200", "Books", "list of recommended books", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<props autocheckin=\"false\" autopublish=\"false\" binary=\"choice\" categories=\"none\" cleanup=\"false\" folder=\"none\"><![CDATA[Doc type for cm tests]]><![CDATA[Doc type for book tests]]></props>\r\n", "2003-06-09 10:51:40", "admin", NULL);
+
+ALTER TABLE t2 ADD FOREIGN KEY FK_DCMNTS_DCTYPES ( DOCTYPEID)
+ REFERENCES t4 (DOCTYPEID );
+ALTER TABLE t2 ADD FOREIGN KEY FK_DCMNTS_FLDRS ( FOLDERID)
+ REFERENCES t3 (FOLDERID );
+ALTER TABLE t3 ADD FOREIGN KEY FK_FLDRS_PRNTID ( PARENTID)
+ REFERENCES t3 (FOLDERID );
+
+SELECT t2.*, t4.DOCTYPENAME, t1.CONTENTSIZE,t1.MIMETYPE FROM t2 INNER JOIN t4 ON t2.DOCTYPEID = t4.DOCTYPEID LEFT OUTER JOIN t1 ON t2.DOCID = t1.DOCID WHERE t2.FOLDERID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t3.FOLDERNAME = 'Level1') AND t3.FOLDERNAME = 'Level2') AND t3.FOLDERNAME = 'Level3') AND t3.FOLDERNAME = 'CopiedFolder') AND t3.FOLDERNAME = 'Movie Reviews') AND t2.DOCNAME = 'Last Discussion';
+
+EXPLAIN SELECT t2.*, t4.DOCTYPENAME, t1.CONTENTSIZE,t1.MIMETYPE FROM t2 INNER JOIN t4 ON t2.DOCTYPEID = t4.DOCTYPEID LEFT OUTER JOIN t1 ON t2.DOCID = t1.DOCID WHERE t2.FOLDERID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t3.FOLDERNAME = 'Level1') AND t3.FOLDERNAME = 'Level2') AND t3.FOLDERNAME = 'Level3') AND t3.FOLDERNAME = 'CopiedFolder') AND t3.FOLDERNAME = 'Movie Reviews') AND t2.DOCNAME = 'Last Discussion';
+
+drop table t1, t2, t3, t4; \ No newline at end of file
diff --git a/mysql-test/t/subselect_gis.test b/mysql-test/t/subselect_gis.test
new file mode 100644
index 00000000000..338051029c4
--- /dev/null
+++ b/mysql-test/t/subselect_gis.test
@@ -0,0 +1,15 @@
+-- source include/have_geometry.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# correct behavoiur for function from reduced subselect
+#
+create table t1(City VARCHAR(30),Location geometry);
+insert into t1 values("Paris",GeomFromText('POINT(2.33 48.87)'));
+select City from t1 where (select
+intersects(GeomFromText(AsText(Location)),GeomFromText('Polygon((2 50, 2.5
+50, 2.5 47, 2 47, 2 50))'))=0);
+drop table t1;
diff --git a/mysql-test/t/subselect_innodb.test b/mysql-test/t/subselect_innodb.test
new file mode 100644
index 00000000000..aa7fe138876
--- /dev/null
+++ b/mysql-test/t/subselect_innodb.test
@@ -0,0 +1,147 @@
+-- source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists t1,t2,t3;
+--enable_warnings
+
+#
+# key field overflow test
+#
+CREATE TABLE t1
+(
+FOLDERID VARCHAR(32)BINARY NOT NULL
+, FOLDERNAME VARCHAR(255)BINARY NOT NULL
+, CREATOR VARCHAR(255)BINARY
+, CREATED TIMESTAMP NOT NULL
+, DESCRIPTION VARCHAR(255)BINARY
+, FOLDERTYPE INTEGER NOT NULL
+, MODIFIED TIMESTAMP
+, MODIFIER VARCHAR(255)BINARY
+, FOLDERSIZE INTEGER NOT NULL
+, PARENTID VARCHAR(32)BINARY
+, REPID VARCHAR(32)BINARY
+, ORIGINATOR INTEGER
+
+, PRIMARY KEY ( FOLDERID )
+) ENGINE=InnoDB;
+CREATE INDEX FFOLDERID_IDX ON t1 (FOLDERID);
+CREATE INDEX CMFLDRPARNT_IDX ON t1 (PARENTID);
+INSERT INTO t1 VALUES("0c9aab05b15048c59bc35c8461507deb", "System", "System", "2003-06-05 16:30:00", "The system content repository folder.", "3", "2003-06-05 16:30:00", "System", "0", NULL, "9c9aab05b15048c59bc35c8461507deb", "1");
+INSERT INTO t1 VALUES("2f6161e879db43c1a5b82c21ddc49089", "Default", "System", "2003-06-09 10:52:02", "The default content repository folder.", "3", "2003-06-05 16:30:00", "System", "0", NULL, "03eea05112b845949f3fd03278b5fe43", "1");
+INSERT INTO t1 VALUES("c373e9f5ad0791724315444553544200", "AddDocumentTest", "admin", "2003-06-09 10:51:25", "Movie Reviews", "0", "2003-06-09 10:51:25", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL);
+SELECT 'c373e9f5ad0791a0dab5444553544200' IN(SELECT t1.FOLDERID FROM t1 WHERE t1.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t1.FOLDERNAME = 'Level1');
+drop table t1;
+
+#
+# UNION unlocking test
+#
+create table t1 (a int) engine=innodb;
+create table t2 (a int) engine=innodb;
+create table t3 (a int) engine=innodb;
+insert into t1 values (1),(2),(3),(4);
+insert into t2 values (10),(20),(30),(40);
+insert into t3 values (1),(2),(10),(50);
+select a from t3 where t3.a in (select a from t1 where a <= 3 union select * from t2 where a <= 30);
+drop table t1,t2,t3;
+
+
+CREATE TABLE t1 (
+ processor_id INTEGER NOT NULL,
+ PRIMARY KEY (processor_id)
+) ENGINE=InnoDB;
+CREATE TABLE t3 (
+ yod_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL,
+ login_processor INTEGER UNSIGNED ,
+ PRIMARY KEY (yod_id)
+) ENGINE=InnoDB;
+CREATE TABLE t2 (
+ processor_id INTEGER NOT NULL,
+ yod_id BIGINT UNSIGNED NOT NULL,
+ PRIMARY KEY (processor_id, yod_id),
+ INDEX (processor_id),
+ INDEX (yod_id),
+ FOREIGN KEY (processor_id) REFERENCES t1(processor_id),
+ FOREIGN KEY (yod_id) REFERENCES t3(yod_id)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2),(3);
+INSERT INTO t3 VALUES (1,1),(2,2),(3,3);
+INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
+SELECT distinct p1.processor_id, (SELECT y.yod_id FROM t1 p2, t2 y WHERE p2.processor_id = p1.processor_id and p2.processor_id = y.processor_id) FROM t1 p1;
+drop table t2,t1,t3;
+
+#
+# innodb locking
+#
+CREATE TABLE t1 (
+ id int(11) NOT NULL default '0',
+ b int(11) default NULL,
+ c char(3) default NULL,
+ PRIMARY KEY (id),
+ KEY t2i1 (b)
+) ENGINE=innodb DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES (0,0,'GPL'),(1,0,'GPL'),(2,1,'GPL'),(3,2,'GPL');
+CREATE TABLE t2 (
+ id int(11) NOT NULL default '0',
+ b int(11) default NULL,
+ c char(3) default NULL,
+ PRIMARY KEY (id),
+ KEY t2i (b)
+) ENGINE=innodb DEFAULT CHARSET=latin1;
+INSERT INTO t2 VALUES (0,0,'GPL'),(1,0,'GPL'),(2,1,'GPL'),(3,2,'GPL');
+select (select max(id) from t2 where b=1 group by b) as x,b from t1 where b=1;
+drop table t1,t2;
+
+#
+# reiniting innodb tables
+#
+create table t1 (id int not null, value char(255), primary key(id)) engine=innodb;
+create table t2 (id int not null, value char(255)) engine=innodb;
+insert into t1 values (1,'a'),(2,'b');
+insert into t2 values (1,'z'),(2,'x');
+select t2.id,t2.value,(select t1.value from t1 where t1.id=t2.id) from t2;
+select t2.id,t2.value,(select t1.value from t1 where t1.id=t2.id) from t2;
+drop table t1,t2;
+
+#
+# unlocking tables with subqueries in HAVING
+#
+create table t1 (a int, b int) engine=innodb;
+insert into t1 values (1,2), (1,3), (2,3), (2,4), (2,5), (3,4), (4,5), (4,100);
+create table t2 (a int) engine=innodb;
+insert into t2 values (1),(2),(3),(4);
+select a, sum(b) as b from t1 group by a having b > (select max(a) from t2);
+drop table t1, t2;
+
+#
+# bug #5220 test suite
+#
+CREATE TABLE `t1` ( `unit` varchar(50) NOT NULL default '', `ingredient` varchar(50) NOT NULL default '') ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE `t2` ( `ingredient` varchar(50) NOT NULL default '', `unit` varchar(50) NOT NULL default '', PRIMARY KEY (ingredient, unit)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+INSERT INTO `t1` VALUES ('xx','yy');
+INSERT INTO `t2` VALUES ('yy','xx');
+
+SELECT R.unit, R.ingredient FROM t1 R WHERE R.ingredient IN (SELECT N.ingredient FROM t2 N WHERE N.unit = R.unit);
+
+drop table t1, t2;
+
+#
+# possible early unlock
+#
+CREATE TABLE t1 (
+ id INT NOT NULL auto_increment,
+ date1 DATE, coworkerid INT,
+ description VARCHAR(255),
+ sum_used DOUBLE,
+ sum_remaining DOUBLE,
+ comments VARCHAR(255),
+ PRIMARY KEY(id)
+) engine=innodb;
+insert into t1 values (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1998-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1998-01-01', 1,'test', 22, 33, 'comment'), (NULL, '2004-01-01', 1,'test', 22, 33, 'comment'), (NULL, '2004-01-01', 1,'test', 22, 33, 'comment');
+SELECT DISTINCT
+ (SELECT sum(sum_used) FROM t1 WHERE sum_used > 0 AND year(date1) <= '2004') as somallontvangsten,
+ (SELECT sum(sum_used) FROM t1 WHERE sum_used < 0 AND year(date1) <= '2004') as somalluitgaven
+ FROM t1;
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test
index 7a42a60054e..78c9b68fde5 100644
--- a/mysql-test/t/symlink.test
+++ b/mysql-test/t/symlink.test
@@ -3,12 +3,15 @@ disable_query_log;
show variables like "have_symlink";
enable_query_log;
+--disable_warnings
drop table if exists t1,t2,t7,t8,t9;
drop database if exists mysqltest;
+--enable_warnings
#
# First create little data to play with
#
+
create table t1 (a int not null auto_increment, b char(16) not null, primary key (a));
create table t2 (a int not null auto_increment, b char(16) not null, primary key (a));
insert into t1 (b) values ("test"),("test1"),("test2"),("test3");
@@ -38,7 +41,7 @@ drop table t2;
#
disable_query_log;
-eval create table t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="$MYSQL_TEST_DIR/var/tmp" index directory="$MYSQL_TEST_DIR/var/run";
+eval create table t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="$MYSQL_TEST_DIR/var/tmp" index directory="$MYSQL_TEST_DIR/var/run";
enable_query_log;
insert into t9 select * from t1;
@@ -63,23 +66,23 @@ drop table t1;
disable_query_log;
--error 1103,1103
-create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="tmp";
+create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="tmp";
# Check that we cannot link over a table from another database.
create database mysqltest;
--error 1,1
-create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="/this-dir-does-not-exist";
+create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="/this-dir-does-not-exist";
--error 1103,1103
-create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="not-hard-path";
+create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="not-hard-path";
--error 1,1
-eval create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="$MYSQL_TEST_DIR/var/run";
+eval create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="$MYSQL_TEST_DIR/var/run";
--error 1,1
-eval create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="$MYSQL_TEST_DIR/var/tmp";
+eval create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="$MYSQL_TEST_DIR/var/tmp";
enable_query_log;
# Check moving table t9 from default database to mysqltest;
@@ -95,7 +98,7 @@ drop database mysqltest;
# Test changing data dir (Bug #1662)
#
-create table t1 (a int not null) type=myisam;
+create table t1 (a int not null) engine=myisam;
disable_query_log;
eval alter table t1 data directory="$MYSQL_TEST_DIR/var/tmp";
enable_query_log;
diff --git a/mysql-test/t/synchronization.test b/mysql-test/t/synchronization.test
new file mode 100644
index 00000000000..7bdeaa8a740
--- /dev/null
+++ b/mysql-test/t/synchronization.test
@@ -0,0 +1,33 @@
+#
+# Test for Bug #2385 CREATE TABLE LIKE lacks locking on source and destination table
+#
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+
+# locking of source:
+
+CREATE TABLE t1 (x1 int);
+let $1= 10;
+while ($1)
+{
+ connection con1;
+ send ALTER TABLE t1 CHANGE x1 x2 int;
+ connection con2;
+ CREATE TABLE t2 LIKE t1;
+ replace_result x1 xx x2 xx;
+ SHOW CREATE TABLE t2;
+ DROP TABLE t2;
+ connection con1;
+ reap;
+ send ALTER TABLE t1 CHANGE x2 x1 int;
+ connection con2;
+ CREATE TABLE t2 LIKE t1;
+ replace_result x1 xx x2 xx;
+ SHOW CREATE TABLE t2;
+ DROP TABLE t2;
+ connection con1;
+ reap;
+ dec $1;
+}
+DROP TABLE t1;
diff --git a/mysql-test/t/system_mysql_db.test b/mysql-test/t/system_mysql_db.test
index 85a2f7f9bae..a6d683489c3 100644
--- a/mysql-test/t/system_mysql_db.test
+++ b/mysql-test/t/system_mysql_db.test
@@ -6,3 +6,8 @@
use mysql;
-- enable_query_log
-- source include/system_db_struct.inc
+-- disable_query_log
+use test;
+-- enable_query_log
+# keep results same with system_mysql_db_fix
+show tables;
diff --git a/mysql-test/t/system_mysql_db_fix.test b/mysql-test/t/system_mysql_db_fix.test
index 0acc7ea073d..1539d210a3a 100644
--- a/mysql-test/t/system_mysql_db_fix.test
+++ b/mysql-test/t/system_mysql_db_fix.test
@@ -9,6 +9,7 @@ use test;
# create system tables as in mysql-3.20
+--disable_warnings
CREATE TABLE db (
Host char(60) binary DEFAULT '' NOT NULL,
Db char(32) binary DEFAULT '' NOT NULL,
@@ -23,10 +24,12 @@ CREATE TABLE db (
KEY User (User)
)
type=ISAM;
+--enable-warnings
INSERT INTO db VALUES ('%','test', '','Y','Y','Y','Y','Y','Y');
INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y');
+--disable_warnings
CREATE TABLE host (
Host char(60) binary DEFAULT '' NOT NULL,
Db char(32) binary DEFAULT '' NOT NULL,
@@ -39,7 +42,9 @@ CREATE TABLE host (
PRIMARY KEY Host (Host,Db)
)
type=ISAM;
+--enable-warnings
+--disable_warnings
CREATE TABLE user (
Host char(60) binary DEFAULT '' NOT NULL,
User char(16) binary DEFAULT '' NOT NULL,
@@ -56,6 +61,7 @@ CREATE TABLE user (
PRIMARY KEY Host (Host,User)
)
type=ISAM;
+--enable-warnings
INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y');
INSERT INTO user VALUES ('localhost','', '','N','N','N','N','N','N','N','N','N');
@@ -68,11 +74,9 @@ INSERT INTO user VALUES ('localhost','', '','N','N','N','N','N','N','N','N','
-- disable_query_log
-DROP TABLE db;
-DROP TABLE host;
-DROP TABLE user;
-DROP TABLE func;
-DROP TABLE tables_priv;
-DROP TABLE columns_priv;
+DROP TABLE db, host, user, func, tables_priv, columns_priv, help_category, help_keyword, help_relation, help_topic, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type;
-- enable_query_log
+
+# check that we droped all system tables
+show tables;
diff --git a/mysql-test/t/system_mysql_db_refs.test b/mysql-test/t/system_mysql_db_refs.test
index b68503a6aa5..9e2c5a20b54 100644
--- a/mysql-test/t/system_mysql_db_refs.test
+++ b/mysql-test/t/system_mysql_db_refs.test
@@ -10,27 +10,39 @@ set @name="This is a very long string, that mustn't find room in a system field
create table test_db select * from mysql.db;
delete from test_db;
+--disable_warnings
insert into test_db (Host,Db,User) values (@name,@name,@name);
+--enable_warnings
create table test_host select * from mysql.host;
delete from test_host;
+--disable_warnings
insert into test_host (Host,Db) values (@name,@name);
+--enable_warnings
create table test_user select * from mysql.user;
delete from test_user;
+--disable_warnings
insert into test_user (Host,User) values (@name,@name);
+--enable_warnings
create table test_func select * from mysql.func;
delete from test_func;
+--disable_warnings
insert into test_func (name) values (@name);
+--enable_warnings
create table test_tables_priv select * from mysql.tables_priv;
delete from test_tables_priv;
+--disable_warnings
insert into test_tables_priv (Host,Db,User,Table_name) values (@name,@name,@name,@name);
+--enable_warnings
create table test_columns_priv select * from mysql.columns_priv;
delete from test_columns_priv;
+--disable_warnings
insert into test_columns_priv (Host,Db,User,Table_name,Column_name) values (@name,@name,@name,@name,@name);
+--enable_warnings
# 'Host' field must be the same for all the tables:
diff --git a/mysql-test/t/tablelock.test b/mysql-test/t/tablelock.test
index fa8c4f03675..fbc5d685096 100644
--- a/mysql-test/t/tablelock.test
+++ b/mysql-test/t/tablelock.test
@@ -2,7 +2,10 @@
# Test of lock tables
#
+--disable_warnings
drop table if exists t1,t2;
+--enable_warnings
+
create table t1 ( n int auto_increment primary key);
lock tables t1 write;
insert into t1 values(NULL);
diff --git a/mysql-test/t/temp_table.test b/mysql-test/t/temp_table.test
index 665e690a322..74276c7668c 100644
--- a/mysql-test/t/temp_table.test
+++ b/mysql-test/t/temp_table.test
@@ -2,7 +2,10 @@
# Test of temporary tables
#
+--disable_warnings
drop table if exists t1,t2;
+--enable_warnings
+
CREATE TABLE t1 (c int not null, d char (10) not null);
insert into t1 values(1,""),(2,"a"),(3,"b");
CREATE TEMPORARY TABLE t1 (a int not null, b char (10) not null);
@@ -13,12 +16,14 @@ select * from t2;
CREATE TABLE t2 (x int not null, y int not null);
alter table t2 rename t1;
select * from t1;
-create TEMPORARY TABLE t2 type=heap select * from t1;
-create TEMPORARY TABLE IF NOT EXISTS t2 (a int) type=heap;
+create TEMPORARY TABLE t2 engine=heap select * from t1;
+create TEMPORARY TABLE IF NOT EXISTS t2 (a int) engine=heap;
# This should give errors
-!$1050 CREATE TEMPORARY TABLE t1 (a int not null, b char (10) not null);
-!$1050 ALTER TABLE t1 RENAME t2;
+--error 1050
+CREATE TEMPORARY TABLE t1 (a int not null, b char (10) not null);
+--error 1050
+ALTER TABLE t1 RENAME t2;
select * from t2;
alter table t2 add primary key (a,b);
@@ -34,7 +39,6 @@ drop table t1;
# Test CONCAT_WS with temporary tables
#
-drop table if exists t1;
CREATE TABLE t1 (pkCrash INTEGER PRIMARY KEY,strCrash VARCHAR(255));
INSERT INTO t1 ( pkCrash, strCrash ) VALUES ( 1, '1');
SELECT CONCAT_WS(pkCrash, strCrash) FROM t1;
@@ -74,11 +78,9 @@ drop table t1;
# In MySQL 4.0.4 doing a GROUP BY on a NULL column created a disk based
# temporary table when a memory based one would be good enough.
-drop table if exists t1;
-
CREATE TABLE t1 (
d datetime default NULL
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('2002-10-24 14:50:32'),('2002-10-24 14:50:33'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40');
diff --git a/mysql-test/t/timezone.test b/mysql-test/t/timezone.test
index 194602f376c..ffc2e3a3ebf 100644
--- a/mysql-test/t/timezone.test
+++ b/mysql-test/t/timezone.test
@@ -1,5 +1,6 @@
#
-# Test of timezone handling. This script must be run with TZ=MET
+# Test of SYSTEM time zone handling ( for my_system_gmt_sec()).
+# This script must be run with TZ=MET
-- require r/have_met_timezone.require
disable_query_log;
@@ -13,7 +14,7 @@ DROP TABLE IF EXISTS t1;
# The following is because of daylight saving time
--replace_result MEST MET
-show variables like "timezone";
+show variables like "system_time_zone";
#
# Test unix timestamp
@@ -40,6 +41,16 @@ INSERT INTO t1 (ts) VALUES (Unix_timestamp('2003-03-30 04:00:01'));
SELECT ts,from_unixtime(ts) FROM t1;
DROP TABLE t1;
+
+#
+# Test of warning for spring time-gap values for system time zone
+#
+CREATE TABLE t1 (ts timestamp);
+INSERT INTO t1 (ts) VALUES ('2003-03-30 01:59:59'),
+ ('2003-03-30 02:59:59'),
+ ('2003-03-30 03:00:00');
+DROP TABLE t1;
+
#
# Test for fix for Bug#2523
#
diff --git a/mysql-test/t/timezone2.test b/mysql-test/t/timezone2.test
new file mode 100644
index 00000000000..d185a647921
--- /dev/null
+++ b/mysql-test/t/timezone2.test
@@ -0,0 +1,268 @@
+# This script tests our own time zone support functions
+
+# Preparing playground
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+
+
+#
+# Let us first check +HH:MM style timezones
+#
+create table t1 (ts timestamp);
+
+set time_zone='+00:00';
+select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp());
+insert into t1 (ts) values ('2003-03-30 02:30:00');
+
+set time_zone='+10:30';
+select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp());
+insert into t1 (ts) values ('2003-03-30 02:30:00');
+
+set time_zone='-10:00';
+select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp());
+insert into t1 (ts) values ('2003-03-30 02:30:00');
+
+# Here we will get different results
+select * from t1;
+
+drop table t1;
+
+
+#
+# Let us try DB specified time zones
+#
+select Name from mysql.time_zone_name where Name in
+ ('UTC','Universal','MET','Europe/Moscow','leap/Europe/Moscow');
+
+create table t1 (i int, ts timestamp);
+
+set time_zone='MET';
+
+# We check common date time value and non existent or ambiguios values
+# Normal value without DST
+insert into t1 (i, ts) values
+ (unix_timestamp('2003-03-01 00:00:00'),'2003-03-01 00:00:00');
+# Values around and in spring time-gap
+insert into t1 (i, ts) values
+ (unix_timestamp('2003-03-30 01:59:59'),'2003-03-30 01:59:59'),
+ (unix_timestamp('2003-03-30 02:30:00'),'2003-03-30 02:30:00'),
+ (unix_timestamp('2003-03-30 03:00:00'),'2003-03-30 03:00:00');
+# Normal value with DST
+insert into t1 (i, ts) values
+ (unix_timestamp('2003-05-01 00:00:00'),'2003-05-01 00:00:00');
+# Ambiguos values (also check for determenism)
+insert into t1 (i, ts) values
+ (unix_timestamp('2003-10-26 01:00:00'),'2003-10-26 01:00:00'),
+ (unix_timestamp('2003-10-26 02:00:00'),'2003-10-26 02:00:00'),
+ (unix_timestamp('2003-10-26 02:59:59'),'2003-10-26 02:59:59'),
+ (unix_timestamp('2003-10-26 04:00:00'),'2003-10-26 04:00:00'),
+ (unix_timestamp('2003-10-26 02:59:59'),'2003-10-26 02:59:59');
+
+set time_zone='UTC';
+
+select * from t1;
+
+delete from t1;
+
+# Simple check for 'Europe/Moscow' time zone just for showing that it works
+set time_zone='Europe/Moscow';
+insert into t1 (i, ts) values
+ (unix_timestamp('2004-01-01 00:00:00'),'2004-01-01 00:00:00'),
+ (unix_timestamp('2004-03-28 02:30:00'),'2004-03-28 02:30:00'),
+ (unix_timestamp('2004-08-01 00:00:00'),'2003-08-01 00:00:00'),
+ (unix_timestamp('2004-10-31 02:30:00'),'2004-10-31 02:30:00');
+select * from t1;
+delete from t1;
+
+
+#
+# Check for time zone with leap seconds
+# Values in ts column must be the same but values in i column should
+# differ from corresponding values for Europe/Moscow a bit.
+#
+set time_zone='leap/Europe/Moscow';
+insert into t1 (i, ts) values
+ (unix_timestamp('2004-01-01 00:00:00'),'2004-01-01 00:00:00'),
+ (unix_timestamp('2004-03-28 02:30:00'),'2004-03-28 02:30:00'),
+ (unix_timestamp('2004-08-01 00:00:00'),'2003-08-01 00:00:00'),
+ (unix_timestamp('2004-10-31 02:30:00'),'2004-10-31 02:30:00');
+select * from t1;
+delete from t1;
+# Let us test leap jump
+insert into t1 (i, ts) values
+ (unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
+ (unix_timestamp('1981-07-01 04:00:00'),'1981-07-01 04:00:00');
+select * from t1;
+# Additional 60ieth second!
+select from_unixtime(362793609);
+
+drop table t1;
+
+
+#
+# Let us test range for TIMESTAMP
+#
+create table t1 (ts timestamp);
+set time_zone='UTC';
+insert into t1 values ('0000-00-00 00:00:00'),('1969-12-31 23:59:59'),
+ ('1970-01-01 00:00:00'),('1970-01-01 00:00:01'),
+ ('2037-12-31 23:59:59'),('2038-01-01 00:00:00');
+select * from t1;
+delete from t1;
+# MET time zone has range shifted by one hour
+set time_zone='MET';
+insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 00:30:00'),
+ ('1970-01-01 01:00:00'),('1970-01-01 01:00:01'),
+ ('2038-01-01 00:59:59'),('2038-01-01 01:00:00');
+select * from t1;
+delete from t1;
+# same for +01:30 time zone
+set time_zone='+01:30';
+insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 01:00:00'),
+ ('1970-01-01 01:30:00'),('1970-01-01 01:30:01'),
+ ('2038-01-01 01:29:59'),('2038-01-01 01:30:00');
+select * from t1;
+
+drop table t1;
+
+
+#
+# Test of show variables
+#
+show variables like 'time_zone';
+set time_zone = default;
+show variables like 'time_zone';
+
+
+#
+# Let us try some invalid time zone specifications
+#
+--error 1298
+set time_zone= '0';
+--error 1298
+set time_zone= '0:0';
+--error 1298
+set time_zone= '-20:00';
+--error 1298
+set time_zone= '+20:00';
+--error 1298
+set time_zone= 'Some/Unknown/Time/Zone';
+
+
+# Let us check that aliases for time zones work and they are
+# case-insensitive
+select convert_tz(now(),'UTC', 'Universal') = now();
+select convert_tz(now(),'utc', 'UTC') = now();
+
+
+#
+# Let us test CONVERT_TZ function (may be func_time.test is better place).
+#
+select convert_tz('1917-11-07 12:00:00', 'MET', 'UTC');
+select convert_tz('1970-01-01 01:00:00', 'MET', 'UTC');
+select convert_tz('1970-01-01 01:00:01', 'MET', 'UTC');
+select convert_tz('2003-03-01 00:00:00', 'MET', 'UTC');
+select convert_tz('2003-03-30 01:59:59', 'MET', 'UTC');
+select convert_tz('2003-03-30 02:30:00', 'MET', 'UTC');
+select convert_tz('2003-03-30 03:00:00', 'MET', 'UTC');
+select convert_tz('2003-05-01 00:00:00', 'MET', 'UTC');
+select convert_tz('2003-10-26 01:00:00', 'MET', 'UTC');
+select convert_tz('2003-10-26 02:00:00', 'MET', 'UTC');
+select convert_tz('2003-10-26 02:59:59', 'MET', 'UTC');
+select convert_tz('2003-10-26 04:00:00', 'MET', 'UTC');
+select convert_tz('2038-01-01 00:59:59', 'MET', 'UTC');
+select convert_tz('2038-01-01 01:00:00', 'MET', 'UTC');
+select convert_tz('2103-01-01 04:00:00', 'MET', 'UTC');
+
+# Let us test variable time zone argument
+create table t1 (tz varchar(3));
+insert into t1 (tz) values ('MET'), ('UTC');
+select tz, convert_tz('2003-12-31 00:00:00',tz,'UTC'), convert_tz('2003-12-31 00:00:00','UTC',tz) from t1 order by tz;
+drop table t1;
+
+# Parameters to CONVERT_TZ() what should give NULL
+select convert_tz('2003-12-31 04:00:00', NULL, 'UTC');
+select convert_tz('2003-12-31 04:00:00', 'SomeNotExistingTimeZone', 'UTC');
+select convert_tz('2003-12-31 04:00:00', 'MET', 'SomeNotExistingTimeZone');
+select convert_tz('2003-12-31 04:00:00', 'MET', NULL);
+select convert_tz( NULL, 'MET', 'UTC');
+
+#
+# Test for bug #4508 "CONVERT_TZ() function with new time zone as param
+# crashes server." (Was caused by improperly worked mechanism of time zone
+# dynamical loading).
+#
+create table t1 (ts timestamp);
+set timestamp=1000000000;
+insert into t1 (ts) values (now());
+select convert_tz(ts, @@time_zone, 'Japan') from t1;
+drop table t1;
+
+#
+# Test for bug #6116 "SET time_zone := ... requires access to mysql.time_zone
+# tables". We should allow implicit access to time zone description tables
+# even for unprivileged users.
+#
+
+# Let us prepare playground
+delete from mysql.user where user like 'mysqltest\_%';
+delete from mysql.db where user like 'mysqltest\_%';
+delete from mysql.tables_priv where user like 'mysqltest\_%';
+delete from mysql.columns_priv where user like 'mysqltest\_%';
+flush privileges;
+create table t1 (a int, b datetime);
+create table t2 (c int, d datetime);
+
+grant all privileges on test.* to mysqltest_1@localhost;
+connect (tzuser, localhost, mysqltest_1,,);
+connection tzuser;
+show grants for current_user();
+set time_zone= '+00:00';
+set time_zone= 'Europe/Moscow';
+select convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC');
+select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
+# Let us also check whenever multi-update works ok
+update t1, t2 set t1.b = convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC')
+ where t1.a = t2.c and t2.d = (select max(d) from t2);
+# But still these two statements should not work:
+--error 1044
+select * from mysql.time_zone_name;
+--error 1044
+select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name;
+
+#
+# Test for bug #6765 "Implicit access to time zone description tables
+# requires privileges for them if some table or column level grants
+# present"
+#
+connection default;
+# Let use some table-level grants instead of db-level
+# to make life more interesting
+delete from mysql.db where user like 'mysqltest\_%';
+flush privileges;
+grant all privileges on test.t1 to mysqltest_1@localhost;
+grant all privileges on test.t2 to mysqltest_1@localhost;
+# The test itself is almost the same as previous one
+connect (tzuser2, localhost, mysqltest_1,,);
+connection tzuser2;
+show grants for current_user();
+set time_zone= '+00:00';
+set time_zone= 'Europe/Moscow';
+select convert_tz('2004-11-31 12:00:00', 'Europe/Moscow', 'UTC');
+select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
+update t1, t2 set t1.b = convert_tz('2004-11-30 12:00:00', 'Europe/Moscow', 'UTC')
+ where t1.a = t2.c and t2.d = (select max(d) from t2);
+# Again these two statements should not work (but with different errors):
+--error 1142
+select * from mysql.time_zone_name;
+--error 1142
+select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name;
+
+# Clean-up
+connection default;
+delete from mysql.user where user like 'mysqltest\_%';
+delete from mysql.db where user like 'mysqltest\_%';
+delete from mysql.tables_priv where user like 'mysqltest\_%';
+flush privileges;
+drop table t1, t2;
diff --git a/mysql-test/t/truncate.test b/mysql-test/t/truncate.test
index f92e92fbc97..b7ec506ecf1 100644
--- a/mysql-test/t/truncate.test
+++ b/mysql-test/t/truncate.test
@@ -1,7 +1,10 @@
#
# Test of truncate
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+
create table t1 (a integer, b integer,c1 CHAR(10));
insert into t1 (a) values (1),(2);
truncate table t1;
diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test
index 928f79a661e..f70193ddbe0 100644
--- a/mysql-test/t/type_blob.test
+++ b/mysql-test/t/type_blob.test
@@ -3,10 +3,46 @@
#
#
+# Basic cleanup
+#
+--disable_warnings
+drop table if exists t1,t2,t3,t4,t5,t6,t7;
+--enable_warnings
+
+
+#
+# Check syntax for creating BLOB/TEXT
+#
+
+CREATE TABLE t1 (a blob, b text, c blob(250), d text(70000), e text(70000000));
+show columns from t1;
+# PS doesn't give errors on prepare yet
+--disable_ps_protocol
+CREATE TABLE t2 (a char(257), b varbinary(70000), c varchar(70000000));
+--enable_ps_protocol
+show columns from t2;
+create table t3 (a long, b long byte);
+show create TABLE t3;
+drop table t1,t2,t3
+
+#
+# Check errors with blob
+#
+
+--error 1074
+CREATE TABLE t1 (a char(257) default "hello");
+--error 1101
+CREATE TABLE t2 (a blob default "hello");
+
+# Safety to be able to continue with other tests if above fails
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
+#
# test of full join with blob
#
-drop table if exists t1,t2,t3,t4,t5,t6,t7;
create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr));
insert into t1 values (null,"a","A");
insert into t1 values (null,"bbb","BBB");
@@ -29,7 +65,7 @@ drop table t1;
#
# test of blob, text, char and char binary
#
-create table t1 (t text,c char(10),b blob, d char(10) binary);
+create table t1 (t text,c char(10),b blob, d binary(10));
insert into t1 values (NULL,NULL,NULL,NULL);
insert into t1 values ("","","","");
insert into t1 values ("hello","hello","hello","hello");
@@ -58,6 +94,7 @@ select b from t1 where b like "%HELLO%";
select d from t1 where d like "%HELLO%";
select c from t1 having c like "%HELLO%";
select d from t1 having d like "%HELLO%";
+select d from t1 having d like "%HE%LLO%";
select t from t1 order by t;
select c from t1 order by c;
select b from t1 order by b;
@@ -87,8 +124,10 @@ select c,count(*) from t1 group by c;
select d,count(*) from t1 group by d;
drop table t1;
-!$1089 create table t1 (a text, key (a(300))); # should give an error
-create table t1 (a text, key (a(255)));
+-- error 1071
+create table t1 (a text, unique (a(2100))); # should give an error
+create table t1 (a text, key (a(2100))); # key is auto-truncated
+show create table t1;
drop table t1;
#
@@ -260,9 +299,20 @@ drop table t1;
create table t1 (id integer auto_increment unique,imagem LONGBLOB not null);
insert into t1 (id) values (1);
+select
+ charset(load_file('../../std_data/words.dat')),
+ collation(load_file('../../std_data/words.dat')),
+ coercibility(load_file('../../std_data/words.dat'));
+explain extended select
+ charset(load_file('../../std_data/words.dat')),
+ collation(load_file('../../std_data/words.dat')),
+ coercibility(load_file('../../std_data/words.dat'));
update t1 set imagem=load_file('../../std_data/words.dat') where id=1;
select if(imagem is null, "ERROR", "OK"),length(imagem) from t1 where id = 1;
drop table t1;
+create table t1 select load_file('../../std_data/words.dat');
+show full fields from t1;
+drop table t1;
#
# Test blob's with end space (Bug #1651)
@@ -293,6 +343,7 @@ drop table t1;
create table t1 (id integer primary key auto_increment, txt text, unique index txt_index (txt (20)));
insert into t1 (txt) values ('Chevy'), ('Chevy '), (NULL);
select * from t1 where txt='Chevy' or txt is NULL;
+explain select * from t1 where txt='Chevy' or txt is NULL;
select * from t1 where txt='Chevy ';
select * from t1 where txt='Chevy ' or txt='Chevy';
select * from t1 where txt='Chevy' or txt='Chevy ';
@@ -311,9 +362,15 @@ select * from t1 where txt < 'Chevy ' or txt is NULL;
select * from t1 where txt <= 'Chevy';
select * from t1 where txt > 'Chevy';
select * from t1 where txt >= 'Chevy';
+alter table t1 modify column txt blob;
+explain select * from t1 where txt='Chevy' or txt is NULL;
+select * from t1 where txt='Chevy' or txt is NULL;
+explain select * from t1 where txt='Chevy' or txt is NULL order by txt;
+select * from t1 where txt='Chevy' or txt is NULL order by txt;
drop table t1;
-CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, PRIMARY KEY (i), KEY (c(1),c(1)));
-INSERT t1 VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
+
+CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, d varchar(1) NOT NULL DEFAULT ' ', PRIMARY KEY (i), KEY (c(1),d));
+INSERT t1 (i, c) VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
select max(i) from t1 where c = '';
drop table t1;
diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test
index 0f949e3a10a..64420a85189 100644
--- a/mysql-test/t/type_date.test
+++ b/mysql-test/t/type_date.test
@@ -1,6 +1,10 @@
#
# test of problem with date fields
#
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
create table t1 (a char(16), b date, c datetime);
insert into t1 SET a='test 2000-01-01', b='2000-01-01', c='2000-01-01';
select * from t1 where c = '2000-01-01';
@@ -11,7 +15,6 @@ drop table t1;
# problem with date conversions
#
-drop table if exists t1,t2;
CREATE TABLE t1 (name char(6),cdate date);
INSERT INTO t1 VALUES ('name1','1998-01-01');
INSERT INTO t1 VALUES ('name2','1998-01-01');
@@ -78,9 +81,10 @@ SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.
drop table t1,t2;
#
-# Bug 4036
+# Multiple SELECT DATE_FORMAT gave incorrect results (Bug #4036)
#
-CREATE TABLE t1 (f1 time default NULL, f2 time default NULL) TYPE=MyISAM;
+
+CREATE TABLE t1 (f1 time default NULL, f2 time default NULL);
INSERT INTO t1 (f1, f2) VALUES ('09:00', '12:00');
SELECT DATE_FORMAT(f1, "%l.%i %p") , DATE_FORMAT(f2, "%l.%i %p") FROM t1;
DROP TABLE t1;
diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test
index 850e5238111..04e4a73554a 100644
--- a/mysql-test/t/type_datetime.test
+++ b/mysql-test/t/type_datetime.test
@@ -2,15 +2,18 @@
# testing different DATETIME ranges
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+
create table t1 (t datetime);
-insert into t1 values(101),(691231),(700101),(991231),(10000101),(99991231),(101000000),(691231000000),(700101000000),(991231235959),(10000101000000),(99991231235959),(20030102030460),(20030102036301),(20030102240401),(20030132030401),(20031302030460);
+insert into t1 values (101),(691231),(700101),(991231),(10000101),(99991231),(101000000),(691231000000),(700101000000),(991231235959),(10000101000000),(99991231235959),(20030100000000),(20030000000000);
select * from t1;
delete from t1 where t > 0;
optimize table t1;
check table t1;
delete from t1;
-insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959"),("20030102030460"),("20030102036301"),("20030102240401"),("20030132030401"),("20031302030460");
+insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959"),("20030100000000"),("20030000000000");
select * from t1;
drop table t1;
@@ -20,7 +23,7 @@ drop table t1;
CREATE TABLE t1 (a timestamp, b date, c time, d datetime);
insert into t1 (b,c,d) values(now(),curtime(),now());
-select date_format(a,"%Y-%m-%d")=b,right(a,6)=c+0,a=d+0 from t1;
+select date_format(a,"%Y-%m-%d")=b,right(a+0,6)=c+0,a=d+0 from t1;
drop table t1;
#
@@ -55,7 +58,7 @@ CREATE TABLE `t1` (
PRIMARY KEY (`numfacture`),
KEY `date` (`date`),
KEY `expedition` (`expedition`)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 (expedition) VALUES ('0001-00-00 00:00:00');
SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00';
@@ -68,3 +71,21 @@ insert into t1 values (now(), now());
insert into t1 values (now(), now());
select * from t1 where a is null or b is null;
drop table t1;
+
+#
+# Let us check if we properly treat wrong datetimes and produce proper
+# warnings (for both strings and numbers)
+#
+create table t1 (t datetime);
+insert into t1 values (20030102030460),(20030102036301),(20030102240401),
+ (20030132030401),(20031302030401),(100001202030401);
+select * from t1;
+delete from t1;
+insert into t1 values
+ ("2003-01-02 03:04:60"),("2003-01-02 03:63:01"),("2003-01-02 24:04:01"),
+ ("2003-01-32 03:04:01"),("2003-13-02 03:04:01"), ("10000-12-02 03:04:00");
+select * from t1;
+delete from t1;
+insert into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00 some trailer");
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test
index 72482731147..414a06deaa9 100644
--- a/mysql-test/t/type_decimal.test
+++ b/mysql-test/t/type_decimal.test
@@ -1,6 +1,10 @@
# bug in decimal() with negative numbers by kaido@tradenet.ee
+--disable_warnings
DROP TABLE IF EXISTS t1;
+--enable_warnings
+SET SQL_WARNINGS=1;
+
CREATE TABLE t1 (
id int(11) NOT NULL auto_increment,
datatype_id int(11) DEFAULT '0' NOT NULL,
@@ -234,11 +238,11 @@ drop table t1;
# Test of wrong decimal type
#
---error 1074
+--error 1064
CREATE TABLE t1 (a_dec DECIMAL(-1,0));
---error 1074
+--error 1064
CREATE TABLE t1 (a_dec DECIMAL(-2,1));
---error 1074
+--error 1064
CREATE TABLE t1 (a_dec DECIMAL(-1,1));
CREATE TABLE t1 (a_dec DECIMAL(0,11));
SHOW CREATE TABLE t1;
@@ -247,7 +251,7 @@ DROP TABLE t1;
#
# Zero prepend overflow bug
#
-
+--disable_warnings
create table t1(a decimal(7,3));
insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000000001'),('10'),('+10'),('-10'),('0000000010'),('+0000000010'),('-0000000010'),('100'),('+100'),('-100'),('0000000100'),('+0000000100'),('-0000000100'),('1000'),('+1000'),('-1000'),('0000001000'),('+0000001000'),('-0000001000'),('10000'),('+10000'),('-10000'),('0000010000'),('+0000010000'),('-0000010000'),('100000'),('+100000'),('-100000'),('0000100000'),('+0000100000'),('-0000100000'),('1000000'),('+1000000'),('-1000000'),('0001000000'),('+0001000000'),('-0001000000'),('10000000'),('+10000000'),('-10000000'),('0010000000'),('+0010000000'),('-0010000000'),('100000000'),('+100000000'),('-100000000'),('0100000000'),('+0100000000'),('-0100000000'),('1000000000'),('+1000000000'),('-1000000000'),('1000000000'),('+1000000000'),('-1000000000');
select * from t1;
@@ -258,5 +262,6 @@ select * from t1;
drop table t1;
create table t1(a decimal(7,3) zerofill);
insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000000001'),('10'),('+10'),('-10'),('0000000010'),('+0000000010'),('-0000000010'),('100'),('+100'),('-100'),('0000000100'),('+0000000100'),('-0000000100'),('1000'),('+1000'),('-1000'),('0000001000'),('+0000001000'),('-0000001000'),('10000'),('+10000'),('-10000'),('0000010000'),('+0000010000'),('-0000010000'),('100000'),('+100000'),('-100000'),('0000100000'),('+0000100000'),('-0000100000'),('1000000'),('+1000000'),('-1000000'),('0001000000'),('+0001000000'),('-0001000000'),('10000000'),('+10000000'),('-10000000'),('0010000000'),('+0010000000'),('-0010000000'),('100000000'),('+100000000'),('-100000000'),('0100000000'),('+0100000000'),('-0100000000'),('1000000000'),('+1000000000'),('-1000000000'),('1000000000'),('+1000000000'),('-1000000000');
+--enable_warnings
select * from t1;
drop table t1;
diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test
index 78b850b6ea6..6b2183df069 100644
--- a/mysql-test/t/type_enum.test
+++ b/mysql-test/t/type_enum.test
@@ -2,7 +2,10 @@
# Problem with many enums
#
+--disable_warnings
DROP TABLE if exists t1;
+--enable_warnings
+
CREATE TABLE t1 (
field enum('001001','001004','001010','001018','001019','001020','001021','001027','001028','001029','001030','001031','001100','002003','002004','002005','002007','002008','002009','002012','002013','002014','003002','003003','003004','003005','003006','003007','003008','003009','003010','003011','003012','003013','003014','003015','003016','003017','003018','003019','004002','004003','004005','004006','004007','004008','004010','004012','004014','004016','004017','004020','004021','004022','004023','004024','004025','004026','006002','006004','006006','006010','006011','006012','006013','006014','007001','007002','007003','007004','007005','007006','007007','007008','007009','007010','007011','007012','007013','007014','007015','007016','007017','007018','007019','007020','007021','007022','007023','007024','007025','007026','007027','007028','007029','007030','007031','007032','007033','007034','007035','007036','007037','007038','007039','007040','007043','007044','009001','009002','009004','009005','009006','009007','009008','009009','009010','009011','009012','009013','010002','010003','010004','010005','010006','010007','010008','010009','010010','010011','010012','010013','010015','010016','010017','010018','010019','010020','010021','010022','010023','010024','010025','010026','010027','010028','011001','011002','011003','011004','011006','011012','011013','011014','011015','011016','012017','012018','012019','012023','012027','012028','012029','012030','012031','012032','012033','012034','012035','012036','012037','012038','012039','014001','016002','016003','016004','016007','016010','016011','016016','016019','016020','016021','016022','016023','016024','016026','016027','016028','016029','016030','016031','016032','016033','016034','017002','018001','019002','019004','020001','020003','020004','020005','020006','020007','020008','020009','022001','022002','022003','023001','023002','023003','023004','023005','023006','023007','023008','023010','023011','023012','023017','023019','023020','023021','023025','023026','023027','023028','023029','023030','023031','023032','023033','023034','023035','025001','025003','025004','025005','025006','025007','025008','025009','025010','025011','025012','025013','025014','025015','025016','025017','025018','025019','025020','025021','025022','025023','025024','025025','025026','025027','025028','025029','025030','025031','025032','025033','025034','025035','025036','025037','025038','025039','025040','025041','025042','025043','025044','025045','025046','025047','025048','025049','025050','025051','025052','025053','025054','025055','025056','025057','025058','025059','025060','025061','025062','025063','027001','027002','027011','035008','035012','036001','037001','037003','037004','037005','037006','037007','037008','037009','038004','038005','038006','038007','038009','039001','039002','039003','039004','039005','039006','046001','046002','046003','046004','046005','046007','046008','046009','046010','046011','046012','046013','046014','047001','047002','048001','051001','051002','051003','051004','052001','052002','052005','053015','053016','053019','053020','053023','053024','053026','053028','053029','053033','053034','053036','053037','053038','053039','053041','053042','053043','053045','053046','053047','053048','053051','053052','053054','053055','053056','053057','053068','053069','053070','053073','053074','053075','053086','053094','053095','053096','053097','053098','053099','053100','053101','053102','053103','053104','053105','053107','053122','053123','053124','053125','053127','053128','054001','054002','054003','054004','054005','054006','054007','054009','054010','056001','056002','056003','056004','056005','056006','056009','056010','056011','056016','056017','056018','056019','056020','056021','056022','057001','057002','057003','057004','058002','058003','058004','058005','060001','060003','060004','060005','060006','060007','061002','061003','061004','061005','061006','069006','069007','069010','069011','069012','069013','069014','069015','069016','069017','069018','069020','069021','069022','069023','069024','071002','071003','071004','071005','071006','071008','071011','071013','071020','071021','071022','072001','073001','073002','073003','073004','074001','074002','074003','074004','074005','074006','074007','074008','074009','074010','074011','074012','075001','075007','076101','076102','076103','077001','077002','077003','077004','077006','077007','077008','077009','078005','079002','079003','079004','079005','079006','079007','081001','082006','082007','082011','082013','082014','082015','082016','082017','082021','082022','082023','082024','082025','082026','082027','082028','082029','082030','082031','082032','082033','082034','082035','082036','082037','082038','082039','082040','082041','082042','082043','082044','084001','084002','084003','084004','084005','084007','084008','084009','084011','084013','084014','084016','084017','084027','084031','084032','084033','084035','084036','084037','084038','084039','084040','084041','084042','084043','084044','084045','084046','084047','084048','084049','084050','084051','085001','085002','085003','085004','085005','085006','085007','085009','085011','085012','085013','085014','085015','085016','085017','085018','085019','085020','085021','085022','085023','085028','085029','085030','085031','085033','085034','085035','085036','085037','085038','085040','085041','085042','085043','085044','085045','085046','085047','085048','085063','085064','085065','085068','085070','085071','085073','085082','085083','085086','085088','085089','085090','085091','085092','085093','085094','085095','085096','085097','085098','085099','085100','085101','085102','085103','085104','085105','085106','085107','085108','085109','085110','085111','085112','085113','085115','085119','085120','085121','085122','085123','085124','085125','085126','085127','085128','085129','085130','085132','085133','085134','085135','085136','085137','086001','086002','086003','086004','086005','088001','088003','088005','088006','088007','088008','088009','089001','090001','090002','090003','090004','090005','090006','090007','090008','090009','090010','090013','090015','090016','090017','090018','090019','090022','090027','090028','091001','091002','091005','091008','091009','091010','091011','091012','091013','091014','091015','091016','091017','091018','093001','093003','093098','093100','093102','093104','093141','093142','093146','093151','093153','093167','093168','093176','094001','094002','094004','094005','095004','099001','099002','100001','101001','102002','102003','105001','105002','106001','113001','113002','113003','113004','113005','113006','113007','113008','113009','113010','113011','113012','113013','113014','113015','113016','113017','113018','113019','113020','113021','113022','113023','113024','113025','113026','113027','113028','114001','115001','115002','115003','115004','115005','115006','115007','115008','115009','115010','115011','115012','115013','115014','115015','115016','115017','115018','115020','115021','115022','115023','115025','115026','115027','115028','115029','115030','115031','115032','115033','115034','115035','115036','115039','115040','115041','115042','115043','115044','115045','115046','115047','115048','115049','115050','115051','115052','115053','115054','115055','115056','115057','115059','115060','115061','115062','115063','115064','115065','115066','115067','115068','115069','115070','115071','115072','115073','115075','115076','115081','115082','115085','115086','115087','115088','115095','115096','115097','115098','115099','115101','115102','115103','115104','115105','115106','115108','115109','115110','115111','115112','115113','115114','115115','115116','115117','115118','115119','115120','115121','115122','116001','116002','116003','116004','116005','116006','116007','116008','116009','116010','116011','116012','117001','117002','117003','123001','124010','124014','124015','124019','124024','124025','124026','124027','124028','124029','124030','124031','124032','124033','124035','124036','124037','124038','124039','124040','124041','124042','124043','124044','124045','124046','124047','124048','124049','124050','124051','124052','124053','124054','124055','124056','124057','124058','124059','124060','124061','124062','124063','124064','124065','126001','126002','126003','126004','126005','126006','126007','126008','126009','126010','126011','126012','130001','132001','132002','132003','133001','133008','133009','133010','133011','133012','133013','133014','133015','133016','133017','133018','133019','133020','133021','133022','133023','133024','133025','133027','133028','133029','133030','133031','134001','135001','135002','135003','135004','135005','135006','135007','135008','135009','135010','136001','137009','137010','137011','137012','137013','137014','137015','137016','137017','137018','137019','138001','138002','138003','138004','139001','139003','140001','141001','141002','141003','141006','141007','141008','141009','141011','141012','141014','141015','141016','141017','141018','141019','141020','141021','141022','141023','141024','141025','141026','141027','141028','142001','142002','142003','142004','142005','142006','142007','142008','142010','142011','142012','144001','145001','145002','145003','145004','145005','145006','145007','145008','145009','145010','145011','145012','145013','145014','145015','145016','147001','150003','150005','150009','150013','150014','150015','150016','150017','150020','150021','152001','152002','152003','152004','152005','152006','152007','154001','154002','154003','155001','155002','155003','155004','155005','155006','159001','159002','159003','159004','160001','160002','160003','161001','162001','162002','162003','162004','162007','162010','162011','162012','163001','163002','163003','163005','163010','163011','163014','163015','163016','165001','165002','165003','165004','165005','165006','165007','165008','165009','165010','165011','165012','165013','165014','165015','165016','165017','165018','165019','165020','165021','165022','165023','165024','165025','165026','165027','165028','165029','165030','165031','165032','165033','165034','165035','165036','167001','168001','168002','168003','168004','168005','168007','168008','168009','168010','168011','168012','168013','168014','169001','169002','169003','169007','169008','169009','169010','170001','171001','171002','171003','171004','171005','171006','171007','171008','171009','172001','174001','174002','174003','176001','176002','176003','177001','177002','179001','179002','179003','179004','179005','179006','179007','179008','179009','179010','179011','179012','179013','179014','179015','179016','179017','179018','179019','179020','179021','179022','179023','179024','179025','179026','179027','179028','179029','179030','179031','179032','179033','179034','179035','179036','179037','179038','179039','179040','179041','179042','179043','179044','179045','179046','179047','180001','180010','180012','180013','180014','180015','180016','180017','180018','180019','180020','180021','180022','180023','180024','180025','180026','180027','180028','180030','180031','180032','180033','180034','180035','180036','180037','180038','180039','180041','180042','180043','180044','180045','180046','180047','180048','180049','180050','180051','180052','180053','180054','180055','180056','180057','180058','180059','180060','180061','180062','180063','180064','180065','180066','180067','180068','180069','180070','180071','182001','184001','184002','184005','184006','184007','184008','184009','184010','184011','185001','185003','187001','188001','188002','188003','188004','188005','188006','188007','188008','188009','188010','188011','191001','191002','192002','194001','194002','194003','194004','194005','194006','194007','195001','195002','195003','195004','195005','195006','195007','196001','196002','197001','197002','197003','197004','197005','197006','198001','198003','198004','198005','198006','198007','198008','198009','198010','198011','198012','198013','198014','198015','198016','198017','201001','201002','201005','202001','203001','203002','203003','203017','203018','203019','204001','204002','204003','205001','208001','208002','208003','208004','208005','209001','209002','209003','210001','210002','210003','210004','210005','210006','210007','210008','210009','210010','210011','210012','210013','211017','212001','212002','212003','212004','212005','212006','212007','212008','212009','212010','212011','212012','212013','218001','218003','218004','218006','218007','218008','218009','218011','218015','218016','218017','218018','218019','218020','218021','218022','218023','218024','218025','218026','218027','218028','218029','218030','218031','218032','218033','218034','218035','218036','221001','221002','221003','221004','221005','221006','221007','221008','221009','221010','221011','221012','221013','223001','223002','223003','224001','224002','224003','224006','224007','224008','225001','225002','225003','225004','225005','225006','225007','225008','225009','225010','225011','225012','225013','226001','226002','226003','226004','226005','226006','226007','226008','226009','227001','227002','227003','227004','227005','227006','227007','227008','227009','227010','227011','227012','227013','227014','227015','227016','227017','227018','227019','227020','227021','227022','227023','227024','227025','227026','227027','227028','227029','227030','227031','227032','227033','227034','227035','227036','227037','227038','227039','227040','227041','227042','227043','227044','227045','227046','227047','227048','227049','227050','227051','227052','227053','227054','227055','227056','227057','227058','227059','227060','227061','227062','227063','227064','227065','227066','227067','227068','227069','227070','227071','227072','227073','227074','227075','227076','227077','227078','227079','227080','227081','227082','227083','227084','227085','227086','227087','227088','227089','227090','227091','227092','227093','227094','227095','227096','227097','227098','227099','227100','227101','227102','227103','227104','227105','227106','227107','227108','227109','227110','227111','227112','227113','227114','227115','227116','227117','227118','227119','227120','227122','227123','227124','227125','227126','227127','227128','227129','227130','227131','227132','227133','227134','227135','227136','227137','227138','227139','227140','227141','227142','227143','227144','227145','227146','227147','227148','227149','227150','227151','227152','228001','229001','229002','229003','229004','229005','230001','230002','232001','233001','233002','233003','233004','233005','233006','233007','233008','234001','234002','234003','234004','234005','234006','234007','234008','234009','234010','234011','234012','234013','234014','234015','234016','234017','234018','234019','234020','234021','234022','234023','234024','234025','234026','234027','234028','234029','234030','235001','235002','235003','235004','235005','236001','236002','236003','237001','238002','238003','238004','238005','238006','238007','238008','333013','333014','333015','333016','333017','333018','333019','333020','333021','333022','333023','333024','333025','333030','333031','333032','333033','333034','333035','334001','334002','334003','334004','334005','334006','334007','336004','337001','337002','337003','337004','339001','339002','343001','344001','344002','344003','344004','344005','345001','345002','345003','347001','347002','348001','348002','348003','348004','348005','349001','349002','349003','350001','353001','353002','353003','353004','355001','355002','355003','355004','355005','355006','356001','358001','359001','359002','360001','360002','360003','360004','360005','366001','366002','366003','366004','369001','373001','373002','373003','373004','373005','373006','373007','373008','373009','373010','373011','373012','373013','373014','373015','373016','373017','373018','373019','373020','373021','374001','374002','374003','374004','374005','374006','374007','374008','374009','374010','374011','374012','374013','374014','374015','374016','376001','376002','376003','376004','376005','376006','376007','376008','376009','376010','376011','376012','376013','376016','376017','376018','376019','376020','376021','379003','382001','382002','383001','384001','384002','385001','385002','386001','386002','386003','386004','386005','386006','386007','386008','386009','386010','386011','386012','386013','386014','387001','389001','389002','389003','389004','392001','393001','393002','393003','393004','395001','396001','397001','397002','399001','399002','399003','400001','400002','401001','401002','401003','402001','402002','402003','402004','402005','403001','403002','403003','504001','504002','504004','504005','504006','504007','504008','504009','504010','504011','504012','504013','504014','504017','504018','504019','504021','504022','504023','504024','504025','506001','506002','508001','508002','511001','511002','511003','511004','511005','511006','511007','511008','511009','511010','511011','511012','511013','511014','511017','511018','511020','511021','511022','511024','511028','511029','513001','513002','513003','513004','514001','515001','515002','515003','515007','515008','515009','515010','515011','515012','515013','515014','515015','518001','518002','518003','520001','520002','521001','521002','521003','521004','521005','521006','521007','521008','521009','521010','521011','521012','521013','521014','521015','521016','523001','523002','523003','523004','523005','523006','523007','524001','700001','701001','701002','701003','702001','702002','702003','702004','702005','702006','702007','702008','703001','703002','703003','704001','704002','704003','704004','705001','706001','706002','707001','707002','707003','708001','709001','709002','710001','710002','711001','711002','712001','713001','713002','714001','714002','715001','716001','718001','718002','719001','719002','991001','991002','991003','991004','991005','991006','991007','991008','992001','995001','996001','996002','996003','998001','998002','998003','998004','998005','998006','998007','999001','999002','011017','011018','034001','034002','071010','208006','239001','519001','519003','126013','184012','053071','374017','374018','374019','374020','374021','404001','405002','405001','405003','405007','405006','405005','405004','240011','240010','240009','240008','240007','240006','240005','240004','240003','240002','240001','240012','240013','240014','240015','240016','240017','357001','235006','235007','712002','355008','355007','056023','999999','046015','019005','126014','241003','241002','241001','240018','240020','240019','242001','242002','242003','242004','242005','242006','089002','406001','406002','406003','406004','406005','406006','243001','243002','243003','243004','243005','243006','243007','243008','010030','010029','407001','407006','407005','407004','407003','407002','408001','366005','133032','016035','077010','996004','025064','011019','407007','407008','407009','409001','115123','504026','039007','039009','039008','039010','039011','039012','180072','240021','240023','408002','405008','235008','525001','525002','525003','525004','410001','410002','410003','410004','410005','410006','410007','410008','410009','410010','410011','410012','410013','410014','410015','410016','344006','240031','240030','240029','240028','240027','240026','240025','240024','240034','240033','240032','410017','410018','411001','411002','411003','411004','411005','411006','411007','411008','203020','203021','203022','412001','412002','412003','412004','069025','244001','244002','244009','244008','244007','244006','244005','244004','244003','244015','244014','244013','244012','244011','244010','244016','244017','240042','240041','240040','240039','240038','240037','240036','240035','405009','405010','240043','504034','504033','504032','504031','504030','504029','504028','504027','504042','504041','504040','504039','504038','504037','504036','504035','800001','410019','410020','410021','244018','244019','244020','399004','413001','504043','198018','198019','344007','082045','010031','010032','010033','010034','010035','504044','515016','801002','801003','801004','801005','802001','801001','414001','414002','414003','141029','141030','803001','803002','803003','803004','803005','803006','803007','803008','803009','803010','803011','803012','803013','803014','803015','803016','803017','410022','410023','803018','803019','803020','415002','415001','244021','011020','011023','011022','011021','025065','165037','165038','165039','416001','416002','416003','417001','418001','504045','803022','803021','240022','419001','420001','804010','804009','804008','804007','804006','804005','804004','804003','804002','804001','804020','804019','804018','804017','804016','804015','804014','804013','804012','804011','804024','804021','804023','804022','511019','511016','511015','511032','511031','511030','511027','511026','511025','511033','511023','133034','133033','169011','344008','344009','244022','244026','244025','244030','244023','244024','244027','244028','244029','244031','082046','082047','082048','126015','126016','416004','416005','421001','421002','016037','016036','115124','115125','115126','240049','240048','240047','240046','240045','240044','244032','244033','422001','422002','422003','422004','422005','184013','239002','805001','805002','805003','805004','805005','056024','423001','344010','235009','212014','056025','056026','802002','244034','244035','244036','244037','244038','244039','515017','504046','203015','245002','245001','071023','056027','056028','056029','056030','056031','056032','424001','056034','056033','805006','805007','805008','805009','805010','422008','422007','422006','422010','422009','422011','209004','150022','150023','100002','056035','023036','185004','185005','246001','247001','247002','425001','416006','165042','165041','165040','165043','010040','010039','010038','010037','010036','422012','422013','422014','422015','426000','248001','248002','248003','248004','248005','249001','249002','249003','249004','249005','249006','250007','250001','250002','250003','250004','250005','250006','250008','250009','250010','250011','250012','250013','251001','251002','422016','422017','422018','806001','806002','116013','235010','235011','091026','091027','091028','091029','091019','091020','091021','091022','091023','091024','091025','252001','243009','249007','249008','249009','011024','011025','427001','428002','428001','169012','429001','429002','429003') DEFAULT '001001' NOT NULL,
KEY field (field)
@@ -31,4 +34,95 @@ insert into t1 set a='foobar';
select * from t1;
update t1 set a = replace(a,'x','y');
select * from t1;
-drop table t1; \ No newline at end of file
+drop table t1;
+
+#
+# Bug #2077
+#
+
+set names latin1;
+create table t1 (a enum(0xE4, '1', '2') not null default 0xE4);
+show columns from t1;
+show create table t1;
+drop table t1;
+
+
+#
+# Bug #5628 German characters in field-defs will be '?'
+# with some table definitions
+#
+set names latin1;
+CREATE TABLE t1 (
+ a INT default 1,
+ b ENUM('value','öäü_value','ÊÃÕ') character set latin1 NOT NULL
+);
+show create table t1;
+show columns from t1;
+drop table t1;
+
+#
+# Bugs #6154, 6206: ENUMs are not case sensitive even if declared BINARY
+#
+CREATE TABLE t1 (c enum('a', 'A') BINARY);
+INSERT INTO t1 VALUES ('a'),('A');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c enum('ae','oe','ue','ss') collate latin1_german2_ci);
+INSERT INTO t1 VALUES ('ä'),('ö'),('ü'),('ß');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+#
+# Bug #6379: ENUM values are incorrectly converted
+#
+# Check latin1 -> utf8 conversion
+#
+CREATE TABLE t1 (
+ a ENUM('ä','ö','ü') character set utf8 default 'ü'
+);
+show create table t1;
+insert into t1 values ('ä'), ('ö'), ('ü');
+select a from t1 order by a;
+drop table t1;
+
+#
+# Now check utf8 -> latin1 conversion
+# This test emulates loading a script generated with mysqldump
+#
+set names utf8;
+CREATE TABLE t1 (
+ a ENUM('À','ö','Ì') character set latin1 default 'Ì'
+);
+insert into t1 values ('À'),('ö'),('Ì');
+# Now check what has been loaded
+set names latin1;
+show create table t1;
+select a from t1 order by a;
+drop table t1;
+
+#
+# Test bug where enum fields where extended for each ALTER TABLE
+#
+
+create table t1 (a enum ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin);
+insert into t1 values ('Y');
+alter table t1 add b set ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin;
+alter table t1 add c enum ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin;
+--enable_metadata
+select * from t1;
+--disable_metadata
+drop table t1;
+
+#
+# Bug #6840 Default value is not checked in ALTER column SET DEFAULT 'x'
+#
+create table t1 (a enum('x','y') default 'x');
+--error 1067
+alter table t1 alter a set default 'z';
+drop table t1;
+
+create table t1 (a set('x','y') default 'x');
+--error 1067
+alter table t1 alter a set default 'z';
+drop table t1;
diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test
index 084d4b815e5..26ac272c6d4 100644
--- a/mysql-test/t/type_float.test
+++ b/mysql-test/t/type_float.test
@@ -2,15 +2,21 @@
# -----------
# Numeric floating point.
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+--replace_result e-0 e- e+0 e+
SELECT 10,10.0,10.,.1e+2,100.0e-1;
+--replace_result e-00 e-0
SELECT 6e-05, -6e-05, --6e-05, -6e-05+1.000000;
SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1;
-drop table if exists t1;
create table t1 (f1 float(24),f2 float(52));
show full columns from t1;
insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150);
insert into t1 values(-10,-10),(1e-5,1e-5),(1e-10,1e-10),(1e-15,1e-15),(1e-20,1e-20),(1e-50,1e-50),(1e-150,1e-150);
+--replace_result e-0 e- e+0 e+
select * from t1;
drop table t1;
@@ -36,10 +42,22 @@ create table t1 (c1 double, c2 varchar(20));
insert t1 values (121,"16");
select c1 + c1 * (c2 / 100) as col from t1;
create table t2 select c1 + c1 * (c2 / 100) as col1, round(c1, 5) as col2, round(c1, 35) as col3, sqrt(c1*1e-15) col4 from t1;
+# Floats are a bit different in PS
+--disable_ps_protocol
select * from t2;
+--enable_ps_protocol
show create table t2;
drop table t1,t2;
+# Bug #1022: When a table contains a 'float' field,
+# and one of the functions MAX, MIN, or AVG is used on that field,
+# the system crashes.
+
+create table t1 (a float);
+insert into t1 values (1);
+select max(a),min(a),avg(a) from t1;
+drop table t1;
+
#
# FLOAT/DOUBLE/DECIMAL handling
#
@@ -54,16 +72,24 @@ select a from t1 order by a;
select min(a) from t1;
drop table t1;
+create table t1 (a float(200,100), b double(200,100));
+insert t1 values (1.0, 2.0);
+select * from t1;
+show create table t1;
+drop table t1;
+
#
# float in a char(1) field
#
create table t1 (c20 char);
-insert into t1 (c20) values (5000.0);
+insert into t1 values (5000.0);
drop table t1;
# Errors
--error 1063
create table t1 (f float(54)); # Should give an error
+--disable_warnings
drop table if exists t1;
+--enable_warnings
diff --git a/mysql-test/t/type_nchar.test b/mysql-test/t/type_nchar.test
new file mode 100644
index 00000000000..e85609e3f0c
--- /dev/null
+++ b/mysql-test/t/type_nchar.test
@@ -0,0 +1,35 @@
+#
+# Test nchar/nvarchar
+#
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+create table t1 (c nchar(10));
+show create table t1;
+drop table t1;
+
+create table t1 (c national char(10));
+show create table t1;
+drop table t1;
+
+create table t1 (c national varchar(10));
+show create table t1;
+drop table t1;
+
+create table t1 (c nvarchar(10));
+show create table t1;
+drop table t1;
+
+create table t1 (c nchar varchar(10));
+show create table t1;
+drop table t1;
+
+create table t1 (c national character varying(10));
+show create table t1;
+drop table t1;
+
+create table t1 (c nchar varying(10));
+show create table t1;
+drop table t1;
+
diff --git a/mysql-test/t/type_ranges.test b/mysql-test/t/type_ranges.test
index 63bbe43512d..572dc0af313 100644
--- a/mysql-test/t/type_ranges.test
+++ b/mysql-test/t/type_ranges.test
@@ -2,7 +2,10 @@
# Test ranges for all types and some other basic tests
#
+--disable_warnings
drop table if exists t1,t2,t3;
+--enable_warnings
+SET SQL_WARNINGS=1;
CREATE TABLE t1 (
auto int(5) unsigned NOT NULL auto_increment,
@@ -53,7 +56,7 @@ DROP INDEX test ON t1;
insert into t1 values (10, 1,1,1,1,1,1,1,1,1,1,1,1,1,NULL,0,0,0,1,1,1,1,'one','one');
insert into t1 values (NULL,2,2,2,2,2,2,2,2,2,2,2,2,2,NULL,NULL,NULL,NULL,NULL,NULL,2,2,'two','two,one');
-insert into t1 values (0,1/3,3,3,3,3,3,3,3,3,3,3,3,3,NULL,'19970303','10:10:10','19970303 101010','','','','3',3,3);
+insert into t1 values (0,1/3,3,3,3,3,3,3,3,3,3,3,3,3,NULL,'19970303','10:10:10','19970303101010','','','','3',3,3);
insert into t1 values (0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,NULL,19970807,080706,19970403090807,-1,-1,-1,'-1',-1,-1);
insert into t1 values (0,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,NULL,0,0,0,-4294967295,-4294967295,-4294967295,'-4294967295',0,"one,two,tree");
insert into t1 values (0,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,NULL,0,0,0,4294967295,4294967295,4294967295,'4294967295',0,0);
@@ -132,7 +135,8 @@ drop table t1,t2;
create table t1 (c int);
insert into t1 values(1),(2);
create table t2 select * from t1;
-!$1060 create table t3 select * from t1, t2; # Should give an error
+--error 1060
+create table t3 select * from t1, t2; # Should give an error
create table t3 select t1.c AS c1, t2.c AS c2,1 as "const" from t1, t2;
show full columns from t3;
drop table t1,t2,t3;
diff --git a/mysql-test/t/type_set.test b/mysql-test/t/type_set.test
index 7f1a75e5dbd..e4aeecb2c79 100644
--- a/mysql-test/t/type_set.test
+++ b/mysql-test/t/type_set.test
@@ -2,10 +2,36 @@
# Test of SET with space
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+
create table t1 (a set (' ','a','b') not null);
show create table t1;
drop table t1;
create table t1 (a set (' ','a','b ') not null default 'b ');
show create table t1;
drop table t1;
+CREATE TABLE t1 ( user varchar(64) NOT NULL default '', path varchar(255) NOT NULL default '', privilege set('select','RESERVED30','RESERVED29','RESERVED28','RESERVED27','RESERVED26', 'RESERVED25','RESERVED24','data.delete','RESERVED22','RESERVED21', 'RESERVED20','data.insert.none','data.insert.approve', 'data.insert.delete','data.insert.move','data.insert.propose', 'data.insert.reject','RESERVED13','RESERVED12','RESERVED11','RESERVED10', 'RESERVED09','data.update','RESERVED07','RESERVED06','RESERVED05', 'RESERVED04','metadata.delete','metadata.put','RESERVED01','RESERVED00') NOT NULL default '', KEY user (user) ) ENGINE=MyISAM CHARSET=utf8;
+DROP TABLE t1;
+
+#
+# Check that SET is case sensitive with a binary collation
+#
+set names latin1;
+create table t1 (s set ('a','A') character set latin1 collate latin1_bin);
+show create table t1;
+insert into t1 values ('a'),('a,A'),('A,a'),('A');
+select s from t1 order by s;
+drop table t1;
+
+#
+# Check that SET honors a more complex collation correctly
+#
+CREATE TABLE t1 (c set('ae','oe','ue','ss') collate latin1_german2_ci);
+INSERT INTO t1 VALUES ('ä'),('ö'),('ü'),('ß');
+INSERT INTO t1 VALUES ('ae'),('oe'),('ue'),('ss');
+INSERT INTO t1 VALUES ('ä,ö,ü,ß');
+INSERT INTO t1 VALUES ('ae,oe,ue,ss');
+SELECT c FROM t1 ORDER BY c;
+DROP TABLE t1;
diff --git a/mysql-test/t/type_time.test b/mysql-test/t/type_time.test
index 2496ec36915..2f342f8bf67 100644
--- a/mysql-test/t/type_time.test
+++ b/mysql-test/t/type_time.test
@@ -1,7 +1,11 @@
#
# testing of the TIME column type
#
+
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+
create table t1 (t time);
insert into t1 values("10:22:33"),("12:34:56.78"),(10),(1234),(123456.78),(1234559.99),("1"),("1:23"),("1:23:45"), ("10.22"), ("-10 1:22:33.45"),("20 10:22:33"),("1999-02-03 20:33:34");
insert t1 values (30),(1230),("1230"),("12:30"),("12:30:35"),("1 12:30:31.32");
diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test
index 464ee63c137..a8a0cf8703c 100644
--- a/mysql-test/t/type_timestamp.test
+++ b/mysql-test/t/type_timestamp.test
@@ -2,7 +2,10 @@
# Test timestamp
#
+--disable_warnings
drop table if exists t1,t2;
+--enable_warnings
+
CREATE TABLE t1 (a int, t timestamp);
CREATE TABLE t2 (a int, t datetime);
SET TIMESTAMP=1234;
@@ -34,11 +37,11 @@ select date_format(a,"%Y %y"),year(a),year(now()) from t1;
drop table t1;
create table t1 (ix timestamp);
-insert into t1 values (19991101000000),(19990102030405),(19990630232922),(19990601000000),(19990930232922),(19990531232922),(19990501000000),(19991101000000),(19990501000000),(20030101010160),(20030101016001),(20030101240101),(20030132010101),(20031301010101);
-select * from t1;
+insert into t1 values (19991101000000),(19990102030405),(19990630232922),(19990601000000),(19990930232922),(19990531232922),(19990501000000),(19991101000000),(19990501000000);
+select ix+0 from t1;
delete from t1;
-insert into t1 values ("19991101000000"),("19990102030405"),("19990630232922"),("19990601000000"),("20030101010160"),("20030101016001"),("20030101240101"),("20030132010101"),("20031301010101");
-select * from t1;
+insert into t1 values ("19991101000000"),("19990102030405"),("19990630232922"),("19990601000000");
+select ix+0 from t1;
drop table t1;
CREATE TABLE t1 (date date, date_time datetime, time_stamp timestamp);
@@ -59,7 +62,6 @@ INSERT INTO t1 VALUES ("2030-01-01","2030-01-01 00:00:00",20300101000000);
SELECT * FROM t1;
drop table t1;
-show variables like 'new';
create table t1 (t2 timestamp(2), t4 timestamp(4), t6 timestamp(6),
t8 timestamp(8), t10 timestamp(10), t12 timestamp(12),
t14 timestamp(14));
@@ -68,53 +70,210 @@ insert t1 values (0,0,0,0,0,0,0),
"1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59",
"1997-12-31 23:47:59");
select * from t1;
-set new=1;
select * from t1;
drop table t1;
-set new=0;
#
-# Bug #1885, bug #2539.
-# Not perfect but still sensible attitude towards defaults for TIMESTAMP
-# We will ignore default value for first TIMESTAMP column.
+# Let us check if we properly treat wrong datetimes and produce proper warnings
+# (for both strings and numbers)
#
-create table t1 (t1 timestamp default '2003-01-01 00:00:00',
- t2 timestamp default '2003-01-01 00:00:00');
-set TIMESTAMP=1000000000;
-insert into t1 values();
+create table t1 (ix timestamp);
+insert into t1 values (0),(20030101010160),(20030101016001),(20030101240101),(20030132010101),(20031301010101),(20031200000000),(20030000000000);
+select ix+0 from t1;
+delete from t1;
+insert into t1 values ("00000000000000"),("20030101010160"),("20030101016001"),("20030101240101"),("20030132010101"),("20031301010101"),("20031200000000"),("20030000000000");
+select ix+0 from t1;
+delete from t1;
+insert into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00 some trailer");
+select ix+0 from t1;
+drop table t1;
+
+#
+# Test for TIMESTAMP column with default now() and on update now() clauses
+#
+
+# These statements should fail.
+--error 1293
+create table t1 (t1 timestamp, t2 timestamp default now());
+--error 1293
+create table t1 (t1 timestamp, t2 timestamp on update now());
+--error 1293
+create table t1 (t1 timestamp, t2 timestamp default now() on update now());
+--error 1293
+create table t1 (t1 timestamp default now(), t2 timestamp on update now());
+--error 1293
+create table t1 (t1 timestamp on update now(), t2 timestamp default now() on update now());
+
+# Let us test TIMESTAMP auto-update behaviour
+# Also we will test behaviour of TIMESTAMP field in SHOW CREATE TABLE and
+# behaviour of DEFAULT literal for such fields
+create table t1 (t1 timestamp default '2003-01-01 00:00:00', t2 datetime, t3 timestamp);
+SET TIMESTAMP=1000000000;
+insert into t1 values ();
+SET TIMESTAMP=1000000001;
+update t1 set t2=now();
+SET TIMESTAMP=1000000002;
+insert into t1 (t1,t3) values (default, default);
select * from t1;
show create table t1;
show columns from t1;
-show columns from t1 like 't2';
-create table t2 (select * from t1);
-show create table t2;
+drop table t1;
-# Ugly, but we can't do anything about this in 4.0
-alter table t1 add column t0 timestamp first;
+create table t1 (t1 timestamp default now(), t2 datetime, t3 timestamp);
+SET TIMESTAMP=1000000002;
+insert into t1 values ();
+SET TIMESTAMP=1000000003;
+update t1 set t2=now();
+SET TIMESTAMP=1000000003;
+insert into t1 (t1,t3) values (default, default);
+select * from t1;
show create table t1;
+show columns from t1;
+drop table t1;
-drop table t1,t2;
+create table t1 (t1 timestamp default '2003-01-01 00:00:00' on update now(), t2 datetime);
+SET TIMESTAMP=1000000004;
+insert into t1 values ();
+select * from t1;
+SET TIMESTAMP=1000000005;
+update t1 set t2=now();
+SET TIMESTAMP=1000000005;
+insert into t1 (t1) values (default);
+select * from t1;
+show create table t1;
+show columns from t1;
+drop table t1;
+create table t1 (t1 timestamp default now() on update now(), t2 datetime);
+SET TIMESTAMP=1000000006;
+insert into t1 values ();
+select * from t1;
+SET TIMESTAMP=1000000007;
+update t1 set t2=now();
+SET TIMESTAMP=1000000007;
+insert into t1 (t1) values (default);
+select * from t1;
+show create table t1;
+show columns from t1;
+drop table t1;
+
+create table t1 (t1 timestamp, t2 datetime, t3 timestamp);
+SET TIMESTAMP=1000000007;
+insert into t1 values ();
+select * from t1;
+SET TIMESTAMP=1000000008;
+update t1 set t2=now();
+SET TIMESTAMP=1000000008;
+insert into t1 (t1,t3) values (default, default);
+select * from t1;
+show create table t1;
+show columns from t1;
+drop table t1;
+
+# Let us test if CURRENT_TIMESTAMP also works well as default value
+# (Of course NOW and CURRENT_TIMESTAMP are same for parser but still just
+# for demonstartion.)
+create table t1 (t1 timestamp default current_timestamp on update current_timestamp, t2 datetime);
+SET TIMESTAMP=1000000009;
+insert into t1 values ();
+select * from t1;
+SET TIMESTAMP=1000000010;
+update t1 set t2=now();
+SET TIMESTAMP=1000000011;
+insert into t1 (t1) values (default);
+select * from t1;
+show create table t1;
+show columns from t1;
+delete from t1;
+
+#
+# Let us test some cases when auto-set should be disabled or influence
+# on server behavior in some other way.
#
-# Test for bug 2464, DEFAULT keyword in INSERT statement should return
-# default value for column.
+
+# Update statement that explicitly sets field should not auto-set it.
+insert into t1 values ('2004-04-01 00:00:00', '2004-04-01 00:00:00');
+SET TIMESTAMP=1000000012;
+update t1 set t1= '2004-04-02 00:00:00';
+select * from t1;
+# The same for multi updates
+update t1 as ta, t1 as tb set tb.t1= '2004-04-03 00:00:00';
+select * from t1;
+drop table t1;
+
+# Now let us test replace it should behave exactly like delete+insert
+# Case where optimization is possible DEFAULT = ON UPDATE
+create table t1 (pk int primary key, t1 timestamp default current_timestamp on update current_timestamp, bulk int);
+insert into t1 values (1, '2004-04-01 00:00:00', 10);
+SET TIMESTAMP=1000000013;
+replace into t1 set pk = 1, bulk= 20;
+select * from t1;
+drop table t1;
+# Case in which there should not be optimisation
+create table t1 (pk int primary key, t1 timestamp default '2003-01-01 00:00:00' on update current_timestamp, bulk int);
+insert into t1 values (1, '2004-04-01 00:00:00', 10);
+SET TIMESTAMP=1000000014;
+replace into t1 set pk = 1, bulk= 20;
+select * from t1;
+drop table t1;
+# Other similar case
+create table t1 (pk int primary key, t1 timestamp default current_timestamp, bulk int);
+insert into t1 values (1, '2004-04-01 00:00:00', 10);
+SET TIMESTAMP=1000000015;
+replace into t1 set pk = 1, bulk= 20;
+select * from t1;
+drop table t1;
+
+# Let us test alter now
+create table t1 (t1 timestamp default current_timestamp on update current_timestamp);
+insert into t1 values ('2004-04-01 00:00:00');
+SET TIMESTAMP=1000000016;
+alter table t1 add i int default 10;
+select * from t1;
+drop table t1;
+
+#
+# Test for TIMESTAMP columns which are able to store NULLs
#
-create table t1 (ts1 timestamp, ts2 timestamp);
-set TIMESTAMP=1000000000;
+# Unlike for default TIMESTAMP fields we don't interpret first field
+# in this table as TIMESTAMP with DEFAULT NOW() ON UPDATE NOW() properties.
+create table t1 (a timestamp null, b timestamp null);
+show create table t1;
+insert into t1 values (NULL, NULL);
+SET TIMESTAMP=1000000017;
+insert into t1 values ();
+select * from t1;
+drop table t1;
+
+# But explicit auto-set properties still should be OK.
+create table t1 (a timestamp null default current_timestamp on update current_timestamp, b timestamp null);
+show create table t1;
+insert into t1 values (NULL, NULL);
+SET TIMESTAMP=1000000018;
insert into t1 values ();
+select * from t1;
+drop table t1;
+
+# It is also OK to specify NULL as default explicitly for such fields.
+# This is also a test for bug #2464, DEFAULT keyword in INSERT statement
+# should return default value for column.
+
+create table t1 (a timestamp null default null, b timestamp null default '2003-01-01 00:00:00');
+show create table t1;
+insert into t1 values (NULL, NULL);
insert into t1 values (DEFAULT, DEFAULT);
select * from t1;
drop table t1;
#
-# Test for bug #4491, TIMESTAMP(19) should be possible to create and not
-# only read in 4.0
+# Let us test behavior of ALTER TABLE when it converts columns
+# containing NULL to TIMESTAMP columns.
#
-create table t1 (ts timestamp(19));
-show create table t1;
-set TIMESTAMP=1000000000;
-insert into t1 values ();
+create table t1 (a bigint, b bigint);
+insert into t1 values (NULL, NULL), (20030101000000, 20030102000000);
+set timestamp=1000000019;
+alter table t1 modify a timestamp, modify b timestamp;
select * from t1;
drop table t1;
@@ -122,29 +281,8 @@ drop table t1;
# Test for bug #4131, TIMESTAMP columns missing minutes and seconds when
# using GROUP BY in @@new=1 mode.
#
-set new=1;
create table t1 (a char(2), t timestamp);
insert into t1 values ('a', '2004-01-01 00:00:00'), ('a', '2004-01-01 01:00:00'),
('b', '2004-02-01 00:00:00');
select max(t) from t1 group by a;
drop table t1;
-
-#
-# More --new mode tests
-# Both columns created before and during alter should have same length.
-#
-create table t1 (ts1 timestamp);
-show create table t1;
-alter table t1 add ts2 timestamp;
-set new=0;
-show create table t1;
-drop table t1;
-# Selecting from table in --new mode should not affect further selects.
-create table t1 (ts1 timestamp);
-insert into t1 values ('2004-01-01 00:00:00'), ('2004-01-01 01:00:00');
-select * from t1;
-set new=1;
-select * from t1;
-set new=0;
-select * from t1;
-drop table t1;
diff --git a/mysql-test/t/type_uint.test b/mysql-test/t/type_uint.test
index 7eb48ae21ac..b1f59242e8e 100644
--- a/mysql-test/t/type_uint.test
+++ b/mysql-test/t/type_uint.test
@@ -2,7 +2,11 @@
# test of unsigned int
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+SET SQL_WARNINGS=1;
+
create table t1 (this int unsigned);
insert into t1 values (1);
insert into t1 values (-1);
diff --git a/mysql-test/t/type_year.test b/mysql-test/t/type_year.test
index e9e34dbc29f..c67b8447494 100644
--- a/mysql-test/t/type_year.test
+++ b/mysql-test/t/type_year.test
@@ -1,7 +1,10 @@
#
# Test year
#
+--disable_warnings
drop table if exists t1;
+--enable_warnings
+
create table t1 (y year,y2 year(2));
insert into t1 values (0,0),(1999,1999),(2000,2000),(2001,2001),(70,70),(69,69);
select * from t1;
diff --git a/mysql-test/t/union-master.opt b/mysql-test/t/union-master.opt
new file mode 100644
index 00000000000..3eb98fc3d6b
--- /dev/null
+++ b/mysql-test/t/union-master.opt
@@ -0,0 +1 @@
+--log-slow-queries --log-long-format --log-queries-not-using-indexes
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index eb2d8dd6efa..468a88b83db 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -2,7 +2,13 @@
# Test of unions
#
+--disable_warnings
drop table if exists t1,t2,t3,t4,t5,t6;
+--enable_warnings
+# PS doesn't work correctly with found_rows: to be fixed
+--disable_ps_protocol
+
+
CREATE TABLE t1 (a int not null, b char (10) not null);
insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
CREATE TABLE t2 (a int not null, b char (10) not null);
@@ -20,7 +26,9 @@ select 't1',b,count(*) from t1 group by b UNION select 't2',b,count(*) from t2 g
(select a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 4;
(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1);
(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
-explain (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
+--error 1250
+(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by t1.b;
+explain extended (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
(select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2;
select found_rows();
select sql_calc_found_rows a,b from t1 union all select a,b from t2 limit 2;
@@ -34,8 +42,11 @@ explain select a,b from t1 union all select a,b from t2;
--error 1054
explain select xx from t1 union select 1;
+--error 1222
explain select a,b from t1 union select 1;
+--error 1222
explain select 1 union select a,b from t1 union select 1;
+--error 1222
explain select a,b from t1 union select 1 limit 0;
--error 1221
@@ -65,11 +76,25 @@ select * from t1 union select SQL_BUFFER_RESULT * from t2;
# Test CREATE, INSERT and REPLACE
create table t3 select a,b from t1 union all select a,b from t2;
insert into t3 select a,b from t1 union all select a,b from t2;
+# PS can't handle REPLACE ... SELECT
replace into t3 select a,b as c from t1 union all select a,b from t2;
drop table t1,t2,t3;
#
+# Test some unions without tables
+#
+--error 1096
+select * union select 1;
+select 1 as a,(select a union select a);
+--error 1054
+(select 1) union (select 2) order by 0;
+SELECT @a:=1 UNION SELECT @a:=@a+1;
+--error 1054
+(SELECT 1) UNION (SELECT 2) ORDER BY (SELECT a);
+(SELECT 1,3) UNION (SELECT 2,1) ORDER BY (SELECT 2);
+
+#
# Test bug reported by joc@presence-pc.com
#
@@ -79,7 +104,7 @@ CREATE TABLE t1 (
`same` tinyint(1) unsigned NOT NULL default '1',
PRIMARY KEY (`pseudo1`),
KEY `pseudo` (`pseudo`)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 (pseudo,pseudo1,same) VALUES ('joce', 'testtt', 1),('joce', 'tsestset', 1),('dekad', 'joce', 1);
SELECT pseudo FROM t1 WHERE pseudo1='joce' UNION SELECT pseudo FROM t1 WHERE pseudo='joce';
SELECT pseudo1 FROM t1 WHERE pseudo1='joce' UNION SELECT pseudo1 FROM t1 WHERE pseudo='joce';
@@ -88,7 +113,7 @@ SELECT pseudo1 FROM t1 WHERE pseudo='joce' UNION SELECT pseudo FROM t1 WHERE pse
SELECT pseudo1 FROM t1 WHERE pseudo='joce' UNION ALL SELECT pseudo FROM t1 WHERE pseudo1='joce';
SELECT pseudo1 FROM t1 WHERE pseudo='joce' UNION SELECT 1;
drop table t1;
-drop table if exists t1,t2;
+
create table t1 (a int);
create table t2 (a int);
insert into t1 values (1),(2),(3),(4),(5);
@@ -157,8 +182,12 @@ INSERT INTO t6 VALUES (1,'test',8);
SELECT t4.uid, t5.rl, t3.gn as g1, t4.cid, t4.gid as gg FROM t3, t6, t1, t4 left join t5 on t5.rid = t4.rid left join t2 on t2.cid = t4.cid WHERE t3.gid=t4.gid AND t6.uid = t4.uid AND t6.uc = t1.cid AND t1.cv = "dummy" AND t6.un = "test";
SELECT t4.uid, t5.rl, t3.gn as g1, t4.cid, t4.gid as gg FROM t3, t6, t1, t4 left join t5 on t5.rid = t4.rid left join t2 on t2.cid = t4.cid WHERE t3.gid=t4.gid AND t6.uid = t4.uid AND t3.must IS NOT NULL AND t6.uc = t1.cid AND t1.cv = "dummy" AND t6.un = "test";
(SELECT t4.uid, t5.rl, t3.gn as g1, t4.cid, t4.gid as gg FROM t3, t6, t1, t4 left join t5 on t5.rid = t4.rid left join t2 on t2.cid = t4.cid WHERE t3.gid=t4.gid AND t6.uid = t4.uid AND t3.must IS NOT NULL AND t6.uc = t1.cid AND t1.cv = "dummy" AND t6.un = "test") UNION (SELECT t4.uid, t5.rl, t3.gn as g1, t4.cid, t4.gid as gg FROM t3, t6, t1, t4 left join t5 on t5.rid = t4.rid left join t2 on t2.cid = t4.cid WHERE t3.gid=t4.gid AND t6.uid = t4.uid AND t6.uc = t1.cid AND t1.cv = "dummy" AND t6.un = "test");
-
drop table t1,t2,t3,t4,t5,t6;
+
+#
+# Test insert ... SELECT with UNION
+#
+
CREATE TABLE t1 (a int not null, b char (10) not null);
insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
CREATE TABLE t2 (a int not null, b char (10) not null);
@@ -190,8 +219,10 @@ select found_rows();
select found_rows();
(SELECT SQL_CALC_FOUND_ROWS * FROM t1) UNION all (SELECT * FROM t2 LIMIT 1);
select found_rows();
+# This used to work in 4.0 but not anymore in 4.1
+--error 1064
(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION SELECT * FROM t2 LIMIT 1;
-select found_rows();
+#select found_rows();
# In these case found_rows() should work
SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION all SELECT * FROM t2 LIMIT 2;
@@ -224,10 +255,10 @@ SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a desc LIMIT 1;
(SELECT * FROM t1) UNION all (SELECT SQL_CALC_FOUND_ROWS * FROM t2) LIMIT 1;
create temporary table t1 select a from t1 union select a from t2;
-drop table t1;
+drop temporary table t1;
--error 1093
create table t1 select a from t1 union select a from t2;
---error 1054
+--error 1109
select a from t1 union select a from t2 order by t2.a;
drop table t1,t2;
@@ -245,3 +276,387 @@ create table t1 (a int);
insert into t1 values (0), (3), (1), (2);
explain (select * from t1) union (select * from t1) order by a;
drop table t1;
+#
+# Test for another bug with UNION and LEFT JOIN
+#
+CREATE TABLE t1 ( id int(3) unsigned default '0') ENGINE=MyISAM;
+INSERT INTO t1 (id) VALUES("1");
+CREATE TABLE t2 ( id int(3) unsigned default '0', id_master int(5) default '0', text1 varchar(5) default NULL, text2 varchar(5) default NULL) ENGINE=MyISAM;
+INSERT INTO t2 (id, id_master, text1, text2) VALUES("1", "1",
+"foo1", "bar1");
+INSERT INTO t2 (id, id_master, text1, text2) VALUES("2", "1",
+"foo2", "bar2");
+INSERT INTO t2 (id, id_master, text1, text2) VALUES("3", "1", NULL,
+"bar3");
+INSERT INTO t2 (id, id_master, text1, text2) VALUES("4", "1",
+"foo4", "bar4");
+SELECT 1 AS id_master, 1 AS id, NULL AS text1, 'ABCDE' AS text2 UNION SELECT id_master, t2.id, text1, text2 FROM t1 LEFT JOIN t2 ON t1.id = t2.id_master;
+SELECT 1 AS id_master, 1 AS id, 'ABCDE' AS text1, 'ABCDE' AS text2 UNION SELECT id_master, t2.id, text1, text2 FROM t1 LEFT JOIN t2 ON t1.id = t2.id_master;
+drop table if exists t1,t2;
+
+#
+# Test of bug when using the same table multiple times
+#
+create table t1 (a int not null primary key auto_increment, b int, key(b));
+create table t2 (a int not null primary key auto_increment, b int);
+insert into t1 (b) values (1),(2),(2),(3);
+insert into t2 (b) values (10),(11),(12),(13);
+
+explain extended (select * from t1 where a=1) union (select * from t2 where a=1);
+(select * from t1 where a=5) union (select * from t2 where a=1);
+(select * from t1 where a=5 and a=6) union (select * from t2 where a=1);
+(select t1.a,t1.b from t1,t2 where t1.a=5) union (select * from t2 where a=1);
+(select * from t1 where a=1) union (select t1.a,t2.a from t1,t2 where t1.a=t2.a);
+explain (select * from t1 where a=1 and b=10) union (select straight_join t1.a,t2.a from t1,t2 where t1.a=t2.a);
+explain (select * from t1 where a=1) union (select * from t1 where b=1);
+drop table t1,t2;
+create table t1 ( id int not null auto_increment, primary key (id) ,user_name text );
+create table t2 ( id int not null auto_increment, primary key (id) ,group_name text );
+create table t3 ( id int not null auto_increment, primary key (id) ,user_id int ,index user_idx (user_id) ,foreign key (user_id) references users(id) ,group_id int ,index group_idx (group_id) ,foreign key (group_id) references groups(id) );
+insert into t1 (user_name) values ('Tester');
+insert into t2 (group_name) values ('Group A');
+insert into t2 (group_name) values ('Group B');
+insert into t3 (user_id, group_id) values (1,1);
+select 1 'is_in_group', a.user_name, c.group_name, b.id from t1 a, t3 b, t2 c where a.id = b.user_id and b.group_id = c.id UNION select 0 'is_in_group', a.user_name, c.group_name, null from t1 a, t2 c;
+drop table t1, t2, t3;
+
+#
+# fix_fields problem
+#
+create table t1 (mat_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, matintnum CHAR(6) NOT NULL, test MEDIUMINT UNSIGNED NULL);
+create table t2 (mat_id MEDIUMINT UNSIGNED NOT NULL, pla_id MEDIUMINT UNSIGNED NOT NULL);
+insert into t1 values (NULL, 'a', 1), (NULL, 'b', 2), (NULL, 'c', 3), (NULL, 'd', 4), (NULL, 'e', 5), (NULL, 'f', 6), (NULL, 'g', 7), (NULL, 'h', 8), (NULL, 'i', 9);
+insert into t2 values (1, 100), (1, 101), (1, 102), (2, 100), (2, 103), (2, 104), (3, 101), (3, 102), (3, 105);
+SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id union SELECT 0, 0;
+drop table t1, t2;
+
+#
+# types conversions
+#
+create table t1 SELECT "a" as a UNION select "aa" as a;
+select * from t1;
+show create table t1;
+drop table t1;
+create table t1 SELECT 12 as a UNION select "aa" as a;
+select * from t1;
+show create table t1;
+drop table t1;
+create table t1 SELECT 12 as a UNION select 12.2 as a;
+select * from t1;
+show create table t1;
+drop table t1;
+
+create table t2 (it1 tinyint, it2 tinyint not null, i int not null, ib bigint, f float, d double, y year, da date, dt datetime, sc char(10), sv varchar(10), b blob, tx text);
+insert into t2 values (NULL, 1, 3, 4, 1.5, 2.5, 1972, '1972-10-22', '1972-10-22 11:50', 'testc', 'testv', 'tetetetetest', 'teeeeeeeeeeeest');
+
+create table t1 SELECT it2 from t2 UNION select it1 from t2;
+select * from t1;
+show create table t1;
+drop table t1;
+create table t1 SELECT it2 from t2 UNION select i from t2;
+select * from t1;
+show create table t1;
+drop table t1;
+create table t1 SELECT i from t2 UNION select f from t2;
+select * from t1;
+show create table t1;
+drop table t1;
+create table t1 SELECT f from t2 UNION select d from t2;
+select * from t1;
+show create table t1;
+drop table t1;
+create table t1 SELECT ib from t2 UNION select f from t2;
+select * from t1;
+show create table t1;
+drop table t1;
+create table t1 SELECT ib from t2 UNION select d from t2;
+select * from t1;
+show create table t1;
+drop table t1;
+create table t1 SELECT f from t2 UNION select y from t2;
+select * from t1;
+show create table t1;
+drop table t1;
+create table t1 SELECT f from t2 UNION select da from t2;
+select * from t1;
+show create table t1;
+drop table t1;
+create table t1 SELECT y from t2 UNION select da from t2;
+select * from t1;
+show create table t1;
+drop table t1;
+create table t1 SELECT y from t2 UNION select dt from t2;
+select * from t1;
+show create table t1;
+drop table t1;
+create table t1 SELECT da from t2 UNION select dt from t2;
+select * from t1;
+show create table t1;
+drop table t1;
+create table t1 SELECT dt from t2 UNION select sc from t2;
+select * from t1;
+show create table t1;
+drop table t1;
+create table t1 SELECT dt from t2 UNION select sv from t2;
+select * from t1;
+show create table t1;
+drop table t1;
+create table t1 SELECT sc from t2 UNION select sv from t2;
+select * from t1;
+show create table t1;
+drop table t1;
+create table t1 SELECT dt from t2 UNION select b from t2;
+select * from t1;
+show create table t1;
+drop table t1;
+create table t1 SELECT sv from t2 UNION select b from t2;
+select * from t1;
+show create table t1;
+drop table t1;
+create table t1 SELECT i from t2 UNION select d from t2 UNION select b from t2;
+select * from t1;
+show create table t1;
+drop table t1;
+create table t1 SELECT sv from t2 UNION select tx from t2;
+select * from t1;
+show create table t1;
+drop table t1;
+create table t1 SELECT b from t2 UNION select tx from t2;
+select * from t1;
+show create table t1;
+drop table t1,t2;
+create table t1 (d decimal(10,1));
+create table t2 (d decimal(10,9));
+insert into t1 values ("100000000.0");
+insert into t2 values ("1.23456780");
+create table t3 select * from t2 union select * from t1;
+select * from t3;
+show create table t3;
+drop table t1,t2,t3;
+create table t1 select 1 union select -1;
+select * from t1;
+show create table t1;
+drop table t1;
+-- error 1267
+create table t1 select _latin1"test" union select _latin2"testt" ;
+create table t1 select _latin2"test" union select _latin2"testt" ;
+show create table t1;
+drop table t1;
+
+#
+# conversion memory->disk table
+#
+create table t1 (s char(200));
+insert into t1 values (repeat("1",200));
+create table t2 select * from t1;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+set local tmp_table_size=1024;
+select count(*) from (select * from t1 union all select * from t2 order by 1) b;
+select count(*) from t1;
+select count(*) from t2;
+drop table t1,t2;
+set local tmp_table_size=default;
+
+#
+# slow logging
+#
+create table t1 (a int, index (a), b int);
+insert t1 values (1,1),(2,2),(3,3),(4,4),(5,5);
+insert t1 select a+1, a+b from t1;
+insert t1 select a+1, a+b from t1;
+insert t1 select a+1, a+b from t1;
+insert t1 select a+1, a+b from t1;
+insert t1 select a+1, a+b from t1;
+FLUSH STATUS;
+show status like 'Slow_queries';
+select count(*) from t1 where a=7;
+show status like 'Slow_queries';
+select count(*) from t1 where b=13;
+show status like 'Slow_queries';
+select count(*) from t1 where b=13 union select count(*) from t1 where a=7;
+show status like 'Slow_queries';
+select count(*) from t1 where a=7 union select count(*) from t1 where b=13;
+show status like 'Slow_queries';
+drop table t1;
+
+#
+# Column 'name' cannot be null (error with union and left join) (bug #2508)
+#
+create table t1 ( RID int(11) not null default '0', IID int(11) not null default '0', nada varchar(50) not null,NAME varchar(50) not null,PHONE varchar(50) not null) engine=MyISAM;
+insert into t1 ( RID,IID,nada,NAME,PHONE) values (1, 1, 'main', 'a', '111'), (2, 1, 'main', 'b', '222'), (3, 1, 'main', 'c', '333'), (4, 1, 'main', 'd', '444'), (5, 1, 'main', 'e', '555'), (6, 2, 'main', 'c', '333'), (7, 2, 'main', 'd', '454'), (8, 2, 'main', 'e', '555'), (9, 2, 'main', 'f', '666'), (10, 2, 'main', 'g', '777');
+select A.NAME, A.PHONE, B.NAME, B.PHONE from t1 A left join t1 B on A.NAME = B.NAME and B.IID = 2 where A.IID = 1 and (A.PHONE <> B.PHONE or B.NAME is null) union select A.NAME, A.PHONE, B.NAME, B.PHONE from t1 B left join t1 A on B.NAME = A.NAME and A.IID = 1 where B.IID = 2 and (A.PHONE <> B.PHONE or A.NAME is null);
+drop table t1;
+
+#
+# Bug #2809 (UNION fails on MyIsam tables when index on second column from
+# same table)
+#
+create table t1 (col1 tinyint unsigned, col2 tinyint unsigned);
+insert into t1 values (1,2),(3,4),(5,6),(7,8),(9,10);
+select col1 n from t1 union select col2 n from t1 order by n;
+alter table t1 add index myindex (col2);
+select col1 n from t1 union select col2 n from t1 order by n;
+drop table t1;
+
+#
+# Incorrect handling of UNION ALL (Bug #1428)
+#
+create table t1 (i int);
+insert into t1 values (1);
+select * from t1 UNION select * from t1;
+select * from t1 UNION ALL select * from t1;
+select * from t1 UNION select * from t1 UNION ALL select * from t1;
+drop table t1;
+select 1 as a union all select 1 union all select 2 union select 1 union all select 2;
+set sql_select_limit=1;
+select 1 union select 2;
+(select 1) union (select 2);
+(select 1) union (select 2) union (select 3) limit 2;
+set sql_select_limit=default;
+
+#
+# ORDER with LIMIT
+#
+create table t1 (a int);
+insert into t1 values (100), (1);
+create table t2 (a int);
+insert into t2 values (100);
+select a from t1 union select a from t2 order by a;
+SET SQL_SELECT_LIMIT=1;
+select a from t1 union select a from t2 order by a;
+drop table t1, t2;
+set sql_select_limit=default;
+
+#
+# nonexisting column in global ORDER BY
+#
+CREATE TABLE t1 (i int(11) default NULL,c char(1) default NULL,KEY i (i));
+CREATE TABLE t2 (i int(11) default NULL,c char(1) default NULL,KEY i (i));
+--error 1054
+explain (select * from t1) union (select * from t2) order by not_existing_column;
+drop table t1, t2;
+
+#
+# length detecting
+#
+CREATE TABLE t1 (uid int(1));
+INSERT INTO t1 SELECT 150;
+SELECT 'a' UNION SELECT uid FROM t1;
+drop table t1;
+
+#
+# parser stack overflow
+#
+CREATE TABLE t1 ( ID1 int(10) unsigned NOT NULL DEFAULT '0' , ID2 datetime NOT NULL DEFAULT '0000-00-00 00:00:00' , DATA1 varchar(10) , DATA2 double(5,4) , DATA3 datetime , PRIMARY KEY (ID1,ID2));
+
+CREATE TABLE t2 ( ID int(3) unsigned NOT NULL DEFAULT '0' , DATA1 timestamp DEFAULT '0000-00-00 00:00:00' , PRIMARY KEY (ID));
+(SELECT * FROM t1 AS PARTITIONED, t2 AS
+PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
+(SELECT * FROM t1 AS PARTITIONED, t2 AS
+PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
+(SELECT * FROM t1 AS PARTITIONED, t2 AS
+PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
+(SELECT * FROM t1 AS PARTITIONED, t2 AS
+PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
+(SELECT * FROM t1 AS PARTITIONED, t2 AS
+PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
+(SELECT * FROM t1 AS PARTITIONED, t2 AS
+PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
+(SELECT * FROM t1 AS PARTITIONED, t2 AS
+PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
+(SELECT * FROM t1 AS PARTITIONED, t2 AS
+PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
+(SELECT * FROM t1 AS PARTITIONED, t2 AS
+PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
+(SELECT * FROM t1 AS PARTITIONED, t2 AS
+PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
+(SELECT * FROM t1 AS PARTITIONED, t2 AS
+PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
+(SELECT * FROM t1 AS PARTITIONED, t2 AS
+PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1);
+drop table t1,t2;
+
+#
+# merging ENUM and SET fields in one UNION
+#
+create table t1 (a ENUM('Yes', 'No') NOT NULL);
+create table t2 (a ENUM('aaa', 'bbb') NOT NULL);
+insert into t1 values ('No');
+insert into t2 values ('bbb');
+create table t3 (a SET('Yes', 'No') NOT NULL);
+create table t4 (a SET('aaa', 'bbb') NOT NULL);
+insert into t3 values (1);
+insert into t4 values (3);
+select "1" as a union select a from t1;
+select a as a from t1 union select "1";
+select a as a from t2 union select a from t1;
+select "1" as a union select a from t3;
+select a as a from t3 union select "1";
+select a as a from t4 union select a from t3;
+select a as a from t1 union select a from t4;
+drop table t1,t2,t3,t4;
+
+#
+# Bug #6139 UNION doesn't understand collate in the column of second select
+#
+create table t1 as
+(select _latin1'test') union
+(select _latin1'TEST') union
+(select _latin1'TeST');
+show create table t1;
+select count(*) from t1;
+drop table t1;
+
+create table t1 as
+(select _latin1'test' collate latin1_bin) union
+(select _latin1'TEST') union
+(select _latin1'TeST');
+show create table t1;
+select count(*) from t1;
+drop table t1;
+
+create table t1 as
+(select _latin1'test') union
+(select _latin1'TEST' collate latin1_bin) union
+(select _latin1'TeST');
+show create table t1;
+select count(*) from t1;
+drop table t1;
+
+create table t1 as
+(select _latin1'test') union
+(select _latin1'TEST') union
+(select _latin1'TeST' collate latin1_bin);
+show create table t1;
+select count(*) from t1;
+drop table t1;
+
+create table t2 (
+a char character set latin1 collate latin1_swedish_ci,
+b char character set latin1 collate latin1_bin);
+--error 1271
+create table t1 as
+(select a from t2) union
+(select b from t2);
+create table t1 as
+(select a collate latin1_german1_ci from t2) union
+(select b from t2);
+show create table t1;
+drop table t1;
+create table t1 as
+(select a from t2) union
+(select b collate latin1_german1_ci from t2);
+show create table t1;
+drop table t1;
+create table t1 as
+(select a from t2) union
+(select b from t2) union
+(select 'c' collate latin1_german1_ci from t2);
+show create table t1;
+drop table t1;
+drop table t2;
+
diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test
index 62439dcc51b..704263b1216 100644
--- a/mysql-test/t/update.test
+++ b/mysql-test/t/update.test
@@ -2,7 +2,10 @@
# test of updating of keys
#
-drop table if exists t1;
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
create table t1 (a int auto_increment , primary key (a));
insert into t1 values (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
update t1 set a=a+10 where a > 34;
@@ -68,7 +71,7 @@ CREATE TABLE t1 (
KEY k3 (parent),
KEY k4 (assignment),
KEY ticket (ticket)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (773,773,'','','',980257344,20010318180652,0,'Open',10,0,0,0,1,'','','','','');
@@ -90,7 +93,10 @@ select * from t1 order by a,b;
update t1 set b=100 where a=1 order by b desc limit 2;
update t1 set a=a+10+b where a=1 order by b;
select * from t1 order by a,b;
-drop table t1;
+create table t2 (a int not null, b int not null);
+insert into t2 values (1,1),(1,2),(1,3);
+update t1 set b=(select distinct 1 from (select * from t2) a);
+drop table t1,t2;
#
# Test with limit (Bug #393)
@@ -101,7 +107,7 @@ CREATE TABLE t1 (
`nom_option` char(40) NOT NULL default '',
`valid` tinyint(1) NOT NULL default '0',
KEY `id_param` (`id_param`,`nom_option`)
- ) TYPE=MyISAM;
+ ) ENGINE=MyISAM;
INSERT INTO t1 (id_param,nom_option,valid) VALUES (185,'600x1200',1);
@@ -119,7 +125,7 @@ insert into t1 (F1,F2,F3,cnt,groupid) values ('0','0','0',1,6),
('0','1','2',1,5), ('0','2','0',1,3), ('1','0','1',1,2),
('1','2','1',1,1), ('1','2','2',1,1), ('2','0','1',2,4),
('2','2','0',1,7);
-delete from t1 using t1 m1,t1 m2 where m1.groupid=m2.groupid and (m1.cnt < m2.cnt or m1.cnt=m2.cnt and m1.F3>m2.F3);
+delete from m1 using t1 m1,t1 m2 where m1.groupid=m2.groupid and (m1.cnt < m2.cnt or m1.cnt=m2.cnt and m1.F3>m2.F3);
select * from t1;
drop table t1;
diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test
index 9cb5d5e1eb0..d985be05b94 100644
--- a/mysql-test/t/user_var.test
+++ b/mysql-test/t/user_var.test
@@ -1,11 +1,18 @@
-error 1054;
+# Initialise
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
+--error 1054
set @a := foo;
set @a := connection_id() + 3;
select @a - connection_id();
+set @b := 1;
+select @b;
+
# Check using and setting variables with SELECT DISTINCT
-drop table if exists t1,t2;
CREATE TABLE t1 ( i int not null, v int not null,index (i));
insert into t1 values (1,1),(1,3),(2,1);
create table t2 (i int not null, unique (i));
@@ -64,3 +71,55 @@ select @a:=0; select @a, @a:=@a+count(*), count(*), @a from t1 group by i;
select @a:=0; select @a+0, @a:=@a+0+count(*), count(*), @a+0 from t1 group by i;
drop table t1;
+#
+# Bug #2244: User variables didn't copy collation and derivation
+# attributes from values they were initialized to.
+#
+
+set @a=_latin2'test';
+select charset(@a),collation(@a),coercibility(@a);
+select @a=_latin2'TEST';
+select @a=_latin2'TEST' collate latin2_bin;
+
+set @a=_latin2'test' collate latin2_general_ci;
+select charset(@a),collation(@a),coercibility(@a);
+select @a=_latin2'TEST';
+--error 1267
+select @a=_latin2'TEST' collate latin2_bin;
+
+#
+# Check the same invoking Item_set_user_var
+#
+select charset(@a:=_latin2'test');
+select collation(@a:=_latin2'test');
+select coercibility(@a:=_latin2'test');
+select collation(@a:=_latin2'test' collate latin2_bin);
+select coercibility(@a:=_latin2'test' collate latin2_bin);
+select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST';
+select charset(@a),collation(@a),coercibility(@a);
+--error 1267
+select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST' collate latin2_general_ci;
+
+# Check that user variables are binlogged correctly (BUG#3875)
+create table t1 (a varchar(50));
+reset master;
+SET TIMESTAMP=10000;
+SET @`a b`='hello';
+INSERT INTO t1 VALUES(@`a b`);
+set @var1= "';aaa";
+insert into t1 values (@var1);
+show binlog events from 79;
+# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
+# absolutely need variables names to be quoted and strings to be
+# escaped).
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
+drop table t1;
+
+
+#
+# Bug #6321 strange error:
+# string function FIELD(<uservariable content NULL>, ...)
+#
+set @var= NULL ;
+select FIELD( @var,'1it','Hit') as my_column;
diff --git a/mysql-test/t/varbinary.test b/mysql-test/t/varbinary.test
index cc9ee99b7f9..9425bd7bd99 100644
--- a/mysql-test/t/varbinary.test
+++ b/mysql-test/t/varbinary.test
@@ -1,3 +1,8 @@
+# Initialise
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
#
# varbinary as string and number
#
@@ -10,11 +15,10 @@ select x'31',X'ffff'+0;
# Test of hex constants in WHERE:
#
-drop table if exists t1;
create table t1 (ID int(8) unsigned zerofill not null auto_increment,UNIQ bigint(21) unsigned zerofill not null,primary key (ID),unique (UNIQ) );
insert into t1 set UNIQ=0x38afba1d73e6a18a;
insert into t1 set UNIQ=123;
-explain select * from t1 where UNIQ=0x38afba1d73e6a18a;
+explain extended select * from t1 where UNIQ=0x38afba1d73e6a18a;
drop table t1;
#
diff --git a/mysql-test/t/variables-master.opt b/mysql-test/t/variables-master.opt
index 5851d32ec31..a0577107f74 100644
--- a/mysql-test/t/variables-master.opt
+++ b/mysql-test/t/variables-master.opt
@@ -1 +1 @@
-max_join_size=10
+--max_join_size=10
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index 03e4778d9d6..7dc07f9313e 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -1,10 +1,14 @@
#
# test variables
#
-drop table if exists t1;
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
set @`test`=1,@TEST=3,@select=2,@t5=1.23456;
select @test,@`select`,@TEST,@not_used;
set @test_int=10,@test_double=1e-10,@test_string="abcdeghi",@test_string2="abcdefghij",@select=NULL;
+--replace_result e-0 e- e+0 e+
select @test_int,@test_double,@test_string,@test_string2,@select;
set @test_int="hello",@test_double="hello",@test_string="hello",@test_string2="hello";
select @test_int,@test_double,@test_string,@test_string2;
@@ -13,6 +17,7 @@ select @test_int,@test_double,@test_string,@test_string2;
set @test_int=null,@test_double=null,@test_string=null,@test_string2=null;
select @test_int,@test_double,@test_string,@test_string2;
select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3;
+explain extended select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3;
select @t5;
#
@@ -49,7 +54,9 @@ select @@local.max_join_size, @@global.max_join_size;
select @@identity, length(@@version)>0;
select @@VERSION=version();
select last_insert_id(345);
+explain extended select last_insert_id(345);
select @@IDENTITY,last_insert_id(), @@identity;
+explain extended select @@IDENTITY,last_insert_id(), @@identity;
set big_tables=OFF, big_tables=ON, big_tables=0, big_tables=1, big_tables="OFF", big_tables="ON";
@@ -64,9 +71,9 @@ show variables like 'concurrent_insert';
set global concurrent_insert=DEFAULT;
show variables like 'concurrent_insert';
-set table_type=MYISAM, table_type="HEAP", global table_type="INNODB";
-show local variables like 'table_type';
-show global variables like 'table_type';
+set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="INNODB";
+show local variables like 'storage_engine';
+show global variables like 'storage_engine';
set GLOBAL query_cache_size=100000;
set GLOBAL myisam_max_sort_file_size=2000000;
@@ -88,12 +95,8 @@ show variables like 'net_buffer_length';
set net_buffer_length=2000000000;
show variables like 'net_buffer_length';
-set GLOBAL character set cp1251_koi8;
-show global variables like "convert_character_set";
set character set cp1251_koi8;
-show variables like "convert_character_set";
-set global character set default, session character set default;
-show variables like "convert_character_set";
+show variables like "character_set_client";
select @@timestamp>0;
set @@rand_seed1=10000000,@@rand_seed2=1000000;
@@ -122,21 +125,23 @@ set big_tables="OFFF";
set unknown_variable=1;
--error 1232
set max_join_size="hello";
+--error 1286
+set storage_engine=UNKNOWN_TABLE_TYPE;
--error 1231
-set table_type=UNKNOWN_TABLE_TYPE;
---error 1231
-set table_type=INNODB, big_tables=2;
-show local variables like 'table_type';
+set storage_engine=INNODB, big_tables=2;
+show local variables like 'storage_engine';
--error 1229
set SESSION query_cache_size=10000;
--error 1230
-set GLOBAL table_type=DEFAULT;
+set GLOBAL storage_engine=DEFAULT;
--error 1115
-set convert_character_set=UNKNOWN_CHARACTER_SET;
---error 1115
-set character set unknown;
---error 1232
-set character set 0;
+set character_set_client=UNKNOWN_CHARACTER_SET;
+--error 1273
+set collation_connection=UNKNOWN_COLLATION;
+--error 1231
+set character_set_client=NULL;
+--error 1231
+set collation_connection=NULL;
--error 1228
set global autocommit=1;
--error 1238
@@ -163,8 +168,8 @@ set big_tables=1;
select @@autocommit, @@big_tables;
set global binlog_cache_size=100;
set bulk_insert_buffer_size=100;
-set convert_character_set=cp1251_koi8;
-set convert_character_set=default;
+set character set cp1251_koi8;
+set character set default;
set @@global.concurrent_insert=1;
set global connect_timeout=100;
select @@delay_key_write;
@@ -235,7 +240,7 @@ set sql_select_limit=1;
set global sql_slave_skip_counter=100;
set sql_warnings=1;
set global table_cache=100;
-set table_type=myisam;
+set storage_engine=myisam;
set global thread_cache_size=100;
set timestamp=1, timestamp=default;
set tmp_table_size=100;
@@ -247,7 +252,6 @@ set log_warnings=1;
# key buffer
#
-DROP TABLE IF EXISTS t1,t2;
create table t1 (a int not null auto_increment, primary key(a));
create table t2 (a int not null auto_increment, primary key(a));
insert into t1 values(null),(null),(null);
@@ -257,6 +261,7 @@ select @@key_buffer_size;
select * from t1 where a=2;
select * from t2 where a=3;
check table t1,t2;
+select max(a) +1, max(a) +2 into @xx,@yy from t1;
drop table t1,t2;
#
@@ -270,12 +275,56 @@ select 1;
--error 1238
select @@session.key_buffer_size;
+--error 1229
+set ft_boolean_syntax = @@init_connect;
+--error 1231
+set global ft_boolean_syntax = @@init_connect;
+--error 1229
+set init_connect = NULL;
+set global init_connect = NULL;
+--error 1229
+set ft_boolean_syntax = @@init_connect;
+--error 1231
+set global ft_boolean_syntax = @@init_connect;
+
# Bug#3754 SET GLOBAL myisam_max_sort_file_size doesn't work as
# expected: check that there is no overflow when 64-bit unsigned
# variables are set
+
set global myisam_max_sort_file_size=4294967296;
--replace_result 4294967296 MAX_FILE_SIZE 2146435072 MAX_FILE_SIZE
show global variables like 'myisam_max_sort_file_size';
+set global myisam_max_sort_file_size=default;
+
+#
+# swap
+#
+select @@global.max_user_connections,@@local.max_join_size;
+set @svc=@@global.max_user_connections, @svj=@@local.max_join_size;
+select @@global.max_user_connections,@@local.max_join_size;
+set @@global.max_user_connections=111,@@local.max_join_size=222;
+select @@global.max_user_connections,@@local.max_join_size;
+set @@global.max_user_connections=@@local.max_join_size,@@local.max_join_size=@@global.max_user_connections;
+select @@global.max_user_connections,@@local.max_join_size;
+set @@global.max_user_connections=@svc, @@local.max_join_size=@svj;
+select @@global.max_user_connections,@@local.max_join_size;
+set @a=1, @b=2;
+set @a=@b, @b=@a;
+select @a, @b;
+
+#
+# Bug#2586:Disallow global/session/local as structured var. instance names
+#
+--error 1064
+set @@global.global.key_buffer_size= 1;
+--error 1064
+set GLOBAL global.key_buffer_size= 1;
+--error 1064
+SELECT @@global.global.key_buffer_size;
+--error 1064
+SELECT @@global.session.key_buffer_size;
+--error 1064
+SELECT @@global.local.key_buffer_size;
# BUG#5135: cannot turn on log_warnings with SET in 4.1 (and 4.0)
set @tstlw = @@log_warnings;
@@ -286,3 +335,30 @@ set global log_warnings = 42;
show global variables like 'log_warnings';
set global log_warnings = @tstlw;
show global variables like 'log_warnings';
+
+#
+# BUG#4788 show create table provides incorrect statement
+#
+# What default width have numeric types?
+create table t1 (
+ c1 tinyint,
+ c2 smallint,
+ c3 mediumint,
+ c4 int,
+ c5 bigint);
+show create table t1;
+drop table t1;
+#
+# What types and widths have variables?
+set @arg00= 8, @arg01= 8.8, @arg02= 'a string';
+create table t1 as select @arg00 as c1, @arg01 as c2, @arg02 as c3;
+show create table t1;
+drop table t1;
+
+
+#
+# Bug #6993: myisam_data_pointer_size
+#
+
+SET GLOBAL MYISAM_DATA_POINTER_SIZE= 8;
+SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE';
diff --git a/mysql-test/t/warnings-master.opt b/mysql-test/t/warnings-master.opt
new file mode 100644
index 00000000000..3b8baeddb14
--- /dev/null
+++ b/mysql-test/t/warnings-master.opt
@@ -0,0 +1 @@
+--skip-isam
diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test
index 5fb536def71..4bd659606f6 100644
--- a/mysql-test/t/warnings.test
+++ b/mysql-test/t/warnings.test
@@ -1,7 +1,11 @@
#
# Test some warnings
#
-drop table if exists t1;
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+SET SQL_WARNINGS=1;
+
create table t1 (a int);
insert into t1 values (1);
insert into t1 values ("hej");
@@ -11,3 +15,95 @@ insert into t1 values ("hej");
insert into t1 values ("hej"),("då");
drop table t1;
set SQL_WARNINGS=0;
+
+#
+# Test other warnings
+#
+
+drop temporary table if exists not_exists;
+drop table if exists not_exists_table;
+show warnings limit 1;
+drop database if exists not_exists_db;
+show count(*) warnings;
+create table t1(id int);
+# PS doesn't give warnings on prepare
+--disable_ps_protocol
+create table if not exists t1(id int);
+select @@warning_count;
+--enable_ps_protocol
+drop table t1;
+
+#
+# Test warnings for LOAD DATA INFILE
+#
+
+create table t1(a tinyint, b int not null, c date, d char(5));
+load data infile '../../std_data/warnings_loaddata.dat' into table t1 fields terminated by ',';
+# PS doesn't work good with @@warning_count
+--disable_ps_protocol
+select @@warning_count;
+--enable_ps_protocol
+drop table t1;
+
+#
+# Warnings from basic INSERT, UPDATE and ALTER commands
+#
+
+create table t1(a tinyint NOT NULL, b tinyint unsigned, c char(5));
+insert into t1 values(NULL,100,'mysql'),(10,-1,'mysql ab'),(500,256,'open source'),(20,NULL,'test');
+alter table t1 modify c char(4);
+alter table t1 add d char(2);
+update t1 set a=NULL where a=10;
+update t1 set c='mysql ab' where c='test';
+update t1 set d=c;
+create table t2(a tinyint NOT NULL, b char(3));
+insert into t2 select b,c from t1;
+insert into t2(b) values('mysqlab');
+set sql_warnings=1;
+insert into t2(b) values('mysqlab');
+set sql_warnings=0;
+drop table t1, t2;
+
+#
+# Test for max_error_count
+#
+
+create table t1(a char(10));
+let $1=50;
+disable_query_log;
+while ($1)
+{
+ eval insert into t1 values('mysql ab');
+ dec $1;
+}
+enable_query_log;
+alter table t1 add b char;
+set max_error_count=10;
+update t1 set b=a;
+--disable_ps_protocol
+select @@warning_count;
+--enable_ps_protocol
+
+#
+# Test for handler type
+#
+drop table t1;
+create table t1 (id int) engine=isam;
+alter table t1 engine=isam;
+drop table t1;
+
+#
+# Test for deprecated TYPE= syntax
+#
+
+# PS doesn't give warnings on prepare
+--disable_ps_protocol
+create table t1 (id int) type=heap;
+alter table t1 type=myisam;
+drop table t1;
+--enable_ps_protocol
+
+#
+# Test for deprecated table_type variable
+#
+set table_type=MYISAM;